summaryrefslogtreecommitdiffstats
path: root/macosx/HBSubtitlesTrack.h
blob: 644c4c1128afdd7824ac04f551a289de31c81a53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*  HBSubtitlesTrack.h

 This file is part of the HandBrake source code.
 Homepage: <http://handbrake.fr/>.
 It may be used under the terms of the GNU General Public License. */

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@class HBSubtitlesTrack;

/**
 *  HBTrackDataSource
 */
@protocol HBTrackDataSource <NSObject>
- (NSDictionary<NSString *, id> *)sourceTrackAtIndex:(NSUInteger)idx;
- (NSArray<NSString *> *)sourceTracksArray;
@end

/**
 * HBTrackDelegate
 */
@protocol HBTrackDelegate <NSObject>
- (void)track:(HBSubtitlesTrack *)track didChangeSourceFrom:(NSUInteger)oldSourceIdx;

- (BOOL)canSetBurnedInOption:(HBSubtitlesTrack *)track;
- (void)didSetBurnedInOption:(HBSubtitlesTrack *)track;

- (void)didSetDefaultOption:(HBSubtitlesTrack *)track;
@end

@interface HBSubtitlesTrack : NSObject <NSSecureCoding, NSCopying>

- (instancetype)initWithTrackIdx:(NSUInteger)index
                       container:(int)container
                      dataSource:(id<HBTrackDataSource>)dataSource
                        delegate:(id<HBTrackDelegate>)delegate;

/// The index of the source in the data source tracks array.
@property (nonatomic, readwrite) NSUInteger sourceTrackIdx;
/// Format.
@property (nonatomic, readonly) int type;
@property (nonatomic, readwrite) int container;

/// Whether to use only the forced subtitles of the track.
@property (nonatomic, readwrite) BOOL forcedOnly;
/// Whether the track should be burned.
@property (nonatomic, readwrite) BOOL burnedIn;
/// Whether is the default track.
@property (nonatomic, readwrite) BOOL def;

/// The URL of the external subtitles file.
@property (nonatomic, readwrite, copy, nullable) NSURL *fileURL;
/// The ISO 639/2 language code of the external subtitles file.
@property (nonatomic, readwrite, copy, nullable) NSString *isoLanguage;
/// The character encoding of the external subtitles file.
@property (nonatomic, readwrite, copy, nullable) NSString *charCode;
/// The offset in milliseconds  of the external subtitles file.
@property (nonatomic, readwrite) int offset;

@property (nonatomic, readwrite, weak, nullable) NSUndoManager *undo;

@property (nonatomic, readwrite, weak) id<HBTrackDataSource> dataSource;
@property (nonatomic, readwrite, weak) id<HBTrackDelegate> delegate;

/// A complete list of the possible languages.
- (NSArray<NSString *> *)languages;
/// A complete list of the possible encodings.
- (NSArray<NSString *> *)encodings;

@property (nonatomic, readonly) BOOL isSrt;
@property (nonatomic, readonly) BOOL isEnabled;
@property (nonatomic, readonly) BOOL isForcedSupported;
@property (nonatomic, readonly) BOOL canPassthru;

@end

/**
 * HBIsoLanguageTrasformer is a trasformer to transform
 * a ISO 639/2 code to a human readable language name.
 */
@interface HBIsoLanguageTrasformer : NSValueTransformer
@end

NS_ASSUME_NONNULL_END