ducatih264enc is now using ih264enc.h from ducati side, rather than re-defining enums
[glsdk/gst-plugin-ducati.git] / src / gstducatih264enc.c
index 7006c082ed0397398fe1edc81db3843a9ff50a33..e5f8b158cdf03c37dbf022c865a8e3bc23ae9adc 100644 (file)
@@ -33,8 +33,8 @@
 
 #define GST_CAT_DEFAULT gst_ducati_debug
 
-#define DEFAULT_PROFILE GST_DUCATI_H264ENC_PROFILE_HIGH
-#define DEFAULT_LEVEL GST_DUCATI_H264ENC_LEVEL_40
+#define DEFAULT_PROFILE IH264_HIGH_PROFILE
+#define DEFAULT_LEVEL IH264_LEVEL_40
 #define DEFAULT_QPI 28
 #define DEFAULT_QP_MAX_I 36
 #define DEFAULT_QP_MIN_I 10
@@ -103,38 +103,6 @@ GST_BOILERPLATE (GstDucatiH264Enc, gst_ducati_h264enc, GstDucatiVidEnc,
     GST_TYPE_DUCATIVIDENC);
 
 
-/* the values for the following enums are taken from the codec */
-
-enum
-{
-  GST_DUCATI_H264ENC_PROFILE_BASELINE = 66,            /**< BaseLine Profile   */
-  GST_DUCATI_H264ENC_PROFILE_MAIN = 77,                /**< Main Profile       */
-  GST_DUCATI_H264ENC_PROFILE_EXTENDED = 88,            /**< Extended Profile   */
-  GST_DUCATI_H264ENC_PROFILE_HIGH = 100,               /**< High Profile       */
-  GST_DUCATI_H264ENC_PROFILE_HIGH_10 = 110,             /**< High 10 Profile    */
-  GST_DUCATI_H264ENC_PROFILE_HIGH_422 = 122             /**< High 4:2:2 Profile */
-};
-
-enum
-{
-  GST_DUCATI_H264ENC_LEVEL_10 = 10, /**<  Level 1.0  */
-  GST_DUCATI_H264ENC_LEVEL_1b = 9,  /**<  Level 1.b  */
-  GST_DUCATI_H264ENC_LEVEL_11 = 11, /**<  Level 1.1  */
-  GST_DUCATI_H264ENC_LEVEL_12 = 12, /**<  Level 1.2  */
-  GST_DUCATI_H264ENC_LEVEL_13 = 13, /**<  Level 1.3  */
-  GST_DUCATI_H264ENC_LEVEL_20 = 20, /**<  Level 2.0  */
-  GST_DUCATI_H264ENC_LEVEL_21 = 21, /**<  Level 2.1  */
-  GST_DUCATI_H264ENC_LEVEL_22 = 22, /**<  Level 2.2  */
-  GST_DUCATI_H264ENC_LEVEL_30 = 30, /**<  Level 3.0  */
-  GST_DUCATI_H264ENC_LEVEL_31 = 31, /**<  Level 3.1  */
-  GST_DUCATI_H264ENC_LEVEL_32 = 32, /**<  Level 3.2  */
-  GST_DUCATI_H264ENC_LEVEL_40 = 40, /**<  Level 4.0  */
-  GST_DUCATI_H264ENC_LEVEL_41 = 41, /**<  Level 4.1  */
-  GST_DUCATI_H264ENC_LEVEL_42 = 42, /**<  Level 4.2  */
-  GST_DUCATI_H264ENC_LEVEL_50 = 50, /**<  Level 5.0  */
-  GST_DUCATI_H264ENC_LEVEL_51 = 51 /**<  Level 5.1  */
-};
-
 static GType
 gst_ducati_h264enc_profile_get_type (void)
 {
@@ -142,12 +110,12 @@ gst_ducati_h264enc_profile_get_type (void)
 
   if (!type) {
     static const GEnumValue vals[] = {
-      {GST_DUCATI_H264ENC_PROFILE_BASELINE, "Base Profile", "baseline"},
-      {GST_DUCATI_H264ENC_PROFILE_MAIN, "Main Profile", "main"},
-      {GST_DUCATI_H264ENC_PROFILE_EXTENDED, "Extended Profile", "extended"},
-      {GST_DUCATI_H264ENC_PROFILE_HIGH, "High Profile", "high"},
-      {GST_DUCATI_H264ENC_PROFILE_HIGH_10, "High 10 Profile", "high-10"},
-      {GST_DUCATI_H264ENC_PROFILE_HIGH_422, "High 4:2:2 Profile", "high-422"},
+      {IH264_BASELINE_PROFILE, "Base Profile", "baseline"},
+      {IH264_MAIN_PROFILE, "Main Profile", "main"},
+      {IH264_EXTENDED_PROFILE, "Extended Profile", "extended"},
+      {IH264_HIGH_PROFILE, "High Profile", "high"},
+      {IH264_HIGH10_PROFILE, "High 10 Profile", "high-10"},
+      {IH264_HIGH422_PROFILE, "High 4:2:2 Profile", "high-422"},
       {0, NULL, NULL},
     };
 
@@ -210,22 +178,22 @@ gst_ducati_h264enc_level_get_type (void)
 
   if (!type) {
     static const GEnumValue vals[] = {
-      {GST_DUCATI_H264ENC_LEVEL_10, "Level 1", "level-1"},
-      {GST_DUCATI_H264ENC_LEVEL_1b, "Level 1b", "level-1b"},
-      {GST_DUCATI_H264ENC_LEVEL_11, "Level 11", "level-11"},
-      {GST_DUCATI_H264ENC_LEVEL_12, "Level 12", "level-12"},
-      {GST_DUCATI_H264ENC_LEVEL_13, "Level 13", "level-13"},
-      {GST_DUCATI_H264ENC_LEVEL_20, "Level 2", "level-2"},
-      {GST_DUCATI_H264ENC_LEVEL_21, "Level 21", "level-21"},
-      {GST_DUCATI_H264ENC_LEVEL_22, "Level 22", "level-22"},
-      {GST_DUCATI_H264ENC_LEVEL_30, "Level 3", "level-3"},
-      {GST_DUCATI_H264ENC_LEVEL_31, "Level 31", "level-31"},
-      {GST_DUCATI_H264ENC_LEVEL_32, "Level 32", "level-32"},
-      {GST_DUCATI_H264ENC_LEVEL_40, "Level 4", "level-4"},
-      {GST_DUCATI_H264ENC_LEVEL_41, "Level 41", "level-41"},
-      {GST_DUCATI_H264ENC_LEVEL_42, "Level 42", "level-42"},
-      {GST_DUCATI_H264ENC_LEVEL_50, "Level 5", "level-5"},
-      {GST_DUCATI_H264ENC_LEVEL_51, "Level 51", "level-51"},
+      {IH264_LEVEL_10, "Level 1", "level-1"},
+      {IH264_LEVEL_1b, "Level 1b", "level-1b"},
+      {IH264_LEVEL_11, "Level 11", "level-11"},
+      {IH264_LEVEL_12, "Level 12", "level-12"},
+      {IH264_LEVEL_13, "Level 13", "level-13"},
+      {IH264_LEVEL_20, "Level 2", "level-2"},
+      {IH264_LEVEL_21, "Level 21", "level-21"},
+      {IH264_LEVEL_22, "Level 22", "level-22"},
+      {IH264_LEVEL_30, "Level 3", "level-3"},
+      {IH264_LEVEL_31, "Level 31", "level-31"},
+      {IH264_LEVEL_32, "Level 32", "level-32"},
+      {IH264_LEVEL_40, "Level 4", "level-4"},
+      {IH264_LEVEL_41, "Level 41", "level-41"},
+      {IH264_LEVEL_42, "Level 42", "level-42"},
+      {IH264_LEVEL_50, "Level 5", "level-5"},
+      {IH264_LEVEL_51, "Level 51", "level-51"},
       {0, NULL, NULL},
     };
 
@@ -524,17 +492,17 @@ static const char *
 get_profile_name (guint profile)
 {
   switch (profile) {
-    case GST_DUCATI_H264ENC_PROFILE_BASELINE:
+    case IH264_BASELINE_PROFILE:
       return "baseline";
-    case GST_DUCATI_H264ENC_PROFILE_MAIN:
+    case IH264_MAIN_PROFILE:
       return "main";
-    case GST_DUCATI_H264ENC_PROFILE_EXTENDED:
+    case IH264_EXTENDED_PROFILE:
       return "extended";
-    case GST_DUCATI_H264ENC_PROFILE_HIGH:
+    case IH264_HIGH_PROFILE:
       return "high";
-    case GST_DUCATI_H264ENC_PROFILE_HIGH_10:
+    case IH264_HIGH10_PROFILE:
       return "high-10";
-    case GST_DUCATI_H264ENC_PROFILE_HIGH_422:
+    case IH264_HIGH422_PROFILE:
       return "high-422";
     default:
       return NULL;
@@ -545,37 +513,37 @@ static const char *
 get_level_name (guint level)
 {
   switch (level) {
-    case GST_DUCATI_H264ENC_LEVEL_10:
+    case IH264_LEVEL_10:
       return "1";
-    case GST_DUCATI_H264ENC_LEVEL_1b:
+    case IH264_LEVEL_1b:
       return "1b";
-    case GST_DUCATI_H264ENC_LEVEL_11:
+    case IH264_LEVEL_11:
       return "1.1";
-    case GST_DUCATI_H264ENC_LEVEL_12:
+    case IH264_LEVEL_12:
       return "1.2";
-    case GST_DUCATI_H264ENC_LEVEL_13:
+    case IH264_LEVEL_13:
       return "1.3";
-    case GST_DUCATI_H264ENC_LEVEL_20:
+    case IH264_LEVEL_20:
       return "2";
-    case GST_DUCATI_H264ENC_LEVEL_21:
+    case IH264_LEVEL_21:
       return "2.1";
-    case GST_DUCATI_H264ENC_LEVEL_22:
+    case IH264_LEVEL_22:
       return "2.2";
-    case GST_DUCATI_H264ENC_LEVEL_30:
+    case IH264_LEVEL_30:
       return "3";
-    case GST_DUCATI_H264ENC_LEVEL_31:
+    case IH264_LEVEL_31:
       return "3.1";
-    case GST_DUCATI_H264ENC_LEVEL_32:
+    case IH264_LEVEL_32:
       return "3.2";
-    case GST_DUCATI_H264ENC_LEVEL_40:
+    case IH264_LEVEL_40:
       return "4";
-    case GST_DUCATI_H264ENC_LEVEL_41:
+    case IH264_LEVEL_41:
       return "4.1";
-    case GST_DUCATI_H264ENC_LEVEL_42:
+    case IH264_LEVEL_42:
       return "4.2";
-    case GST_DUCATI_H264ENC_LEVEL_50:
+    case IH264_LEVEL_50:
       return "5";
-    case GST_DUCATI_H264ENC_LEVEL_51:
+    case IH264_LEVEL_51:
       return "5.1";
     default:
       return NULL;
@@ -602,7 +570,7 @@ gst_ducati_h264enc_configure (GstDucatiVidEnc * videnc)
   videnc->params->level = self->level;
 
   inter_interval = self->inter_interval;
-  if (self->profile == GST_DUCATI_H264ENC_PROFILE_BASELINE)
+  if (self->profile == IH264_BASELINE_PROFILE)
     inter_interval = 1;
   else if (videnc->rate_preset == IVIDEO_LOW_DELAY)
     inter_interval = 1;