Package flumotion :: Package component :: Package producers :: Package rtsp :: Module rtsp
[hide private]

Source Code for Module flumotion.component.producers.rtsp.rtsp

 1  # -*- Mode: Python -*- 
 2  # vi:si:et:sw=4:sts=4:ts=4 
 3   
 4  # Flumotion - a streaming media server 
 5  # Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L. 
 6  # Copyright (C) 2010,2011 Flumotion Services, S.A. 
 7  # All rights reserved. 
 8  # 
 9  # This file may be distributed and/or modified under the terms of 
10  # the GNU Lesser General Public License version 2.1 as published by 
11  # the Free Software Foundation. 
12  # This file is distributed without any warranty; without even the implied 
13  # warranty of merchantability or fitness for a particular purpose. 
14  # See "LICENSE.LGPL" in the source distribution for more information. 
15  # 
16  # Headers in this file shall remain intact. 
17   
18   
19  from flumotion.component import feedcomponent 
20   
21  __version__ = "$Rev$" 
22   
23   
24  # this is a producer component for rtsp sources eg axis network cameras 
25   
26   
27 -class Rtsp(feedcomponent.ParseLaunchComponent):
28
29 - def get_pipeline_string(self, properties):
30 width = properties.get('width', 0) 31 height = properties.get('height', 0) 32 location = properties.get('location') 33 framerate = properties.get('framerate', (25, 2)) 34 has_audio = properties.get('has-audio', True) 35 if width > 0 and height > 0: 36 scaling_template = (" videoscale method=1 ! " 37 "video/x-raw-yuv,width=%d,height=%d !" % (width, height)) 38 else: 39 scaling_template = "" 40 if has_audio: 41 audio_template = "d. ! queue ! audioconvert ! audio/x-raw-int" 42 else: 43 audio_template = "fakesrc silent=true ! audio/x-raw-int" 44 return ("rtspsrc name=src location=%s ! decodebin name=d ! queue " 45 " ! %s ffmpegcolorspace ! video/x-raw-yuv " 46 " ! videorate ! video/x-raw-yuv,framerate=%d/%d ! " 47 " @feeder:video@ %s ! @feeder:audio@" 48 % (location, scaling_template, framerate[0], 49 framerate[1], audio_template))
50