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  16:00:40 UTC

Log message:
Add core_for_each_port helper in util.

Modified files:
    omx             : gstomx_util.c

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-openmax/omx/gstomx_util.c.diff?r1=1.38&r2=1.39

====Begin Diffs====
Index: gstomx_util.c
===================================================================
RCS file: /cvs/gstreamer/gst-openmax/omx/gstomx_util.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- gstomx_util.c	15 Aug 2008 15:14:05 -0000	1.38
+++ gstomx_util.c	20 Nov 2008 16:00:26 -0000	1.39
@@ -277,25 +277,32 @@
     core->imp = NULL;
 }
 
-void
-g_omx_core_prepare (GOmxCore *core)
+typedef void (*GOmxPortFunc) (GOmxPort *port);
+
+static void inline
+core_for_each_port (GOmxCore *core,
+                    GOmxPortFunc func)
 {
-    change_state (core, OMX_StateIdle);
+    guint index;
-    /* Allocate buffers. */
+    for (index = 0; index < core->ports->len; index++)
     {
-        guint index;
-
-        for (index = 0; index < core->ports->len; index++)
-        {
-            GOmxPort *port;
+        GOmxPort *port;
-            port = g_omx_core_get_port (core, index);
+        port = g_omx_core_get_port (core, index);
-            if (port)
-                port_allocate_buffers (port);
-        }
+        if (port)
+            func (port);
     }
+}
+void
+g_omx_core_prepare (GOmxCore *core)
+{
+    change_state (core, OMX_StateIdle);
+    /* Allocate buffers. */
+    core_for_each_port (core, port_allocate_buffers);
     wait_for_state (core, OMX_StateIdle);
@@ -304,29 +311,15 @@
 g_omx_core_start (GOmxCore *core)
     change_state (core, OMX_StateExecuting);
     wait_for_state (core, OMX_StateExecuting);
-    {
-                port_start_buffers (port);
-    }
+    core_for_each_port (core, port_start_buffers);
 void
 g_omx_core_pause (GOmxCore *core)
     change_state (core, OMX_StatePause);
     wait_for_state (core, OMX_StatePause);
@@ -334,37 +327,14 @@
 g_omx_core_finish (GOmxCore *core)
     change_state (core, OMX_StateIdle);
     change_state (core, OMX_StateLoaded);
-                port_free_buffers (port);
+    core_for_each_port (core, port_free_buffers);
     wait_for_state (core, OMX_StateLoaded);
-            g_omx_port_free (port);
-        g_ptr_array_clear (core->ports);
+    core_for_each_port (core, g_omx_port_free);
+    g_ptr_array_clear (core->ports);
 GOmxPort *

-------------------------------------------------------------------------
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.