All pastes #963029 Raw Edit

macosx/ diff for new audio

public diff v1 · immutable
#963029 ·published 2008-03-30 05:09 UTC
rendered paste body
Index: macosx/HBQueueController.h===================================================================--- macosx/HBQueueController.h	(revision 1364)+++ macosx/HBQueueController.h	(working copy)@@ -105,7 +105,9 @@     int                         h264_level;     int                         crf;     NSString                    *x264opts;-+    +    NSString                    *audioinfo_codecs;+    NSString                    *audioinfo_summary;  //<-hack to use a string to display all audio info for each job in one string     int                         audio_mixdowns[8];     int                         acodec;     int                         abitrate;Index: macosx/Controller.mm===================================================================--- macosx/Controller.mm	(revision 1364)+++ macosx/Controller.mm	(working copy)@@ -1467,8 +1467,8 @@     hb_title_t * title = (hb_title_t *) hb_list_item( list,             [fSrcTitlePopUp indexOfSelectedItem] );     hb_job_t * job = title->job;-    //int i;-+    hb_audio_config_t *audio;+         /* Chapter selection */     job->chapter_start = [fSrcChapterStartPopUp indexOfSelectedItem] + 1;     job->chapter_end   = [fSrcChapterEndPopUp   indexOfSelectedItem] + 1;@@ -1478,7 +1478,8 @@     int codecs = [fDstCodecsPopUp indexOfSelectedItem];     job->mux    = FormatSettings[format][codecs] & HB_MUX_MASK;     job->vcodec = FormatSettings[format][codecs] & HB_VCODEC_MASK;-    job->acodec = FormatSettings[format][codecs] & HB_ACODEC_MASK;+    +     /* If mpeg-4, then set mpeg-4 specific options like chapters and > 4gb file sizes */ 	if ([fDstFormatPopUp indexOfSelectedItem] == 0) 	{@@ -1594,67 +1595,108 @@     job->subtitle = [fSubPopUp indexOfSelectedItem] - 2;      /* Audio tracks and mixdowns */-    /* check for the condition where track 2 has an audio selected, but track 1 does not */-    /* we will use track 2 as track 1 in this scenario */-    if ([fAudLang1PopUp indexOfSelectedItem] > 0)+    /* Lets make sure there arent any erroneous audio tracks in the job list, so lets make sure its empty*/+    int num_audio_tracks = hb_list_count(job->list_audio);+    for( int i = 0; i < num_audio_tracks;i++)     {-        job->audios[0] = [fAudLang1PopUp indexOfSelectedItem] - 1;-        job->audios[1] = [fAudLang2PopUp indexOfSelectedItem] - 1; /* will be -1 if "none" is selected */-        job->audios[2] = -1;-        job->audio_mixdowns[0] = [[fAudTrack1MixPopUp selectedItem] tag];-        job->audio_mixdowns[1] = [[fAudTrack2MixPopUp selectedItem] tag];+        audio = (hb_audio_config_t *) hb_list_item( job->list_audio, i );+        hb_list_rem(job->list_audio, audio);     }-    else if ([fAudLang2PopUp indexOfSelectedItem] > 0)+    /* Now lets add our new tracks to the audio list here */+    if ([fAudLang1PopUp indexOfSelectedItem] > 0)     {-        job->audios[0] = [fAudLang2PopUp indexOfSelectedItem] - 1;-        job->audio_mixdowns[0] = [[fAudTrack2MixPopUp selectedItem] tag];-        job->audios[1] = -1;+        /* First we copy the source audio structure (remember, in the popup 0 is "None" so we subtract 1 to match the list->audio*/+        //audio = (hb_audio_config_t *) hb_list_audio_config_item( title->list_audio, [fAudLang1PopUp indexOfSelectedItem] - 1);+        audio = hb_audio_config_new();+        /* We go ahead and assign values to our audio->out.<properties> */+        audio->out.track = [fAudLang1PopUp indexOfSelectedItem] - 1;+        if ([[fAudTrack1MixPopUp titleOfSelectedItem] isEqualToString: @"AC3 Passthru"])+        {+        audio->out.codec = HB_ACODEC_AC3;+        audio->out.mixdown = HB_ACODEC_AC3;+        audio->out.bitrate = audio->in.bitrate / 1000; // we use the audio.in bitrate for passthru, / 1000 so it displays right.+        audio->out.samplerate = 48000;+        audio->out.dynamic_range_compression = 1.00;+        }+        else+        {+        audio->out.codec = FormatSettings[format][codecs] & HB_ACODEC_MASK;+        audio->out.mixdown = [[fAudTrack1MixPopUp selectedItem] tag];+        audio->out.bitrate = [[fAudBitratePopUp selectedItem] tag];+        audio->out.samplerate = hb_audio_rates[[fAudRatePopUp indexOfSelectedItem]].rate;+        audio->out.dynamic_range_compression = [fAudDrcField floatValue];+        } +        +        /* We add the newly modified audio track to job->list_audio */+        //hb_list_add(job->list_audio, audio );+        hb_audio_add( job, audio );+        +        /*HACK: We use the format and codecs popups to determine if we should slide in the extra ac3 passthru track for the atv hybrid mp4 */+        if (format == 0 && codecs == 2 && audio->in.codec != HB_ACODEC_DCA) // if mp4 and aac + ac3 and input is NOT DTS (dts cannot be passed through as ac3)+        {+            //audio = (hb_audio_config_t *) hb_list_audio_config_item( title->list_audio, [fAudLang1PopUp indexOfSelectedItem] - 1 );+            audio = hb_audio_config_new();+            /* We go ahead and assign values to our audio->out.<properties> */+            audio->out.track = [fAudLang1PopUp indexOfSelectedItem] - 1;+            audio->out.codec = HB_ACODEC_AC3;+            audio->out.codec = HB_ACODEC_AC3;+            audio->out.samplerate = 48000;+            audio->out.bitrate = audio->in.bitrate / 1000; // we use the audio.in bitrate for passthru, / 1000 do it displays right.+            audio->out.mixdown = HB_ACODEC_AC3;//<-- Lets manually set the mixdown int +            audio->out.dynamic_range_compression = 1.00;+            /* We add the newly modified audio track to job->list_audio */+            //hb_list_add(job->list_audio, audio );+            hb_audio_add( job, audio );+        }+             }-    else+    if ([fAudLang2PopUp indexOfSelectedItem] > 0)     {-        job->audios[0] = -1;+        /* First we copy the source audio structure (remember, in the popup 0 is "None" so we subtract 1 to match the list->audio*/+        //audio = (hb_audio_config_t *) hb_list_audio_config_item( title->list_audio, [fAudLang2PopUp indexOfSelectedItem] - 1 );+        /* Now we modify it according to the gui settings for the specified track number */+        audio = hb_audio_config_new();+        /* We go ahead and assign values to our audio->out.<properties> */+        audio->out.track = [fAudLang2PopUp indexOfSelectedItem] - 1;+        if ([[fAudTrack2MixPopUp titleOfSelectedItem] isEqualToString: @"AC3 Passthru"])+        {+        audio->out.codec = HB_ACODEC_AC3;+        audio->out.mixdown = HB_ACODEC_AC3;+        audio->out.bitrate = audio->in.bitrate / 1000; // we use the audio.in bitrate for passthru, / 1000 so it displays right.+        audio->out.samplerate = 48000;+        }+        else+        {+        audio->out.codec = FormatSettings[format][codecs] & HB_ACODEC_MASK;+        audio->out.mixdown = [[fAudTrack2MixPopUp selectedItem] tag];+        audio->out.bitrate = [[fAudBitratePopUp selectedItem] tag];+        audio->out.samplerate = hb_audio_rates[[fAudRatePopUp indexOfSelectedItem]].rate;+        }+        audio->out.dynamic_range_compression = [fAudDrcField floatValue];+        /* We add the newly modified audio track to job->list_audio */+        //hb_list_add(job->list_audio, audio );+        hb_audio_add( job, audio );+        +        /*HACK: We use the format and codecs popups to determine if we should slide in the extra ac3 passthru track for the atv hybrid mp4 */+        if (format == 0 && codecs == 2 && audio->in.codec != HB_ACODEC_DCA) // if mp4 and aac + ac3 and input is NOT DTS (dts cannot be passed through as ac3)+        {+            //audio = (hb_audio_config_t *) hb_list_audio_config_item( title->list_audio, [fAudLang2PopUp indexOfSelectedItem] - 1 );+            audio = hb_audio_config_new();+            /* We go ahead and assign values to our audio->out.<properties> */+            audio->out.track = [fAudLang2PopUp indexOfSelectedItem] - 1;+            audio->out.codec = HB_ACODEC_AC3;+            audio->out.codec = HB_ACODEC_AC3;+            audio->out.samplerate = 48000;+            audio->out.bitrate = audio->in.bitrate / 1000; // we use the audio.in bitrate for passthru, / 1000 so it displays right.+            audio->out.mixdown = HB_ACODEC_AC3;//<-- Lets manually set the mixdown int +            audio->out.dynamic_range_compression = [fAudDrcField floatValue];+            /* We add the newly modified audio track to job->list_audio */+            //hb_list_add(job->list_audio, audio );+            hb_audio_add( job, audio );+        }     } -    /*-     * Where one or more of the audio tracks has a mixdown of DPLII+AC3 we need to create an extra-     * track for each.-     */-    if (job->audio_mixdowns[0] == HB_AMIXDOWN_DOLBYPLII_AC3)-    {-        /*-         * Make space for the AC3 track by moving 1 to 2-         */-        job->audios[2] = job->audios[1];-        job->audio_mixdowns[2] = job->audio_mixdowns[1];-        job->audios[1] = job->audios[0];-        job->audio_mixdowns[0] = HB_AMIXDOWN_DOLBYPLII;-        job->audio_mixdowns[1] = HB_AMIXDOWN_AC3;-    }--    if (job->audio_mixdowns[1] == HB_AMIXDOWN_DOLBYPLII_AC3)-    {-        job->audios[2] = job->audios[1];-        job->audio_mixdowns[1] = HB_AMIXDOWN_DOLBYPLII;-        job->audio_mixdowns[2] = HB_AMIXDOWN_AC3;-        job->audios[3] = -1;-    }--    if (job->audio_mixdowns[2] == HB_AMIXDOWN_DOLBYPLII_AC3)-    {-        job->audios[3] = job->audios[2];-        job->audio_mixdowns[2] = HB_AMIXDOWN_DOLBYPLII;-        job->audio_mixdowns[3] = HB_AMIXDOWN_AC3;-        job->audios[4] = -1;-    }--    /* Audio settings */-    job->arate = hb_audio_rates[[fAudRatePopUp-                     indexOfSelectedItem]].rate;-    job->abitrate = [[fAudBitratePopUp selectedItem] tag];     -    /* Dynamic Range Compression */-    job->dynamic_range_compression = [fAudDrcField floatValue];-         /* set vfr according to the Picture Window */     if ([fPictureController vfr])     {@@ -1785,16 +1827,16 @@      // Create a Queue Controller job group. Each job that we submit to libhb will also     // get added to the job group so that the queue can track the jobs.-    HBJobGroup * jobGroup = [HBJobGroup jobGroup];+   HBJobGroup * jobGroup = [HBJobGroup jobGroup];     // The job group can maintain meta data that libhb can not...-    [jobGroup setPresetName: [fPresetSelectedDisplay stringValue]];+   [jobGroup setPresetName: [fPresetSelectedDisplay stringValue]];      // Job groups require that each job within the group be assigned a unique id so     // that the queue can xref between itself and the private jobs that libhb     // maintains. The ID is composed a group id number and a "sequence" number. libhb     // does not use this id.-    static int jobGroupID = 0;-    jobGroupID++;+   static int jobGroupID = 0;+   jobGroupID++;          // A sequence number, starting at zero, is used to identifiy to each pass. This is     // used by the queue UI to determine if a pass if the first pass of an encode.@@ -1941,7 +1983,7 @@         otherwise, just rip the queue */         if( hb_count( fHandle ) == 0)         {-            [self doAddToQueue];+            [self doAddToQueue];                  }          NSString *destinationDirectory = [[fDstFile2Field stringValue] stringByDeletingLastPathComponent];@@ -2787,17 +2829,15 @@  - (IBAction) setEnabledStateOfAudioMixdownControls: (id) sender {-     /* enable/disable the mixdown text and popupbutton for audio track 1 */-    [fAudTrack1MixPopUp setEnabled: ([fAudLang1PopUp indexOfSelectedItem] == 0) ? NO : YES];-    [fAudTrack1MixLabel setTextColor: ([fAudLang1PopUp indexOfSelectedItem] == 0) ?-        [NSColor disabledControlTextColor] : [NSColor controlTextColor]];--    /* enable/disable the mixdown text and popupbutton for audio track 2 */-    [fAudTrack2MixPopUp setEnabled: ([fAudLang2PopUp indexOfSelectedItem] == 0) ? NO : YES];-    [fAudTrack2MixLabel setTextColor: ([fAudLang2PopUp indexOfSelectedItem] == 0) ?-        [NSColor disabledControlTextColor] : [NSColor controlTextColor]];-+        [fAudTrack1MixPopUp setEnabled: ([fAudLang1PopUp indexOfSelectedItem] == 0) ? NO : YES];+        [fAudTrack1MixLabel setTextColor: ([fAudLang1PopUp indexOfSelectedItem] == 0) ?+         [NSColor disabledControlTextColor] : [NSColor controlTextColor]];+        +        /* enable/disable the mixdown text and popupbutton for audio track 2 */+        [fAudTrack2MixPopUp setEnabled: ([fAudLang2PopUp indexOfSelectedItem] == 0) ? NO : YES];+        [fAudTrack2MixLabel setTextColor: ([fAudLang2PopUp indexOfSelectedItem] == 0) ?+         [NSColor disabledControlTextColor] : [NSColor controlTextColor]]; }  - (IBAction) addAllAudioTracksToPopUp: (id) sender@@ -2807,15 +2847,15 @@     hb_title_t * title = (hb_title_t*)         hb_list_item( list, [fSrcTitlePopUp indexOfSelectedItem] ); -	hb_audio_t * audio;-+	hb_audio_config_t * audio;+         [sender removeAllItems];     [sender addItemWithTitle: _( @"None" )];     for( int i = 0; i < hb_list_count( title->list_audio ); i++ )     {-        audio = (hb_audio_t *) hb_list_item( title->list_audio, i );+        audio = (hb_audio_config_t *) hb_list_audio_config_item( title->list_audio, i );         [[sender menu] addItemWithTitle:-            [NSString stringWithCString: audio->lang]+            [NSString stringWithCString: audio->lang.description]             action: NULL keyEquivalent: @""];     }     [sender selectItemAtIndex: 0];@@ -2863,17 +2903,17 @@  - (IBAction) audioTrackPopUpChanged: (id) sender mixdownToUse: (int) mixdownToUse {-+         /* make sure we have a selected title before continuing */     if (fTitle == NULL) return;-+         /* find out if audio track 1 or 2 was changed - this is passed to us in the tag of the sender */     /* the sender will have been either fAudLang1PopUp (tag = 0) or fAudLang2PopUp (tag = 1) */     int thisAudio = [sender tag];-+         /* get the index of the selected audio */     int thisAudioIndex = [sender indexOfSelectedItem] - 1;-+     #if 0     /* Handbrake can't currently cope with ripping the same source track twice */     /* So, if this audio is also selected in the other audio track popup, set that popup's selection to "none" */@@ -2887,10 +2927,10 @@         [self audioTrackPopUpChanged: otherAudioPopUp];     } #endif-+         /* pointer for the hb_audio_s struct we will use later on */-    hb_audio_t * audio;-+    hb_audio_config_t * audio;+         /* find out what the currently-selected output audio codec is */     int format = [fDstFormatPopUp indexOfSelectedItem];     int codecs = [fDstCodecsPopUp indexOfSelectedItem];@@ -2900,17 +2940,17 @@     bool mp4AacAc3;     if (format == 0 && codecs == 2) // if mp4 and aac + ac3     {-    mp4AacAc3 = 1;+        mp4AacAc3 = 1;     }     else     {-    mp4AacAc3 = 0;+        mp4AacAc3 = 0;     }-+         /* pointer to this track's mixdown NSPopUpButton */     NSTextField   * mixdownTextField;     NSPopUpButton * mixdownPopUp;-+         /* find our mixdown NSTextField and NSPopUpButton */     if (thisAudio == 0)     {@@ -2922,125 +2962,124 @@         mixdownTextField = fAudTrack2MixLabel;         mixdownPopUp = fAudTrack2MixPopUp;     }-+         /* delete the previous audio mixdown options */     [mixdownPopUp removeAllItems];-+         /* check if the audio mixdown controls need their enabled state changing */     [self setEnabledStateOfAudioMixdownControls: NULL];-+         if (thisAudioIndex != -1)     {-+                 /* get the audio */-        audio = (hb_audio_t *) hb_list_item( fTitle->list_audio, thisAudioIndex );+        audio = (hb_audio_config_t *) hb_list_audio_config_item( fTitle->list_audio, thisAudioIndex );// Should "fTitle" be title and be setup ?         if (audio != NULL)         {-+                         /* find out if our selected output audio codec supports mono and / or 6ch */             /* we also check for an input codec of AC3 or DCA,-               as they are the only libraries able to do the mixdown to mono / conversion to 6-ch */+             as they are the only libraries able to do the mixdown to mono / conversion to 6-ch */             /* audioCodecsSupportMono and audioCodecsSupport6Ch are the same for now,-               but this may change in the future, so they are separated for flexibility */-            int audioCodecsSupportMono = ((audio->codec == HB_ACODEC_AC3 ||-                audio->codec == HB_ACODEC_DCA) && acodec == HB_ACODEC_FAAC);-            int audioCodecsSupport6Ch =  ((audio->codec == HB_ACODEC_AC3 ||-                audio->codec == HB_ACODEC_DCA) && (acodec == HB_ACODEC_FAAC ||-                acodec == HB_ACODEC_VORBIS));-+             but this may change in the future, so they are separated for flexibility */+            int audioCodecsSupportMono = ((audio->in.codec == HB_ACODEC_AC3 ||+                                           audio->in.codec == HB_ACODEC_DCA) && acodec == HB_ACODEC_FAAC);+            int audioCodecsSupport6Ch =  ((audio->in.codec == HB_ACODEC_AC3 ||+                                           audio->in.codec == HB_ACODEC_DCA) && (acodec == HB_ACODEC_FAAC ||+                                                                                 acodec == HB_ACODEC_VORBIS));+                         /* check for AC-3 passthru */-            if (audio->codec == HB_ACODEC_AC3 && acodec == HB_ACODEC_AC3)+            if (audio->in.codec == HB_ACODEC_AC3 && acodec == HB_ACODEC_AC3)             {-            -                    [[mixdownPopUp menu] addItemWithTitle:-                        [NSString stringWithCString: "AC3 Passthru"]-                        action: NULL keyEquivalent: @""];+                +                [[mixdownPopUp menu] addItemWithTitle:+                 [NSString stringWithCString: "AC3 Passthru"]+                                               action: NULL keyEquivalent: @""];             }             else             {-+                                 /* add the appropriate audio mixdown menuitems to the popupbutton */                 /* in each case, we set the new menuitem's tag to be the amixdown value for that mixdown,-                   so that we can reference the mixdown later */-+                 so that we can reference the mixdown later */+                                 /* keep a track of the min and max mixdowns we used, so we can select the best match later */                 int minMixdownUsed = 0;                 int maxMixdownUsed = 0;                                  /* get the input channel layout without any lfe channels */-                int layout = audio->input_channel_layout & HB_INPUT_CH_LAYOUT_DISCRETE_NO_LFE_MASK;+                int layout = audio->in.channel_layout & HB_INPUT_CH_LAYOUT_DISCRETE_NO_LFE_MASK; -                /* do we want to add a mono option? */-                if (!mp4AacAc3 && audioCodecsSupportMono == 1) {-                    NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:-                        [NSString stringWithCString: hb_audio_mixdowns[0].human_readable_name]-                        action: NULL keyEquivalent: @""];-                    [menuItem setTag: hb_audio_mixdowns[0].amixdown];-                    if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[0].amixdown;-                    maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[0].amixdown);-                }--                /* do we want to add a stereo option? */-                /* offer stereo if we have a mono source and non-mono-supporting codecs, as otherwise we won't have a mixdown at all */-                /* also offer stereo if we have a stereo-or-better source */-                if (((!mp4AacAc3 || audio->codec == HB_ACODEC_MPGA ||  audio->codec == HB_ACODEC_LPCM || audio->codec == HB_ACODEC_DCA) && ((layout == HB_INPUT_CH_LAYOUT_MONO && audioCodecsSupportMono == 0) || layout >= HB_INPUT_CH_LAYOUT_STEREO))) {-                    NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:-                        [NSString stringWithCString: hb_audio_mixdowns[1].human_readable_name]-                        action: NULL keyEquivalent: @""];-                    [menuItem setTag: hb_audio_mixdowns[1].amixdown];-                    if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[1].amixdown;-                    maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[1].amixdown);-                }--                /* do we want to add a dolby surround (DPL1) option? */-                if (!mp4AacAc3 && (layout == HB_INPUT_CH_LAYOUT_3F1R || layout == HB_INPUT_CH_LAYOUT_3F2R || layout == HB_INPUT_CH_LAYOUT_DOLBY)) {-                    NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:-                        [NSString stringWithCString: hb_audio_mixdowns[2].human_readable_name]-                        action: NULL keyEquivalent: @""];-                    [menuItem setTag: hb_audio_mixdowns[2].amixdown];-                    if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[2].amixdown;-                    maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[2].amixdown);-                }--                /* do we want to add a dolby pro logic 2 (DPL2) option? */-                if ((!mp4AacAc3 || audio->codec == HB_ACODEC_DCA) && layout == HB_INPUT_CH_LAYOUT_3F2R) {-                    NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:-                        [NSString stringWithCString: hb_audio_mixdowns[3].human_readable_name]-                        action: NULL keyEquivalent: @""];-                    [menuItem setTag: hb_audio_mixdowns[3].amixdown];-                    if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[3].amixdown;-                    maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[3].amixdown);-                }--                /* do we want to add a 6-channel discrete option? */-                if (!mp4AacAc3 && (audioCodecsSupport6Ch == 1 && layout == HB_INPUT_CH_LAYOUT_3F2R && (audio->input_channel_layout & HB_INPUT_CH_LAYOUT_HAS_LFE))) {-                    NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:-                        [NSString stringWithCString: hb_audio_mixdowns[4].human_readable_name]-                        action: NULL keyEquivalent: @""];-                    [menuItem setTag: hb_audio_mixdowns[4].amixdown];-                    if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[4].amixdown;-                    maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[4].amixdown);-                }--                /* do we want to add an AC-3 passthrough option? */-                if (audio->codec == HB_ACODEC_AC3 && acodec == HB_ACODEC_AC3) {-                    NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:-                        [NSString stringWithCString: hb_audio_mixdowns[5].human_readable_name]-                        action: NULL keyEquivalent: @""];-                    [menuItem setTag: hb_audio_mixdowns[5].amixdown];-                    if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[5].amixdown;-                    maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[5].amixdown);-                }--                /* do we want to add the DPLII+AC3 passthrough option? */-                if (mp4AacAc3 && audio->codec == HB_ACODEC_AC3) {-                    NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:-                        [NSString stringWithCString: hb_audio_mixdowns[6].human_readable_name]-                        action: NULL keyEquivalent: @""];-                    [menuItem setTag: hb_audio_mixdowns[6].amixdown];-                    if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[6].amixdown;-                    maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[6].amixdown);-                }+                    /* do we want to add a mono option? */+                    //if (!mp4AacAc3 && audioCodecsSupportMono == 1)+                    if (audioCodecsSupportMono == 1) +                    {+                        NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:+                                                [NSString stringWithCString: hb_audio_mixdowns[0].human_readable_name]+                                                                              action: NULL keyEquivalent: @""];+                        [menuItem setTag: hb_audio_mixdowns[0].amixdown];+                        if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[0].amixdown;+                        maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[0].amixdown);+                    }+                    +                    /* do we want to add a stereo option? */+                    /* offer stereo if we have a mono source and non-mono-supporting codecs, as otherwise we won't have a mixdown at all */+                    /* also offer stereo if we have a stereo-or-better source */+                    //if (((!mp4AacAc3 || audio->in.codec == HB_ACODEC_MPGA ||  audio->in.codec == HB_ACODEC_LPCM || audio->in.codec == HB_ACODEC_DCA) && ((layout == HB_INPUT_CH_LAYOUT_MONO && audioCodecsSupportMono == 0) || layout >= HB_INPUT_CH_LAYOUT_STEREO))) +                    //if (((audio->in.codec == HB_ACODEC_MPGA ||  audio->in.codec == HB_ACODEC_LPCM || audio->in.codec == HB_ACODEC_DCA) && ((layout == HB_INPUT_CH_LAYOUT_MONO && audioCodecsSupportMono == 0) || layout >= HB_INPUT_CH_LAYOUT_STEREO))) +                    if ((layout == HB_INPUT_CH_LAYOUT_MONO && audioCodecsSupportMono == 0) || layout >= HB_INPUT_CH_LAYOUT_STEREO)+                    {+                        NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:+                                                [NSString stringWithCString: hb_audio_mixdowns[1].human_readable_name]+                                                                              action: NULL keyEquivalent: @""];+                        [menuItem setTag: hb_audio_mixdowns[1].amixdown];+                        if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[1].amixdown;+                        maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[1].amixdown);+                    }+                    +                    /* do we want to add a dolby surround (DPL1) option? */+                    if (layout == HB_INPUT_CH_LAYOUT_3F1R || layout == HB_INPUT_CH_LAYOUT_3F2R || layout == HB_INPUT_CH_LAYOUT_DOLBY)+                    {+                        NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:+                                                [NSString stringWithCString: hb_audio_mixdowns[2].human_readable_name]+                                                                              action: NULL keyEquivalent: @""];+                        [menuItem setTag: hb_audio_mixdowns[2].amixdown];+                        if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[2].amixdown;+                        maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[2].amixdown);+                    }+                    +                    /* do we want to add a dolby pro logic 2 (DPL2) option? */+                    if (layout == HB_INPUT_CH_LAYOUT_3F2R) +                    {+                        NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:+                                                [NSString stringWithCString: hb_audio_mixdowns[3].human_readable_name]+                                                                              action: NULL keyEquivalent: @""];+                        [menuItem setTag: hb_audio_mixdowns[3].amixdown];+                        if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[3].amixdown;+                        maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[3].amixdown);+                    }+                    +                    /* do we want to add a 6-channel discrete option? */+                    if (!mp4AacAc3 && (audioCodecsSupport6Ch == 1 && layout == HB_INPUT_CH_LAYOUT_3F2R && (audio->in.channel_layout & HB_INPUT_CH_LAYOUT_HAS_LFE))) +                    {+                        NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:+                                                [NSString stringWithCString: hb_audio_mixdowns[4].human_readable_name]+                                                                              action: NULL keyEquivalent: @""];+                        [menuItem setTag: hb_audio_mixdowns[4].amixdown];+                        if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[4].amixdown;+                        maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[4].amixdown);+                    }+                    +                    /* do we want to add an AC-3 passthrough option? */+                    if (audio->in.codec == HB_ACODEC_AC3 && acodec == HB_ACODEC_AC3) {+                        NSMenuItem *menuItem = [[mixdownPopUp menu] addItemWithTitle:+                                                [NSString stringWithCString: hb_audio_mixdowns[5].human_readable_name]+                                                                              action: NULL keyEquivalent: @""];+                        [menuItem setTag: hb_audio_mixdowns[5].amixdown];+                        if (minMixdownUsed == 0) minMixdownUsed = hb_audio_mixdowns[5].amixdown;+                        maxMixdownUsed = MAX(maxMixdownUsed, hb_audio_mixdowns[5].amixdown);+                    }+                                     /* auto-select the best mixdown based on our saved mixdown preference */                                  /* for now, this is hard-coded to a "best" mixdown of HB_AMIXDOWN_DOLBYPLII */@@ -3059,24 +3098,24 @@                                  /* if useMixdown > maxMixdownUsed, then use maxMixdownUsed */                 if (useMixdown > maxMixdownUsed) useMixdown = maxMixdownUsed;-+                                 /* if useMixdown < minMixdownUsed, then use minMixdownUsed */                 if (useMixdown < minMixdownUsed) useMixdown = minMixdownUsed;-+                                 /* select the (possibly-amended) preferred mixdown */                 [mixdownPopUp selectItemWithTag: useMixdown]; 				 				/* lets call the audioTrackMixdownChanged method here to determine appropriate bitrates, etc. */                 [self audioTrackMixdownChanged: NULL];             }-+                     }              }-+     	/* see if the new audio track choice will change the bitrate we need */     [self calculateBitrate: sender];	-+     } - (IBAction) audioTrackMixdownChanged: (id) sender {@@ -3095,9 +3134,7 @@         case HB_ACODEC_FAAC:             /* check if we have a 6ch discrete conversion in either audio track */             if ([[fAudTrack1MixPopUp selectedItem] tag] == HB_AMIXDOWN_6CH || -                [[fAudTrack2MixPopUp selectedItem] tag] == HB_AMIXDOWN_6CH || -                [[fAudTrack1MixPopUp selectedItem] tag] == HB_AMIXDOWN_AC3 || -                [[fAudTrack2MixPopUp selectedItem] tag] == HB_AMIXDOWN_AC3)+                [[fAudTrack2MixPopUp selectedItem] tag] == HB_AMIXDOWN_6CH)             {                 /* FAAC is happy using our min bitrate of 32 kbps, even for 6ch */                 minbitrate = 32;@@ -3164,9 +3201,7 @@      /* select the default bitrate (but use 384 for 6-ch AAC) */     if ([[fAudTrack1MixPopUp selectedItem] tag] == HB_AMIXDOWN_6CH || -        [[fAudTrack2MixPopUp selectedItem] tag] == HB_AMIXDOWN_6CH ||-        [[fAudTrack1MixPopUp selectedItem] tag] == HB_AMIXDOWN_AC3 || -        [[fAudTrack2MixPopUp selectedItem] tag] == HB_AMIXDOWN_AC3)+        [[fAudTrack2MixPopUp selectedItem] tag] == HB_AMIXDOWN_6CH)     {         [fAudBitratePopUp selectItemWithTag: 384];     }Index: macosx/HandBrake.plist===================================================================--- macosx/HandBrake.plist	(revision 1364)+++ macosx/HandBrake.plist	(working copy)@@ -9,7 +9,7 @@ 	<key>CFBundleExecutable</key> 	<string>HandBrake</string> 	<key>CFBundleGetInfoString</key>-	<string>0.9.2</string>+	<string>0.9.3</string> 	<key>CFBundleIconFile</key> 	<string>HandBrake</string> 	<key>CFBundleIdentifier</key>@@ -21,11 +21,11 @@ 	<key>CFBundlePackageType</key> 	<string>APPL</string> 	<key>CFBundleShortVersionString</key>-	<string>0.9.2</string>+	<string>0.9.3</string> 	<key>CFBundleSignature</key> 	<string>HB##</string> 	<key>CFBundleVersion</key>-	<string>2008021900</string>+	<string>2008032900</string> 	<key>NSHumanReadableCopyright</key> 	<string>HandBrake Devs</string> 	<key>NSMainNibFile</key>Index: macosx/HBQueueController.mm===================================================================--- macosx/HBQueueController.mm	(revision 1364)+++ macosx/HBQueueController.mm	(working copy)@@ -141,10 +141,62 @@         crf = job->crf;         if (job->x264opts)             x264opts = [[NSString stringWithUTF8String:job->x264opts] retain];-        memcpy(audio_mixdowns, job->audio_mixdowns, sizeof(audio_mixdowns));-        acodec = job->acodec;-        abitrate = job->abitrate;-        arate = job->arate;+        /* So, with the advent of job->list_audio's I decided why not just use an NSString and concatanate+         all of the info we need for all of the audio values to display right into an NSString here ? So I+         did. I have no idea why we are reading libhb stuff just to display it in the queue gui. So here we+         are with a huge string. But its easy to change and saves alot of messing about. Maybe we move a bunch+         of other display stuff into strings for display for each job. It's not like they have to actually do+         anything.*/+        hb_audio_config_t * audio;+        NSString * thisJobAudioCodecs = [NSString stringWithFormat:@""];+        NSString * thisJobAudioInfo = [NSString stringWithFormat:@""]; // Setup a simple way to start the string+        for( int i = 0; i < hb_list_count(job->list_audio); i++ )+        {+           audio = (hb_audio_config_t *) hb_list_audio_config_item( job->list_audio, i );+            /* Output Codec */+            NSString *outputCodec;+            if (audio->out.codec == HB_ACODEC_AC3)+                outputCodec = @"AC3";+            else if (audio->out.codec == HB_ACODEC_FAAC)+                outputCodec = @"AAC";+            else if (audio->out.codec == HB_ACODEC_LAME)+                outputCodec = @"MP3";+            else if (audio->out.codec == HB_ACODEC_VORBIS)+                outputCodec = @"Vorbis";+            else+                outputCodec = @"Unknown Codec";       +            /* Add the codec to the audio codecs list ( We should check against dupes)*/+            thisJobAudioCodecs = [thisJobAudioCodecs stringByAppendingString:[NSString stringWithFormat:@" %@,",outputCodec]];+            if (i > 0)+            {+                /* Insert a line break so that we get each track on a separate line */+                /* Wicked HACK alert!!, use 18 whitespaces to align offset in display for list > 2 to offset "Audio" in the queue display+                 Please Fix Me because this is embarrassing (but it works) */+                thisJobAudioInfo = [thisJobAudioInfo stringByAppendingString:@"\n                  "];+            }+            /* Detailed Job audio track info*/+            /* Track Number and Mixdown Info */+            if (audio->out.mixdown == HB_ACODEC_AC3)// Remember for ac3 passthru the mixdown uses the source codec+                thisJobAudioInfo = [thisJobAudioInfo stringByAppendingString:[NSString stringWithFormat:@" - Track %d: Source: %@ Output: %@, Pass-Thru", i + 1, [NSString stringWithUTF8String:audio->lang.description], outputCodec]];+            else if (audio->out.mixdown == HB_AMIXDOWN_MONO)+                thisJobAudioInfo = [thisJobAudioInfo stringByAppendingString:[NSString stringWithFormat:@" - Track %d: Source: %@ Output: %@, Mono", i + 1, [NSString stringWithUTF8String:audio->lang.description], outputCodec]];+            else if (audio->out.mixdown == HB_AMIXDOWN_STEREO)+                thisJobAudioInfo = [thisJobAudioInfo stringByAppendingString:[NSString stringWithFormat:@" - Track %d: Source: %@ Output: %@, Stereo", i + 1, [NSString stringWithUTF8String:audio->lang.description], outputCodec]];+            else if (audio->out.mixdown == HB_AMIXDOWN_DOLBY)+                thisJobAudioInfo = [thisJobAudioInfo stringByAppendingString:[NSString stringWithFormat:@" - Track %d: Source: %@ Output: %@, Dolby Surround", i + 1, [NSString stringWithUTF8String:audio->lang.description], outputCodec]];+            else if (audio->out.mixdown == HB_AMIXDOWN_DOLBYPLII)+                thisJobAudioInfo = [thisJobAudioInfo stringByAppendingString:[NSString stringWithFormat:@" - Track %d: Source: %@ Output: %@, Dolby Pro Logic II", i + 1, [NSString stringWithUTF8String:audio->lang.description], outputCodec]];+            else if (audio->out.mixdown == HB_AMIXDOWN_6CH)+                thisJobAudioInfo = [thisJobAudioInfo stringByAppendingString:[NSString stringWithFormat:@" - Track %d: Source: %@ Output: %@, 6 Channel Discreet", i + 1, [NSString stringWithUTF8String:audio->lang.description], outputCodec]];+            else+                thisJobAudioInfo = [thisJobAudioInfo stringByAppendingString:[NSString stringWithFormat:@" - Track %d: Source: %@ Output: Unknown Codec Info", i + 1, [NSString stringWithUTF8String:audio->lang.description]]];+            +            thisJobAudioInfo = [thisJobAudioInfo stringByAppendingString:[NSString stringWithFormat:@", %d kbps, %d Hz", audio->out.bitrate, audio->out.samplerate]];+            +        }+        audioinfo_summary = [[NSString stringWithFormat:@"%@",thisJobAudioInfo]retain];+        audioinfo_codecs = [[NSString stringWithFormat:@"%@",thisJobAudioCodecs]retain];+                 subtitle = job->subtitle;         mux = job->mux;         if (job->file)@@ -197,6 +249,8 @@     [file release];     [titleName release];     [subtitleLang release];+    [audioinfo_summary release];+    [audioinfo_codecs release];     [super dealloc]; } @@ -407,9 +461,9 @@             jobFormatInfo = @"unknown";                          if (chapter_markers == 1)-            jobFormatInfo = [NSString stringWithFormat:@"%@ Container, %@ Video + %@ Audio, Chapter Markers\n", jobFormatInfo, jobVideoCodec, jobAudioCodec];+            jobFormatInfo = [NSString stringWithFormat:@"%@ Container, %@ Video + %@ Audio, Chapter Markers\n", jobFormatInfo, jobVideoCodec, audioinfo_codecs];         else-            jobFormatInfo = [NSString stringWithFormat:@"%@ Container, %@ Video + %@ Audio\n", jobFormatInfo, jobVideoCodec, jobAudioCodec];+            jobFormatInfo = [NSString stringWithFormat:@"%@ Container, %@ Video + %@ Audio\n", jobFormatInfo, jobVideoCodec, audioinfo_codecs];                      [finalString appendString: @"Format: " withAttributes:detailBoldAttr];         [finalString appendString: jobFormatInfo withAttributes:detailAttr];@@ -497,34 +551,10 @@      if (withAudioInfo)     {-        NSString * jobAudioInfo;-        if ([jobAudioCodec isEqualToString: @"AC3"])-            jobAudioInfo = [NSString stringWithFormat:@"%@, Pass-Through", jobAudioCodec];-        else-            jobAudioInfo = [NSString stringWithFormat:@"%@, %d kbps, %d Hz", jobAudioCodec, abitrate, arate];-        -        // we now get the audio mixdown info for each of the two gui audio tracks-        // lets do it the long way here to get a handle on things.-        // Hardcoded for two tracks for gui: audio_mixdowns[i] audio_mixdowns[i]-        int ai; // counter for each audios [] , macgui only allows for two audio tracks currently-        for( ai = 0; ai < 2; ai++ )-        {-            if (audio_mixdowns[ai] == HB_AMIXDOWN_MONO)-                jobAudioInfo = [jobAudioInfo stringByAppendingString:[NSString stringWithFormat:@", Track %d: Mono", ai + 1]];-            if (audio_mixdowns[ai] == HB_AMIXDOWN_STEREO)-                jobAudioInfo = [jobAudioInfo stringByAppendingString:[NSString stringWithFormat:@", Track %d: Stereo", ai + 1]];-            if (audio_mixdowns[ai] == HB_AMIXDOWN_DOLBY)-                jobAudioInfo = [jobAudioInfo stringByAppendingString:[NSString stringWithFormat:@", Track %d: Dolby Surround", ai + 1]];-            if (audio_mixdowns[ai] == HB_AMIXDOWN_DOLBYPLII)-                jobAudioInfo = [jobAudioInfo stringByAppendingString:[NSString stringWithFormat:@", Track %d: Dolby Pro Logic II", ai + 1]];-            if (audio_mixdowns[ai] == HB_AMIXDOWN_AC3)-                jobAudioInfo = [jobAudioInfo stringByAppendingString:[NSString stringWithFormat:@", Pass-Through", ai + 1]];-                -        }         if (withIcon)   // implies indent the info             [finalString appendString: @"\t" withAttributes:detailBoldAttr];         [finalString appendString: @"Audio: " withAttributes:detailBoldAttr];-        [finalString appendString:[NSString stringWithFormat:@"%@\n", jobAudioInfo] withAttributes:detailAttr];+        [finalString appendString:[NSString stringWithFormat:@"%@\n", audioinfo_summary] withAttributes:detailAttr];     }          if (withSubtitleInfo)