[FFmpeg-devel] Realmedia patch
Ronald S. Bultje
rsbultje
Wed Sep 3 01:39:19 CEST 2008
Hi Luca,
On Tue, Sep 2, 2008 at 11:57 AM, Ronald S. Bultje <rsbultje at gmail.com> wrote:
> On Tue, Sep 2, 2008 at 9:16 AM, Luca Abeni <lucabe72 at email.it> wrote:
>> Ronald S. Bultje wrote:
>> [...]
>>> So... I made one modification in this patch, it allowed me to get
>>> video to work, but it's kind of ugly:
>>>
>>> in rtsp_read_packet():
>>>
>>> @@ -1246,6 +1246,8 @@
>>> ret = url_readbuf(rt->rtsp_hd, buf, len);
>>> if (ret != len)
>>> return -1;
>>> + if (rt->server_type == RTSP_SERVER_RDT)
>>> + id = (buf[0] >> 1) & 0x1f;
>>>
>>> /* find the matching stream */
>>> for(i = 0; i < rt->nb_rtsp_streams; i++) {
>>>
>>> I just found out that the byte after $ is always 0, which is maybe why
>>> Luca was confused and thought they only contain one stream. However,
>>> they really contain multiple streams, but the RTP^d^dDT header
>>> apparently uses the 4th byte after the $ for the stream, as per above.
>>
>> Ugh... This confirms that real rtsp is _really_ a mess...
[..]
>>> I can move this to ff_rdt_parse_packet() if you prefer it there
>>
>> Yes, this belongs to ff_rdt_parse_packet(), since it has nothing to
>> do with RTSP...
OK so this is becoming problematic for me now. Here's why:
- RTSPStream is private to rtsp.c
- AVStream->priv_data is a RTSPStream
- the only way to get to the DynamicProtocolHandler private data is
through RTPDemuxContext->dynamic_protocol_context or RTSPStream
- I can't get to my context data without rtsp.c data
So either I need to completely switch around and use a different API
for rtp_ vs. rdt_parse_packet(), which is a lot of work and basically
leads to bigger gaps between the RTP and RDT code-paths, something I
was hoping to prevent... Alternatively, the "hack" above needs to stay
in place.
Now bear with me, you me flame me in a second, but I think we should
leave it in, and here's why: at the rtsp protocol level, I believe
that we *are* dealing with multiple streams. Evidence: the SDP:
sdp: v='0'
sdp: o='- 1213479627 1213479627 IN IP4 212.58.252.6'
sdp: s='_1653779_marconi20_blythe_vi.rm'
sdp: i='<No author> <No copyright>'
sdp: c='IN IP4 0.0.0.0'
sdp: t='0 0'
sdp: a='SdpplinVersion:1610641560'
sdp: a='StreamCount:integer;2'
sdp: a='control:*'
sdp: a='IsRealDataType:integer;1'
sdp: a='Flags:integer;18'
sdp: a='range:npt=0-143.103000'
sdp: m='audio 0 RTP/AVP 101' <<<<<<<<<
sdp: b='AS:10'
sdp: b='RR:318'
sdp: b='RS:106'
sdp: a='control:streamid=0'
sdp: a='range:npt=0-143.103000'
sdp: a='length:npt=143.103000'
sdp: a='rtpmap:101 x-pn-realaudio/1000'
sdp: a='fmtp:101 '
sdp: a='mimetype:string;"audio/x-pn-realaudio"'
sdp: a='Helix-Adaptation-Support:1'
sdp: a='MaxBitRate:integer;8500'
sdp: a='AvgBitRate:integer;8500'
sdp: a='MaxPacketSize:integer;304'
sdp: a='AvgPacketSize:integer;304'
sdp: a='Preroll:integer;3432'
sdp: a='ActualPreroll:integer;1716'
sdp: a='EndTime:integer;142315'
sdp: a='EndOneRuleEndAll:integer;1'
sdp: a='OpaqueData:buffer;"LnJh/QAEAAAucmE0ZgVhxwAEAAAAOQABAAABMAACT2AAAPdlAAAAAAAGATAAAAAAH0AAAAAQAAEEc2lwcgRzaXByAQIAAAAAAA=="'
sdp: a='RMFF 1.0 Flags:buffer;"AAIAAgAA"'
sdp: a='StreamName:string;"Audio Stream"'
sdp: a='intrinsicDurationType:string;"intrinsicDurationContinuous"'
sdp: a='ASMRuleBook:string;"priority=5,averagebandwidth=8500,PNMKeyFrameRule=T;priority=5,averagebandwidth=0,PNMNonKeyFrameRule=T,OnDepend=\"0\",OffDepend=\"0\";"'
sdp: m='video 0 RTP/AVP 101' <<<<<<<<<
sdp: b='AS:29'
sdp: b='RR:956'
sdp: b='RS:318'
sdp: a='control:streamid=1'
sdp: a='range:npt=0-142.160000'
sdp: a='length:npt=142.160000'
sdp: a='rtpmap:101 x-pn-realvideo/1000'
sdp: a='fmtp:101 '
sdp: a='mimetype:string;"video/x-pn-realvideo"'
sdp: a='Helix-Adaptation-Support:1'
sdp: a='MaxBitRate:integer;25500'
sdp: a='AvgBitRate:integer;25500'
sdp: a='MaxPacketSize:integer;607'
sdp: a='AvgPacketSize:integer;468'
sdp: a='Preroll:integer;9667'
sdp: a='EndOneRuleEndAll:integer;1'
sdp: a='OpaqueData:buffer;"AAAAJFZJRE9SVjIwAMAAkAAMAAAAAAAMgAABAZg4ICAQAjAk"'
sdp: a='RMFF 1.0 Flags:buffer;"AAMAAgAAAAI="'
sdp: a='StreamName:string;"Video Stream"'
sdp: a='intrinsicDurationType:string;"intrinsicDurationContinuous"'
sdp: a='ASMRuleBook:string;"#($Bandwidth >=
25500),priority=9,averagebandwidth=25500,PNMKeyFrameRule=T;#($Bandwidth
>= 25500),OnDepend=\"0\",priority=5,averagebandwidth=0,PNMNonKeyFrameRule=T;#($Bandwidth
< 25500),priority=9,timestampdelivery=T,DropByN=T,PNMThinningRule=T;"'
Note how there's two 'm' lines (marked by "<<"), just as for a regular
two-stream RTSP/RTP stream. I conclude that although real screwed up
everything, that it's not a muxed stream and that for my mental
sanity, we should just keep the stream tracking in rtsp.c, with the
two-liner above... It basically keeps RDT as similar as possible to
RTP at the API level, which makes all the rest of the code smaller and
simpler.
Please flame me if you have better ideas, I somehow can't think of a
good easy way to solve this... :-(.
Ronald
More information about the ffmpeg-devel
mailing list