1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 from flumotion.component import feedcomponent
22
23 __version__ = "$Rev$"
24
25
26
27
28
29 -class Rtsp(feedcomponent.ParseLaunchComponent):
30
32 width = properties.get('width', 0)
33 height = properties.get('height', 0)
34 location = properties.get('location')
35 framerate = properties.get('framerate', (25, 2))
36 has_audio = properties.get('has-audio', True)
37 if width > 0 and height > 0:
38 scaling_template = (" videoscale method=1 ! "
39 "video/x-raw-yuv,width=%d,height=%d !" % (width, height))
40 else:
41 scaling_template = ""
42 if has_audio:
43 audio_template = "d. ! queue ! audioconvert ! audio/x-raw-int"
44 else:
45 audio_template = "fakesrc silent=true ! audio/x-raw-int"
46 return ("rtspsrc name=src location=%s ! decodebin name=d ! queue "
47 " ! %s ffmpegcolorspace ! video/x-raw-yuv "
48 " ! videorate ! video/x-raw-yuv,framerate=%d/%d ! "
49 " @feeder:video@ %s ! @feeder:audio@"
50 % (location, scaling_template, framerate[0],
51 framerate[1], audio_template))
52