aacparse: parse codec_data to determine number of samples per frame

Fixes #656734.
This commit is contained in:
Mark Nauwelaerts 2011-09-06 15:59:49 +02:00
parent 2d2e816aee
commit 625e7a6143
2 changed files with 9 additions and 17 deletions

View file

@ -262,9 +262,11 @@ gst_aac_parse_sink_setcaps (GstBaseParse * parse, GstCaps * caps)
aacparse->channels = (buffer[1] & 0x78) >> 3;
aacparse->header_type = DSPAAC_HEADER_NONE;
aacparse->mpegversion = 4;
aacparse->frame_samples = (buffer[1] & 4) ? 960 : 1024;
GST_DEBUG ("codec_data: object_type=%d, sample_rate=%d, channels=%d",
aacparse->object_type, aacparse->sample_rate, aacparse->channels);
GST_DEBUG ("codec_data: object_type=%d, sample_rate=%d, channels=%d, "
"samples=%d", aacparse->object_type, aacparse->sample_rate,
aacparse->channels, aacparse->frame_samples);
/* arrange for metadata and get out of the way */
gst_aac_parse_set_src_caps (aacparse, caps);
@ -460,7 +462,8 @@ gst_aac_parse_detect_stream (GstAacParse * aacparse,
gst_aac_parse_parse_adts_header (aacparse, data, &rate, &channels,
&aacparse->object_type, &aacparse->mpegversion);
gst_base_parse_set_frame_rate (GST_BASE_PARSE (aacparse), rate, 1024, 2, 2);
gst_base_parse_set_frame_rate (GST_BASE_PARSE (aacparse), rate,
aacparse->frame_samples, 2, 2);
GST_DEBUG ("ADTS: samplerate %d, channels %d, objtype %d, version %d",
rate, channels, aacparse->object_type, aacparse->mpegversion);
@ -679,7 +682,7 @@ gst_aac_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
}
gst_base_parse_set_frame_rate (GST_BASE_PARSE (aacparse),
aacparse->sample_rate, 1024, 2, 2);
aacparse->sample_rate, aacparse->frame_samples, 2, 2);
}
return ret;
@ -701,6 +704,7 @@ gst_aac_parse_start (GstBaseParse * parse)
aacparse = GST_AAC_PARSE (parse);
GST_DEBUG ("start");
aacparse->frame_samples = 1024;
gst_base_parse_set_min_frame_size (GST_BASE_PARSE (aacparse), ADTS_MAX_SIZE);
return TRUE;
}

View file

@ -63,19 +63,6 @@ typedef struct _GstAacParseClass GstAacParseClass;
/**
* GstAacParse:
* @element: the parent element.
* @object_type: AAC object type of the stream.
* @bitrate: Current media bitrate.
* @sample_rate: Current media samplerate.
* @channels: Current media channel count.
* @frames_per_sec: FPS value of the current stream.
* @header_type: #GstAacHeaderType indicating the current stream type.
* @framecount: The amount of frames that has been processed this far.
* @bytecount: The amount of bytes that has been processed this far.
* @sync: Tells whether the parser is in sync (a.k.a. not searching for header)
* @eos: End-of-Stream indicator. Set when EOS event arrives.
* @duration: Duration of the current stream.
* @ts: Current stream timestamp.
*
* The opaque GstAacParse data structure.
*/
@ -88,6 +75,7 @@ struct _GstAacParse {
gint sample_rate;
gint channels;
gint mpegversion;
gint frame_samples;
GstAacHeaderType header_type;
};