/**
* SECTION:element-aacparse
+ * @title: aacparse
* @short_description: AAC parser
* @see_also: #GstAmrParse
*
* be determined either. However, ADTS format AAC clips can be seeked, and parser
* can also estimate playback position and clip duration.
*
- * <refsect2>
- * <title>Example launch line</title>
+ * ## Example launch line
* |[
* gst-launch-1.0 filesrc location=abc.aac ! aacparse ! faad ! audioresample ! audioconvert ! alsasink
* ]|
- * </refsect2>
+ *
*/
#ifdef HAVE_CONFIG_H
gst_aac_parse_set_src_caps (GstAacParse * aacparse, GstCaps * sink_caps)
{
GstStructure *s;
- GstCaps *src_caps = NULL, *allowed;
+ GstCaps *src_caps = NULL, *peercaps;
gboolean res = FALSE;
const gchar *stream_format;
guint8 codec_data[2];
if (stream_format)
gst_structure_set (s, "stream-format", G_TYPE_STRING, stream_format, NULL);
- allowed = gst_pad_get_allowed_caps (GST_BASE_PARSE (aacparse)->srcpad);
- if (allowed && !gst_caps_can_intersect (src_caps, allowed)) {
+ peercaps = gst_pad_peer_query_caps (GST_BASE_PARSE_SRC_PAD (aacparse), NULL);
+ if (peercaps && !gst_caps_can_intersect (src_caps, peercaps)) {
GST_DEBUG_OBJECT (GST_BASE_PARSE (aacparse)->srcpad,
"Caps can not intersect");
if (aacparse->header_type == DSPAAC_HEADER_ADTS) {
"Input is ADTS, trying raw");
gst_caps_set_simple (src_caps, "stream-format", G_TYPE_STRING, "raw",
NULL);
- if (gst_caps_can_intersect (src_caps, allowed)) {
+ if (gst_caps_can_intersect (src_caps, peercaps)) {
GstBuffer *codec_data_buffer;
GST_DEBUG_OBJECT (GST_BASE_PARSE (aacparse)->srcpad,
"Input is raw, trying ADTS");
gst_caps_set_simple (src_caps, "stream-format", G_TYPE_STRING, "adts",
NULL);
- if (gst_caps_can_intersect (src_caps, allowed)) {
+ if (gst_caps_can_intersect (src_caps, peercaps)) {
GST_DEBUG_OBJECT (GST_BASE_PARSE (aacparse)->srcpad,
"Caps can intersect, we will prepend ADTS headers");
aacparse->output_header_type = DSPAAC_HEADER_ADTS;
}
}
}
- if (allowed)
- gst_caps_unref (allowed);
+ if (peercaps)
+ gst_caps_unref (peercaps);
aacparse->last_parsed_channels = 0;
aacparse->last_parsed_sample_rate = 0;
adts_headers[0] = 0xFFU;
adts_headers[1] = 0xF0U | (id << 3) | 0x1U;
adts_headers[2] = (profile << 6) | (sampling_frequency_index << 2) | 0x2U |
- (channel_configuration & 0x4U);
+ ((channel_configuration & 0x4U) >> 2);
adts_headers[3] = ((channel_configuration & 0x3U) << 6) | 0x30U |
(guint8) (frame_size >> 11);
adts_headers[4] = (guint8) ((frame_size >> 3) & 0x00FF);
gst_buffer_get_size (frame->out_buffer) - header_size);
}
+ frame->flags |= GST_BASE_PARSE_FRAME_FLAG_CLIP;
+
return GST_FLOW_OK;
}