]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gst-plugin-ducati.git/blobdiff - src/gstducatih264dec.c
h264dec: Add a property to set display-delay
[glsdk/gst-plugin-ducati.git] / src / gstducatih264dec.c
index 9bfded97d3ef5e7d3a4be5e2ae4e369017389524..d41133619466ade27c27c492e775cf5e0655cca8 100644 (file)
 #define GST_BUFFER_FLAG_B_FRAME (GST_BUFFER_FLAG_LAST << 0)
 #define PADX  32
 #define PADY  24
+#define DEFAULT_DISPLAY_DELAY   IVIDDEC3_DISPLAY_DELAY_AUTO
 
 /* This structure is not public, this should be replaced by
    sizeof(sErrConcealLayerStr) when it is made so. */
 #define SIZE_OF_CONCEALMENT_DATA 65536
 
+enum
+{
+  PROP_0,
+  PROP_DISPLAY_DELAY
+};
+
+static void gst_ducati_h264dec_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec);
+static void gst_ducati_h264dec_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec);
+
+
 
 static void gst_ducati_h264dec_base_init (gpointer gclass);
 static void gst_ducati_h264dec_class_init (GstDucatiH264DecClass * klass);
@@ -146,7 +159,7 @@ gst_ducati_h264dec_allocate_params (GstDucatiVidDec * self, gint params_sz,
   if (ret) {
     IH264VDEC_Params *params = (IH264VDEC_Params *) self->params;
 
-    self->params->displayDelay = IVIDDEC3_DISPLAY_DELAY_AUTO;
+    self->params->displayDelay = self->displayDelay;
     params->dpbSizeInFrames = IH264VDEC_DPB_NUMFRAMES_AUTO;
     params->pConstantMemory = 0;
     params->presetLevelIdc = IH264VDEC_LEVEL41;
@@ -457,7 +470,15 @@ gst_ducati_h264dec_class_init (GstDucatiH264DecClass * klass)
   bclass->can_drop_frame =
       GST_DEBUG_FUNCPTR (gst_ducati_h264dec_can_drop_frame);
   bclass->set_sink_caps = GST_DEBUG_FUNCPTR (gst_ducati_h264dec_set_sink_caps);
+  gobject_class->set_property = gst_ducati_h264dec_set_property;
+  gobject_class->get_property = gst_ducati_h264dec_get_property;
   gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_ducati_h264dec_finalize);
+
+  g_object_class_install_property (gobject_class, PROP_DISPLAY_DELAY,
+      g_param_spec_int ("display-delay", "Display delay", "Display delay configuration of h264 decoder",
+          -1, 16,  DEFAULT_DISPLAY_DELAY,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
 }
 
 static void
@@ -491,4 +512,42 @@ gst_ducati_h264dec_init (GstDucatiH264Dec * self, gpointer gclass)
   dec->error_strings[30] = "no SPS/PPS header";
   dec->error_strings[31] = "gap in frame num";
 #endif
+  dec->displayDelay =  DEFAULT_DISPLAY_DELAY;
+}
+static void
+gst_ducati_h264dec_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstDucatiH264Dec *self;
+  GstDucatiVidDec *dec;
+  g_return_if_fail (GST_IS_DUCATIH264DEC (object));
+  self = GST_DUCATIH264DEC (object);
+  dec = GST_DUCATIVIDDEC (self);
+
+  switch (prop_id) {
+    case PROP_DISPLAY_DELAY:
+      dec->displayDelay = g_value_get_int (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+  }
+}
+
+static void
+gst_ducati_h264dec_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstDucatiH264Dec *self;
+  GstDucatiVidDec *dec;
+  g_return_if_fail (GST_IS_DUCATIH264DEC (object));
+  self = GST_DUCATIH264DEC (object);
+  dec = GST_DUCATIVIDDEC (self);
+
+  switch (prop_id) {
+    case PROP_DISPLAY_DELAY:
+      g_value_set_int (value, dec->displayDelay);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+  }
 }