OSDN Git Service

MacGui: Enable soft vobsubs in mp4
authordynaflash <dynaflash@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 25 May 2010 17:09:10 +0000 (17:09 +0000)
committerdynaflash <dynaflash@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 25 May 2010 17:09:10 +0000 (17:09 +0000)
- Initial patch by Rodeo. Thanks Rodeo!
- Enables soft vobsubsin macgui as per http://trac.handbrake.fr/changeset/3325
- Due to the fact that currently no quicktime based playback devices (yes, including computers and iphone/ipod/ipad) supports soft vobsubs, "Burned In" is on by default.
- Currently soft vobsubs are shown as supported by VLC (Lunettes) and Mplayer on the mac platform.

git-svn-id: svn://localhost/HandBrake/trunk@3326 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/Controller.m
macosx/HBSubtitles.m

index 9d76e01..6526d15 100644 (file)
@@ -3221,23 +3221,18 @@ bool one_burned = FALSE;
                 [self writeToActivityLog: "Foreign Language Search: %d", 1];
                 
                 job->indepth_scan = 1;
-                if (burned == 1 || job->mux != HB_MUX_MP4)
+                
+                if (burned != 1)
                 {
-                    if (burned != 1 && job->mux == HB_MUX_MKV)
-                    {
-                        job->select_subtitle_config.dest = PASSTHRUSUB;
-                    }
-                    else
-                    {
-                        job->select_subtitle_config.dest = RENDERSUB;
-                    }
-                    
-                    job->select_subtitle_config.force = force;
-                    job->select_subtitle_config.default_track = def;
-                    
+                    job->select_subtitle_config.dest = PASSTHRUSUB;
+                }
+                else
+                {
+                    job->select_subtitle_config.dest = RENDERSUB;
                 }
                 
-                
+                job->select_subtitle_config.force = force;
+                job->select_subtitle_config.default_track = def;
             }
             else
             {
@@ -3285,17 +3280,10 @@ bool one_burned = FALSE;
                 {
                     hb_subtitle_config_t sub_config = subt->config;
                     
-                    if (!burned && job->mux == HB_MUX_MKV && 
-                        subt->format == PICTURESUB)
+                    if ( !burned && subt->format == PICTURESUB )
                     {
                         sub_config.dest = PASSTHRUSUB;
                     }
-                    else if (!burned && job->mux == HB_MUX_MP4 && 
-                             subt->format == PICTURESUB)
-                    {
-                        // Skip any non-burned vobsubs when output is mp4
-                        continue;
-                    }
                     else if ( burned && subt->format == PICTURESUB )
                     {
                         // Only allow one subtitle to be burned into the video
@@ -3796,22 +3784,18 @@ bool one_burned = FALSE;
                 [self writeToActivityLog: "Foreign Language Search: %d", 1];
                 
                 job->indepth_scan = 1;
-                if (burned == 1 || job->mux != HB_MUX_MP4)
+                
+                if (burned != 1)
                 {
-                    if (burned != 1 && job->mux == HB_MUX_MKV)
-                    {
-                        job->select_subtitle_config.dest = PASSTHRUSUB;
-                    }
-                    else
-                    {
-                        job->select_subtitle_config.dest = RENDERSUB;
-                    }
-                    
-                    job->select_subtitle_config.force = force;
-                    job->select_subtitle_config.default_track = def;
+                    job->select_subtitle_config.dest = PASSTHRUSUB;
+                }
+                else
+                {
+                    job->select_subtitle_config.dest = RENDERSUB;
                 }
                 
-                
+                job->select_subtitle_config.force = force;
+                job->select_subtitle_config.default_track = def;
             }
             else
             {
@@ -3860,17 +3844,10 @@ bool one_burned = FALSE;
                 {
                     hb_subtitle_config_t sub_config = subt->config;
                     
-                    if (!burned && job->mux == HB_MUX_MKV && 
-                        subt->format == PICTURESUB)
+                    if ( !burned && subt->format == PICTURESUB )
                     {
                         sub_config.dest = PASSTHRUSUB;
                     }
-                    else if (!burned && job->mux == HB_MUX_MP4 && 
-                             subt->format == PICTURESUB)
-                    {
-                        // Skip any non-burned vobsubs when output is mp4
-                        continue;
-                    }
                     else if ( burned && subt->format == PICTURESUB )
                     {
                         // Only allow one subtitle to be burned into the video
index aca46b5..027ff01 100644 (file)
     if ([[aTableColumn identifier] isEqualToString:@"track"])
     {
         
-        /* since mp4 only supports burned in vobsubs (bitmap) we need to make sure burned in is specified */
+        /* Since currently no quicktime based playback devices support soft vobsubs (bitmap) in mp4, we make sure
+         * "burned in" is specified  by default to avoid massive confusion and anarchy. */
         if (container == HB_MUX_MP4 && [anObject intValue] != 0)
         {
-            /* so, if isPictureSub = TRUE and we are mp4, we now have to A) set burned-in to 1 and b) remove any other
-             * tracks specified that are burned in */
             if ([[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackisPictureSub"] intValue] == 1)
             {
                 [[subtitleArray objectAtIndex:rowIndex] setObject:[NSNumber numberWithInt:1] forKey:@"subtitleTrackBurned"];
             }
         }
         
-        
         /* We use the track popup index number (presumes index 0 is "None" which is ignored and only used to remove tracks if need be)
          * to determine whether to 1 modify an existing track, 2. add a new empty "None" track or 3. remove an existing track.
          */
         else if ([[aTableColumn identifier] isEqualToString:@"burned"])
         {
             [aCell setState:[[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleTrackBurned"] intValue]];
-            /* Disable the "Burned-In" checkbox if a) the track is "None", b) the subtitle track is text (we do not support burning in
-             * text subs, or c) we are mp4 and the track is a vobsub (picture sub) */
+            /* Disable the "Burned-In" checkbox if a) the track is "None" or b) the subtitle track is text (we do not support burning in
+             * text subs) */
             if ([[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackNum"] intValue] == 0 ||
-                [[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackisPictureSub"] intValue] == 0 ||
-                (container == HB_MUX_MP4 && [[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackisPictureSub"] intValue] == 1))
+                [[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackisPictureSub"] intValue] == 0)
             {
                 [aCell setEnabled:NO];
             }
         
     }
     
-    
-    if (container == HB_MUX_MP4)
-    {
-        /* now remove any other tracks that are set as burned and are picturesubs */
-        int i = 0;
-        int removedTracks = 0;
-        NSEnumerator *enumerator = [subtitleArray objectEnumerator];
-        id tempObject;
-        NSMutableArray *tempArrayToDelete = [NSMutableArray array];
-        BOOL removeTrack = NO; 
-        while ( tempObject = [enumerator nextObject] )  
-        {
-            
-            if ([[tempObject objectForKey:@"subtitleSourceTrackisPictureSub"] intValue] == 1)
-            {
-                /* if this is the first vobsub mark it. if not, remove it */
-                if (removeTrack == NO)
-                {
-                    /* make sure that this is set to be burned in */
-                    [tempObject setObject:[NSNumber numberWithInt:1] forKey:@"subtitleTrackBurned"];
-                    removeTrack = YES;
-                }
-                else
-                {
-                    [tempArrayToDelete addObject:tempObject];
-                    removedTracks ++;
-                }
-            }
-            
-            i++;
-        }
-        /* check to see if there are tracks to remove from the array */
-        if ([tempArrayToDelete count] > 0)
-        {
-            /* Popup a warning that hb only support one pic sub being burned in with mp4 */
-            int status;
-            status = NSRunAlertPanel(@"More than one vobsub is not supported in an mp4...",@"Your first vobsub track will now be used.", @"OK", nil, nil);
-            [NSApp requestUserAttention:NSCriticalRequest];
-            
-            [subtitleArray removeObjectsInArray:tempArrayToDelete];
-            [aTableView reloadData];
-        }
-    }
 }