[FFmpeg-devel] [PATCH] lavf/concatdec: allow to match streams by id.
Michael Niedermayer
michaelni at gmx.at
Sun Mar 2 04:09:14 CET 2014
On Wed, Feb 26, 2014 at 08:33:04PM +0100, Nicolas George wrote:
> That makes the concat demuxer usable with MPEG-PS streams,
> even when the streams in the different parts are detected
> in different order.
Do i understand correctly that in such case the user has to
specify the stream maping one by one ?
I think it would be better if (additionally) the code tried to match
streams automatically based on codec id, resolution, language, channel
layout
(possibly program name if its TS)
[...]
> +static int match_streams(AVFormatContext *avf)
> +{
> + ConcatContext *cat = avf->priv_data;
> + AVStream *st;
> + int *map, i, j, ret;
> +
> + if (!cat->match_streams ||
> + cat->cur_file->stream_map_size >= cat->avf->nb_streams)
> + return 0;
> + map = av_realloc(cat->cur_file->stream_map,
> + cat->avf->nb_streams * sizeof(*map));
> + if (!map)
> + return AVERROR(ENOMEM);
> +
> + for (i = cat->cur_file->stream_map_size; i < cat->avf->nb_streams; i++) {
> + st = cat->avf->streams[i];
> + map[i] = -1;
> + for (j = 0; j < avf->nb_streams; j++) {
> + if (avf->streams[j]->id == st->id) {
> + av_log(avf, AV_LOG_VERBOSE,
> + "Match slave stream #%d with stream #%d id 0x%x\n",
> + i, j, st->id);
> + map[i] = j;
> + if (!avf->streams[j]->codec->codec_id && st->codec->codec_id)
> + if ((ret = copy_stream_props(avf->streams[j], st)) < 0)
> + return ret;
this leaves a stale pointer in cat->cur_file->stream_map
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
You can kill me, but you cannot change the truth.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140302/19e02ed2/attachment.asc>
More information about the ffmpeg-devel
mailing list