Changeset 1022
- Timestamp:
- 10/21/07 12:37:08 (15 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/Audio/Properties/OggVorbisPropertiesReader.m
r731 r1022 28 28 29 29 - (BOOL) readProperties:(NSError **)error 30 { 31 NSMutableDictionary *propertiesDictionary; 32 NSString *path; 33 OggVorbis_File vf; 34 vorbis_info *ovInfo; 35 FILE *file; 36 int result; 37 ogg_int64_t totalFrames; 38 long bitrate; 39 40 path = [[self valueForKey:StreamURLKey] path]; 41 file = fopen([path fileSystemRepresentation], "r"); 30 { 31 NSString *path = [[self valueForKey:StreamURLKey] path]; 32 FILE *file = fopen([path fileSystemRepresentation], "r"); 42 33 43 34 if(NULL == file) { … … 57 48 } 58 49 59 result = ov_test(file, &vf, NULL, 0); 50 OggVorbis_File vf; 51 int result = ov_test(file, &vf, NULL, 0); 60 52 61 53 if(0 != result) { … … 82 74 83 75 // Get input file information 84 ovInfo = ov_info(&vf, -1);76 vorbis_info *ovInfo = ov_info(&vf, -1); 85 77 NSAssert(NULL != ovInfo, @"Unable to get information on Ogg Vorbis stream."); 86 78 87 totalFrames = ov_pcm_total(&vf, -1);88 bitrate = ov_bitrate(&vf, -1);79 ogg_int64_t totalFrames = ov_pcm_total(&vf, -1); 80 long bitrate = ov_bitrate(&vf, -1); 89 81 90 propertiesDictionary = [NSMutableDictionary dictionary];82 NSMutableDictionary *propertiesDictionary = [NSMutableDictionary dictionary]; 91 83 92 84 [propertiesDictionary setValue:NSLocalizedStringFromTable(@"Ogg", @"Formats", @"") forKey:PropertiesFileTypeKey]; … … 95 87 [propertiesDictionary setValue:[NSNumber numberWithLongLong:totalFrames] forKey:PropertiesTotalFramesKey]; 96 88 [propertiesDictionary setValue:[NSNumber numberWithLong:bitrate] forKey:PropertiesBitrateKey]; 97 // [propertiesDictionary setValue:[NSNumber numberWithUnsignedInt:16] forKey:PropertiesBitsPerChannelKey];89 // [propertiesDictionary setValue:[NSNumber numberWithUnsignedInt:16] forKey:PropertiesBitsPerChannelKey]; 98 90 [propertiesDictionary setValue:[NSNumber numberWithUnsignedInt:ovInfo->channels] forKey:PropertiesChannelsPerFrameKey]; 99 91 [propertiesDictionary setValue:[NSNumber numberWithUnsignedInt:ovInfo->rate] forKey:PropertiesSampleRateKey]; 100 92 [propertiesDictionary setValue:[NSNumber numberWithDouble:(double)totalFrames / ovInfo->rate] forKey:PropertiesDurationKey]; 101 102 93 103 94 [self setValue:propertiesDictionary forKey:@"properties"];
