summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorjbrjake <[email protected]>2007-06-12 03:39:39 +0000
committerjbrjake <[email protected]>2007-06-12 03:39:39 +0000
commit7bf643db12b5e43fa42d738d8d5c3b8a74c83c64 (patch)
treec15a8e76d184115db7bd9e0bd66c106bf5d5b4bb /libhb
parentae1b00dbcbacfb302d4bc3f341ad092c7491a589 (diff)
Disables extra audio tracks so they don't all play over the main audio track in QuickTime. They can be re-enabled from the Properties menu in QT Pro or with Dumpster. Shouldn't have any affect on people who use sane video players. Props to eddyg for reporting the issue, identifying the atom in question, and castigating me for my lazy and unkempt coding ways.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@606 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/muxmp4.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/libhb/muxmp4.c b/libhb/muxmp4.c
index 284c4ce6e..cfaf11ebb 100644
--- a/libhb/muxmp4.c
+++ b/libhb/muxmp4.c
@@ -137,6 +137,10 @@ static int MP4Init( hb_mux_object_t * m )
hb_mux_data_t * mux_data;
int i;
u_int16_t language_code;
+
+ /* Flags for enabling/disabling tracks in an MP4. */
+ typedef enum { TRACK_DISABLED = 0x0, TRACK_ENABLED = 0x1, TRACK_IN_MOVIE = 0x2, TRACK_IN_PREVIEW = 0x4, TRACK_IN_POSTER = 0x8} track_header_flags;
+
/* Create an empty mp4 file */
m->file = MP4Create( job->file, MP4_DETAILS_ERROR, 0 );
@@ -295,12 +299,23 @@ static int MP4Init( hb_mux_object_t * m )
/* Set the correct number of channels for this track */
reserved2[9] = (u_int8_t)HB_AMIXDOWN_GET_DISCRETE_CHANNEL_COUNT(audio->amixdown);
MP4SetTrackBytesProperty(m->file, mux_data->track, "mdia.minf.stbl.stsd.mp4a.reserved2", reserved2, sizeof(reserved2));
-
- /* store a reference to the first audio track,
- so we can use it to feed the chapter text track's sample rate */
- if (i == 0) {
- firstAudioTrack = mux_data->track;
- }
+
+ /* store a reference to the first audio track,
+ so we can use it to feed the chapter text track's sample rate */
+ if (i == 0) {
+ firstAudioTrack = mux_data->track;
+
+ /* Enable the first audio track */
+ MP4SetTrackIntegerProperty(m->file, mux_data->track, "tkhd.flags", (TRACK_ENABLED | TRACK_IN_MOVIE));
+ }
+
+ else
+ /* Disable the other audio tracks so QuickTime doesn't play
+ them all at once. */
+ {
+ MP4SetTrackIntegerProperty(m->file, mux_data->track, "tkhd.flags", (TRACK_DISABLED | TRACK_IN_MOVIE));
+ hb_log("Disabled extra audio track %i", mux_data->track-1);
+ }
}