[FFmpeg-devel] [PATCH] make stream-switching work with MOV demuxer

Baptiste Coudurier baptiste.coudurier
Tue Jun 23 22:06:58 CEST 2009

Reimar D?ffinger wrote:
> On Tue, Jun 23, 2009 at 09:19:38PM +0200, Reimar D?ffinger wrote:
>> On Tue, Jun 23, 2009 at 11:59:21AM -0700, Baptiste Coudurier wrote:
>>> I think discard variable can be avoided by checking
>>> s->streams[sc->ffindex]->discard.
>>> We could even declare AVStream *st = s->streams[sc->ffindex] when sample
>>> is found and factore because it is already done when computing duration.
>>> We could even get rid of sc->ffindex by choosing AVStream in the loop
>>> and use ->priv_data, but well that can be done separately.
>> I think it is uglier, but here it is.
> Ok, I think the real issue is that things that belong together
> (incrementing current_sample and incrementing ctts_sample) are done in
> different places.
> I also think it is wrong that on read error only current_sample is
> incremented.

I'm not sure, but if read error happens, it's over currently (return
-1), so the ctts incrementation should not be needed anyway.
Seek will update everything correctly in any case, afterwards.

> Attached patch fixes it.
> It should of course be applied in multiple steps, e.g. I think that
>>        if (dv_get_packet(mov->dv_demux, pkt) < 0)
>>            return -1;
> should actually be
>>        ret = dv_get_packet(mov->dv_demux, pkt);
>>        if (ret < 0)
>>            return ret;
> regardless of what you think of the other changes.

This hunk should be ok, yes.

This patch break duration computation, and this time IMHO it is ugly and

The other patch looks ok, and it is not uglier IMHO, it will allow sc =
msc removal since sc == st->priv_data, and sc->ffindex will no longer be

Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org

More information about the ffmpeg-devel mailing list