[FFmpeg-devel] [PATCH] Playlist API

Geza Kovacs gkovacs
Thu Aug 13 23:27:43 CEST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/07/2009 06:00 PM, Michael Niedermayer wrote:
>> 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
> 

This updated patch switches to the model described above, so that stream
indexes uniquely identify streams rather than having streams be replaced
on the go (though the older behavior can be restored by having
ff_playlist_streams_offset_from_playidx always return 0).

Additionally this patch fixes some packet-loss issues on certain formats
while switching streams which existed in the previous patch.

Some caveats:

Number of possible playlist items is still limited by
AVFormatContext->filename being a fixed-size buffer. I will address this
issue, and will finish up aurel's MAX_STREAMS fix, in separate patches.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkqEhU4ACgkQs6+5LdXBeIIvIQCfXQ1u0sz9mHhKByfV0IkBGjLc
SlUAn0q89yex7PhG/y80tQwpCD1p/cwJ
=2JuE
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-concat.diff
Type: text/x-diff
Size: 53457 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090813/35a2f50b/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-concat.diff.sig
Type: application/pgp-signature
Size: 72 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090813/35a2f50b/attachment.pgp>



More information about the ffmpeg-devel mailing list