summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorRodeo <[email protected]>2011-09-19 21:15:01 +0000
committerRodeo <[email protected]>2011-09-19 21:15:01 +0000
commita3367322b982a61975df2a28307455d16a7ab081 (patch)
tree6cd2359254fc23066d3a08e9edfc43e93898937c /macosx
parent3453ca5ca1601c613e2998fc18ce49f5a13fe0b5 (diff)
libhb: Auto Passthru and audio/video encoder lists.
This adds Auto Passthru as another encoder in libhb. Used in LinGUI and CLI. MacGUI features a partial impplmentation (with hardcoded values), which is disabled for now. Also, audio and video encoders are now stored in "lists", like we previously did for mixdowns. New mixdown "None" (HB_AMIXDOWN_NONE) added to hb_audio_mixdowns (was previously declared in MacGUI/LinGUI). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4237 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r--macosx/Controller.m111
-rw-r--r--macosx/HBAudio.m133
-rw-r--r--macosx/HBAudioController.m8
3 files changed, 124 insertions, 128 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m
index 865cc7f60..57ea2cc3b 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -2415,12 +2415,25 @@ fWorkingCount = 0;
[queueFileJob setObject:[NSString stringWithFormat:@"%d",[fPictureController deblock]] forKey:@"PictureDeblock"];
[queueFileJob setObject:[NSNumber numberWithInt:[fPictureController grayscale]] forKey:@"VideoGrayScale"];
+
+ /* Auto Passthru */
+ /* For the time being, values are hardcoded. */
+ [queueFileJob setObject: [NSNumber numberWithInt: 1] forKey: @"AudioAllowAACPass"];
+ [queueFileJob setObject: [NSNumber numberWithInt: 1] forKey: @"AudioAllowAC3Pass"];
+ [queueFileJob setObject: [NSNumber numberWithInt: 1] forKey: @"AudioAllowDTSHDPass"];
+ [queueFileJob setObject: [NSNumber numberWithInt: 1] forKey: @"AudioAllowDTSPass"];
+ [queueFileJob setObject: [NSNumber numberWithInt: 1] forKey: @"AudioAllowMP3Pass"];
+ // just in case we need it for display purposes
+ [queueFileJob setObject: @"AC3 (ffmpeg)" forKey: @"AudioEncoderFallback"];
+ // actual fallback encoder
+ [queueFileJob setObject: [NSNumber numberWithInt: HB_ACODEC_AC3] forKey: @"JobAudioEncoderFallback"];
+
+ /* Audio */
[self writeToActivityLog: "createQueueFileItem: Getting Audio from prepareAudioForQueueFileJob ..."];
- /*Audio*/
- [fAudioDelegate prepareAudioForQueueFileJob: queueFileJob];
- [self writeToActivityLog: "createQueueFileItem: Returned getting audio from prepareAudioForQueueFileJob"];
+ [fAudioDelegate prepareAudioForQueueFileJob: queueFileJob];
+ [self writeToActivityLog: "createQueueFileItem: Returned getting audio from prepareAudioForQueueFileJob"];
- /* Subtitles*/
+ /* Subtitles */
NSMutableArray *subtitlesArray = [[NSMutableArray alloc] initWithArray:[fSubtitlesDelegate getSubtitleArray] copyItems:YES];
[queueFileJob setObject:[NSArray arrayWithArray: subtitlesArray] forKey:@"SubtitleList"];
[subtitlesArray autorelease];
@@ -2815,11 +2828,13 @@ fWorkingCount = 0;
/* Turbo 1st pass for 2 Pass Encoding */
[fVidTurboPassCheck setState:[[queueToApply objectForKey:@"VideoTurboTwoPass"] intValue]];
- /*Audio*/
-
+ /* Auto Passthru */
+ /* For the time being, there are no GUI elements for this;
+ * everything is hardcoded. */
+ /* Audio */
/* Now lets add our new tracks to the audio list here */
- [fAudioDelegate addTracksFromQueue: queueToApply];
+ [fAudioDelegate addTracksFromQueue: queueToApply];
/*Subtitles*/
/* Crashy crashy right now, working on it */
@@ -3220,8 +3235,13 @@ bool one_burned = FALSE;
-[subtitlesArray autorelease];
+[subtitlesArray autorelease];
+
+ /* Auto Passthru */
+ /* For the time being, values are hardcoded. */
+ job->acodec_copy_mask = HB_ACODEC_PASS_MASK;
+ job->acodec_fallback = HB_ACODEC_AC3;
/* Audio tracks and mixdowns */
[fAudioDelegate prepareAudioForJob: job];
@@ -3716,11 +3736,34 @@ bool one_burned = FALSE;
#pragma mark -
-
+ /* Auto Passthru */
+ job->acodec_copy_mask = 0;
+ if( [[queueToApply objectForKey: @"AudioAllowAACPass"] intValue] == 1 )
+ {
+ job->acodec_copy_mask |= HB_ACODEC_FFAAC;
+ }
+ if( [[queueToApply objectForKey: @"AudioAllowAC3Pass"] intValue] == 1 )
+ {
+ job->acodec_copy_mask |= HB_ACODEC_AC3;
+ }
+ if( [[queueToApply objectForKey: @"AudioAllowDTSHDPass"] intValue] == 1 )
+ {
+ job->acodec_copy_mask |= HB_ACODEC_DCA_HD;
+ }
+ if( [[queueToApply objectForKey: @"AudioAllowDTSPass"] intValue] == 1 )
+ {
+ job->acodec_copy_mask |= HB_ACODEC_DCA;
+ }
+ if( [[queueToApply objectForKey: @"AudioAllowMP3Pass"] intValue] == 1 )
+ {
+ job->acodec_copy_mask |= HB_ACODEC_MP3;
+ }
+ job->acodec_fallback = [[queueToApply objectForKey: @"JobAudioEncoderFallback"] intValue];
+
/* Audio tracks and mixdowns */
- /* Lets make sure there arent any erroneous audio tracks in the job list, so lets make sure its empty*/
+ /* Lets make sure there arent any erroneous audio tracks in the job list, so lets make sure its empty */
int audiotrack_count = hb_list_count(job->list_audio);
- for( int i = 0; i < audiotrack_count;i++)
+ for( int i = 0; i < audiotrack_count; i++ )
{
hb_audio_t * temp_audio = (hb_audio_t*) hb_list_item( job->list_audio, 0 );
hb_list_rem(job->list_audio, temp_audio);
@@ -4059,8 +4102,8 @@ bool one_burned = FALSE;
{
/* Let libhb do the job */
hb_start( fQueueEncodeLibhb );
- /*set the fEncodeState State */
- fEncodeState = 1;
+ /* set the fEncodeState State */
+ fEncodeState = 1;
}
@@ -4500,13 +4543,17 @@ bool one_burned = FALSE;
/* Note: we now store the video encoder int values from common.c in the tags of each popup for easy retrieval later */
[fVidEncoderPopUp removeAllItems];
NSMenuItem *menuItem;
- /* These video encoders are available to all of our current muxers, so lets list them once here */
- menuItem = [[fVidEncoderPopUp menu] addItemWithTitle:@"MPEG-4 (FFmpeg)" action: NULL keyEquivalent: @""];
- [menuItem setTag: HB_VCODEC_FFMPEG_MPEG4];
- menuItem = [[fVidEncoderPopUp menu] addItemWithTitle:@"MPEG-2 (FFmpeg)" action: NULL keyEquivalent: @""];
- [menuItem setTag: HB_VCODEC_FFMPEG_MPEG2];
- menuItem = [[fVidEncoderPopUp menu] addItemWithTitle:@"H.264 (x264)" action: NULL keyEquivalent: @""];
- [menuItem setTag: HB_VCODEC_X264];
+ int i;
+ for( i = 0; i < hb_video_encoders_count; i++ )
+ {
+ if( ( ( format == 0 ) && ( hb_video_encoders[i].muxers & HB_MUX_MP4 ) ) ||
+ ( ( format == 1 ) && ( hb_video_encoders[i].muxers & HB_MUX_MKV ) ) )
+ {
+ menuItem = [[fVidEncoderPopUp menu] addItemWithTitle: [NSString stringWithUTF8String: hb_video_encoders[i].human_readable_name]
+ action: NULL keyEquivalent: @""];
+ [menuItem setTag: hb_video_encoders[i].encoder];
+ }
+ }
switch( format )
{
@@ -4519,11 +4566,8 @@ bool one_burned = FALSE;
[fDstMp4iPodFileCheck setHidden: NO];
break;
- case 1:
+ case 1:
ext = "mkv";
- /* Add additional video encoders here */
- menuItem = [[fVidEncoderPopUp menu] addItemWithTitle:@"VP3 (Theora)" action: NULL keyEquivalent: @""];
- [menuItem setTag: HB_VCODEC_THEORA];
/* We enable the create chapters checkbox here */
[fCreateChapterMarkers setEnabled: YES];
break;
@@ -5592,8 +5636,12 @@ return YES;
/* Turbo 1st pass for 2 Pass Encoding */
[fVidTurboPassCheck setState:[[chosenPreset objectForKey:@"VideoTurboTwoPass"] intValue]];
- /*Audio*/
- [fAudioDelegate addTracksFromPreset: chosenPreset];
+ /* Auto Passthru */
+ /* For the time being, there are no GUI elements for this;
+ * everything is hardcoded. */
+
+ /* Audio */
+ [fAudioDelegate addTracksFromPreset: chosenPreset];
/*Subtitles*/
[fSubPopUp selectItemWithTitle:[chosenPreset objectForKey:@"Subtitles"]];
@@ -6112,7 +6160,16 @@ return YES;
[preset setObject:[fPictureController decombCustomString] forKey:@"PictureDecombCustom"];
[preset setObject:[NSNumber numberWithInt:[fPictureController grayscale]] forKey:@"VideoGrayScale"];
- /*Audio*/
+ /* Auto Pasthru */
+ /* For the time being, values are hardcoded. */
+ [preset setObject: [NSNumber numberWithInt: 1] forKey: @"AudioAllowAACPass"];
+ [preset setObject: [NSNumber numberWithInt: 1] forKey: @"AudioAllowAC3Pass"];
+ [preset setObject: [NSNumber numberWithInt: 1] forKey: @"AudioAllowDTSHDPass"];
+ [preset setObject: [NSNumber numberWithInt: 1] forKey: @"AudioAllowDTSPass"];
+ [preset setObject: [NSNumber numberWithInt: 1] forKey: @"AudioAllowMP3Pass"];
+ [preset setObject: @"AC3 (ffmpeg)" forKey: @"AudioEncoderFallback"];
+
+ /* Audio */
NSMutableArray *audioListArray = [[NSMutableArray alloc] init];
[fAudioDelegate prepareAudioForPreset: audioListArray];
diff --git a/macosx/HBAudio.m b/macosx/HBAudio.m
index b7fdbcc85..10522b3d3 100644
--- a/macosx/HBAudio.m
+++ b/macosx/HBAudio.m
@@ -70,104 +70,51 @@ static NSMutableArray *masterBitRateArray = nil;
{
if ([HBAudio class] == self)
{
- int i;
+ int i, audioMustMatch, shouldAdd;
+ BOOL muxMKV, muxMP4;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSDictionary *dict;
masterCodecArray = [[NSMutableArray alloc] init]; // knowingly leaked
- [masterCodecArray addObject: [NSDictionary dictionaryWithObjectsAndKeys:
- NSLocalizedString(@"AAC (CoreAudio)", @"AAC (CoreAudio)"), keyAudioCodecName,
- [NSNumber numberWithInt: HB_ACODEC_CA_AAC], keyAudioCodec,
- [NSNumber numberWithBool: YES], keyAudioMP4,
- [NSNumber numberWithBool: YES], keyAudioMKV,
- [NSNumber numberWithBool: NO], keyAudioMustMatchTrack,
- nil]];
- if (encca_haac_available())
+ for( i = 0; i < hb_audio_encoders_count; i++ )
{
- [masterCodecArray addObject: [NSDictionary dictionaryWithObjectsAndKeys:
- NSLocalizedString(@"HE-AAC (CoreAudio)", @"HE-AAC (CoreAudio)"), keyAudioCodecName,
- [NSNumber numberWithInt: HB_ACODEC_CA_HAAC], keyAudioCodec,
- [NSNumber numberWithBool: YES], keyAudioMP4,
- [NSNumber numberWithBool: YES], keyAudioMKV,
- [NSNumber numberWithBool: NO], keyAudioMustMatchTrack,
- nil]];
+ if( ( hb_audio_encoders[i].encoder & HB_ACODEC_PASS_FLAG ) &&
+ ( hb_audio_encoders[i].encoder != HB_ACODEC_AUTO_PASS ) )
+ {
+ audioMustMatch = ( hb_audio_encoders[i].encoder & ~HB_ACODEC_PASS_FLAG );
+ }
+ else
+ {
+ audioMustMatch = 0;
+ }
+ // Auto Passthru disabled until we have GUI widgets for it
+ shouldAdd = ( hb_audio_encoders[i].encoder != HB_ACODEC_AUTO_PASS ) &&
+ ( ( hb_audio_encoders[i].encoder != HB_ACODEC_CA_HAAC ) || encca_haac_available() );
+ muxMKV = ( hb_audio_encoders[i].muxers & HB_MUX_MKV ) ? YES : NO;
+ muxMP4 = ( hb_audio_encoders[i].muxers & HB_MUX_MP4 ) ? YES : NO;
+ if( shouldAdd && audioMustMatch )
+ {
+ [masterCodecArray addObject: [NSDictionary dictionaryWithObjectsAndKeys:
+ [NSString stringWithUTF8String: hb_audio_encoders[i].human_readable_name], keyAudioCodecName,
+ [NSNumber numberWithInt: hb_audio_encoders[i].encoder], keyAudioCodec,
+ [NSNumber numberWithBool: muxMP4], keyAudioMP4,
+ [NSNumber numberWithBool: muxMKV], keyAudioMKV,
+ [NSNumber numberWithInt: audioMustMatch], keyAudioMustMatchTrack,
+ nil]];
+ }
+ else if( shouldAdd )
+ {
+ [masterCodecArray addObject: [NSDictionary dictionaryWithObjectsAndKeys:
+ [NSString stringWithUTF8String: hb_audio_encoders[i].human_readable_name], keyAudioCodecName,
+ [NSNumber numberWithInt: hb_audio_encoders[i].encoder], keyAudioCodec,
+ [NSNumber numberWithBool: muxMP4], keyAudioMP4,
+ [NSNumber numberWithBool: muxMKV], keyAudioMKV,
+ [NSNumber numberWithBool: NO], keyAudioMustMatchTrack,
+ nil]];
+ }
}
- [masterCodecArray addObject: [NSDictionary dictionaryWithObjectsAndKeys:
- NSLocalizedString(@"AAC (ffmpeg)", @"AAC (ffmpeg)"), keyAudioCodecName,
- [NSNumber numberWithInt: HB_ACODEC_FFAAC], keyAudioCodec,
- [NSNumber numberWithBool: YES], keyAudioMP4,
- [NSNumber numberWithBool: YES], keyAudioMKV,
- [NSNumber numberWithBool: NO], keyAudioMustMatchTrack,
- nil]];
- [masterCodecArray addObject: [NSDictionary dictionaryWithObjectsAndKeys:
- NSLocalizedString(@"AAC (faac)", @"AAC (faac)"), keyAudioCodecName,
- [NSNumber numberWithInt: HB_ACODEC_FAAC], keyAudioCodec,
- [NSNumber numberWithBool: YES], keyAudioMP4,
- [NSNumber numberWithBool: YES], keyAudioMKV,
- [NSNumber numberWithBool: NO], keyAudioMustMatchTrack,
- nil]];
- [masterCodecArray addObject: [NSDictionary dictionaryWithObjectsAndKeys:
- NSLocalizedString(@"AAC Passthru", @"AAC Passthru"), keyAudioCodecName,
- [NSNumber numberWithInt: HB_ACODEC_AAC_PASS], keyAudioCodec,
- [NSNumber numberWithBool: YES], keyAudioMP4,
- [NSNumber numberWithBool: YES], keyAudioMKV,
- [NSNumber numberWithInt: HB_ACODEC_FFAAC], keyAudioMustMatchTrack,
- nil]];
- [masterCodecArray addObject: [NSDictionary dictionaryWithObjectsAndKeys:
- NSLocalizedString(@"AC3 (ffmpeg)", @"AC3 (ffmpeg)"), keyAudioCodecName,
- [NSNumber numberWithInt: HB_ACODEC_AC3], keyAudioCodec,
- [NSNumber numberWithBool: YES], keyAudioMP4,
- [NSNumber numberWithBool: YES], keyAudioMKV,
- [NSNumber numberWithBool: NO], keyAudioMustMatchTrack,
- nil]];
- [masterCodecArray addObject: [NSDictionary dictionaryWithObjectsAndKeys:
- NSLocalizedString(@"AC3 Passthru", @"AC3 Passthru"), keyAudioCodecName,
- [NSNumber numberWithInt: HB_ACODEC_AC3_PASS], keyAudioCodec,
- [NSNumber numberWithBool: YES], keyAudioMP4,
- [NSNumber numberWithBool: YES], keyAudioMKV,
- [NSNumber numberWithInt: HB_ACODEC_AC3], keyAudioMustMatchTrack,
- nil]];
- [masterCodecArray addObject: [NSDictionary dictionaryWithObjectsAndKeys:
- NSLocalizedString(@"DTS Passthru", @"DTS Passthru"), keyAudioCodecName,
- [NSNumber numberWithInt: HB_ACODEC_DCA_PASS], keyAudioCodec,
- [NSNumber numberWithBool: YES], keyAudioMP4,
- [NSNumber numberWithBool: YES], keyAudioMKV,
- [NSNumber numberWithInt: HB_ACODEC_DCA], keyAudioMustMatchTrack,
- nil]];
- [masterCodecArray addObject: [NSDictionary dictionaryWithObjectsAndKeys:
- NSLocalizedString(@"DTS-HD Passthru", @"DTS-HD Passthru"), keyAudioCodecName,
- [NSNumber numberWithInt: HB_ACODEC_DCA_HD_PASS], keyAudioCodec,
- [NSNumber numberWithBool: YES], keyAudioMP4,
- [NSNumber numberWithBool: YES], keyAudioMKV,
- [NSNumber numberWithInt: HB_ACODEC_DCA_HD], keyAudioMustMatchTrack,
- nil]];
- [masterCodecArray addObject: [NSDictionary dictionaryWithObjectsAndKeys:
- NSLocalizedString(@"MP3 (lame)", @"MP3 (lame)"), keyAudioCodecName,
- [NSNumber numberWithInt: HB_ACODEC_LAME], keyAudioCodec,
- [NSNumber numberWithBool: YES], keyAudioMP4,
- [NSNumber numberWithBool: YES], keyAudioMKV,
- [NSNumber numberWithBool: NO], keyAudioMustMatchTrack,
- nil]];
- [masterCodecArray addObject: [NSDictionary dictionaryWithObjectsAndKeys:
- NSLocalizedString(@"MP3 Passthru", @"MP3 Passthru"), keyAudioCodecName,
- [NSNumber numberWithInt: HB_ACODEC_MP3_PASS], keyAudioCodec,
- [NSNumber numberWithBool: YES], keyAudioMP4,
- [NSNumber numberWithBool: YES], keyAudioMKV,
- [NSNumber numberWithInt: HB_ACODEC_MP3], keyAudioMustMatchTrack,
- nil]];
- [masterCodecArray addObject: [NSDictionary dictionaryWithObjectsAndKeys:
- NSLocalizedString(@"Vorbis (vorbis)", @"Vorbis (vorbis)"), keyAudioCodecName,
- [NSNumber numberWithInt: HB_ACODEC_VORBIS], keyAudioCodec,
- [NSNumber numberWithBool: NO], keyAudioMP4,
- [NSNumber numberWithBool: YES], keyAudioMKV,
- [NSNumber numberWithBool: NO], keyAudioMustMatchTrack,
- nil]];
masterMixdownArray = [[NSMutableArray alloc] init]; // knowingly leaked
- [masterMixdownArray addObject: [NSDictionary dictionaryWithObjectsAndKeys:
- NSLocalizedString(@"None", @"None"), keyAudioMixdownName,
- [NSNumber numberWithInt: 0], keyAudioMixdown,
- nil]];
for (i = 0; i < hb_audio_mixdowns_count; i++)
{
[masterMixdownArray addObject: [NSDictionary dictionaryWithObjectsAndKeys:
@@ -296,11 +243,11 @@ static NSMutableArray *masterBitRateArray = nil;
// Basically with the way the mixdowns are stored, the assumption from the libhb point of view
// currently is that all mixdowns from the best down to mono are supported.
- if (currentMixdown && currentMixdown <= theBestMixdown)
+ if ((currentMixdown != HB_AMIXDOWN_NONE) && (currentMixdown <= theBestMixdown))
{
shouldAdd = YES;
}
- else if (0 == currentMixdown && (codecCodec & HB_ACODEC_PASS_FLAG))
+ else if ((currentMixdown == HB_AMIXDOWN_NONE) && (codecCodec & HB_ACODEC_PASS_FLAG))
{
// "None" mixdown (passthru)
shouldAdd = YES;
@@ -638,7 +585,7 @@ static NSMutableArray *masterBitRateArray = nil;
if (retval)
{
int myMixdown = [[[self mixdown] objectForKey: keyAudioMixdown] intValue];
- if (0 == myMixdown)
+ if (myMixdown == HB_AMIXDOWN_NONE)
{
// "None" mixdown (passthru)
retval = NO;
diff --git a/macosx/HBAudioController.m b/macosx/HBAudioController.m
index 16538c2ff..b275f7a82 100644
--- a/macosx/HBAudioController.m
+++ b/macosx/HBAudioController.m
@@ -302,14 +302,6 @@ NSString *HBMixdownChangedNotification = @"HBMixdownChangedNotification";
[dict setObject: @"AAC (CoreAudio)" forKey: @"AudioEncoder"];
}
- // Auto Passthru not yet implemented - fallback to AC3 Passthru as it is
- // compatible with all source codecs (via the AC3 encoder fallback)
- if ([key isEqualToString: @"Auto Passthru"])
- {
- [dict setObject: @"AC3 Passthru" forKey: @"AudioEncoder"];
- key = @"AC3 Passthru";
- }
-
// passthru fallbacks
if ([key isEqualToString: @"AAC Passthru"])
{