Changeset 1007
- Timestamp:
- 12/29/08 08:24:20 (1 year ago)
- Files:
-
- trunk/ff_private.c (modified) (4 diffs)
- trunk/ff_private.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ff_private.c
r989 r1007 219 219 220 220 memset(&asbd,0,sizeof(asbd)); 221 map_avi_to_mov_tag(codec->codec_id, &asbd, map );221 map_avi_to_mov_tag(codec->codec_id, &asbd, map, codec->channels); 222 222 if(asbd.mFormatID == 0) /* no know codec, use the ms tag */ 223 223 asbd.mFormatID = 'ms\0\0' + codec->codec_tag; /* the number is stored in the last byte => big endian */ … … 235 235 asbd.mSampleRate = codec->sample_rate; 236 236 asbd.mChannelsPerFrame = codec->channels; 237 if(!map->vbr ) /* This works for all the tested codecs. but is there any better way? */237 if(!map->vbr && asbd.mBytesPerPacket == 0) /* This works for all the tested codecs. but is there any better way? */ 238 238 asbd.mBytesPerPacket = codec->block_align; /* this is tested for alaw/mulaw/msadpcm */ 239 239 asbd.mFramesPerPacket = codec->frame_size; /* works for mp3, all other codecs this is 0 anyway */ … … 354 354 355 355 /* maps the codec_id tag of libavformat to a constant the AudioToolbox can work with */ 356 void map_avi_to_mov_tag(enum CodecID codec_id, AudioStreamBasicDescription *asbd, NCStream *map )356 void map_avi_to_mov_tag(enum CodecID codec_id, AudioStreamBasicDescription *asbd, NCStream *map, int channels) 357 357 { 358 358 switch(codec_id) { … … 370 370 asbd->mFormatID = kAudioFormatLinearPCM; 371 371 asbd->mFormatFlags = kLinearPCMFormatFlagIsSignedInteger; 372 asbd->mBytesPerPacket = 2 * channels; 372 373 break; 373 374 case CODEC_ID_PCM_U8: 374 375 asbd->mFormatID = kAudioFormatLinearPCM; 375 376 asbd->mFormatFlags = kLinearPCMFormatFlagIsBigEndian; 377 asbd->mBytesPerPacket = channels; 376 378 break; 377 379 case CODEC_ID_PCM_ALAW: trunk/ff_private.h
r984 r1007 109 109 OSType map_video_codec_to_mov_tag(enum CodecID codec_id); 110 110 OSType forced_map_video_codec_to_mov_tag(enum CodecID codec_id); 111 void map_avi_to_mov_tag(enum CodecID codec_id, AudioStreamBasicDescription *asbd, NCStream *map );111 void map_avi_to_mov_tag(enum CodecID codec_id, AudioStreamBasicDescription *asbd, NCStream *map, int channels); 112 112 uint8_t *create_cookie(AVCodecContext *codec, size_t *cookieSize, UInt32 formatID, int vbr); 113 113 Handle create_strf_ext(AVCodecContext *codec);
