FFmpegKit iOS / macOS / tvOS API 6.0
Loading...
Searching...
No Matches
Chapter.m
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Taner Sener
3 *
4 * This file is part of FFmpegKit.
5 *
6 * FFmpegKit is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * FFmpegKit is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#import "Chapter.h"
21
22NSString* const ChapterKeyId = @"id";
23NSString* const ChapterKeyTimeBase = @"time_base";
24NSString* const ChapterKeyStart = @"start";
25NSString* const ChapterKeyStartTime = @"start_time";
26NSString* const ChapterKeyEnd = @"end";
27NSString* const ChapterKeyEndTime = @"end_time";
28NSString* const ChapterKeyTags = @"tags";
29
30@implementation Chapter {
31
35 NSDictionary *dictionary;
36
37}
38
39- (instancetype)init:(NSDictionary*)chapterDictionary {
40 self = [super init];
41 if (self) {
42 dictionary = chapterDictionary;
43 }
44
45 return self;
46}
47
48- (NSNumber*)getId {
49 return [self getNumberProperty:ChapterKeyId];
50}
51
52- (NSString*)getTimeBase {
53 return [self getStringProperty:ChapterKeyTimeBase];
54}
55
56- (NSNumber*)getStart {
57 return [self getNumberProperty:ChapterKeyStart];
58}
59
60- (NSString*)getStartTime {
61 return [self getStringProperty:ChapterKeyStartTime];
62}
63
64- (NSNumber*)getEnd {
65 return [self getNumberProperty:ChapterKeyEnd];
66}
67
68- (NSString*)getEndTime {
69 return [self getStringProperty:ChapterKeyEndTime];
70}
71
72- (NSDictionary*)getTags {
73 return [self getProperty:ChapterKeyTags];
74}
75
76- (NSString*)getStringProperty:(NSString*)key {
77 NSDictionary* allProperties = [self getAllProperties];
78 if (allProperties == nil) {
79 return nil;
80 }
81
82 return allProperties[key];
83}
84
85- (NSNumber*)getNumberProperty:(NSString*)key {
86 NSDictionary* allProperties = [self getAllProperties];
87 if (allProperties == nil) {
88 return nil;
89 }
90
91 return allProperties[key];
92}
93
94- (id)getProperty:(NSString*)key {
95 NSDictionary* allProperties = [self getAllProperties];
96 if (allProperties == nil) {
97 return nil;
98 }
99
100 return allProperties[key];
101}
102
103- (NSDictionary*)getAllProperties {
104 return dictionary;
105}
106
107@end
NSString *const ChapterKeyTimeBase
Definition Chapter.m:23
NSString *const ChapterKeyStartTime
Definition Chapter.m:25
NSString *const ChapterKeyId
Definition Chapter.m:22
NSString *const ChapterKeyEndTime
Definition Chapter.m:27
NSString *const ChapterKeyEnd
Definition Chapter.m:26
NSString *const ChapterKeyTags
Definition Chapter.m:28
NSString *const ChapterKeyStart
Definition Chapter.m:24