-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestMP4Parser.m
62 lines (51 loc) · 1.54 KB
/
TestMP4Parser.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
//
// TestMP4Parser.m
// OHMTagLib
//
// Created by Tobias Hieta on 2011-01-19.
// Copyright 2011 OHM Interactive. All rights reserved.
//
#import "TestMP4Parser.h"
#import "GTMLogger.h"
@implementation TestMP4Parser
-(void)setUp
{
parser = [MP4Parser new];
}
-(void)buffer:(OHMPositionalBuffer *)buf needMoreData:(UInt64)bytes
{
if (fileData) {
[buf addData:fileData];
fileData = nil;
/* always call parseAtoms after we have added more data */
[parser parseAtoms];
}
GTMLoggerDebug(@"We sent data to the parser");
}
-(void)parser:(MP4Parser *)parser doneWithMetadata:(OHMTagLibMetadata *)metaData
{
if (metaData == nil || metaData.artist == nil) {
GTMLoggerDebug(@"korv!");
}
GTMLoggerDebug(@"We got metadata! '%@'", metaData.artist);
STAssertTrue([metaData.artist isEqualToString:@"Edge of Dawn"], @"korv");
STAssertTrue([metaData.album isEqualToString:@"Anything That Gets You Through the Night"], @"korv");
STAssertTrue([metaData.title isEqualToString:@"Beyond the Gate"], @"korv");
STAssertTrue([metaData.year isEqualToString:@"2010-05-21"], @"korv");
}
-(void)testParseFullFile
{
GTMLoggerDebug(@"running parseFullFile..");
fileData = [NSData dataWithContentsOfFile:@"testdata/testm4a.m4a"];
STAssertNotNil(fileData, @"no testdata");
parser.delegate = self;
[parser.readBuffer addData:fileData];
GTMLoggerDebug(@"Going into the parser");
[parser parseAtoms];
GTMLoggerDebug(@"Done with parseAtoms");
}
-(void)tearDown
{
[parser release];
}
@end