-
Notifications
You must be signed in to change notification settings - Fork 0
/
MP4.m
71 lines (60 loc) · 1.23 KB
/
MP4.m
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
//
// MP4.m
// OHMTagLib
//
// Created by Tobias Hieta on 2010-12-20.
// Copyright 2010 OHM Interactive. All rights reserved.
//
#import "MP4.h"
#import "OHMTagLibErrorCodes.h"
#import "GTMLogger.h"
@implementation MP4
@synthesize buffer;
@synthesize delegate;
+(NSString*)name
{
return @"MP4";
}
-(id)init
{
if ((self = [super init])) {
parser = [MP4Parser new];
}
return self;
}
-(void)parser:(MP4Parser *)parser doneWithMetadata:(OHMTagLibMetadata *)metadata
{
if ([delegate respondsToSelector:@selector(reader:gotMetadata:)]) {
[delegate reader:self gotMetadata:metadata];
}
}
-(void)bufferHaveMoreData:(OHMPositionalBuffer *)buf
{
GTMLoggerDebug(@"Got more data to the MP4Parser");
[parser parseAtoms];
}
-(void)readMetadata
{
parser.delegate = self;
parser.readBuffer = buffer;
[parser parseAtoms];
}
+(BOOL)isMine:(NSData *)data
{
if ([data length] > 8) {
MP4Atom *atom = [MP4Atom getAtomFromData:data error:nil];
if (atom && atom.type == kOHMMP4AtomFTYP) {
return YES;
} else {
return NO;
}
}
return NO;
}
- (void)dealloc {
[delegate release];
[parser release];
[buffer release];
[super dealloc];
}
@end