diff options
author | Rodeo <[email protected]> | 2012-06-18 19:54:54 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2012-06-18 19:54:54 +0000 |
commit | f7a7a65d4c8898ca3173e7fdff9457e9944d028e (patch) | |
tree | 0acc3efe209e34480c23d945e962a7ca4e0f6ac5 | |
parent | 007eba8be0d6f329d3823fbb067a26166f78ecfb (diff) |
Bugfix branch: fix HE-AAC in MKV.
HandBrake's output should now play correctly on Sigma-based hardware players (among others).
git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/0.9.x@4752 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | contrib/libmkv/A02-audio-out-sampling-freq.patch | 28 | ||||
-rw-r--r-- | libhb/muxmkv.c | 15 |
2 files changed, 42 insertions, 1 deletions
diff --git a/contrib/libmkv/A02-audio-out-sampling-freq.patch b/contrib/libmkv/A02-audio-out-sampling-freq.patch new file mode 100644 index 000000000..ea31957c1 --- /dev/null +++ b/contrib/libmkv/A02-audio-out-sampling-freq.patch @@ -0,0 +1,28 @@ +diff --git a/include/libmkv.h b/include/libmkv.h +index 146a91f..f03d608 100644 +--- a/include/libmkv.h ++++ b/include/libmkv.h +@@ -203,6 +204,7 @@ struct mk_TrackConfig_s { + } video; + struct { + float samplingFreq; /* Sampling Frequency in Hz */ ++ float outputSamplingFreq; /* Playback Sampling Frequency in Hz (e.g. for AAC w/SBR) */ + unsigned channels; /* Number of channels for this track */ + unsigned bitDepth; /* Bits per sample (PCM) */ + } audio; +diff --git a/src/tracks.c b/src/tracks.c +index f9c7e48..a2a60ca 100644 +--- a/src/tracks.c ++++ b/src/tracks.c +@@ -174,6 +174,11 @@ mk_Track *mk_createTrack(mk_Writer *w, mk_TrackConfig *tc) + /* SamplingFrequency */ + if (mk_writeFloat(v, MATROSKA_ID_AUDIOSAMPLINGFREQ, tc->extra.audio.samplingFreq) < 0) + return NULL; ++ if (tc->extra.audio.outputSamplingFreq) { ++ /* Output SamplingFrequency */ ++ if (mk_writeFloat(v, MATROSKA_ID_AUDIOOUTSAMPLINGFREQ, tc->extra.audio.outputSamplingFreq) < 0) ++ return NULL; ++ } + /* Channels */ + if (mk_writeUInt(v, MATROSKA_ID_AUDIOCHANNELS, tc->extra.audio.channels) < 0) + return NULL; diff --git a/libhb/muxmkv.c b/libhb/muxmkv.c index 7d8af9310..5debb658d 100644 --- a/libhb/muxmkv.c +++ b/libhb/muxmkv.c @@ -283,7 +283,20 @@ static int MKVInit( hb_mux_object_t * m ) // MKV lang codes should be ISO-639-2/B lang = lang_for_code2( audio->config.lang.iso639_2 ); track->language = lang->iso639_2b ? lang->iso639_2b : lang->iso639_2; - track->extra.audio.samplingFreq = (float)audio->config.out.samplerate; + // sample rate + if ((audio->config.out.codec == HB_ACODEC_CA_HAAC) || + (audio->config.out.codec == HB_ACODEC_AAC_PASS && + audio->priv.config.extradata.length == 5)) + { + // For HE-AAC, write outputSamplingFreq too + // samplingFreq is half of outputSamplingFreq + track->extra.audio.outputSamplingFreq = (float)audio->config.out.samplerate; + track->extra.audio.samplingFreq = track->extra.audio.outputSamplingFreq / 2.; + } + else + { + track->extra.audio.samplingFreq = (float)audio->config.out.samplerate; + } if (audio->config.out.codec & HB_ACODEC_PASS_FLAG) { track->extra.audio.channels = HB_INPUT_CH_LAYOUT_GET_DISCRETE_COUNT(audio->config.in.channel_layout); |