mediafoundation: Update for documentation
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-bad / sys / mediafoundation / gstmfh265enc.cpp
index 9e75ff1..3805c02 100644 (file)
@@ -53,6 +53,11 @@ enum
   GST_MF_H265_ENC_RC_MODE_QUALITY,
 };
 
+/**
+ * GstMFH265EncRCMode:
+ *
+ * Since: 1.18
+ */
 #define GST_TYPE_MF_H265_ENC_RC_MODE (gst_mf_h265_enc_rc_mode_get_type())
 static GType
 gst_mf_h265_enc_rc_mode_get_type (void)
@@ -77,6 +82,11 @@ enum
   GST_MF_H265_ENC_CONTENT_TYPE_FIXED_CAMERA_ANGLE,
 };
 
+/**
+ * GstMFH265EncContentType:
+ *
+ * Since: 1.18
+ */
 #define GST_TYPE_MF_H265_ENC_CONTENT_TYPE (gst_mf_h265_enc_content_type_get_type())
 static GType
 gst_mf_h265_enc_content_type_get_type (void)
@@ -140,6 +150,19 @@ enum
 #define DEFAULT_QP_B 26
 #define DEFAULT_REF 2
 
+#define DOC_SINK_CAPS_COMM \
+    "format = (string) { NV12, P010_10LE }, " \
+    "width = (int) [ 64, 8192 ], height = (int) [ 64, 8192 ]"
+
+#define DOC_SINK_CAPS \
+    "video/x-raw(memory:D3D11Memory), " DOC_SINK_CAPS_COMM "; " \
+    "video/x-raw, " DOC_SINK_CAPS_COMM
+
+#define DOC_SRC_CAPS \
+    "video/x-h265, width = (int) [ 64, 8192 ], height = (int) [ 64, 8192 ], " \
+    "stream-format = (string) byte-stream, alignment = (string) au, " \
+    "profile = (string) { main, main-10 }"
+
 typedef struct _GstMFH265Enc
 {
   GstMFVideoEncoder parent;
@@ -198,6 +221,8 @@ gst_mf_h265_enc_class_init (GstMFH265EncClass * klass, gpointer data)
   GstMFVideoEncoderDeviceCaps *device_caps = &cdata->device_caps;
   gchar *long_name;
   gchar *classification;
+  GstPadTemplate *pad_templ;
+  GstCaps *doc_caps;
 
   parent_class = (GstElementClass *) g_type_class_peek_parent (klass);
 
@@ -211,6 +236,11 @@ gst_mf_h265_enc_class_init (GstMFH265EncClass * klass, gpointer data)
           (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
 
   if (device_caps->rc_mode) {
+    /**
+     * GstMFH264Enc:rc-mode:
+     *
+     * Since: 1.18
+     */
     g_object_class_install_property (gobject_class, PROP_RC_MODE,
         g_param_spec_enum ("rc-mode", "Rate Control Mode",
             "Rate Control Mode",
@@ -226,6 +256,11 @@ gst_mf_h265_enc_class_init (GstMFH265EncClass * klass, gpointer data)
   }
 
   if (device_caps->buffer_size) {
+    /**
+     * GstMFH264Enc:vbv-buffer-size:
+     *
+     * Since: 1.18
+     */
     g_object_class_install_property (gobject_class, PROP_BUFFER_SIZE,
         g_param_spec_uint ("vbv-buffer-size", "VBV Buffer Size",
             "VBV(HRD) Buffer Size in bytes (0 = MFT default)",
@@ -235,6 +270,11 @@ gst_mf_h265_enc_class_init (GstMFH265EncClass * klass, gpointer data)
   }
 
   if (device_caps->max_bitrate) {
+    /**
+     * GstMFH264Enc:max-bitrate:
+     *
+     * Since: 1.18
+     */
     g_object_class_install_property (gobject_class, PROP_MAX_BITRATE,
         g_param_spec_uint ("max-bitrate", "Max Bitrate",
             "The maximum bitrate applied when rc-mode is \"pcvbr\" in kbit/sec "
@@ -244,6 +284,11 @@ gst_mf_h265_enc_class_init (GstMFH265EncClass * klass, gpointer data)
   }
 
   if (device_caps->quality_vs_speed) {
+    /**
+     * GstMFH264Enc:quality-vs-speed:
+     *
+     * Since: 1.18
+     */
     g_object_class_install_property (gobject_class, PROP_QUALITY_VS_SPEED,
         g_param_spec_uint ("quality-vs-speed", "Quality Vs Speed",
             "Quality and speed tradeoff, [0, 33]: Low complexity, "
@@ -254,6 +299,11 @@ gst_mf_h265_enc_class_init (GstMFH265EncClass * klass, gpointer data)
   }
 
   if (device_caps->bframes) {
+    /**
+     * GstMFH264Enc:bframes:
+     *
+     * Since: 1.18
+     */
     g_object_class_install_property (gobject_class, PROP_BFRAMES,
         g_param_spec_uint ("bframes", "bframes",
             "The maximum number of consecutive B frames",
@@ -263,6 +313,11 @@ gst_mf_h265_enc_class_init (GstMFH265EncClass * klass, gpointer data)
   }
 
   if (device_caps->gop_size) {
+    /**
+     * GstMFH264Enc:gop-size:
+     *
+     * Since: 1.18
+     */
     g_object_class_install_property (gobject_class, PROP_GOP_SIZE,
         g_param_spec_int ("gop-size", "GOP size",
             "The number of pictures from one GOP header to the next. "
@@ -274,6 +329,11 @@ gst_mf_h265_enc_class_init (GstMFH265EncClass * klass, gpointer data)
   }
 
   if (device_caps->threads) {
+    /**
+     * GstMFH264Enc:threads:
+     *
+     * Since: 1.18
+     */
     g_object_class_install_property (gobject_class, PROP_THREADS,
         g_param_spec_uint ("threads", "Threads",
             "The number of worker threads used by a encoder, (0 = MFT default)",
@@ -283,6 +343,11 @@ gst_mf_h265_enc_class_init (GstMFH265EncClass * klass, gpointer data)
   }
 
   if (device_caps->content_type) {
+    /**
+     * GstMFH264Enc:content-type:
+     *
+     * Since: 1.18
+     */
     g_object_class_install_property (gobject_class, PROP_CONTENT_TYPE,
         g_param_spec_enum ("content-type", "Content Type",
             "Indicates the type of video content",
@@ -298,6 +363,11 @@ gst_mf_h265_enc_class_init (GstMFH265EncClass * klass, gpointer data)
   }
 
   if (device_caps->qp) {
+    /**
+     * GstMFH264Enc:qp:
+     *
+     * Since: 1.18
+     */
     g_object_class_install_property (gobject_class, PROP_QP,
         g_param_spec_uint ("qp", "qp",
             "QP applied when rc-mode is \"qvbr\"", 16, 51, DEFAULT_QP,
@@ -306,6 +376,11 @@ gst_mf_h265_enc_class_init (GstMFH265EncClass * klass, gpointer data)
   }
 
   if (device_caps->low_latency) {
+    /**
+     * GstMFH264Enc:low-latency:
+     *
+     * Since: 1.18
+     */
     g_object_class_install_property (gobject_class, PROP_LOW_LATENCY,
         g_param_spec_boolean ("low-latency", "Low Latency",
             "Enable low latency encoding", DEFAULT_LOW_LATENCY,
@@ -314,6 +389,11 @@ gst_mf_h265_enc_class_init (GstMFH265EncClass * klass, gpointer data)
   }
 
   if (device_caps->min_qp) {
+    /**
+     * GstMFH265Enc:min-qp:
+     *
+     * Since: 1.18
+     */
     g_object_class_install_property (gobject_class, PROP_MIN_QP,
         g_param_spec_uint ("min-qp", "Min QP",
             "The minimum allowed QP applied to all rc-mode",
@@ -323,6 +403,11 @@ gst_mf_h265_enc_class_init (GstMFH265EncClass * klass, gpointer data)
   }
 
   if (device_caps->max_qp) {
+    /**
+     * GstMFH265Enc:max-qp:
+     *
+     * Since: 1.18
+     */
     g_object_class_install_property (gobject_class, PROP_MAX_QP,
         g_param_spec_uint ("max-qp", "Max QP",
             "The maximum allowed QP applied to all rc-mode",
@@ -332,6 +417,11 @@ gst_mf_h265_enc_class_init (GstMFH265EncClass * klass, gpointer data)
   }
 
   if (device_caps->frame_type_qp) {
+    /**
+     * GstMFH265Enc:qp-i:
+     *
+     * Since: 1.18
+     */
     g_object_class_install_property (gobject_class, PROP_QP_I,
         g_param_spec_uint ("qp-i", "QP I",
             "QP applied to I frames", 0, 51,
@@ -339,6 +429,11 @@ gst_mf_h265_enc_class_init (GstMFH265EncClass * klass, gpointer data)
             (GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE |
                 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
 
+    /**
+     * GstMFH265Enc:qp-p:
+     *
+     * Since: 1.18
+     */
     g_object_class_install_property (gobject_class, PROP_QP_P,
         g_param_spec_uint ("qp-p", "QP P",
             "QP applied to P frames", 0, 51,
@@ -346,6 +441,11 @@ gst_mf_h265_enc_class_init (GstMFH265EncClass * klass, gpointer data)
             (GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE |
                 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
 
+    /**
+     * GstMFH265Enc:qp-b:
+     *
+     * Since: 1.18
+     */
     g_object_class_install_property (gobject_class, PROP_QP_B,
         g_param_spec_uint ("qp-b", "QP B",
             "QP applied to B frames", 0, 51,
@@ -355,6 +455,11 @@ gst_mf_h265_enc_class_init (GstMFH265EncClass * klass, gpointer data)
   }
 
   if (device_caps->max_num_ref) {
+    /**
+     * GstMFH265Enc:ref:
+     *
+     * Since: 1.18
+     */
     g_object_class_install_property (gobject_class, PROP_REF,
         g_param_spec_uint ("ref", "Reference Frames",
             "The number of reference frames",
@@ -388,8 +493,9 @@ gst_mf_h265_enc_class_init (GstMFH265EncClass * klass, gpointer data)
     g_object_class_install_property (gobject_class, PROP_ADAPTER_LUID,
         g_param_spec_int64 ("adapter-luid", "Adapter LUID",
             "DXGI Adapter LUID (Locally Unique Identifier) of created device",
-            G_MININT64, G_MAXINT64, device_caps->adapter_luid,
-            (GParamFlags) (GST_PARAM_CONDITIONALLY_AVAILABLE |
+            G_MININT64, G_MAXINT64, 0,
+            (GParamFlags) (GST_PARAM_DOC_SHOW_DEFAULT |
+                GST_PARAM_CONDITIONALLY_AVAILABLE |
                 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
   }
 
@@ -404,12 +510,19 @@ gst_mf_h265_enc_class_init (GstMFH265EncClass * klass, gpointer data)
   g_free (long_name);
   g_free (classification);
 
-  gst_element_class_add_pad_template (element_class,
-      gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
-          cdata->sink_caps));
-  gst_element_class_add_pad_template (element_class,
-      gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
-          cdata->src_caps));
+  pad_templ = gst_pad_template_new ("sink",
+      GST_PAD_SINK, GST_PAD_ALWAYS, cdata->sink_caps);
+  doc_caps = gst_caps_from_string (DOC_SINK_CAPS);
+  gst_pad_template_set_documentation_caps (pad_templ, doc_caps);
+  gst_caps_unref (doc_caps);
+  gst_element_class_add_pad_template (element_class, pad_templ);
+
+  pad_templ = gst_pad_template_new ("src",
+      GST_PAD_SRC, GST_PAD_ALWAYS, cdata->src_caps);
+  doc_caps = gst_caps_from_string (DOC_SRC_CAPS);
+  gst_pad_template_set_documentation_caps (pad_templ, doc_caps);
+  gst_caps_unref (doc_caps);
+  gst_element_class_add_pad_template (element_class, pad_templ);
 
   encoder_class->set_option = GST_DEBUG_FUNCPTR (gst_mf_h265_enc_set_option);
   encoder_class->set_src_caps =