ducatih264enc: include profile and level on src caps
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Wed, 17 Oct 2012 13:18:21 +0000 (13:18 +0000)
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Wed, 17 Oct 2012 13:49:45 +0000 (13:49 +0000)
src/gstducatih264enc.c

index 61f8b1c54190b18b8c095adb2f659aa4eeda2aa2..bc0fd316169e981f37310a09edc5d4f01cd46435 100644 (file)
@@ -503,6 +503,68 @@ gst_ducati_h264enc_get_property (GObject * object, guint prop_id,
   }
 }
 
+static const char *
+get_profile_name (guint profile)
+{
+  switch (profile) {
+    case GST_DUCATI_H264ENC_PROFILE_BASELINE:
+      return "baseline";
+    case GST_DUCATI_H264ENC_PROFILE_MAIN:
+      return "main";
+    case GST_DUCATI_H264ENC_PROFILE_EXTENDED:
+      return "extended";
+    case GST_DUCATI_H264ENC_PROFILE_HIGH:
+      return "high";
+    case GST_DUCATI_H264ENC_PROFILE_HIGH_10:
+      return "high-10";
+    case GST_DUCATI_H264ENC_PROFILE_HIGH_422:
+      return "high-422";
+    default:
+      return NULL;
+  }
+}
+
+static const char *
+get_level_name (guint level)
+{
+  switch (level) {
+    case GST_DUCATI_H264ENC_LEVEL_10:
+      return "1";
+    case GST_DUCATI_H264ENC_LEVEL_1b:
+      return "1b";
+    case GST_DUCATI_H264ENC_LEVEL_11:
+      return "1.1";
+    case GST_DUCATI_H264ENC_LEVEL_12:
+      return "1.2";
+    case GST_DUCATI_H264ENC_LEVEL_13:
+      return "1.3";
+    case GST_DUCATI_H264ENC_LEVEL_20:
+      return "2";
+    case GST_DUCATI_H264ENC_LEVEL_21:
+      return "2.1";
+    case GST_DUCATI_H264ENC_LEVEL_22:
+      return "2.2";
+    case GST_DUCATI_H264ENC_LEVEL_30:
+      return "3";
+    case GST_DUCATI_H264ENC_LEVEL_31:
+      return "3.1";
+    case GST_DUCATI_H264ENC_LEVEL_32:
+      return "3.2";
+    case GST_DUCATI_H264ENC_LEVEL_40:
+      return "4";
+    case GST_DUCATI_H264ENC_LEVEL_41:
+      return "4.1";
+    case GST_DUCATI_H264ENC_LEVEL_42:
+      return "4.2";
+    case GST_DUCATI_H264ENC_LEVEL_50:
+      return "5";
+    case GST_DUCATI_H264ENC_LEVEL_51:
+      return "5.1";
+    default:
+      return NULL;
+  }
+}
+
 static gboolean
 gst_ducati_h264enc_configure (GstDucatiVidEnc * videnc)
 {
@@ -510,6 +572,7 @@ gst_ducati_h264enc_configure (GstDucatiVidEnc * videnc)
   IH264ENC_Params *params;
   IH264ENC_DynamicParams *dynParams;
   gboolean ret;
+  const char *s;
 
   videnc->params->profile = self->profile;
   videnc->params->level = self->level;
@@ -544,6 +607,12 @@ gst_ducati_h264enc_configure (GstDucatiVidEnc * videnc)
         "stream-format", G_TYPE_STRING, "byte-stream",
         "align", G_TYPE_STRING, "au",
         NULL);
+    s = get_profile_name (self->profile);
+    if (s)
+      gst_caps_set_simple (caps, "profile", G_TYPE_STRING, s, NULL);
+    s = get_level_name (self->level);
+    if (s)
+      gst_caps_set_simple (caps, "level", G_TYPE_STRING, s, NULL);
     ret = gst_pad_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (self), caps);
   }