mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-08 13:18:52 +00:00
aacparse: forego (bogus) parsing of already parsed (raw) input
This commit is contained in:
parent
338f58e573
commit
6c9a9d3304
3 changed files with 42 additions and 5 deletions
|
@ -200,6 +200,7 @@ gst_aacparse_finalize (GObject * object)
|
|||
/**
|
||||
* gst_aacparse_set_src_caps:
|
||||
* @aacparse: #GstAacParse.
|
||||
* @sink_caps: (proposed) caps of sink pad
|
||||
*
|
||||
* Set source pad caps according to current knowledge about the
|
||||
* audio stream.
|
||||
|
@ -207,13 +208,12 @@ gst_aacparse_finalize (GObject * object)
|
|||
* Returns: TRUE if caps were successfully set.
|
||||
*/
|
||||
static gboolean
|
||||
gst_aacparse_set_src_caps (GstAacParse * aacparse)
|
||||
gst_aacparse_set_src_caps (GstAacParse * aacparse, GstCaps * sink_caps)
|
||||
{
|
||||
GstStructure *s;
|
||||
GstCaps *sink_caps, *src_caps = NULL;
|
||||
GstCaps *src_caps = NULL;
|
||||
gboolean res = FALSE;
|
||||
|
||||
sink_caps = GST_PAD_CAPS (GST_BASE_PARSE (aacparse)->sinkpad);
|
||||
GST_DEBUG_OBJECT (aacparse, "sink caps: %" GST_PTR_FORMAT, sink_caps);
|
||||
if (sink_caps)
|
||||
src_caps = gst_caps_copy (sink_caps);
|
||||
|
@ -282,6 +282,10 @@ gst_aacparse_sink_setcaps (GstBaseParse * parse, GstCaps * caps)
|
|||
|
||||
GST_DEBUG ("codec_data: object_type=%d, sample_rate=%d, channels=%d",
|
||||
aacparse->object_type, aacparse->sample_rate, aacparse->channels);
|
||||
|
||||
/* arrange for metadata and get out of the way */
|
||||
gst_aacparse_set_src_caps (aacparse, caps);
|
||||
gst_base_parse_set_passthrough (parse, TRUE);
|
||||
} else
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -680,7 +684,8 @@ gst_aacparse_parse_frame (GstBaseParse * parse, GstBuffer * buffer)
|
|||
aacparse->bytecount += GST_BUFFER_SIZE (buffer);
|
||||
|
||||
if (!aacparse->src_caps_set) {
|
||||
if (!gst_aacparse_set_src_caps (aacparse)) {
|
||||
if (!gst_aacparse_set_src_caps (aacparse,
|
||||
GST_PAD_CAPS (GST_BASE_PARSE (aacparse)->sinkpad))) {
|
||||
/* If linking fails, we need to return appropriate error */
|
||||
ret = GST_FLOW_NOT_LINKED;
|
||||
}
|
||||
|
@ -713,6 +718,7 @@ gst_aacparse_start (GstBaseParse * parse)
|
|||
aacparse->ts = 0;
|
||||
aacparse->sync = FALSE;
|
||||
aacparse->eos = FALSE;
|
||||
gst_base_parse_set_passthrough (parse, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -201,6 +201,7 @@ struct _GstBaseParsePrivate
|
|||
GstFormat duration_fmt;
|
||||
|
||||
guint min_frame_size;
|
||||
gboolean passthrough;
|
||||
|
||||
gboolean discont;
|
||||
gboolean flushing;
|
||||
|
@ -405,6 +406,7 @@ gst_base_parse_init (GstBaseParse * parse, GstBaseParseClass * bclass)
|
|||
parse->priv->pad_mode = GST_ACTIVATE_NONE;
|
||||
parse->priv->duration = -1;
|
||||
parse->priv->min_frame_size = 1;
|
||||
parse->priv->passthrough = FALSE;
|
||||
parse->priv->discont = FALSE;
|
||||
parse->priv->flushing = FALSE;
|
||||
parse->priv->offset = 0;
|
||||
|
@ -919,6 +921,10 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer)
|
|||
if (G_LIKELY (buffer)) {
|
||||
GST_LOG_OBJECT (parse, "buffer size: %d, offset = %lld",
|
||||
GST_BUFFER_SIZE (buffer), GST_BUFFER_OFFSET (buffer));
|
||||
if (G_UNLIKELY (parse->priv->passthrough)) {
|
||||
buffer = gst_buffer_make_metadata_writable (buffer);
|
||||
return gst_base_parse_push_buffer (parse, buffer);
|
||||
} else
|
||||
gst_adapter_push (parse->adapter, buffer);
|
||||
}
|
||||
|
||||
|
@ -1410,6 +1416,30 @@ gst_base_parse_set_min_frame_size (GstBaseParse * parse, guint min_size)
|
|||
GST_BASE_PARSE_UNLOCK (parse);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_base_transform_set_passthrough:
|
||||
* @trans: the #GstBaseTransform to set
|
||||
* @passthrough: boolean indicating passthrough mode.
|
||||
*
|
||||
* Set passthrough mode for this filter by default. This is mostly
|
||||
* useful for filters that do not care about negotiation.
|
||||
*
|
||||
* Always TRUE for filters which don't implement either a transform
|
||||
* or transform_ip method.
|
||||
*
|
||||
* MT safe.
|
||||
*/
|
||||
void
|
||||
gst_base_parse_set_passthrough (GstBaseParse * parse, gboolean passthrough)
|
||||
{
|
||||
g_return_if_fail (parse != NULL);
|
||||
|
||||
GST_BASE_PARSE_LOCK (parse);
|
||||
parse->priv->passthrough = passthrough;
|
||||
GST_LOG_OBJECT (parse, "set passthrough: %d", passthrough);
|
||||
GST_BASE_PARSE_UNLOCK (parse);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gst_base_parse_get_querytypes:
|
||||
|
|
|
@ -234,6 +234,7 @@ void gst_base_parse_set_duration (GstBaseParse *parse,
|
|||
|
||||
void gst_base_parse_set_min_frame_size (GstBaseParse *parse,
|
||||
guint min_size);
|
||||
void gst_base_parse_set_passthrough (GstBaseParse * parse, gboolean passthrough);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
Loading…
Reference in a new issue