ducatih264enc: expose number of B frames allowed
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Thu, 18 Oct 2012 17:11:20 +0000 (18:11 +0100)
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Thu, 18 Oct 2012 17:11:20 +0000 (18:11 +0100)
src/gstducatih264enc.c
src/gstducatih264enc.h

index 2852e1b06e003bc9045b6a3a5f018436d909fc05..3c6aa001822f11a3d2fa33d095f5102af66352ed 100644 (file)
@@ -40,6 +40,7 @@
 #define DEFAULT_QP_MIN_I 10
 /* 2 x targetBitRate for VBR Rate Control */
 #define DEFAULT_HRD_BUFFER_SIZE 40960000
+#define DEFAULT_INTER_INTERVAL 1
 
 #define GST_TYPE_DUCATI_H264ENC_PROFILE (gst_ducati_h264enc_profile_get_type ())
 #define GST_TYPE_DUCATI_H264ENC_LEVEL (gst_ducati_h264enc_level_get_type ())
@@ -66,6 +67,7 @@ enum
   PROP_QP_MIN_I,
   PROP_HRD_BUFFER_SIZE,
   PROP_ENTROPY_CODING_MODE,
+  PROP_INTER_INTERVAL,
   PROP_SLICE_MODE,
 };
 
@@ -321,6 +323,11 @@ gst_ducati_h264enc_class_init (GstDucatiH264EncClass * klass)
       g_param_spec_enum ("level", "H.264 Level", "H.264 Level",
           GST_TYPE_DUCATI_H264ENC_LEVEL, DEFAULT_LEVEL, G_PARAM_READWRITE));
 
+  g_object_class_install_property (gobject_class, PROP_INTER_INTERVAL,
+      g_param_spec_uint ("inter-interval", "Inter-frame interval",
+          "Max number of B frames between reference frames", 1, 31,
+          DEFAULT_INTER_INTERVAL, G_PARAM_READWRITE));
+
   g_object_class_install_property (gobject_class,
       PROP_RATE_CONTROL_PARAMS_PRESET,
       g_param_spec_enum ("rate-control-params-preset",
@@ -392,6 +399,7 @@ gst_ducati_h264enc_init (GstDucatiH264Enc * self, GstDucatiH264EncClass * klass)
   self->qp_min_i = DEFAULT_QP_MIN_I;
   self->qp_max_i = DEFAULT_QP_MAX_I;
   self->hrd_buffer_size = DEFAULT_HRD_BUFFER_SIZE;
+  self->inter_interval = DEFAULT_INTER_INTERVAL;
 }
 
 static void
@@ -456,6 +464,9 @@ gst_ducati_h264enc_set_property (GObject * object, guint prop_id,
     case PROP_SLICE_MODE:
       self->slice_mode = g_value_get_enum (value);
       break;
+    case PROP_INTER_INTERVAL:
+      self->inter_interval = g_value_get_uint (value);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
   }
@@ -501,6 +512,9 @@ gst_ducati_h264enc_get_property (GObject * object, guint prop_id,
     case PROP_SLICE_MODE:
       g_value_set_enum (value, self->slice_mode);
       break;
+    case PROP_INTER_INTERVAL:
+      g_value_set_uint (value, self->inter_interval);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
   }
@@ -586,6 +600,7 @@ gst_ducati_h264enc_configure (GstDucatiVidEnc * videnc)
   params->IDRFrameInterval = 1;
   params->numTemporalLayer = 1;
   params->entropyCodingMode = self->entropy_coding_mode;
+  videnc->params->maxInterFrameInterval = self->inter_interval;
 
   /* Dynamic params */
   dynParams = (IH264ENC_DynamicParams *) videnc->dynParams;
index 3806fe4159e42f19fa5a8e8cd668f2cb61d26e15..94961bbe98fababfc63b23caefff9bd8c111d0a2 100644 (file)
@@ -55,6 +55,7 @@ struct _GstDucatiH264Enc
   IH264ENC_RateControlAlgo rate_control_algo;
   IH264ENC_EntropyCodingMode entropy_coding_mode;
   IH264ENC_SliceMode slice_mode;
+  guint inter_interval;
 };
 
 struct _GstDucatiH264EncClass