atdec: Set correct number of frames for MP3

This commit is contained in:
Sebastian Dröge 2014-03-11 11:18:22 +01:00
parent 2d8b195911
commit 1c13e513c9
3 changed files with 9 additions and 4 deletions

View file

@ -225,22 +225,27 @@ gst_caps_to_at_format (GstCaps * caps, AudioStreamBasicDescription * format)
format->mFormatID = kAudioFormatMPEG4AAC; format->mFormatID = kAudioFormatMPEG4AAC;
format->mFramesPerPacket = 1024; format->mFramesPerPacket = 1024;
} else if (can_intersect_static_caps (caps, &mp3_caps)) { } else if (can_intersect_static_caps (caps, &mp3_caps)) {
gint layer; gint layer, mpegaudioversion = 1;
gst_structure_get_int (structure, "layer", &layer); gst_structure_get_int (structure, "layer", &layer);
gst_structure_get_int (structure, "mpegaudioversion", &mpegaudioversion);
switch (layer) { switch (layer) {
case 1: case 1:
format->mFormatID = kAudioFormatMPEGLayer1; format->mFormatID = kAudioFormatMPEGLayer1;
format->mFramesPerPacket = 384;
break; break;
case 2: case 2:
format->mFormatID = kAudioFormatMPEGLayer2; format->mFormatID = kAudioFormatMPEGLayer2;
format->mFramesPerPacket = 1152;
break; break;
case 3: case 3:
format->mFormatID = kAudioFormatMPEGLayer3; format->mFormatID = kAudioFormatMPEGLayer3;
format->mFramesPerPacket = (mpegaudioversion == 1 ? 1152 : 576);
break; break;
default: default:
g_warn_if_reached (); g_warn_if_reached ();
format->mFormatID = kAudioFormatMPEGLayer3; format->mFormatID = kAudioFormatMPEGLayer3;
format->mFramesPerPacket = 1152;
break; break;
} }
} else if (can_intersect_static_caps (caps, &raw_caps)) { } else if (can_intersect_static_caps (caps, &raw_caps)) {

View file

@ -25,7 +25,7 @@ gst_core_media_meta_free (GstCoreMediaMeta * meta, GstBuffer * buf)
if (meta->image_buf != NULL) { if (meta->image_buf != NULL) {
CVPixelBufferUnlockBaseAddress (meta->image_buf, CVPixelBufferUnlockBaseAddress (meta->image_buf,
kCVPixelBufferLock_ReadOnly); kCVPixelBufferLock_ReadOnly);
CVBufferRelease(meta->image_buf); CVBufferRelease (meta->image_buf);
} }
if (meta->block_buf != NULL) { if (meta->block_buf != NULL) {
CFRelease (meta->block_buf); CFRelease (meta->block_buf);

View file

@ -75,7 +75,7 @@ void
gst_vtutil_dict_set_boolean (CFMutableDictionaryRef dict, CFStringRef key, gst_vtutil_dict_set_boolean (CFMutableDictionaryRef dict, CFStringRef key,
gboolean value) gboolean value)
{ {
CFDictionarySetValue (dict, key, value ? kCFBooleanTrue: kCFBooleanFalse); CFDictionarySetValue (dict, key, value ? kCFBooleanTrue : kCFBooleanFalse);
} }
void void
@ -91,7 +91,7 @@ gst_vtutil_dict_set_data (CFMutableDictionaryRef dict, CFStringRef key,
void void
gst_vtutil_dict_set_object (CFMutableDictionaryRef dict, CFStringRef key, gst_vtutil_dict_set_object (CFMutableDictionaryRef dict, CFStringRef key,
CFTypeRef *value) CFTypeRef * value)
{ {
CFDictionarySetValue (dict, key, value); CFDictionarySetValue (dict, key, value);
CFRelease (value); CFRelease (value);