[FFmpeg-devel] [PATCH] Playlist API
Geza Kovacs
gkovacs
Sun Aug 30 01:29:50 CEST 2009
On 08/29/2009 03:11 AM, Michael Niedermayer wrote:
> well, this sounds a little buggy ...
> I mean first the user app can have a playlist and play that and after
> playing such list of mp3s once or a few times the user might choose to
> insert a few new mp3s, or remove a few but it does not seem the durations
> or stream numbers would be updated in that case ...
>
> also, it seems seeking would similarly fail with this system, but maybe
> ive missed something ...
> I mean, the seek code expects durations to be summed but as they are only
> summed in read_packet they are not neccesarily summed for all elements
> of a playlist making forward seek fail ...
>
Ok, I'm now briefly opening the AVFormatcontext, setting nb_streams and
durations, then closing and freeing it when insert_item is called (and
offsetting the sums appropriately when remove_item is called), so
durations and nb_streams should always be set at the correct summed
values at all times.
>
>
> [...]
>
>> + flist_tmp = av_realloc(ctx->flist, sizeof(*(ctx->flist)) * (++ctx->pelist_size));
>> + if (!flist_tmp) {
>> + av_log(NULL, AV_LOG_ERROR, "av_realloc error in av_playlist_insert_item\n");
>> + return AVERROR_NOMEM;
>> + } else
>> + ctx->flist = flist_tmp;
>> + durations_tmp = av_realloc(ctx->durations,
>> + sizeof(*(ctx->durations)) * (ctx->pelist_size));
>> + if (!durations_tmp) {
>> + av_log(NULL, AV_LOG_ERROR, "av_realloc error in av_playlist_insert_item\n");
>> + return AVERROR_NOMEM;
>> + } else
>> + ctx->durations = durations_tmp;
>> + nb_streams_list_tmp = av_realloc(ctx->nb_streams_list,
>> + sizeof(*(ctx->nb_streams_list)) * (ctx->pelist_size));
>> + if (!nb_streams_list_tmp) {
>
>> + av_log(NULL, AV_LOG_ERROR, "av_realloc error in av_playlist_insert_item\n");
>> + return AVERROR_NOMEM;
>
> Triplicated
>
I assume you're referring to the error message? If so, I'm now
indicating the variable for which the realloc failed in the error.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-concat.diff
Type: text/x-diff
Size: 69206 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090829/c3c343d3/attachment.diff>
More information about the ffmpeg-devel
mailing list