History

avformat/movenc: dont mark multichannel as mono tracks as containing the center channel

Fixes Ticket3727

Michael Niedermayer committed 12 years ago

Commit 68215721 parent ec247962 files · +29 −0Browse files

Unified · Split

2 files
  1. libavformat/movenc.c +28 −0
  2. libavformat/movenc.h +1 −0
libavformat/movenc.c+28−0
@@ -432,6 +432,9 @@ static int mov_write_chan_tag(AVIOContext *pb, MOVTrack *track) · 431 unmodified lines
432432 return 0;
433433 }
434434
435+ if (track->multichannel_as_mono)
436+ return 0;
437+
435438 avio_wb32(pb, 0); // Size
436439 ffio_wfourcc(pb, "chan"); // Type
437440 avio_w8(pb, 0); // Version
@@ -4120,6 +4123,31 @@ static int mov_write_header(AVFormatContext *s) · 3682 unmodified lines
41204123 }
41214124 }
41224125
4126+ for (i = 0; i < s->nb_streams; i++) {
4127+ int j;
4128+ AVStream *st= s->streams[i];
4129+ MOVTrack *track= &mov->tracks[i];
4130+
4131+ if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO ||
4132+ track->enc->channel_layout != AV_CH_LAYOUT_MONO)
4133+ continue;
4134+
4135+ for (j = 0; j < s->nb_streams; j++) {
4136+ AVStream *stj= s->streams[j];
4137+ MOVTrack *trackj= &mov->tracks[j];
4138+ if (j == i)
4139+ continue;
4140+
4141+ if (stj->codec->codec_type != AVMEDIA_TYPE_AUDIO ||
4142+ trackj->enc->channel_layout != AV_CH_LAYOUT_MONO ||
4143+ trackj->language != track->language ||
4144+ trackj->tag != track->tag
4145+ )
4146+ continue;
4147+ track->multichannel_as_mono++;
4148+ }
4149+ }
4150+
41234151 enable_tracks(s);
41244152
41254153
libavformat/movenc.h+1−0
@@ -100,6 +100,7 @@ typedef struct MOVTrack { · 99 unmodified lines
100100 int tag; ///< stsd fourcc
101101 AVStream *st;
102102 AVCodecContext *enc;
103+ int multichannel_as_mono;
103104
104105 int vos_len;
105106 uint8_t *vos_data;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t