[FFmpeg-devel] Realmedia patch
Ronald S. Bultje
rsbultje
Tue Sep 2 17:57:38 CEST 2008
Hi Luca,
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...
+1.
> According to RFC 2326,
> " Stream data such as RTP packets is encapsulated by an ASCII dollar
> sign (24 hexadecimal), followed by a one-byte channel identifier,
> followed by the length of the encapsulated binary data as a binary,
> two-byte integer in network byte order. The stream data follows
> immediately afterwards, without a CRLF, but including the upper-layer
> protocol headers. Each $ block contains exactly one upper-layer
> protocol data unit, e.g., one RTP packet."
> So, the byte that you are parsing for getting the id is really part
> of the "stream data". That is to say, it is part of the RDT header...
> This confirms that audio and video are really mixed in the same stream,
> and you must read the RDT header to make a distinction between audio
> and video.
Whatever way you interpret it, it's a mess, that we agree on. :-).
>> 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 small question on the best way to do that. There's two stream
enums, RTSPStream (by the RTP/RDT stream id, enumerated in RTPSState)
and AVStream (the number of total stream rules). RTSPState.RTSPStream
is private to rtsp.c and so rdt has no access to it, even though
that's the only way to match rdt/rtp-stream-id to stream number.
Should I export RTSPStream into rtsp.h or is there a better way? I'm
currently using AVStream.id for rule-number but I'm not really
actively using it so I guess I could match it to be the
RTP/RDT-stream-id and use that rather than exporting
RTSPState.RTSPStream?
Ronald
More information about the ffmpeg-devel
mailing list