[FFmpeg-devel] [PATCH] Playlist API

Geza Kovacs gkovacs
Wed Aug 26 11:00:18 CEST 2009

On 08/25/2009 02:52 PM, Michael Niedermayer wrote:
> I think the API needs more work, designing an API is not just about throwing
> random functions in a header. We cant change or remove these once it is in
> svn because libav* must stay compatible between versions whenever possible.
> currently there are 12 public functions, for some of which i do not even know
> when or why a user application would call them. (-> that at the very least
> means the documentation is bad ...)
> It seems we agree that playlists should be accessable as a demuxer and also
> through a new API as the existing demuxer API is not entirely appropriate.
> That you have implemented (short of a few bugs and nitpicks...) but
> the interface API seems very poor IMHO.
> if we take a step back, not thinking of the implementation
> * There is a playlist, that is a ordered list of multimedia files
> * The obvious use cases a user application could have in mind are:
>   A Create such a list

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.

>   B Destroy such a list


>   C Insert a file into the list at a specific position


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.

>   D Remove a file from the list (from a specific position)


>   E Get the AVFormatContext for a specific index
> Now if we just have a array of AVFormatContexts, that makes E just a
> playlist.avf[index]


> that leaves us with 4 functions but your public header adds 12
> I hope you see what my problem is with this, the public API is used by
> application developers and must be simple, effective and easy to understand
> and remember (our existing APIs are poor enough in some spots (improvments
> for them of course are welcome but thats off topic in this thread...))

I've moved the other functions out of the public header (avplaylist.h)
into a private header (playlist.h)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-concat.diff
Type: text/x-diff
Size: 66687 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090826/b939cbd3/attachment.diff>

More information about the ffmpeg-devel mailing list