[FFmpeg-devel] Patch to close ticket 2873 (enhancement)

kad kadmandu kadmandux at gmail.com
Mon Jan 6 12:11:58 CET 2014

El lunes 6 de enero de 2014, Nicolas George <george at nsup.org> escribió:
> "git format-patch" or "git send-email" is the recommended way of preparing
> patches, since it allow for easy inclusion, with author information and

Thanks, I'm not familiar with git patching, buy I'll do a look a this.

>> +int av_compare_streams(const void *st1, const void *st2);
>> +void av_sort_streams_by_id(AVFormatContext *s);
> I really think these should not be public. Especially the first one, with
> its strange types for arguments (yes, I know how qsort works).
> And if they are public, the documentation is missing.

You're right. I'll fix this and will send a new patch.

>> +    /* Reorder streams if the format requires it.*/
>> +    if (ic->ctx_flags & AVFMTCTX_NOHEADER)
>> +     av_sort_streams_by_id(ic);
> Did you check that doing that actually works?

Yes, it woks!

> Right there, I can see that you will leave the AVStream.index

Nope. Look at the for loop at the end of av_sort_streams_by_id. This fixes
the indexes.

> .... and I suspect that the
> packets already read by avformat_find_stream_info() will be inconsistent
> too.

I'll do a deeper look at this. Thanks to point that.

> Also, I do not think that it should be done for MPEG-TS, where the streams
> are actually declared in a particular order.

Ok. I don't know well MPEG-TS. Do you know if the AVFMTCTX_NOHEADER is
present there?

The reordering is applied only when this flag is actived.

> Last: what happens if the application has read frames by itself before
> calling avformat_find_stream_info()? In that case, I am afraid the order
> the streams will change underfoot.

You're right here. Perhaps this change should be applied at application
level instead of at lib level. This was my first approach, but it required
changes in more places.

What do you think?

Thans a lot!

More information about the ffmpeg-devel mailing list