[gst-cvs] gst-plugins-bad: baseparse: sync baseparse change
Mark Nauwelaerts
mnauw at kemper.freedesktop.org
Fri Sep 25 08:25:15 PDT 2009
Module: gst-plugins-bad
Branch: master
Commit: c36e5950ba3119b591bdf60b3939f8b296cbbb19
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=c36e5950ba3119b591bdf60b3939f8b296cbbb19
Author: Mark Nauwelaerts <mark.nauwelaerts at collabora.co.uk>
Date: Fri Sep 25 16:54:10 2009 +0200
baseparse: sync baseparse change
---
gst/amrparse/gstbaseparse.c | 32 +++++++++++++++++++++++++++++++-
gst/amrparse/gstbaseparse.h | 1 +
gst/flacparse/gstbaseparse.c | 32 +++++++++++++++++++++++++++++++-
gst/flacparse/gstbaseparse.h | 1 +
4 files changed, 64 insertions(+), 2 deletions(-)
diff --git a/gst/amrparse/gstbaseparse.c b/gst/amrparse/gstbaseparse.c
index 68a8aad..16af9a3 100644
--- a/gst/amrparse/gstbaseparse.c
+++ b/gst/amrparse/gstbaseparse.c
@@ -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,7 +921,11 @@ 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));
- gst_adapter_push (parse->adapter, 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);
}
/* Parse and push as many frames as possible */
@@ -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:
diff --git a/gst/amrparse/gstbaseparse.h b/gst/amrparse/gstbaseparse.h
index 9d53f07..6363f1c 100644
--- a/gst/amrparse/gstbaseparse.h
+++ b/gst/amrparse/gstbaseparse.h
@@ -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
diff --git a/gst/flacparse/gstbaseparse.c b/gst/flacparse/gstbaseparse.c
index ccc2f3e..3aed038 100644
--- a/gst/flacparse/gstbaseparse.c
+++ b/gst/flacparse/gstbaseparse.c
@@ -195,6 +195,7 @@ struct _GstBaseParsePrivate
GstFormat duration_fmt;
guint min_frame_size;
+ gboolean passthrough;
gboolean discont;
gboolean flushing;
@@ -434,6 +435,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;
@@ -998,7 +1000,11 @@ 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));
- gst_adapter_push (parse->priv->adapter, 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->priv->adapter, buffer);
}
/* Parse and push as many frames as possible */
@@ -1532,6 +1538,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:
diff --git a/gst/flacparse/gstbaseparse.h b/gst/flacparse/gstbaseparse.h
index 5ccbf09..74c720d 100644
--- a/gst/flacparse/gstbaseparse.h
+++ b/gst/flacparse/gstbaseparse.h
@@ -237,6 +237,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
More information about the Gstreamer-commits
mailing list