Changeset 658

Show
Ignore:
Timestamp:
02/26/07 15:36:48 (3 years ago)
Author:
vasi
Message:

grr frustration

Location:
QTSplit
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • QTSplit/AGRegex/pcre-build.sh

    r653 r658  
    2828/usr/bin/install_name_tool -id "@executable_path/../Libraries/libpcre.dylib" \ 
    2929    "${built}" 
     30mkdir -p "`dirname ${lib}`" 
    3031ln -f "${built}" "${lib}" 
  • QTSplit/AppDelegate.m

    r657 r658  
    7272        NSLog(@"Saving chapter %d in '%@'", i + 1, dst); 
    7373         
    74         QTExporter *exporter = [QTExporterM4A exporterWithMovie: ext]; 
    75         [exporter exportToFile: dst]; 
     74//        QTExporter *exporter = [QTExporterM4A exporterWithMovie: ext]; 
     75//        [exporter exportToFile: dst]; 
    7676    } 
    7777} 
  • QTSplit/QTChapter.m

    r654 r658  
    7171- (QTMovie*) extractWithRange: (QTTimeRange)range { 
    7272        QTMovie *mov = [[self movie] extract: range]; 
    73          
     73 
     74        [mov setEditable: YES]; 
     75     
    7476        // Don't keep artwork, text, etc from margins    
    7577        NSEnumerator *en = [[self chapterSpecificTracks] objectEnumerator]; 
     
    8789        // Get rid of chapter track 
    8890        [[mov chapterTrack] removeFromMovie]; 
    89          
     91        [mov setEditable: NO]; 
     92     
    9093    // Add meta-data to indicate title 
    9194    [mov setMetaData: [self name] forTag: QTMetaDataName]; 
  • QTSplit/QTExporter.m

    r657 r658  
    6868} 
    6969 
     70+ (NSString*) mktemp: (NSString*)file ext: (NSString*)ext { 
     71    NSString *tempfile = nil; 
     72    char *ctmpl = NULL; 
     73     
     74    NSString *template = [[NSTemporaryDirectory() 
     75        stringByAppendingPathComponent: file] 
     76        stringByAppendingPathExtension: ext]; 
     77    unsigned len = [template maximumLengthOfBytesUsingEncoding: 
     78        NSUTF8StringEncoding]; 
     79    ctmpl = malloc(len + 1); 
     80    BOOL ok = [template getCString: ctmpl maxLength: len 
     81        encoding: NSUTF8StringEncoding]; 
     82    if (!ok) goto done; 
     83     
     84    char *ctmpfile = mktemp(ctmpl); 
     85    tempfile = [NSString stringWithUTF8String: ctmpfile]; 
     86     
     87done: 
     88    if (ctmpl) free(ctmpl); 
     89    return tempfile; 
     90} 
     91 
    7092- (void) exportToFile: (NSString*)path { 
     93    NSFileManager *fm = [NSFileManager defaultManager]; 
     94    BOOL isDir; 
     95    BOOL exists = [fm fileExistsAtPath: path isDirectory: &isDir]; 
     96    if (exists && isDir) [NSException raise: QTExporterExportException 
     97        format: @"Directory is in the way of movie export"]; 
     98     
    7199    /* QuickTime can sometimes be sensitive to file names, so export to a 
    72100     * safe path and then move to the desired location */ 
    73     char template[] = "QTExporterXXXXXXXXX"; 
    74     char *tmpfile = mktemp(template); 
    75     NSString *safe = tmpfile ? [NSString stringWithUTF8String: tmpfile] : path; 
    76      
    77         NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys: 
    78                 [NSNumber numberWithBool: YES],         QTMovieExport, 
    79                 [NSNumber numberWithLong: stype],       QTMovieExportType, 
    80                 [NSNumber numberWithLong: manu],        QTMovieExportManufacturer, 
    81                 [settings asData],                                      QTMovieExportSettings, 
    82                 nil]; 
    83         BOOL success = [movie writeToFile: safe withAttributes: attrs]; 
    84         if (!success) [NSException raise: QTExporterExportException 
    85                                                           format: @"Movie export failed"]; 
     101    NSString *safe = [[self class] mktemp: @".QTExporterXXXXXXXXXXX" 
     102        ext: [path pathExtension]]; 
     103    if (!safe) safe = path; 
     104     
     105    NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys: 
     106        [NSNumber numberWithBool: YES],         QTMovieExport, 
     107        [NSNumber numberWithLong: stype],       QTMovieExportType, 
     108        [NSNumber numberWithLong: manu],        QTMovieExportManufacturer, 
     109        [settings asData],                                      QTMovieExportSettings, 
     110        nil]; 
     111    BOOL success = [movie writeToFile: safe withAttributes: attrs]; 
     112    if (!success) [NSException raise: QTExporterExportException 
     113                              format: @"Movie export failed"]; 
    86114     
    87115    if (![safe isEqual: path]) { 
    88         NSFileManager *fm = [NSFileManager defaultManager]; 
     116        if ([fm fileExistsAtPath: path]) 
     117            [fm removeFileAtPath: path handler: nil]; 
    89118        if (![fm movePath: safe toPath: path handler: nil]) { 
     119            [fm removeFileAtPath: safe handler: nil]; 
    90120            [NSException raise: QTExporterExportException 
    91121                format: @"Can't move exported movie into place"]; 
  • QTSplit/QTKit+Extensions.h

    r652 r658  
    4646 
    4747// Editing movies 
     48@interface QTMovie (EditingHidden) // Methods exist but silly Apple hides them 
     49- (void) setEditable: (BOOL)ed; 
     50@end 
     51 
    4852@interface QTMovie (Editing) 
    4953- (QTMovie*) extract: (QTTimeRange)range; 
  • QTSplit/QTKit+Extensions.m

    r652 r658  
    141141@end 
    142142 
    143  
     143#import <objc/objc-class.h> 
    144144 
    145145@implementation QTMovie (Editing) 
     
    147147        range = QTWorkingIntersection(range, [self timeRange]); 
    148148        QTMovie *dst = [QTMovie movie]; 
    149         [dst setAttribute: [NSNumber numberWithBool: TRUE] 
    150                            forKey: QTMovieEditableAttribute]; 
     149printf("%s\n", dst->isa->name); 
     150     
     151    [dst setEditable: YES]; 
    151152        [dst insertSegmentOfMovie: self timeRange: range 
    152153                                           atTime: [dst startTime]]; 
     154        [dst setEditable: NO]; 
    153155        return dst; 
    154156}