source: trunk/Subtitles/SubImport.h @ 1044

Revision 1044, 3.1 KB checked in by astrange, 5 years ago (diff)
  • Add new tool targets ssa2html and detect-encoding.
  • Lift some Xcode settings out of the Perian target into the project.
  • Fix compilation error in FFission.
  • Remove unused variable in SubContext?. (small memory savings)
Line 
1/*
2 * SubParsing.h
3 * Created by Alexander Strange on 7/24/07.
4 *
5 * This file is part of Perian.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef __SUBIMPORT_H__
23#define __SUBIMPORT_H__
24
25#include <QuickTime/QuickTime.h>
26#ifndef __OBJC__
27#include "SubATSUIRenderer.h"
28#endif
29
30#ifndef __OBJC_GC__
31#ifndef __strong
32#define __strong
33#endif
34#endif
35
36#ifdef __cplusplus
37extern "C"
38{
39#endif
40
41short GetFilenameLanguage(CFStringRef filename);
42ComponentResult LoadExternalSubtitles(const FSRef *theFile, Movie theMovie);
43ComponentResult LoadExternalSubtitlesFromFileDataRef(Handle dataRef, OSType dataRefType, Movie theMovie);
44Track CreatePlaintextSubTrack(Movie theMovie, ImageDescriptionHandle imgDesc, TimeScale timescale, Handle dataRef, OSType dataRefType, FourCharCode subType, Handle imageExtension, Rect movieBox);
45
46#ifdef __OBJC__
47#import <Cocoa/Cocoa.h>
48#import "SubContext.h"
49#import "SubATSUIRenderer.h"
50
51@interface SubLine : NSObject
52{
53        @public
54        NSString *line;
55        unsigned begin_time, end_time;
56        unsigned no; // line number, used only by SubSerializer
57}
58-(id)initWithLine:(NSString*)l start:(unsigned)s end:(unsigned)e;
59@end
60
61@interface SubSerializer : NSObject
62{
63        // input lines, sorted by 1. beginning time 2. original insertion order
64        NSMutableArray *lines;
65        BOOL finished;
66       
67        unsigned last_begin_time, last_end_time;
68        unsigned linesInput;
69}
70-(void)addLine:(SubLine *)sline;
71-(void)setFinished:(BOOL)finished;
72-(SubLine*)getSerializedPacket;
73-(BOOL)isEmpty;
74@end
75
76@interface VobSubSample : NSObject
77{
78        @public
79        long            timeStamp;
80        long            fileOffset;
81}
82
83- (id)initWithTime:(long)time offset:(long)offset;
84@end
85
86
87@interface VobSubTrack : NSObject
88{
89        @public
90        NSData                  *privateData;
91        NSString                *language;
92        int                             index;
93        NSMutableArray  *samples;
94}
95
96- (id)initWithPrivateData:(NSData *)idxPrivateData language:(NSString *)lang andIndex:(int)trackIndex;
97- (void)addSample:(VobSubSample *)sample;
98- (void)addSampleTime:(long)time offset:(long)offset;
99
100@end
101
102extern NSString *LoadSSAFromPath(NSString *path, SubSerializer *ss);
103       
104#endif
105
106#ifdef __cplusplus
107}
108
109class CXXSubSerializer
110{
111        __strong void *priv;
112       
113public:
114        CXXSubSerializer();
115        ~CXXSubSerializer();
116       
117        void pushLine(const char *line, size_t size, unsigned start, unsigned end);
118        void setFinished();
119        const char *popPacket(size_t *size, unsigned *start, unsigned *end);
120        void release();
121        void retain();
122        bool empty();
123};
124
125class CXXAutoreleasePool
126{
127        __strong void *pool;
128public:
129        CXXAutoreleasePool();
130        ~CXXAutoreleasePool();
131};
132#endif
133
134#endif
Note: See TracBrowser for help on using the repository browser.