]> granicus.if.org Git - handbrake/commitdiff
Merged Trunk to OpenCL
authorsr55 <sr55.hb@outlook.com>
Sat, 16 Mar 2013 17:49:51 +0000 (17:49 +0000)
committersr55 <sr55.hb@outlook.com>
Sat, 16 Mar 2013 17:49:51 +0000 (17:49 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/opencl@5332 b64f7644-9d1e-0410-96f1-a4d463321fa5

13 files changed:
libhb/encavcodecaudio.c
libhb/platform/macosx/encca_aac.c
libhb/scan.c
macosx/Controller.m
macosx/HBSubtitles.h
macosx/HBSubtitles.m
pkg/linux/module.defs
pkg/linux/module.rules
pkg/module.defs
pkg/module.rules
test/parsecsv.c
test/parsecsv.h
test/test.c

index 2c4471babfac204cf1bb70f4e397e84d030979a5..3633fed9e1f5cb26fa0d43c1e9f35cf9262bf4f8 100644 (file)
@@ -189,8 +189,10 @@ static int encavcodecaInit(hb_work_object_t *w, hb_job_t *job)
     pv->samples_per_frame = context->frame_size;
     pv->input_samples     = context->frame_size * context->channels;
     pv->input_buf         = malloc(pv->input_samples * sizeof(float));
-    pv->max_output_bytes  = (pv->input_samples *
-                             av_get_bytes_per_sample(context->sample_fmt));
+    // Some encoders in libav (e.g. fdk-aac) fail if the output buffer
+    // size is not some minumum value.  8K seems to be enough :(
+    pv->max_output_bytes  = MAX(8192, (pv->input_samples *
+                             av_get_bytes_per_sample(context->sample_fmt)));
 
     // sample_fmt conversion
     if (context->sample_fmt != AV_SAMPLE_FMT_FLT)
index 98e5ddfaf35552efd54e3f346660ead70d26c445..a5c7488a569eaad5a8592745490d888bc2893559 100644 (file)
@@ -1,6 +1,6 @@
 /* encca_aac.c
 
-   Copyright (c) 2003-2012 HandBrake Team
+   Copyright (c) 2003-2013 HandBrake Team
    This file is part of the HandBrake source code
    Homepage: <http://handbrake.fr/>.
    It may be used under the terms of the GNU General Public License v2.
index 7dfb44c607d86ea39070a3de80147f818dec8915..40dffa01ec1b1657a7af29c290fe19afa24e2ddb 100644 (file)
@@ -1119,9 +1119,9 @@ static void UpdateState2(hb_scan_t *scan, int title)
     p.preview_cur = 1;
     p.preview_count = scan->preview_count;
     if (scan->title_index)
-        p.progress = (float)p.title_cur / p.title_count;
+        p.progress = (float)(p.title_cur - 1) / p.title_count;
     else
-        p.progress = 0.5 + 0.5 * (float)p.title_cur / p.title_count;
+        p.progress = 0.5 + 0.5 * (float)(p.title_cur - 1) / p.title_count;
 #undef p
 
     hb_set_state(scan->h, &state);
index b1faa7d0867f40b89033c9c1319b17681397a165..79ef5da5e8cd6e1a47ce6b7e0cf44c97f0a2f328 100644 (file)
@@ -3452,7 +3452,7 @@ bool one_burned = FALSE;
             else
             {
                 /* if we are getting the subtitles from an external srt file */
-                if ([[tempObject objectForKey:@"subtitleSourceTrackType"] isEqualToString:@"SRT"])
+                if ([[tempObject objectForKey:@"subtitleSourceTrackType"] intValue] == SRTSUB)
                 {
                     hb_subtitle_config_t sub_config;
                     
@@ -4012,7 +4012,7 @@ bool one_burned = FALSE;
             else
             {
                 /* if we are getting the subtitles from an external srt file */
-                if ([[tempObject objectForKey:@"subtitleSourceTrackType"] isEqualToString:@"SRT"])
+                if ([[tempObject objectForKey:@"subtitleSourceTrackType"] intValue] == SRTSUB)
                 {
                     hb_subtitle_config_t sub_config;
                     
index 83c9a1d6fe6a462811668168821086c3f5e21f57..9b001fe7a1c00b8860dd7610800eccbf8abf5360 100644 (file)
@@ -15,6 +15,7 @@ hb_title_t                   *fTitle;
 
 NSMutableArray               *subtitleArray; // contains the output subtitle track info
 NSMutableArray               *subtitleSourceArray;// contains the source subtitle track info
+NSString                     *foreignAudioSearchTrackName;
 NSMutableArray               *languagesArray; // array of languages taken from lang.c
 int                           languagesArrayDefIndex;
 NSMutableArray               *charCodeArray; // array of character codes
index f84749303c0a180f85acfa23e52f1ed801469b45..94561a983fa8c37fd15a24da88c1c75ce6afe754 100644 (file)
 
 - (void)resetWithTitle:(hb_title_t *)title
 {
-    fTitle = title;
-    
     if (!title)
     {
         return;
     }
+    fTitle = title;
     
     /* reset the subtitle source array */
     if (subtitleSourceArray)
     subtitleSourceArray = [[NSMutableArray alloc] init];
     
     /* now populate the array with the source subtitle track info */
-    if (fTitle)
+    int i;
+    hb_subtitle_t *subtitle;
+    NSMutableArray *forcedSourceNamesArray = [[NSMutableArray alloc] init];
+    for (i = 0; i < hb_list_count(fTitle->list_subtitle); i++)
+    {
+        subtitle = (hb_subtitle_t*)hb_list_item(fTitle->list_subtitle, i);
+        
+        /* Subtitle source features */
+        int canBeBurnedIn       = hb_subtitle_can_burn(subtitle->source);
+        int supportsForcedFlags = hb_subtitle_can_force(subtitle->source);
+        /* Human-readable representation of subtitle->source */
+        NSString *bitmapOrText  = subtitle->format == PICTURESUB ? @"Bitmap" : @"Text";
+        NSString *subSourceName = [NSString stringWithUTF8String:hb_subsource_name(subtitle->source)];
+        /* if the subtitle track can be forced, add its source name to the array */
+        if (supportsForcedFlags &&
+            [forcedSourceNamesArray containsObject:subSourceName] == NO)
         {
-            hb_subtitle_t *subtitle;
-            hb_subtitle_config_t sub_config;
-            int i;
-            for(i = 0; i < hb_list_count( fTitle->list_subtitle ); i++ )
+            [forcedSourceNamesArray addObject:subSourceName];
+        }
+        
+        /* create a dictionary of source subtitle information to store in our array */
+        NSMutableDictionary *newSubtitleSourceTrack = [[NSMutableDictionary alloc] init];
+        /* Subtitle Source track name */
+        [newSubtitleSourceTrack setObject:[NSString stringWithFormat:@"%d - %@ - (%@) (%@)",
+                                           i, [NSString stringWithUTF8String:subtitle->lang],
+                                           bitmapOrText,subSourceName]
+                                   forKey:@"sourceTrackName"];
+        /* Subtitle Source track number, type and features */
+        [newSubtitleSourceTrack setObject:[NSNumber numberWithInt:i]                   forKey:@"sourceTrackNum"];
+        [newSubtitleSourceTrack setObject:[NSNumber numberWithInt:subtitle->source]    forKey:@"sourceTrackType"];
+        [newSubtitleSourceTrack setObject:[NSNumber numberWithInt:canBeBurnedIn]       forKey:@"sourceTrackCanBeBurnedIn"];
+        [newSubtitleSourceTrack setObject:[NSNumber numberWithInt:supportsForcedFlags] forKey:@"sourceTrackSupportsForcedFlags"];
+        [subtitleSourceArray addObject:newSubtitleSourceTrack];
+        [newSubtitleSourceTrack autorelease];
+    }
+    
+    /* now set the name of the Foreign Audio Search track */
+    if ([forcedSourceNamesArray count])
+    {
+        [forcedSourceNamesArray sortUsingComparator:^(id obj1, id obj2)
+         {
+             return [((NSString*)obj1) compare:((NSString*)obj2)];
+         }];
+        NSString *tempString;
+        NSString *tempList       = @"";
+        NSEnumerator *enumerator = [forcedSourceNamesArray objectEnumerator];
+        while (tempString = (NSString*)[enumerator nextObject])
+        {
+            if ([tempList length])
             {
-                subtitle = (hb_subtitle_t *) hb_list_item( fTitle->list_subtitle, i );
-                sub_config = subtitle->config;
-                
-                int canBeBurnedIn = hb_subtitle_can_burn( subtitle->source );
-                int supportsForcedFlags = hb_subtitle_can_force( subtitle->source );
-                
-                /* create a dictionary of source subtitle information to store in our array */
-                NSMutableDictionary *newSubtitleSourceTrack = [[NSMutableDictionary alloc] init];
-                /* Subtitle Source track popup index */
-                [newSubtitleSourceTrack setObject:[NSNumber numberWithInt:i] forKey:@"sourceTrackNum"];
-                /* Human-readable representation of subtitle->source */
-                NSString *subSourceName = [NSString stringWithUTF8String:hb_subsource_name( subtitle->source )];
-                NSString *bitmapOrText = subtitle->format == PICTURESUB ? @"Bitmap" : @"Text";
-                /* Subtitle Source track name */
-                NSString *popupName = [NSString stringWithFormat:@"%d - %@ - (%@) (%@)",i,[NSString stringWithUTF8String:subtitle->lang],bitmapOrText,subSourceName];
-                [newSubtitleSourceTrack setObject:popupName forKey:@"sourceTrackName"];
-                /* Subtitle Source track type (VobSub, Srt, etc.) */
-                [newSubtitleSourceTrack setObject:subSourceName forKey:@"sourceTrackType"];
-                /* Subtitle Source track canBeBurnedIn */
-                [newSubtitleSourceTrack setObject:[NSNumber numberWithInt:canBeBurnedIn] forKey:@"sourceTrackCanBeBurnedIn"];
-                /* Subtitle Source track supportsForcedFlags */
-                [newSubtitleSourceTrack setObject:[NSNumber numberWithInt:supportsForcedFlags] forKey:@"sourceTrackSupportsForcedFlags"];
-                
-                [subtitleSourceArray addObject:newSubtitleSourceTrack];
-                [newSubtitleSourceTrack autorelease];
+                tempList = [tempList stringByAppendingString:@", "];
             }
+            tempList = [tempList stringByAppendingString:tempString];
         }
-    
-    
+        [foreignAudioSearchTrackName release];
+        foreignAudioSearchTrackName = [[NSString stringWithFormat:@"Foreign Audio Search - (Bitmap) (%@)", tempList]
+                                       retain];
+    }
+    else
+    {
+        [foreignAudioSearchTrackName release];
+        foreignAudioSearchTrackName = [[NSString stringWithString:@"Foreign Audio Search - (Bitmap)"]
+                                       retain];
+    }
+    [forcedSourceNamesArray release];
     
     /* reset the subtitle output array */
     if (subtitleArray)
     /* Subtitle Source track name */
     [newSubtitleSourceTrack setObject:displayname forKey:@"sourceTrackName"];
     /* Subtitle Source track type (VobSub, Srt, etc.) */
-    [newSubtitleSourceTrack setObject:@"SRT" forKey:@"sourceTrackType"];
-    [newSubtitleSourceTrack setObject:@"SRT" forKey:@"subtitleSourceTrackType"];
+    [newSubtitleSourceTrack setObject:[NSNumber numberWithInt:SRTSUB] forKey:@"sourceTrackType"];
+    [newSubtitleSourceTrack setObject:[NSNumber numberWithInt:SRTSUB] forKey:@"subtitleSourceTrackType"];
     /* Subtitle Source file path */
     [newSubtitleSourceTrack setObject:filePath forKey:@"sourceSrtFilePath"];
     /* Subtitle Source track canBeBurnedIn */
         [newSubtitleSrtTrack setObject:[NSNumber numberWithInt:[subtitleSourceArray count]] forKey:@"subtitleSourceTrackNum"];
     }
     
-    [newSubtitleSrtTrack setObject:@"SRT" forKey:@"sourceTrackType"];
-    [newSubtitleSrtTrack setObject:@"SRT" forKey:@"subtitleSourceTrackType"];
+    [newSubtitleSrtTrack setObject:[NSNumber numberWithInt:SRTSUB] forKey:@"sourceTrackType"];
+    [newSubtitleSrtTrack setObject:[NSNumber numberWithInt:SRTSUB] forKey:@"subtitleSourceTrackType"];
     /* Subtitle Source track popup language */
     [newSubtitleSrtTrack setObject:displayname forKey:@"subtitleSourceTrackName"];
     /* Subtitle track forced state */
     while ( tempObject = [enumerator nextObject] )  
     {
         /* We have an srt track */
-        if ([[tempObject objectForKey:@"subtitleSourceTrackType"] isEqualToString:@"SRT"])
+        if ([[tempObject objectForKey:@"subtitleSourceTrackType"] intValue] == SRTSUB)
         {
             NSString *filePath = [tempObject objectForKey:@"subtitleSourceSrtFilePath"];
             /* Start replicate the add new srt code above */
             /* Subtitle Source track name */
             [newSubtitleSourceTrack setObject:displayname forKey:@"sourceTrackName"];
             /* Subtitle Source track type (VobSub, Srt, etc.) */
-            [newSubtitleSourceTrack setObject:@"SRT" forKey:@"sourceTrackType"];
-            [newSubtitleSourceTrack setObject:@"SRT" forKey:@"subtitleSourceTrackType"];
+            [newSubtitleSourceTrack setObject:[NSNumber numberWithInt:SRTSUB] forKey:@"sourceTrackType"];
+            [newSubtitleSourceTrack setObject:[NSNumber numberWithInt:SRTSUB] forKey:@"subtitleSourceTrackType"];
             /* Subtitle Source file path */
             [newSubtitleSourceTrack setObject:filePath forKey:@"sourceSrtFilePath"];
             /* Subtitle Source track canBeBurnedIn */
         /* Foreign Audio Search (index 1 in the popup) is only available for the first track */
         if (rowIndex == 0)
         {
-            [[cellTrackPopup menu] addItemWithTitle: @"Foreign Audio Search - (Bitmap)" action: NULL keyEquivalent: @""];
+            // TODO: hide the track when no force-able subtitles are present in the source
+            [[cellTrackPopup menu] addItemWithTitle:foreignAudioSearchTrackName
+                                             action:NULL
+                                      keyEquivalent:@""];
         }
         
         int i;
         /* Set the array to track if we are vobsub (picture sub) */
         if ([anObject intValue] != 0)
         {
-            int sourceSubtitleIndex;
+            /* The first row has an additional track (Foreign Audio Search) */
+            int sourceSubtitleIndex = [anObject intValue] - 1 - (rowIndex == 0);
             
-            if (rowIndex == 0)
-            {
-                sourceSubtitleIndex = [anObject intValue] - 2;
-            }
-            else
+            if(rowIndex == 0 && [anObject intValue] == 1)
             {
-                sourceSubtitleIndex = [anObject intValue] - 1;
-            }
-            
-            if(rowIndex == 0 && [anObject intValue] == 1) // we are foreign lang search, which is inherently vobsub
-            {
-                [[subtitleArray objectAtIndex:rowIndex] setObject:[NSString stringWithUTF8String:hb_subsource_name( VOBSUB )] forKey:@"subtitleSourceTrackType"];
-                [[subtitleArray objectAtIndex:rowIndex] setObject:[NSNumber numberWithInt:1] forKey:@"subtitleSourceTrackCanBeBurnedIn"];
-                [[subtitleArray objectAtIndex:rowIndex] setObject:[NSNumber numberWithInt:1] forKey:@"subtitleSourceTrackSupportsForcedFlags"];
+                /*
+                 * we are foreign lang search, which is inherently bitmap
+                 *
+                 * since it can be either VOBSUB or PGS and the latter can't be
+                 * passed through to MP4, we need to know whether there are any
+                 * PGS tracks in the source - otherwise we can just set the
+                 * source track type to VOBSUB
+                 */
+                int subtitleTrackType = VOBSUB;
+                if ([foreignAudioSearchTrackName rangeOfString:
+                     [NSString stringWithUTF8String:
+                      hb_subsource_name(PGSSUB)]].location != NSNotFound)
+                {
+                    subtitleTrackType = PGSSUB;
+                }
+                // now set the track type
+                [[subtitleArray objectAtIndex:rowIndex] setObject:[NSNumber numberWithInt:subtitleTrackType] forKey:@"subtitleSourceTrackType"];
+                [[subtitleArray objectAtIndex:rowIndex] setObject:[NSNumber numberWithInt:1]                 forKey:@"subtitleSourceTrackCanBeBurnedIn"];
+                [[subtitleArray objectAtIndex:rowIndex] setObject:[NSNumber numberWithInt:1]                 forKey:@"subtitleSourceTrackSupportsForcedFlags"];
                 // foreign lang search is most useful when combined w/Forced Only - make it default
-                [[subtitleArray objectAtIndex:rowIndex] setObject:[NSNumber numberWithInt:1] forKey:@"subtitleTrackForced"];
+                [[subtitleArray objectAtIndex:rowIndex] setObject:[NSNumber numberWithInt:1]                 forKey:@"subtitleTrackForced"];
             }
             /* check to see if we are an srt, in which case set our file path and source track type kvp's*/
-            else if ([[[subtitleSourceArray objectAtIndex:sourceSubtitleIndex] objectForKey:@"sourceTrackType"] isEqualToString:@"SRT"])
+            else if ([[[subtitleSourceArray objectAtIndex:sourceSubtitleIndex] objectForKey:@"sourceTrackType"] intValue] == SRTSUB)
             {
-                [[subtitleArray objectAtIndex:rowIndex] setObject:@"SRT" forKey:@"subtitleSourceTrackType"];
-                [[subtitleArray objectAtIndex:rowIndex] setObject:[[subtitleSourceArray objectAtIndex:sourceSubtitleIndex] objectForKey:@"sourceSrtFilePath"] forKey:@"subtitleSourceSrtFilePath"];
+                [[subtitleArray objectAtIndex:rowIndex] setObject:[NSNumber numberWithInt:SRTSUB]
+                                                           forKey:@"subtitleSourceTrackType"];
+                [[subtitleArray objectAtIndex:rowIndex] setObject:[[subtitleSourceArray objectAtIndex:sourceSubtitleIndex] objectForKey:@"sourceSrtFilePath"]
+                                                           forKey:@"subtitleSourceSrtFilePath"];
             }
             else
             {
-                [[subtitleArray objectAtIndex:rowIndex] setObject:[[subtitleSourceArray objectAtIndex:sourceSubtitleIndex] objectForKey:@"sourceTrackType"] forKey:@"subtitleSourceTrackType"];
-                [[subtitleArray objectAtIndex:rowIndex] setObject:[NSNumber numberWithInt:[[[subtitleSourceArray objectAtIndex:sourceSubtitleIndex] objectForKey:@"sourceTrackCanBeBurnedIn"] intValue]]
-                                                        forKey:@"subtitleSourceTrackCanBeBurnedIn"];
-                [[subtitleArray objectAtIndex:rowIndex] setObject:[NSNumber numberWithInt:[[[subtitleSourceArray objectAtIndex:sourceSubtitleIndex] objectForKey:@"sourceTrackSupportsForcedFlags"] intValue]]
-                                                        forKey:@"subtitleSourceTrackSupportsForcedFlags"];
+                [[subtitleArray objectAtIndex:rowIndex] setObject:[[subtitleSourceArray objectAtIndex:sourceSubtitleIndex] objectForKey:@"sourceTrackType"]
+                                                           forKey:@"subtitleSourceTrackType"];
+                [[subtitleArray objectAtIndex:rowIndex] setObject:[[subtitleSourceArray objectAtIndex:sourceSubtitleIndex] objectForKey:@"sourceTrackCanBeBurnedIn"]
+                                                           forKey:@"subtitleSourceTrackCanBeBurnedIn"];
+                [[subtitleArray objectAtIndex:rowIndex] setObject:[[subtitleSourceArray objectAtIndex:sourceSubtitleIndex] objectForKey:@"sourceTrackSupportsForcedFlags"]
+                                                           forKey:@"subtitleSourceTrackSupportsForcedFlags"];
             } 
             
             if([[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackCanBeBurnedIn"] intValue] == 0)
          */
         if (container == HB_MUX_MP4 && [anObject intValue] != 0)
         {
-            NSString *subtitleSourceTrackType = [[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackType"];
-            if ([subtitleSourceTrackType isEqualToString:[NSString stringWithUTF8String:hb_subsource_name( VOBSUB )]] ||
-                [subtitleSourceTrackType isEqualToString:[NSString stringWithUTF8String:hb_subsource_name( PGSSUB )]])
+            if ([[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackType"] intValue] == VOBSUB)
             {
                 /* lets see if there are currently any burned in subs specified */
                 NSEnumerator *enumerator = [subtitleArray objectEnumerator];
         {
             [aCell setState:[[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleTrackForced"] intValue]];
             /* Disable the "Forced Only" checkbox if a) the track is "None" or b) the subtitle track doesn't support forced flags */
-            if ([[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackNum"] intValue] == 0 ||
-                [[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackSupportsForcedFlags"] intValue] == 0)
+            if (![[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackNum"] intValue] ||
+                ![[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackSupportsForcedFlags"] intValue])
             {
                 [aCell setEnabled:NO];
             }
         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" or b) the subtitle track can't be burned in */
-            if ([[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackNum"] intValue] == 0 ||
-                [[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackCanBeBurnedIn"] intValue] == 0)
+            /*
+             * Disable the "Burned In" checkbox if:
+             * a) the track is "None" OR
+             * b) the subtitle track can't be burned in OR
+             * c) the subtitle track can't be passed through (e.g. PGS w/MP4)
+             */
+            if (![[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackNum"] intValue] ||
+                ![[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackCanBeBurnedIn"] intValue] ||
+                !hb_subtitle_can_pass([[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackType"] intValue], container))
             {
                 [aCell setEnabled:NO];
             }
         }
         else if ([[aTableColumn identifier] isEqualToString:@"default"])
         {
-            [aCell setState:[[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleTrackDefault"] intValue]];   
+            /*
+             * Disable the "Default" checkbox if:
+             * a) the track is "None" OR
+             * b) the subtitle track can't be passed through (e.g. PGS w/MP4)
+             */
+            if (![[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackNum"] intValue] ||
+                !hb_subtitle_can_pass([[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackType"] intValue], container))
+            {
+                [aCell setState:NSOffState];
+                [aCell setEnabled:NO];
+            }
+            else
+            {
+                [aCell setState:[[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleTrackDefault"] intValue]];
+                [aCell setEnabled:YES];
+            }
         }
         /* These next three columns only apply to srt's. they are disabled for source subs */
         else if ([[aTableColumn identifier] isEqualToString:@"srt_lang"])
         {
             /* We have an srt file so set the track type (Source or SRT, and the srt file path ) kvp's*/
-            if ([[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackType"] isEqualToString:@"SRT"])
+            if ([[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackType"] intValue] == SRTSUB)
             {
                 [aCell setEnabled:YES];
                 if([[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleTrackSrtLanguageIndex"])
         else if ([[aTableColumn identifier] isEqualToString:@"srt_charcode"])
         {
             /* We have an srt file so set the track type (Source or SRT, and the srt file path ) kvp's*/
-            if ([[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackType"] isEqualToString:@"SRT"])
+            if ([[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackType"] intValue] == SRTSUB)
             {
                 [aCell setEnabled:YES];
                 if ([[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleTrackSrtCharCodeIndex"])
         }
         else if ([[aTableColumn identifier] isEqualToString:@"srt_offset"])
         {
-            if ([[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackType"] isEqualToString:@"SRT"])
+            if ([[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackType"] intValue] == SRTSUB)
             {
                 [aCell setEnabled:YES];
             }
             }
         }
         
+        /*
+         * Let's check whether any subtitles in the list cannot be passed through.
+         * Set the first of any such subtitles to burned-in, remove the others.
+         */
+        id tempObject;
+        int subtitleTrackType;
+        BOOL convertToBurnInUsed       = NO;
+        NSMutableArray *tracksToDelete = [[NSMutableArray alloc] init];
+        NSEnumerator *enumerator       = [subtitleArray objectEnumerator];
+        /* convert any incompatible tracks to burn-in or remove them */
+        while (tempObject = [enumerator nextObject])
+        {
+            subtitleTrackType = [[tempObject objectForKey:@"subtitleSourceTrackType"] intValue];
+            if (!hb_subtitle_can_pass(subtitleTrackType, container))
+            {
+                if (convertToBurnInUsed == NO)
+                {
+                    /* we haven't set any track to burned-in yet, so we can */
+                    [tempObject setObject:[NSNumber numberWithInt:1] forKey:@"subtitleTrackBurned"];
+                    convertToBurnInUsed = YES; //remove any additional tracks
+                }
+                else
+                {
+                    /* we already have a burned-in track, we must remove others */
+                    [tracksToDelete addObject:tempObject];
+                }
+            }
+        }
+        /* if we converted a track to burned-in, unset it for tracks that support passthru */
+        if (convertToBurnInUsed == YES)
+        {
+            enumerator = [subtitleArray objectEnumerator];
+            while (tempObject = [enumerator nextObject])
+            {
+                subtitleTrackType = [[tempObject objectForKey:@"subtitleSourceTrackType"] intValue];
+                if (hb_subtitle_can_pass(subtitleTrackType, container))
+                {
+                    [tempObject setObject:[NSNumber numberWithInt:0] forKey:@"subtitleTrackBurned"];
+                }
+            }
+        }
+        /* this is where the actual removal takes place */
+        if ([tracksToDelete count] > 0)
+        {
+            [subtitleArray removeObjectsInArray:tracksToDelete];
+            [aTableView reloadData];
+            /* this must be called after reloadData so as to not block the UI */
+            [[NSAlert alertWithMessageText:@"Subtitle tack(s) removed"
+                             defaultButton:@"OK"
+                           alternateButton:nil
+                               otherButton:nil
+                 informativeTextWithFormat:@"%d subtitle %@ could neither be converted to burn-in nor passed through",
+              [tracksToDelete count],
+              [tracksToDelete count] > 1 ? @"tracks" : @"track"] runModal];
+        }
+        [tracksToDelete release];
     }
-     
 }
 
 
index e4232b343d42c055b76e159cbcff716698cd9656..2570d0857ceab4d26e712e5b139c7d2dc9f34907 100644 (file)
@@ -3,6 +3,15 @@ PKG.rpm.machine = `rpm -E "%_target_cpu"`
 PKG.release = 1
 PKG.rpm.dist = `rpm -E "%dist"`
 
+
+###############################################################################
+
+PKG.cli.tar = $(PKG.out/)$(HB.name)-$(HB.version)-$(BUILD.machine)_CLI.tar.gz
+
+STAGE.out.cli/ = $(STAGE.out/)cli/
+
+###############################################################################
+
 PKG.rpm.src.tar.bz2 = $(STAGE.out.src/)rpm/$(PKG.basename).tar.bz2
 STAGE.out.rpm.src/ = $(STAGE.out.src/)rpm/
 
@@ -36,3 +45,4 @@ BUILD.out += $(PKG.cli.deb)
 BUILD.out += $(PKG.gui.deb)
 BUILD.out += $(PKG.cli.rpm)
 BUILD.out += $(PKG.gui.rpm)
+BUILD.out += $(PKG.cli.tar)
index af38b061a4897b7e15f82e1386177dabe8344368..1e04fee1e153f04f71c0c35c3cfd204e99494e02 100644 (file)
@@ -1,6 +1,21 @@
 pkg.create.deb:: $(PKG.gui.deb) $(PKG.cli.deb)
 pkg.create.rpm:: $(PKG.gui.rpm)
 pkg.create.src.deb:: $(PKG.src.deb.stamp)
+pkg.create.tar:: pkg.create $(PKG.cli.tar)
+
+#
+# CLI Tar Package
+#
+
+$(PKG.cli.tar): | $(dir $(PKG.cli.tar))
+$(PKG.cli.tar): | $(STAGE.out.cli/)
+       cd $(STAGE.out.cli/) && $(TAR.exe) cjf $(call fn.ABSOLUTE,$(PKG.cli.tar)) .
+
+
+$(STAGE.out.cli/):
+       -$(MKDIR.exe) -p $@
+       $(CP.exe) HandBrakeCLI $(STAGE.out.cli/)
+       $(call STAGE.doc,$(STAGE.out.cli/))
 
 #
 # RPM binary package rules
index 11dae99f739f09ba3bb0fa66a298b0dd2ec293c0..2bc6081c4d61fb8e3e24ca0a0c6a1a908c36f9dd 100644 (file)
@@ -3,8 +3,9 @@ $(eval $(call import.MODULE.defs,PKG,pkg))
 PKG.in/  = $(SRC/)pkg/
 PKG.out/ = $(BUILD/)pkg/
 
-PKG.basename    = $(HB.name)-$(HB.version)
-PKG.src.tar.bz2 = $(PKG.out/)$(PKG.basename).tar.bz2
+PKG.basename            = $(HB.name)-$(HB.version)
+PKG.src.tar.bz2         = $(PKG.out/)$(PKG.basename).tar.bz2
+PKG.src-contrib.tar.bz2 = $(PKG.out/)$(PKG.basename)-contrib.tar.bz2
 
 STAGE.out/     = $(BUILD/)stage/
 STAGE.out.src/ = $(STAGE.out/)src/
index f841fd93beb0fd565640b15563c6e084081d4a77..da46620f1d3cffaaf9fe3b74836f247be84d7f22 100644 (file)
@@ -6,6 +6,8 @@ $(eval $(call import.MODULE.rules,PKG))
 
 pkg.create:: $(PKG.src.tar.bz2)
 
+pkg.createx:: pkg.create $(PKG.src-contrib.tar.bz2)
+
 pkg.clean:
        $(RM.exe) -fr $(STAGE.out/)
        $(RM.exe) -fr $(PKG.out/)
@@ -20,6 +22,10 @@ $(STAGE.out.src/):
            $@/$(PKG.basename)/make/configure.py > $@/$(PKG.basename)/make/configure.py.tmp
        $(MV.exe) $@/$(PKG.basename)/make/configure.py.tmp $@/$(PKG.basename)/make/configure.py
 
+$(PKG.src-contrib.tar.bz2):
+       $(TAR.exe) cjf $@ -C $(CONTRIB.download/) \
+           $(foreach f,$(MODULES.NAMES),$(notdir $($f.FETCH.tar)))
+
 ###############################################################################
 
 ## include optional platform packaging
index f0c2a1ac55fb9a41355a49853c4a82c7b3a31f32..8b287d08bb99f2f28bd4cfcdb8f7787567fe06e4 100644 (file)
@@ -1,8 +1,11 @@
-/* $Id: parsecsv.c $
+/* parsecsv.c
 
-   This file is part of the HandBrake source code.
+   Copyright (c) 2003-2013 HandBrake Team
+   This file is part of the HandBrake source code
    Homepage: <http://handbrake.fr/>.
-   It may be used under the terms of the GNU General Public License. */
+   It may be used under the terms of the GNU General Public License v2.
+   For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html
+ */
 
 #include <fcntl.h>
 #include "hb.h"
index ef20792e7001d9bf2b098d1607c3bbb195773f24..180da178ab098267ccf31200d32eef6308f12497 100644 (file)
@@ -1,8 +1,11 @@
-/* $Id: parsecsv.h $
+/* parsecsv.c
 
-   This file is part of the HandBrake source code.
+   Copyright (c) 2003-2013 HandBrake Team
+   This file is part of the HandBrake source code
    Homepage: <http://handbrake.fr/>.
-   It may be used under the terms of the GNU General Public License. */
+   It may be used under the terms of the GNU General Public License v2.
+   For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html
+ */
 
 /*
     A very simple CSV file parser.
index a9cc46bd178e204a9d57db8e9c1d1f9db1c02708..a50974c81a99fef5d01748e51f5f7162f06b65eb 100644 (file)
@@ -1,8 +1,11 @@
-/* $Id: test.c,v 1.82 2005/11/19 08:25:54 titer Exp $
+/* test.c
 
-   This file is part of the HandBrake source code.
+   Copyright (c) 2003-2013 HandBrake Team
+   This file is part of the HandBrake source code
    Homepage: <http://handbrake.fr/>.
-   It may be used under the terms of the GNU General Public License. */
+   It may be used under the terms of the GNU General Public License v2.
+   For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html
+ */
 
 #include <signal.h>
 #include <getopt.h>