source: trunk/Subtitles/SubImport.h @ 1036

Revision 1036, 2.6 KB checked in by astrange, 6 years ago (diff)

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
Line 
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
24extern "C"
25{
26#endif
27
28short GetFilenameLanguage(CFStringRef filename);
29ComponentResult LoadExternalSubtitles(const FSRef *theFile, Movie theMovie);
30ComponentResult LoadExternalSubtitlesFromFileDataRef(Handle dataRef, OSType dataRefType, Movie theMovie);
31Track 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        unsigned no; // line number, used only by SubSerializer
44}
45-(id)initWithLine:(NSString*)l start:(unsigned)s end:(unsigned)e;
46@end
47
48@interface SubSerializer : NSObject
49{
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;
56}
57-(void)addLine:(SubLine *)sline;
58-(void)setFinished:(BOOL)finished;
59-(SubLine*)getSerializedPacket;
60-(BOOL)isEmpty;
61@end
62
63@interface VobSubSample : NSObject
64{
65        @public
66        long            timeStamp;
67        long            fileOffset;
68}
69
70- (id)initWithTime:(long)time offset:(long)offset;
71@end
72
73
74@interface VobSubTrack : NSObject
75{
76        @public
77        NSData                  *privateData;
78        NSString                *language;
79        int                             index;
80        NSMutableArray  *samples;
81}
82
83- (id)initWithPrivateData:(NSData *)idxPrivateData language:(NSString *)lang andIndex:(int)trackIndex;
84- (void)addSample:(VobSubSample *)sample;
85- (void)addSampleTime:(long)time offset:(long)offset;
86
87@end
88
89
90extern void SubLoadSSAFromPath(NSString *path, SubContext **meta, SubSerializer **lines, SubRenderer *renderer);
91extern void SubLoadSRTFromPath(NSString *path, SubContext **meta, SubSerializer **lines, SubRenderer *renderer);
92
93#endif
94
95#ifdef __cplusplus
96}
97
98class CXXSubSerializer
99{
100        __strong void *priv;
101       
102public:
103        CXXSubSerializer();
104        ~CXXSubSerializer();
105       
106        void pushLine(const char *line, size_t size, unsigned start, unsigned end);
107        void setFinished();
108        const char *popPacket(size_t *size, unsigned *start, unsigned *end);
109        void release();
110        void retain();
111        bool empty();
112};
113
114class CXXAutoreleasePool
115{
116        __strong void *pool;
117public:
118        CXXAutoreleasePool();
119        ~CXXAutoreleasePool();
120};
121#endif
122
123#endif
Note: See TracBrowser for help on using the repository browser.