[FFmpeg-devel] Realmedia patch

Ronald S. Bultje rsbultje
Sun Aug 31 22:50:37 CEST 2008

Hi Luca,

On Sun, Aug 31, 2008 at 3:26 PM, Luca Abeni <lucabe72 at email.it> wrote:
> Ronald S. Bultje wrote:
> [...]
>> +    if (rt->server_type == RTSP_SERVER_RDT && rt->need_subscription) {
>> +        int i;
>> +        RTSPHeader reply1, *reply = &reply1;
>> +        char cmd[1024];
>> +
>> +        snprintf(cmd, sizeof(cmd),
>> +                 "SET_PARAMETER %s RTSP/1.0\r\n"
>> +                 "Subscribe: ",
>> +                 s->filename);
> [...]
> Not sure if this code belongs here, or if it should be moved
> to rtsp_read_play(). Did you already try anything similar?
> [...]
>> @@ -1350,6 +1379,7 @@
>>      av_log(s, AV_LOG_DEBUG, "hello state=%d\n", rt->state);
>> +    if (!(rt->server_type == RTSP_SERVER_RDT && rt->need_subscription)) {
> This change looks suspicious...
> (same for the rtsp_read_pause() change)

These two can (hopefully) be addressed in one...

So, for Realmedia, you can subscribe to one of the N rules. The way
ffplay does that is that it calls av_open_input_file() and
av_find_stream_info(), then chooses one of the N streams (based on the
-ast X parameter) and then it sets the AVDISCARD_* flag in all
AVStreams and starts reading data.

This means that stream subscription is best done *after* header
reading, probably in the first call to _read_packet(), but before
actual data reading. When I started doing all of this, there was this
silly thing called AVFormatParameters.initial_pause, which (when set
to 0) means that rtsp_play() is called in read_header(). Conclusion: I
can't do the subscribe in rtsp_play() in a way that it fits ffplay to
be able to use the -ast X parameter. Therefore, I subscribe in the
first call to read_packet().

Logical so far, I hope, but now comes problem 2: I can only send the
PLAY command to the server *after* doing the Subscribe:, so for RDT
servers, I modified rtsp_play() (and pause()) to not be sent while the
Subscribe command hasn't been sent yet, that's the second half of this
change. Ugly, I know, but it worked. :-]. I'm open for suggestions on
how to better do this.


More information about the ffmpeg-devel mailing list