[0.11] gst-plugins-base: audioencoder: Add gst_audio_encoder_set_output_format() function for consistency

Sebastian Dröge slomo at kemper.freedesktop.org
Wed Feb 1 07:27:52 PST 2012


Module: gst-plugins-base
Branch: 0.11
Commit: 0370b0dc12d8afdb7d94afec92c2845ab55f94f7
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=0370b0dc12d8afdb7d94afec92c2845ab55f94f7

Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date:   Wed Feb  1 16:00:37 2012 +0100

audioencoder: Add gst_audio_encoder_set_output_format() function for consistency

---

 gst-libs/gst/audio/gstaudioencoder.c |   33 +++++++++++++++++++++++++++++++++
 gst-libs/gst/audio/gstaudioencoder.h |    3 +++
 2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/gst-libs/gst/audio/gstaudioencoder.c b/gst-libs/gst/audio/gstaudioencoder.c
index a1c948a..dc5d79e 100644
--- a/gst-libs/gst/audio/gstaudioencoder.c
+++ b/gst-libs/gst/audio/gstaudioencoder.c
@@ -2169,3 +2169,36 @@ gst_audio_encoder_merge_tags (GstAudioEncoder * enc,
     gst_tag_list_free (otags);
   GST_OBJECT_UNLOCK (enc);
 }
+
+/*
+ * gst_audio_encoder_set_output_format:
+ * @enc: a #GstAudioEncoder
+ * @caps: #GstCaps
+ *
+ * Configure output caps on the srcpad of @enc.
+ *
+ * Returns: %TRUE on success.
+ **/
+gboolean
+gst_audio_encoder_set_output_format (GstAudioEncoder * enc, GstCaps * caps)
+{
+  gboolean res = FALSE;
+
+  GST_DEBUG_OBJECT (enc, "Setting srcpad caps %" GST_PTR_FORMAT, caps);
+
+  if (!gst_caps_is_fixed (caps))
+    goto refuse_caps;
+
+  res = gst_pad_set_caps (enc->srcpad, caps);
+
+done:
+  return res;
+
+  /* ERRORS */
+refuse_caps:
+  {
+    GST_WARNING_OBJECT (enc, "refused caps %" GST_PTR_FORMAT, caps);
+    res = FALSE;
+    goto done;
+  }
+}
diff --git a/gst-libs/gst/audio/gstaudioencoder.h b/gst-libs/gst/audio/gstaudioencoder.h
index 0481281..c737e70 100644
--- a/gst-libs/gst/audio/gstaudioencoder.h
+++ b/gst-libs/gst/audio/gstaudioencoder.h
@@ -197,6 +197,9 @@ GstFlowReturn   gst_audio_encoder_finish_frame (GstAudioEncoder * enc,
 GstCaps *       gst_audio_encoder_proxy_getcaps (GstAudioEncoder * enc,
                                                  GstCaps         * caps);
 
+gboolean        gst_audio_encoder_set_output_format  (GstAudioEncoder    * enc,
+                                                      GstCaps            * caps);
+
 
 /* context parameters */
 GstAudioInfo  * gst_audio_encoder_get_audio_info (GstAudioEncoder * enc);



More information about the gstreamer-commits mailing list