[FFmpeg-devel] [PATCH] segment: don't copy codec_tag when not available
ChanMin Kim
kcm1700 at gmail.com
Thu Nov 15 19:11:50 CET 2012
It looks like gmail added unnecessary newline in the patch.
+ av_codec_get_id (oc->oformat->codec_tag,
icodec->codec_tag) == codec->codec_id ||
should be in one line.
+ av_codec_get_id (oc->oformat->codec_tag,
icodec->codec_tag) == codec->codec_id ||
On Fri, Nov 16, 2012 at 2:30 AM, ChanMin Kim <kcm1700 at gmail.com> wrote:
> - Some muxers do not allow stream if codec_tag is incompatible
> - Sometimes passed input codec's codec_tag isn't compatible to output muxer
> - Because codec_tag field of segment muxer cannot be set, ffmpeg.c doesn't
> know how to handle these cases.
>
> Signed-off-by: ChanMin Kim <kcm1700 at gmail.com>
> ---
> libavformat/segment.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/segment.c b/libavformat/segment.c
> index f31b25f..cbe46e1 100644
> --- a/libavformat/segment.c
> +++ b/libavformat/segment.c
> @@ -108,9 +108,20 @@ static int segment_mux_init(AVFormatContext *s)
>
> for (i = 0; i < s->nb_streams; i++) {
> AVStream *st;
> + AVCodecContext *icodec, *codec;
> if (!(st = avformat_new_stream(oc, NULL)))
> return AVERROR(ENOMEM);
> - avcodec_copy_context(st->codec, s->streams[i]->codec);
> +
> + icodec = s->streams[i]->codec;
> + codec = st->codec;
> + avcodec_copy_context(codec, icodec);
> + if (!oc->oformat->codec_tag ||
> + av_codec_get_id (oc->oformat->codec_tag, icodec->codec_tag) == codec->codec_id ||
> + av_codec_get_tag(oc->oformat->codec_tag, icodec->codec_id) <= 0) {
> + codec->codec_tag = icodec->codec_tag;
> + } else {
> + codec->codec_tag = 0;
> + }
> st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio;
> }
>
> --
> 1.7.10.4
--
Kim, Chan Min
Computer Science & Engineering
Seoul National University
More information about the ffmpeg-devel
mailing list