summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-02-12 15:06:58 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2012-02-22 20:07:02 -0500
commit3798205a77ce275613098ecb48645e6029811f14 (patch)
tree41ad2274e8fe47a7546bb8ea301280090b66e2ac /libavformat/mov.c
parent1254022ea717fba6f189d6a66841e0ba204ed80a (diff)
mov: set channel layout for AC-3 streams based on the 'dac3' atom info
fixes Bug 225
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index c2f13b6316..b11e0bfef7 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -25,11 +25,13 @@
//#define DEBUG
//#define MOV_EXPORT_ALL_METADATA
+#include "libavutil/audioconvert.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat.h"
#include "libavutil/mathematics.h"
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
+#include "libavcodec/ac3tab.h"
#include "avformat.h"
#include "internal.h"
#include "avio_internal.h"
@@ -552,6 +554,9 @@ static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
acmod = (ac3info >> 11) & 0x7;
lfeon = (ac3info >> 10) & 0x1;
st->codec->channels = ((int[]){2,1,2,3,3,4,4,5})[acmod] + lfeon;
+ st->codec->channel_layout = avpriv_ac3_channel_layout_tab[acmod];
+ if (lfeon)
+ st->codec->channel_layout |= AV_CH_LOW_FREQUENCY;
st->codec->audio_service_type = bsmod;
if (st->codec->channels > 1 && bsmod == 0x7)
st->codec->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE;