| 1 |
// |
|---|
| 2 |
// SubImport.h |
|---|
| 3 |
// SSARender2 |
|---|
| 4 |
// |
|---|
| 5 |
// Created by Alexander Strange on 7/24/07. |
|---|
| 6 |
// Copyright 2007 __MyCompanyName__. All rights reserved. |
|---|
| 7 |
// |
|---|
| 8 |
|
|---|
| 9 |
#ifndef __SUBIMPORT_H__ |
|---|
| 10 |
#define __SUBIMPORT_H__ |
|---|
| 11 |
|
|---|
| 12 |
#include <QuickTime/QuickTime.h> |
|---|
| 13 |
#ifndef __OBJC__ |
|---|
| 14 |
#include "SubATSUIRenderer.h" |
|---|
| 15 |
#endif |
|---|
| 16 |
|
|---|
| 17 |
#ifndef __OBJC_GC__ |
|---|
| 18 |
#ifndef __strong |
|---|
| 19 |
#define __strong |
|---|
| 20 |
#endif |
|---|
| 21 |
#endif |
|---|
| 22 |
|
|---|
| 23 |
#ifdef __cplusplus |
|---|
| 24 |
extern "C" |
|---|
| 25 |
{ |
|---|
| 26 |
#endif |
|---|
| 27 |
|
|---|
| 28 |
short GetFilenameLanguage(CFStringRef filename); |
|---|
| 29 |
ComponentResult LoadExternalSubtitles(const FSRef *theFile, Movie theMovie); |
|---|
| 30 |
ComponentResult LoadExternalSubtitlesFromFileDataRef(Handle dataRef, OSType dataRefType, Movie theMovie); |
|---|
| 31 |
Track CreatePlaintextSubTrack(Movie theMovie, ImageDescriptionHandle imgDesc, TimeScale timescale, Handle dataRef, OSType dataRefType, FourCharCode subType, Handle imageExtension, Rect movieBox); |
|---|
| 32 |
|
|---|
| 33 |
#ifdef __OBJC__ |
|---|
| 34 |
#import <Cocoa/Cocoa.h> |
|---|
| 35 |
#import "SubContext.h" |
|---|
| 36 |
#import "SubATSUIRenderer.h" |
|---|
| 37 |
|
|---|
| 38 |
@interface SubLine : NSObject |
|---|
| 39 |
{ |
|---|
| 40 |
@public |
|---|
| 41 |
NSString *line; |
|---|
| 42 |
unsigned begin_time, end_time; |
|---|
| 43 |
} |
|---|
| 44 |
-(id)initWithLine:(NSString*)l start:(unsigned)s end:(unsigned)e; |
|---|
| 45 |
@end |
|---|
| 46 |
|
|---|
| 47 |
@interface SubSerializer : NSObject |
|---|
| 48 |
{ |
|---|
| 49 |
NSMutableArray *lines, *outpackets; |
|---|
| 50 |
BOOL finished, write_gap; |
|---|
| 51 |
unsigned last_time; |
|---|
| 52 |
SubLine *toReturn; |
|---|
| 53 |
} |
|---|
| 54 |
-(void)addLine:(SubLine *)sline; |
|---|
| 55 |
-(void)setFinished:(BOOL)finished; |
|---|
| 56 |
-(SubLine*)getSerializedPacket; |
|---|
| 57 |
-(BOOL)isEmpty; |
|---|
| 58 |
@end |
|---|
| 59 |
|
|---|
| 60 |
extern void SubLoadSSAFromPath(NSString *path, SubContext **meta, SubSerializer **lines, SubRenderer *renderer); |
|---|
| 61 |
extern void SubLoadSRTFromPath(NSString *path, SubContext **meta, SubSerializer **lines, SubRenderer *renderer); |
|---|
| 62 |
|
|---|
| 63 |
#endif |
|---|
| 64 |
|
|---|
| 65 |
#ifdef __cplusplus |
|---|
| 66 |
} |
|---|
| 67 |
|
|---|
| 68 |
class CXXSubSerializer |
|---|
| 69 |
{ |
|---|
| 70 |
__strong void *priv; |
|---|
| 71 |
|
|---|
| 72 |
public: |
|---|
| 73 |
CXXSubSerializer(); |
|---|
| 74 |
~CXXSubSerializer(); |
|---|
| 75 |
|
|---|
| 76 |
void pushLine(const char *line, size_t size, unsigned start, unsigned end); |
|---|
| 77 |
void setFinished(); |
|---|
| 78 |
const char *popPacket(size_t *size, unsigned *start, unsigned *end); |
|---|
| 79 |
void release(); |
|---|
| 80 |
void retain(); |
|---|
| 81 |
bool empty(); |
|---|
| 82 |
}; |
|---|
| 83 |
|
|---|
| 84 |
class CXXAutoreleasePool |
|---|
| 85 |
{ |
|---|
| 86 |
__strong void *pool; |
|---|
| 87 |
public: |
|---|
| 88 |
CXXAutoreleasePool(); |
|---|
| 89 |
~CXXAutoreleasePool(); |
|---|
| 90 |
}; |
|---|
| 91 |
#endif |
|---|
| 92 |
|
|---|
| 93 |
#endif |
|---|