felipec gst-openmax: gst-openmax/omx/

[email protected]
Newsgroups gmane.comp.video.gstreamer.cvs
Message-ID <[email protected]>
CVS Root:       /cvs/gstreamer
Module:         gst-openmax
Changes by:     felipec
Date:           Thu Nov 20 2008  17:15:34 UTC

Log message:
Fix iLBC caps negotiation.

Modified files:
    omx             : gstomx_ilbcdec.c gstomx_ilbcenc.c

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-openmax/omx/gstomx_ilbcdec.c.diff?r1=1.4&r2=1.5
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-openmax/omx/gstomx_ilbcenc.c.diff?r1=1.4&r2=1.5

====Begin Diffs====
Index: gstomx_ilbcdec.c
===================================================================
RCS file: /cvs/gstreamer/gst-openmax/omx/gstomx_ilbcdec.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- gstomx_ilbcdec.c	15 Aug 2008 14:49:21 -0000	1.4
+++ gstomx_ilbcdec.c	20 Nov 2008 17:15:19 -0000	1.5
@@ -53,9 +53,29 @@
     caps = gst_caps_new_empty ();
 
     struc = gst_structure_new ("audio/x-iLBC",
-                               "mode", GST_TYPE_INT_RANGE, 20, 30,
                                NULL);
+    {
+        GValue list;
+        GValue val;
+
+        list.g_type = val.g_type = 0;
+        g_value_init (&list, GST_TYPE_LIST);
+        g_value_init (&val, G_TYPE_INT);
+        g_value_set_int (&val, 20);
+        gst_value_list_append_value (&list, &val);
+        g_value_set_int (&val, 30);
+        gst_structure_set_value (struc, "mode", &list);
+        g_value_unset (&val);
+        g_value_unset (&list);
+    }
     gst_caps_append_structure (caps, struc);
     return caps;
@@ -111,30 +131,44 @@
     parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
 }
-static void
-settings_changed_cb (GOmxCore *core)
+static gboolean
+sink_setcaps (GstPad *pad,
+              GstCaps *caps)
 {
+    GstStructure *structure;
     GstOmxBaseFilter *omx_base;
+    GOmxCore *gomx;
+    const gchar *mode;
-    omx_base = core->client_data;
+    omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad));
+    gomx = (GOmxCore *) omx_base->gomx;
-    GST_DEBUG_OBJECT (omx_base, "settings changed");
+    GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps);
+    structure = gst_caps_get_structure (caps, 0);
+    mode = gst_structure_get_name (structure);
+    /* set caps on the srcpad */
     {
-        GstCaps *new_caps;
+        GstCaps *tmp_caps;
-        new_caps = gst_caps_new_simple ("audio/x-raw-int",
-                                        "endianness", G_TYPE_INT, G_BYTE_ORDER,
-                                        "width", G_TYPE_INT, 16,
-                                        "depth", G_TYPE_INT, 16,
-                                        "rate", G_TYPE_INT, 8000,
-                                        "signed", G_TYPE_BOOLEAN, TRUE,
-                                        "channels", G_TYPE_INT, 1,
-                                        NULL);
+        tmp_caps = gst_pad_get_allowed_caps (omx_base->srcpad);
+        tmp_caps = gst_caps_make_writable (tmp_caps);
+        gst_caps_truncate (tmp_caps);
-        GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps);
-        gst_pad_set_caps (omx_base->srcpad, new_caps);
+        gst_pad_fixate_caps (omx_base->srcpad, tmp_caps);
+        if (gst_caps_is_fixed (tmp_caps))
+        {
+            GST_INFO_OBJECT (omx_base, "fixated to: %" GST_PTR_FORMAT, tmp_caps);
+            gst_pad_set_caps (omx_base->srcpad, tmp_caps);
+        }
+        gst_caps_unref (tmp_caps);
     }
+    return gst_pad_set_caps (pad, caps);
 static void
@@ -149,7 +183,7 @@
     omx_base->omx_component = g_strdup (OMX_COMPONENT_NAME);
-    omx_base->gomx->settings_changed_cb = settings_changed_cb;
+    gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
 GType
Index: gstomx_ilbcenc.c
RCS file: /cvs/gstreamer/gst-openmax/omx/gstomx_ilbcenc.c,v
--- gstomx_ilbcenc.c	15 Aug 2008 14:49:21 -0000	1.4
+++ gstomx_ilbcenc.c	20 Nov 2008 17:15:19 -0000	1.5
@@ -36,9 +36,29 @@
@@ -125,12 +145,29 @@
     GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps);
-    g_return_val_if_fail (gst_caps_get_size (caps) == 1, FALSE);
-
     structure = gst_caps_get_structure (caps, 0);
     mode = gst_structure_get_name (structure);
     return gst_pad_set_caps (pad, caps);

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.