omxvideodec: Make the inport and outport index configurable by the subclass
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 6 Jul 2011 06:48:37 +0000 (08:48 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Sat, 9 Jul 2011 09:06:05 +0000 (11:06 +0200)
omx/gstomxmpeg4videodec.c
omx/gstomxvideodec.c
omx/gstomxvideodec.h

index 55d992a..f20a5ca 100644 (file)
@@ -96,6 +96,8 @@ gst_omx_mpeg4_video_dec_class_init (GstOMXMPEG4VideoDecClass * klass)
   /* TODO: Make this configurable */
   videodec_class->core_name = "/usr/local/lib/libomxil-bellagio.so.0";
   videodec_class->component_name = "OMX.st.video_decoder.mpeg4";
+  videodec_class->in_port_index = 0;
+  videodec_class->out_port_index = 1;
 
   videodec_class->is_format_change =
       GST_DEBUG_FUNCPTR (gst_omx_mpeg4_video_dec_is_format_change);
index 8007182..2d6dfbf 100644 (file)
@@ -97,6 +97,9 @@ gst_omx_video_dec_class_init (GstOMXVideoDecClass * klass)
       GST_DEBUG_FUNCPTR (gst_omx_video_dec_handle_frame);
   base_video_decoder_class->finish =
       GST_DEBUG_FUNCPTR (gst_omx_video_dec_finish);
+
+  klass->in_port_index = 0;
+  klass->out_port_index = 1;
 }
 
 static void
@@ -122,8 +125,10 @@ gst_omx_video_dec_open (GstOMXVideoDec * self)
     return FALSE;
 
   /* FIXME: Always 0 == input, 1 == output? Make configurable? Let subclass decide? */
-  self->in_port = gst_omx_component_add_port (self->component, 0);
-  self->out_port = gst_omx_component_add_port (self->component, 1);
+  self->in_port =
+      gst_omx_component_add_port (self->component, klass->in_port_index);
+  self->out_port =
+      gst_omx_component_add_port (self->component, klass->out_port_index);
 
   if (!self->in_port || !self->out_port)
     return FALSE;
index 0ac411c..a675e4e 100644 (file)
@@ -65,6 +65,8 @@ struct _GstOMXVideoDecClass
 
   const gchar *core_name;
   const gchar *component_name;
+  
+  guint32 in_port_index, out_port_index;
 
   gboolean (*is_format_change) (GstOMXVideoDec * self, GstOMXPort * port, GstVideoState * state);
   gboolean (*set_format)       (GstOMXVideoDec * self, GstOMXPort * port, GstVideoState * state);