Changeset 1036

Show
Ignore:
Timestamp:
03/29/09 00:40:09 (17 months ago)
Author:
astrange
Message:

Build system/logging:
- Don't regenerate SubParsing?.m/ffmpeg universal libs if not needed
- Print "Perian" instead of "Perian Codec"

Subtitles:
- Rewrite SubSerializer?; much shorter and correct now (aside from line order).
(fixes many dropped lines in Live-eviL Captain Harlock and gg Sayonara Zetsubou Sensei)
- Fix some bugs where line spans were rendered more than once with the wrong style.
(fixes transparency in Spice and Wolf 01 [ADTRW].mkv)
- Ignore \blur properly
(fixes unstyled lines in [gg]_Goku_Sayonara_Zetsubou_Sensei_-_02_[D284BF24].mkv)
- Fix an overrelease crash

Location:
trunk
Files:
11 modified

Legend:

Unmodified
Added
Removed
  • trunk/Codecprintf.c

    r1035 r1036  
    1313#include "log.h" 
    1414 
    15 #define CODEC_HEADER                    "Perian Codec: " 
     15#define CODEC_HEADER                    "Perian: " 
    1616 
    1717static int Codecvprintf(FILE *fileLog, const char *format, va_list va, int print_header) 
  • trunk/FFusionCodec.c

    r1031 r1036  
    10181018         
    10191019        if (!glob->avContext) { 
    1020                 fprintf(stderr, "Perian Codec: QT tried to call BeginBand without preflighting!\n"); 
     1020                fprintf(stderr, "Perian: QT tried to call BeginBand without preflighting!\n"); 
    10211021                return internalComponentErr; 
    10221022        } 
  • trunk/Perian.xcodeproj/project.pbxproj

    r1031 r1036  
    275275                                "$(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE).dot", 
    276276                        ); 
    277                         script = "RAGEL=${PROJECT_DIR}/Subtitles/ragel\nRLCODEGEN=${PROJECT_DIR}/Subtitles/rlgen-cd\n${RAGEL} ${INPUT_FILE_PATH} | ${RLCODEGEN} -T0 -o ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}\n"; 
     277                        script = "RAGEL=${PROJECT_DIR}/Subtitles/ragel\nRLCODEGEN=${PROJECT_DIR}/Subtitles/rlgen-cd\n[ ${INPUT_FILE_PATH} -nt ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE} ] || exit 0\n${RAGEL} ${INPUT_FILE_PATH} | ${RLCODEGEN} -T0 -o ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}\n"; 
    278278                }; 
    279279/* End PBXBuildRule section */ 
  • trunk/Subtitles/SubATSUIRenderer.m

    r1027 r1036  
    119119        ret->fontVertical = fontVertical; 
    120120         
    121         return [ret autorelease]; 
     121        return ret; 
     122} 
     123 
     124-(NSString*)description 
     125{ 
     126        return [NSString stringWithFormat:@"SpanEx with alpha %f/%f", primaryAlpha, outlineAlpha]; 
    122127} 
    123128@end 
     
    416421-(void*)spanExtraFromRenderDiv:(SubRenderDiv*)div 
    417422{ 
    418         return [[[SubATSUISpanEx alloc] initWithStyle:(ATSUStyle)div->styleLine->ex subStyle:div->styleLine colorSpace:srgbCSpace] autorelease]; 
     423        return [[SubATSUISpanEx alloc] initWithStyle:(ATSUStyle)div->styleLine->ex subStyle:div->styleLine colorSpace:srgbCSpace]; 
    419424} 
    420425 
     
    424429} 
    425430 
    426 -(void)disposeSpanExtra:(void*)ex 
     431-(void)releaseSpanExtra:(void*)ex 
    427432{ 
    428433        SubATSUISpanEx *spanEx = ex; 
    429434        [spanEx release]; 
     435} 
     436 
     437-(NSString*)describeSpanEx:(void*)ex 
     438{ 
     439        SubATSUISpanEx *spanEx = ex; 
     440        return [spanEx description]; 
    430441} 
    431442 
     
    840851        UniCharArrayOffset *breaks; 
    841852        ItemCount breakCount; 
    842         unsigned lStart, lEnd; 
     853        int lStart, lEnd; 
    843854        SInt8 direction; 
    844855} BreakContext; 
     
    870881                        if_different(outlineAlpha) { 
    871882                                if (endLayer) CGContextEndTransparencyLayer(c); 
    872                                  
    873883                                CGContextSetAlpha(c, spanEx->outlineAlpha); 
    874884                                if (spanEx->outlineAlpha != 1.) { 
     
    906916                if (!lineLen) return; 
    907917        } 
    908          
     918 
    909919        if (textType == kTextLayerOutline && div->styleLine->borderStyle == kSubBorderStyleBox) { 
    910920                ATSUTextMeasurement lineWidth, lineHeight, lineX, lineY; 
     
    944954                        extraHeight = div->styleLine->outlineRadius; 
    945955                } else { 
    946                         int j, spans = [div->spans count]; 
     956                        int j, nspans = [div->spans count]; 
    947957                         
    948958                        //linear search for the next span to draw 
    949                         for (j = 0; j < spans; j++) { 
     959                        //XXX not at all sure how this works or if it's correct 
     960                        for (j = 0; j < nspans; j++) { 
    950961                                SubRenderSpan *span = [div->spans objectAtIndex:j]; 
    951962                                SubATSUISpanEx *spanEx = span->ex; 
    952963                                UniCharArrayOffset spanLen, drawStart, drawLen; 
    953964                                 
    954                                 if (j < spans-1) { 
     965                                if (j < nspans-1) { 
    955966                                        SubRenderSpan *nextSpan = [div->spans objectAtIndex:j+1]; 
    956967                                        spanLen = nextSpan->offset - span->offset; 
    957968                                } else spanLen = [div->text length] - span->offset; 
    958                                  
    959                                 if (spanLen == 0) continue; 
    960                                 if ((span->offset + spanLen) < thisBreak) continue; // too early 
    961                                 if (span->offset >= nextBreak) break; // too far ahead 
    962969                                 
    963970                                if (span->offset < thisBreak) { // text spans a newline 
     
    966973                                } else { 
    967974                                        drawStart = span->offset; 
    968                                         drawLen = spanLen; 
     975                                        drawLen = MIN(spanLen, nextBreak - span->offset); 
    969976                                } 
     977                                 
     978                                if (spanLen == 0 || drawLen == 0) continue; 
     979                                if ((span->offset + spanLen) < thisBreak) continue; // too early 
     980                                if (span->offset >= nextBreak) break; // too far ahead 
    970981 
    971982                                endLayer = SetupCGForSpan(c, spanEx, lastSpanEx, div, textType, endLayer); 
     
    980991                penY += breakc.direction * (GetLineHeight(layout, thisBreak) + FloatToFixed(extraHeight)); 
    981992        } 
    982          
     993                 
    983994        if (endLayer) CGContextEndTransparencyLayer(c); 
    984995 
     
    10411052                        lastLayer = div->layer; 
    10421053                } 
    1043                  
     1054                                 
    10441055                NSRect marginRect = NSMakeRect(div->marginL, div->marginV, context->resX - div->marginL - div->marginR, context->resY - div->marginV - div->marginV); 
    10451056                 
     
    11741185        SubtitleRendererPtr s = headerLen ? SubInitForSSA(header, headerLen, 640, 480) 
    11751186                                                                      : SubInitNonSSA(640, 480); 
    1176          
    11771187        /* 
    11781188        CGColorSpaceRef csp = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); 
     
    11811191         
    11821192        if (!headerLen) { 
    1183                 SubRenderPacket(s, c, (CFStringRef)@"to Be continued", 640, 480); 
     1193                SubRenderPacket(s, c, (CFStringRef)@"Abcde .", 640, 480); 
    11841194        } else { 
    11851195                NSArray *styles = [s->context->styles allValues]; 
     
    11881198                for (i = 0; i < nstyles; i++) { 
    11891199                        SubStyle *sty = [styles objectAtIndex:i]; 
    1190                         NSString *line = [NSString stringWithFormat:@"0,0,%@,,0,0,0,,{\fs1}If you are seeing this message, your player doesn't fully support the formatted subtitle track. It is recommended you switch to the unformatted track.", sty->name]; 
     1200                        NSString *line = [NSString stringWithFormat:@"0,0,%@,,0,0,0,,Abcde .", sty->name]; 
    11911201                        SubRenderPacket(s, c, (CFStringRef)line, 640, 480); 
    11921202                } 
  • trunk/Subtitles/SubContext.m

    r1027 r1036  
    303303-(void)releaseSpanExtra:(void*)ex {} 
    304304-(float)aspectRatio {return 4./3.;} 
     305-(NSString*)describeSpanEx:(void*)ex {return @"";} 
    305306@end 
  • trunk/Subtitles/SubImport.h

    r982 r1036  
    4141        NSString *line; 
    4242        unsigned begin_time, end_time; 
     43        unsigned no; // line number, used only by SubSerializer 
    4344} 
    4445-(id)initWithLine:(NSString*)l start:(unsigned)s end:(unsigned)e; 
     
    4748@interface SubSerializer : NSObject 
    4849{ 
    49         NSMutableArray *lines, *outpackets; 
    50         BOOL finished, write_gap; 
    51         unsigned last_time; 
    52         SubLine *toReturn; 
     50        // input lines, sorted by 1. beginning time 2. original insertion order 
     51        NSMutableArray *lines; 
     52        BOOL finished; 
     53         
     54        unsigned last_begin_time, last_end_time; 
     55        unsigned linesInput; 
    5356} 
    5457-(void)addLine:(SubLine *)sline; 
     
    6669 
    6770- (id)initWithTime:(long)time offset:(long)offset; 
    68  
    6971@end 
    7072 
  • trunk/Subtitles/SubImport.mm

    r1034 r1036  
    11881188        if (self = [super init]) { 
    11891189                lines = [[NSMutableArray alloc] init]; 
    1190                 outpackets = [[NSMutableArray alloc] init]; 
    11911190                finished = NO; 
    1192                 write_gap = NO; 
    1193                 toReturn = nil; 
    1194                 last_time = 0; 
     1191                last_begin_time = last_end_time = 0; 
     1192                linesInput = 0; 
    11951193        } 
    11961194         
     
    12001198-(void)dealloc 
    12011199{ 
    1202         [outpackets release]; 
    12031200        [lines release]; 
    12041201        [super dealloc]; 
    12051202} 
    12061203 
    1207 -(void)addLine:(SubLine *)sline 
    1208 { 
    1209         if (sline->begin_time < sline->end_time) 
    1210                 [lines addObject:sline]; 
    1211 } 
    1212  
    1213 static int cmp_line(id a, id b, void* unused) 
    1214 {                        
    1215         SubLine *av = (SubLine*)a, *bv = (SubLine*)b; 
    1216          
    1217         if (av->begin_time > bv->begin_time) return NSOrderedDescending; 
    1218         if (av->begin_time < bv->begin_time) return NSOrderedAscending; 
    1219         return NSOrderedSame; 
     1204static CFComparisonResult CompareLinesByBeginTime(const void *a, const void *b, void *unused) 
     1205{ 
     1206        SubLine *al = (SubLine*)a, *bl = (SubLine*)b; 
     1207         
     1208        if (al->begin_time > bl->begin_time) return kCFCompareGreaterThan; 
     1209        if (al->begin_time < bl->begin_time) return kCFCompareLessThan; 
     1210         
     1211        if (al->no > bl->no) return kCFCompareGreaterThan; 
     1212        if (al->no < bl->no) return kCFCompareLessThan; 
     1213        return kCFCompareEqualTo; 
    12201214} 
    12211215 
     
    12291223} 
    12301224 
    1231 static bool isinrange(unsigned base, unsigned test_s, unsigned test_e) 
    1232 { 
    1233         return (base >= test_s) && (base < test_e); 
    1234 } 
    1235  
    1236 -(void)refill 
    1237 { 
    1238         unsigned num = [lines count]; 
    1239         unsigned min_allowed = finished ? 1 : 2; 
    1240         if (num < min_allowed) return; 
    1241         unsigned times[num*2], last_last_end = 0; 
    1242         SubLine *slines[num], *last=nil; 
    1243         bool last_has_invalid_end = false; 
    1244          
    1245         [lines sortUsingFunction:cmp_line context:nil]; 
    1246         [lines getObjects:slines]; 
    1247 #ifdef SS_DEBUG 
    1248         NSLog(@"pre - %@",lines); 
    1249 #endif   
    1250         //leave early if all subtitle lines overlap 
     1225-(void)addLine:(SubLine *)line 
     1226{ 
     1227        if (line->begin_time >= line->end_time) { 
     1228                if (line->begin_time) 
     1229                        Codecprintf(NULL, "Invalid times (%d and %d) for line \"%s\"", line->begin_time, line->end_time, [line->line UTF8String]); 
     1230                return; 
     1231        } 
     1232         
     1233        line->no = linesInput++; 
     1234         
     1235        int nlines = [lines count]; 
     1236         
     1237        if (!nlines || line->begin_time > ((SubLine*)[lines objectAtIndex:nlines-1])->begin_time) { 
     1238                [lines addObject:line]; 
     1239        } else { 
     1240                CFIndex i = CFArrayBSearchValues((CFArrayRef)lines, CFRangeMake(0, nlines), line, CompareLinesByBeginTime, NULL); 
     1241                 
     1242                if (i >= nlines) 
     1243                        [lines addObject:line]; 
     1244                else 
     1245                        [lines insertObject:line atIndex:i]; 
     1246        } 
     1247         
     1248} 
     1249 
     1250-(SubLine*)getNextRealSerializedPacket 
     1251{ 
     1252        int nlines = [lines count]; 
     1253        SubLine *first = [lines objectAtIndex:0]; 
     1254        int i; 
     1255 
    12511256        if (!finished) { 
    1252                 bool all_overlap = true; 
    1253                 int i; 
    1254                  
    1255                 for (i=0;i < num-1;i++) { 
    1256                         SubLine *c = slines[i], *n = slines[i+1]; 
    1257                         if (c->end_time <= n->begin_time) {all_overlap = false; break;} 
    1258                 } 
    1259                  
    1260                 if (all_overlap) return; 
    1261                  
    1262                 for (i=0;i < num-1;i++) { 
    1263                         if (isinrange(slines[num-1]->begin_time, slines[i]->begin_time, slines[i]->end_time)) { 
    1264                                 num = i + 1; break; 
     1257                if (nlines > 1) { 
     1258                        unsigned maxEndTime = first->end_time; 
     1259                         
     1260                        for (i = 1; i < nlines; i++) { 
     1261                                SubLine *l = [lines objectAtIndex:i]; 
     1262                                 
     1263                                if (l->begin_time >= maxEndTime) { 
     1264                                        goto canOutput; 
     1265                                } 
     1266                                 
     1267                                maxEndTime = MAX(maxEndTime, l->end_time); 
    12651268                        } 
    12661269                } 
    1267         } 
    1268          
    1269         for (int i=0;i < num;i++) { 
    1270                 times[i*2]   = slines[i]->begin_time; 
    1271                 times[i*2+1] = slines[i]->end_time; 
    1272         } 
    1273          
    1274         qsort(times, num*2, sizeof(unsigned), cmp_uint); 
    1275          
    1276         for (int i=0;i < num*2; i++) { 
    1277                 if (i > 0 && times[i-1] == times[i]) continue; 
    1278                 NSMutableString *accum = nil; 
    1279                 unsigned start = times[i], last_end = start, next_start=times[num*2-1], end = start; 
    1280                 bool finishedOutput = false, is_last_line = false; 
    1281                  
    1282                 // Add on packets until we find one that marks it ending (by starting later) 
    1283                 // ...except if we know this is the last input packet from the stream, then we have to explicitly flush it 
    1284                 if (finished && (times[i] == slines[num-1]->begin_time || times[i] == slines[num-1]->end_time)) finishedOutput = is_last_line = true; 
    1285                  
    1286                 for (int j=0; j < num; j++) { 
    1287                         if (isinrange(times[i], slines[j]->begin_time, slines[j]->end_time)) { 
    1288                                  
    1289                                 // find the next line that starts after this one 
    1290                                 if (j != num-1) { 
    1291                                         unsigned ns = slines[j]->end_time; 
    1292                                         for (int h = j; h < num; h++) if (slines[h]->begin_time != slines[j]->begin_time) {ns = slines[h]->begin_time; break;} 
    1293                                                 next_start = MIN(next_start, ns); 
    1294                                 } else next_start = slines[j]->end_time; 
    1295                                  
    1296                                 last_end = MAX(slines[j]->end_time, last_end); 
    1297                                 if (accum) [accum appendString:slines[j]->line]; else accum = [[slines[j]->line mutableCopy] autorelease]; 
    1298                         } else if (j == num-1) finishedOutput = true; 
     1270                 
     1271                return nil; 
     1272        } 
     1273         
     1274canOutput: 
     1275        NSMutableString *str = [NSMutableString stringWithString:first->line]; 
     1276        unsigned begin_time = last_end_time, end_time = first->end_time; 
     1277        int deleted = 0; 
     1278                 
     1279        for (i = 1; i < nlines; i++) { 
     1280                SubLine *l = [lines objectAtIndex:i]; 
     1281                if (l->begin_time >= end_time) break; 
     1282                 
     1283                //shorten packet end time if another shorter time (begin or end) is found 
     1284                //as long as it isn't the begin time 
     1285                end_time = MIN(end_time, l->end_time); 
     1286                if (l->begin_time > begin_time) 
     1287                        end_time = MIN(end_time, l->begin_time); 
     1288                 
     1289                if (l->begin_time <= begin_time) 
     1290                        [str appendString:l->line]; 
     1291        } 
     1292         
     1293        for (i = 0; i < nlines; i++) { 
     1294                SubLine *l = [lines objectAtIndex:i - deleted]; 
     1295                 
     1296                if (l->end_time == end_time) { 
     1297                        [lines removeObjectAtIndex:i - deleted]; 
     1298                        deleted++; 
    12991299                } 
    1300                  
    1301                 if (accum && finishedOutput) { 
    1302                         [accum deleteCharactersInRange:NSMakeRange([accum length] - 1, 1)]; // delete last newline 
    1303 #ifdef SS_DEBUG 
    1304                         NSLog(@"%d - %d %d",start,last_end,next_start);  
    1305 #endif 
    1306                         if (last_has_invalid_end) { 
    1307                                 if (last_end < next_start) {  
    1308                                         int j, set; 
    1309                                         for (j=i; j >= 0; j--) if (times[j] == last->begin_time) break; 
    1310                                         set = times[j+1]; 
    1311                                         last->end_time = set; 
    1312                                 } else last->end_time = MIN(last_last_end,start);  
    1313                         } 
    1314                         end = last_end; 
    1315                         last_has_invalid_end = false; 
    1316                         if (last_end > next_start && !is_last_line) last_has_invalid_end = true; 
    1317                         SubLine *event = [[SubLine alloc] initWithLine:accum start:start end:end]; 
    1318                          
    1319                         [outpackets addObject:event]; 
    1320                          
    1321                         last_last_end = last_end; 
    1322                         last = event; 
    1323                 } 
    1324         } 
    1325          
    1326         if (last_has_invalid_end) { 
    1327                 last->end_time = times[num*2 - 3]; // end time of line before last 
    1328         } 
    1329 #ifdef SS_DEBUG 
    1330         NSLog(@"out - %@",outpackets); 
    1331 #endif 
    1332          
    1333         if (finished) [lines removeAllObjects]; 
    1334         else { 
    1335                 num = [lines count]; 
    1336                 for (int i = 0; i < num-1; i++) { 
    1337                         if (isinrange(slines[num-1]->begin_time, slines[i]->begin_time, slines[i]->end_time)) break; 
    1338                         [lines removeObject:slines[i]]; 
    1339                 } 
    1340         } 
    1341 #ifdef SS_DEBUG 
    1342         NSLog(@"post - %@",lines); 
    1343 #endif 
    1344 } 
    1345  
    1346 -(SubLine*)_getSerializedPacket 
    1347 { 
    1348         if ([outpackets count] == 0)  { 
    1349                 [self refill]; 
    1350                 if ([outpackets count] == 0)  
    1351                         return nil; 
    1352         } 
    1353          
    1354         SubLine *sl = [outpackets objectAtIndex:0]; 
    1355         [outpackets removeObjectAtIndex:0]; 
    1356          
    1357         [sl autorelease]; 
    1358         return sl; 
     1300        } 
     1301         
     1302        return [[SubLine alloc] initWithLine:str start:begin_time end:end_time]; 
    13591303} 
    13601304 
    13611305-(SubLine*)getSerializedPacket 
    13621306{ 
    1363         if (!last_time) { 
    1364                 SubLine *ret = [self _getSerializedPacket]; 
    1365                 if (ret) { 
    1366                         last_time = ret->end_time; 
    1367                         write_gap = YES; 
    1368                 } 
    1369                 return ret; 
    1370         } 
    1371          
    1372 restart: 
    1373          
    1374         if (write_gap) { 
    1375                 SubLine *next = [self _getSerializedPacket]; 
    1376                 SubLine *sl; 
    1377  
    1378                 if (!next) return nil; 
    1379  
    1380                 toReturn = [next retain]; 
    1381                  
    1382                 write_gap = NO; 
    1383                  
    1384                 if (toReturn->begin_time > last_time) sl = [[SubLine alloc] initWithLine:@"\n" start:last_time end:toReturn->begin_time]; 
    1385                 else goto restart; 
    1386                  
    1387                 return [sl autorelease]; 
     1307        int nlines = [lines count]; 
     1308 
     1309        if (!nlines) return nil; 
     1310         
     1311        SubLine *nextline = [lines objectAtIndex:0], *ret; 
     1312         
     1313        if (nextline->begin_time > last_end_time) { 
     1314                ret = [[SubLine alloc] initWithLine:@"\n" start:last_end_time end:nextline->begin_time]; 
    13881315        } else { 
    1389                 SubLine *ret = toReturn; 
    1390                 last_time = ret->end_time; 
    1391                 write_gap = YES; 
    1392                  
    1393                 toReturn = nil; 
    1394                 return [ret autorelease]; 
    1395         } 
    1396 } 
    1397  
    1398 -(void)setFinished:(BOOL)f 
    1399 { 
    1400         finished = f; 
     1316                ret = [self getNextRealSerializedPacket]; 
     1317        } 
     1318         
     1319        if (!ret) return nil; 
     1320         
     1321        last_begin_time = ret->begin_time; 
     1322        last_end_time   = ret->end_time; 
     1323                 
     1324        return [ret autorelease]; 
     1325} 
     1326 
     1327-(void)setFinished:(BOOL)_finished 
     1328{ 
     1329        finished = _finished; 
    14011330} 
    14021331 
    14031332-(BOOL)isEmpty 
    14041333{ 
    1405         return [lines count] == 0 && [outpackets count] == 0 && !toReturn; 
     1334        return [lines count] == 0; 
    14061335} 
    14071336 
    14081337-(NSString*)description 
    14091338{ 
    1410         return [NSString stringWithFormat:@"i: %d o: %d finished inputting: %d",[lines count],[outpackets count],finished]; 
     1339        return [NSString stringWithFormat:@"lines left: %d finished inputting: %d",[lines count],finished]; 
    14111340} 
    14121341@end 
     
    14201349                begin_time = s; 
    14211350                end_time = e; 
     1351                no = 0; 
    14221352        } 
    14231353         
     
    14331363-(NSString*)description 
    14341364{ 
    1435         return [NSString stringWithFormat:@"\"%@\", from %d s to %d s",line,begin_time,end_time]; 
     1365        return [NSString stringWithFormat:@"\"%@\", from %d s to %d s",[line substringToIndex:[line length]-1],begin_time,end_time]; 
    14361366} 
    14371367@end 
  • trunk/Subtitles/SubParsing.h

    r1027 r1036  
    3737        @public; 
    3838        UniCharArrayOffset offset; 
    39         __strong void *ex; 
     39        id ex; 
    4040        SubRenderer *delegate; 
    4141} 
  • trunk/Subtitles/SubParsing.m.rl

    r1031 r1036  
    4141} 
    4242 
    43 -(void)finalize {[delegate releaseSpanExtra:ex]; [super finalize];} 
     43-(void)finalize 
     44{ 
     45        [delegate releaseSpanExtra:ex]; 
     46        [super finalize]; 
     47} 
     48 
     49-(NSString*)description 
     50{ 
     51        return [NSString stringWithFormat:@"Span at %d: %@", offset, [delegate describeSpanEx:ex]]; 
     52} 
    4453@end 
    4554 
     
    191200%%machine SSAtag; 
    192201%%write data; 
    193  
    194 static NSMutableString *FilterSlashEscapes(NSMutableString *s) 
    195 { 
    196         [s replaceOccurrencesOfString:@"\\n" withString:@"\n" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [s length])]; 
    197         unichar nbsp = 0xA0; 
    198          
    199         [s replaceOccurrencesOfString:@"\\h" withString:[NSString stringWithCharacters:&nbsp length:1] options:0 range: NSMakeRange(0,[s length])]; 
    200         return s; 
    201 } 
    202202 
    203203static int compare_layer(const void *a, const void *b) 
     
    306306                                action setfloatnum {floatnum = [psend() floatValue];} 
    307307                                action setstringval {strval = psend();} 
     308                                action nullstring {strval = @"";} 
    308309                                action setxypos {curX=curY=-1; sscanf([psend() UTF8String], "(%d,%d)", &curX, &curY);} 
    309310                                 
     
    346347                                flag = [01] >paramset %setintnum; 
    347348                                floatnum = ("-"? [0-9]+ ("." [0-9]*)?) >paramset %setfloatnum; 
    348                                 string = ([^\\}]*) >paramset %setstringval; 
     349                                string = (([^\\}]+) >paramset %setstringval | "" %nullstring ); 
    349350                                color = ("H"|"&"){,2} (xdigit+) >paramset %sethexnum "&"?; 
    350351                                parens = "(" [^)]* ")"; 
     
    359360                                                        |"shad" floatnum %shadowdist 
    360361                                                        |"be" flag %bluredge 
     362                                                        |"blur" floatnum 
    361363                                                        |"fn" string %fontname 
    362364                                                        |"fs" floatnum %fontsize 
  • trunk/Subtitles/SubRenderer.h

    r1027 r1036  
    1212@class SubStyle, SubContext, SubRenderDiv, SubRenderSpan; 
    1313 
    14 typedef enum {tag_b=0, tag_i, tag_u, tag_s, tag_bord, tag_shad, tag_be, tag_fn, tag_fs, tag_fscx, tag_fscy, tag_fsp, tag_frx, tag_fry, tag_frz, tag_1c, tag_2c, tag_3c, tag_4c,  
    15           tag_alpha, tag_1a, tag_2a, tag_3a, tag_4a, tag_r, tag_p} SSATagType; 
     14typedef enum { 
     15        tag_b=0, tag_i, tag_u, tag_s, tag_bord, tag_shad, tag_be, 
     16        tag_fn, tag_fs, tag_fscx, tag_fscy, tag_fsp, tag_frx, 
     17        tag_fry, tag_frz, tag_1c, tag_2c, tag_3c, tag_4c, tag_alpha, 
     18        tag_1a, tag_2a, tag_3a, tag_4a, tag_r, tag_p 
     19} SSATagType; 
    1620 
    1721#ifndef __OBJC_GC__ 
     
    2125#endif 
    2226 
     27// XXX these should be 'id' instead of 'void*' but it makes it easier to use ATSUStyle 
    2328@interface SubRenderer : NSObject 
    2429-(void)completedHeaderParsing:(SubContext*)sc; 
     
    3035-(void)spanChangedTag:(SSATagType)tag span:(SubRenderSpan*)span div:(SubRenderDiv*)div param:(void*)p; 
    3136-(float)aspectRatio; 
     37-(NSString*)describeSpanEx:(void*)ex; 
    3238@end 
  • trunk/createStaticLibs.sh

    r1035 r1036  
    155155        make -j3 
    156156    fi 
     157 
     158        ####################### 
     159        # lipo/copy shlibs 
     160        ####################### 
     161        BUILDDIR="$BUILT_PRODUCTS_DIR/Universal" 
     162        INTEL="$BUILT_PRODUCTS_DIR/intel" 
     163        PPC="$BUILT_PRODUCTS_DIR/ppc" 
     164         
     165        rm -rf "$BUILDDIR" 
     166        mkdir "$BUILDDIR" 
     167        echo $buildi386 $buildppc 
     168        if [ $buildi386 -eq $buildppc ] ; then 
     169                # lipo them 
     170                for aa in "$INTEL"/*/*.a ; do 
     171                        echo lipo -create $aa `echo -n $aa | sed 's/intel/ppc/'` -output `echo -n $aa | sed 's/intel\/.*\//Universal\//'` 
     172                        lipo -create $aa `echo -n $aa | sed 's/intel/ppc/'` -output `echo -n $aa | sed 's/intel\/.*\//Universal\//'` 
     173                done 
     174        else 
     175                if [ $buildppc -gt 0 ] ; then 
     176                        archDir="ppc" 
     177                        BUILDARCHDIR=$PPC 
     178                else 
     179                        archDir="intel" 
     180                        BUILDARCHDIR=$INTEL 
     181                fi 
     182                # just copy them 
     183                for aa in "$BUILDARCHDIR"/*/*.a ; do 
     184                        echo cp "$aa" `echo -n $aa | sed 's/'$archDir'\/.*\//Universal\//'` 
     185                        cp "$aa" `echo -n $aa | sed 's/'$archDir'\/.*\//Universal\//'` 
     186                done 
     187        fi 
     188        echo -n "$buildid_ffmpeg" > $OUTPUT_FILE 
     189         
     190        mkdir "$SYMROOT/Universal" || true 
     191        cp "$BUILT_PRODUCTS_DIR/Universal"/* "$SYMROOT/Universal" 
     192        ranlib "$SYMROOT/Universal"/*.a 
     193 
    157194fi 
    158  
    159 ####################### 
    160 # lipo/copy shlibs 
    161 ####################### 
    162 BUILDDIR="$BUILT_PRODUCTS_DIR/Universal" 
    163 INTEL="$BUILT_PRODUCTS_DIR/intel" 
    164 PPC="$BUILT_PRODUCTS_DIR/ppc" 
    165  
    166 rm -rf "$BUILDDIR" 
    167 mkdir "$BUILDDIR" 
    168 echo $buildi386 $buildppc 
    169 if [ $buildi386 -eq $buildppc ] ; then 
    170     # lipo them 
    171     for aa in "$INTEL"/*/*.a ; do 
    172         echo lipo -create $aa `echo -n $aa | sed 's/intel/ppc/'` -output `echo -n $aa | sed 's/intel\/.*\//Universal\//'` 
    173         lipo -create $aa `echo -n $aa | sed 's/intel/ppc/'` -output `echo -n $aa | sed 's/intel\/.*\//Universal\//'` 
    174     done 
    175 else 
    176     if [ $buildppc -gt 0 ] ; then 
    177         archDir="ppc" 
    178         BUILDARCHDIR=$PPC 
    179     else 
    180         archDir="intel" 
    181         BUILDARCHDIR=$INTEL 
    182     fi 
    183     # just copy them 
    184     for aa in "$BUILDARCHDIR"/*/*.a ; do 
    185         echo cp "$aa" `echo -n $aa | sed 's/'$archDir'\/.*\//Universal\//'` 
    186         cp "$aa" `echo -n $aa | sed 's/'$archDir'\/.*\//Universal\//'` 
    187     done 
    188 fi 
    189 echo -n "$buildid_ffmpeg" > $OUTPUT_FILE 
    190  
    191 mkdir "$SYMROOT/Universal" || true 
    192 cp "$BUILT_PRODUCTS_DIR/Universal"/* "$SYMROOT/Universal" 
    193 ranlib "$SYMROOT/Universal"/*.a