[FFmpeg-devel] [PATCH] Playlist API

Michael Niedermayer michaelni
Sat Aug 8 03:00:14 CEST 2009


On Fri, Aug 07, 2009 at 03:09:40PM -0700, Geza Kovacs wrote:
> > Currently it seems to me that playlists through AVFormatContext could only
> > be done by assigning each playlist entry a unique set of stream ids. This
> > would reuqire some changes in applications to handle but it at least is
> > providing the applications with well defined semantics and not some
> > continiusly changing values one cannot really depend upon
> > 
> 
> I had something along these lines implemented before I went for the
> current stream-switching model, basically it was like this:
> 
> Rather than replacing the existing streams when opening a new playlist
> element, nb_streams is incremented by the number of new streams, and the
> new streams are appended on the end of the streams list in the same
> order they were organized in. For example:
> 
> file1 with 2 streams is opened:
> nb_streams=2
> streams[0]=file1-stream0
> streams[1]=file1-stream1
> 
> file2 with 3 streams is opened:
> nb_streams=5
> streams[0]=file1-stream0
> streams[1]=file1-stream1
> streams[2]=file2-stream0
> streams[3]=file2-stream1
> streams[4]=file2-stream2
> 
> file3 with 1 stream is opened:
> nb_streams=6
> streams[0]=file1-stream0
> streams[1]=file1-stream1
> streams[2]=file2-stream0
> streams[3]=file2-stream1
> streams[4]=file2-stream2
> streams[5]=file2-stream0
                 ^
typo :)
 

> 
> ...etc...
> 
> The stream index thus allows each stream to be uniquely identified; just
> add a nb_streams_list to the PlaylistContext and store the nb_streams of
> each element (so that it will work even after the AVFormatContext is
> freed); and by going through the list you can calculate the offset and
> actual stream index.
> 

> Now the problem with this is of course that you'll hit MAX_STREAMS
> rather quickly,

well, yes, MAX_STREAMS should really be droped and replaced by a dynamically
allocated array, if your code depends on that you will have to implement that
unless someone has already done it and i forgot it ...
this does not seem like that much work, and it is something that will make
some peoplr happy even without playlists, we have at least one bug on roundup
due to it IIRC


> and it required some additional code to check if the
> AVFormatContext is a playlist and if yes then offset the stream indexes
> accordingly, but other than that it worked well.

not sure if i understand that ...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090808/204f996e/attachment.pgp>



More information about the ffmpeg-devel mailing list