[FFmpeg-devel] [PATCH] Playlist API

Geza Kovacs gkovacs
Wed Aug 26 21:15:16 CEST 2009

On 08/26/2009 09:13 AM, Michael Niedermayer wrote:
>> av_mallocz(sizeof(AVPlaylistContext)) -- since realloc is used to expand
>> the various lists (and hence the first realloc acts as a malloc),
>> there's no need to explicitly allocate anything else beforehand.
> This has problems, setting defaults different from 0 is one

I assume you meant if you wanted to change the defaults to non-zero
values sometime in the future? av_playlist_alloc is now used, though
since the defaults are currently 0 anyway it's just doing a mallocz.

>> I also added a convenience function av_playlist_add_item to add the new
>> item to the end since that's probably the most common position where
>> items would be inserted, I think it should be pretty harmless and
>> self-explanatory but if you don't like it I can remove it.
> insert() with index ctx->pelist_size could be used directly

ok, removed av_playlist_add_item

> also it should be possible for the user to add playlists through this
> same api (like a .m3u) and have its contents automatically inserted

ok, added av_playlist_insert_playlist to do this

>> +    ctx->durations[pos] = 0;
>> +    ctx->durations[ctx->pelist_size] = 0;
> i thought these were sums of durations?

Yes, but since the AVFormatContext for the current and previous items
might not have yet been allocated and opened when an item is added (in
fact the way I'm currently using it all the items are added before any
of the AVFormatContexts are allocated or opened), then the setting of
the summed durations is deferred until the child AVFormatContext is
actually allocated and opened (playlist_populate_context, invoked by
read_packet once necessary). Same applies to nb_streams_list.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-concat.diff
Type: text/x-diff
Size: 67140 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090826/b29fe7f9/attachment.diff>

More information about the ffmpeg-devel mailing list