diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-07-14 16:51:28 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-07-14 17:11:11 +0200 |
commit | 68215724997c26d02a215b377de441b511804ecc (patch) | |
tree | 2e17ac91382d16fadc639023d73738efe88980f5 | |
parent | ec24796731d39308936e1e0746f06b105a52e072 (diff) | |
download | ffmpeg-68215724997c26d02a215b377de441b511804ecc.tar.gz |
avformat/movenc: dont mark multichannel as mono tracks as containing the center channel
Fixes Ticket3727
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/movenc.c | 28 | ||||
-rw-r--r-- | libavformat/movenc.h | 1 |
2 files changed, 29 insertions, 0 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 59bf24d6bc..b3287cab93 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -432,6 +432,9 @@ static int mov_write_chan_tag(AVIOContext *pb, MOVTrack *track) return 0; } + if (track->multichannel_as_mono) + return 0; + avio_wb32(pb, 0); // Size ffio_wfourcc(pb, "chan"); // Type avio_w8(pb, 0); // Version @@ -4120,6 +4123,31 @@ static int mov_write_header(AVFormatContext *s) } } + for (i = 0; i < s->nb_streams; i++) { + int j; + AVStream *st= s->streams[i]; + MOVTrack *track= &mov->tracks[i]; + + if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO || + track->enc->channel_layout != AV_CH_LAYOUT_MONO) + continue; + + for (j = 0; j < s->nb_streams; j++) { + AVStream *stj= s->streams[j]; + MOVTrack *trackj= &mov->tracks[j]; + if (j == i) + continue; + + if (stj->codec->codec_type != AVMEDIA_TYPE_AUDIO || + trackj->enc->channel_layout != AV_CH_LAYOUT_MONO || + trackj->language != track->language || + trackj->tag != track->tag + ) + continue; + track->multichannel_as_mono++; + } + } + enable_tracks(s); diff --git a/libavformat/movenc.h b/libavformat/movenc.h index 04cb1f392a..6ebe265447 100644 --- a/libavformat/movenc.h +++ b/libavformat/movenc.h @@ -100,6 +100,7 @@ typedef struct MOVTrack { int tag; ///< stsd fourcc AVStream *st; AVCodecContext *enc; + int multichannel_as_mono; int vos_len; uint8_t *vos_data; |