summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorSreerenj Balachandran <sreerenj.balachandran@intel.com>2018-02-15 15:59:08 +0000
committerSreerenj Balachandran <sreerenj.balachandran@intel.com>2018-02-20 12:40:50 -0900
commitddd02be0def33a9be313038bf409cf294c5d2b2d (patch)
tree29ce67756a2f9a982a209861d9901f0c01e35e4f /sys
parentb7dbcb26b80e0d1baaaa8ef43a85b9c0daa49afa (diff)
msdk: move enum definitions to separte file
Move enum value defintions which are (or in future) supported by more than one codec into a common file. https://bugzilla.gnome.org/show_bug.cgi?id=791637
Diffstat (limited to 'sys')
-rw-r--r--sys/msdk/Makefile.am4
-rw-r--r--sys/msdk/gstmsdkenc.c33
-rw-r--r--sys/msdk/gstmsdkenc.h1
-rw-r--r--sys/msdk/gstmsdkh264enc.c46
-rw-r--r--sys/msdk/meson.build1
-rw-r--r--sys/msdk/msdk-enums.c102
-rw-r--r--sys/msdk/msdk-enums.h53
7 files changed, 163 insertions, 77 deletions
diff --git a/sys/msdk/Makefile.am b/sys/msdk/Makefile.am
index 28643f7fb..e10c346e9 100644
--- a/sys/msdk/Makefile.am
+++ b/sys/msdk/Makefile.am
@@ -19,13 +19,15 @@ libgstmsdk_la_SOURCES = \
gstmsdkvc1dec.c \
gstmsdkdec.c \
gstmsdkenc.c \
- gstmsdk.c
+ gstmsdk.c \
+ msdk-enums.c
# Causes linking libgstmsdk.la with CXXLINK, required by libmfx
nodist_EXTRA_libgstmsdk_la_SOURCES = not_present.cxx
noinst_HEADERS = \
msdk.h \
+ msdk-enums.h \
gstmsdkcontext.h \
gstmsdkcontextutil.h \
gstmsdksystemmemory.h \
diff --git a/sys/msdk/gstmsdkenc.c b/sys/msdk/gstmsdkenc.c
index 67a1ac537..4c29643ec 100644
--- a/sys/msdk/gstmsdkenc.c
+++ b/sys/msdk/gstmsdkenc.c
@@ -101,37 +101,6 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
#define PROP_MAX_VBV_BITRATE_DEFAULT 0
#define PROP_MAX_FRAME_SIZE_DEFAULT 0
-#define GST_MSDKENC_RATE_CONTROL_TYPE (gst_msdkenc_rate_control_get_type())
-static GType
-gst_msdkenc_rate_control_get_type (void)
-{
- static GType type = 0;
-
- static const GEnumValue values[] = {
- {MFX_RATECONTROL_CBR, "Constant Bitrate", "cbr"},
- {MFX_RATECONTROL_VBR, "Variable Bitrate", "vbr"},
- {MFX_RATECONTROL_CQP, "Constant Quantizer", "cqp"},
- {MFX_RATECONTROL_AVBR, "Average Bitrate", "avbr"},
- {MFX_RATECONTROL_LA, "VBR with look ahead (Non HRD compliant)", "la_vbr"},
- {MFX_RATECONTROL_ICQ, "Intelligent CQP", "icq"},
- {MFX_RATECONTROL_VCM, "Video Conferencing Mode (Non HRD compliant)", "vcm"},
- {MFX_RATECONTROL_LA_ICQ, "Intelligent CQP with LA (Non HRD compliant)",
- "la_icq"},
-#if 0
- /* intended for one to N transcode scenario */
- {MFX_RATECONTROL_LA_EXT, "Extended LA", "la_ext"},
-#endif
- {MFX_RATECONTROL_LA_HRD, "HRD compliant LA", "la_hrd"},
- {MFX_RATECONTROL_QVBR, "VBR with CQP", "qvbr"},
- {0, NULL, NULL}
- };
-
- if (!type) {
- type = g_enum_register_static ("GstMsdkEncRateControl", values);
- }
- return type;
-}
-
#define gst_msdkenc_parent_class parent_class
G_DEFINE_TYPE (GstMsdkEnc, gst_msdkenc, GST_TYPE_VIDEO_ENCODER);
@@ -1619,7 +1588,7 @@ gst_msdkenc_install_common_properties (GstMsdkEncClass * klass)
obj_properties[GST_MSDKENC_PROP_RATE_CONTROL] =
g_param_spec_enum ("rate-control", "Rate Control",
- "Rate control method", GST_MSDKENC_RATE_CONTROL_TYPE,
+ "Rate control method", gst_msdkenc_rate_control_get_type (),
PROP_RATE_CONTROL_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
obj_properties[GST_MSDKENC_PROP_BITRATE] =
diff --git a/sys/msdk/gstmsdkenc.h b/sys/msdk/gstmsdkenc.h
index 76df76a03..3b8e207a4 100644
--- a/sys/msdk/gstmsdkenc.h
+++ b/sys/msdk/gstmsdkenc.h
@@ -35,6 +35,7 @@
#include <gst/gst.h>
#include <gst/video/gstvideoencoder.h>
#include "msdk.h"
+#include "msdk-enums.h"
#include "gstmsdkcontext.h"
G_BEGIN_DECLS
diff --git a/sys/msdk/gstmsdkh264enc.c b/sys/msdk/gstmsdkh264enc.c
index ffdd93cee..299e26b2c 100644
--- a/sys/msdk/gstmsdkh264enc.c
+++ b/sys/msdk/gstmsdkh264enc.c
@@ -50,8 +50,6 @@ enum
PROP_TRELLIS,
};
-#define _MFX_TRELLIS_NONE 0
-
#define PROP_CABAC_DEFAULT TRUE
#define PROP_LOWPOWER_DEFAULT FALSE
#define PROP_FRAME_PACKING_DEFAULT -1
@@ -88,46 +86,6 @@ gst_msdkh264enc_frame_packing_get_type (void)
return format_type;
}
-static GType
-gst_msdkh264enc_rc_lookahead_ds_get_type (void)
-{
- static GType type = 0;
-
- static const GEnumValue values[] = {
- {MFX_LOOKAHEAD_DS_UNKNOWN, "SDK desides what to do", "default"},
- {MFX_LOOKAHEAD_DS_OFF, "No downsampling", "off"},
- {MFX_LOOKAHEAD_DS_2x, "Down sample 2-times before estimation", "2x"},
- {MFX_LOOKAHEAD_DS_4x, "Down sample 4-times before estimation", "4x"},
- {0, NULL, NULL}
- };
-
- if (!type) {
- type =
- g_enum_register_static ("GstMsdkH264RCLookAheadDownsampling", values);
- }
- return type;
-}
-
-static GType
-gst_msdkh264enc_trellis_quantization_get_type (void)
-{
- static GType type = 0;
-
- static const GFlagsValue values[] = {
- {_MFX_TRELLIS_NONE, "Disable for all frames", "None"},
- {MFX_TRELLIS_I, "Enable for I frames", "i"},
- {MFX_TRELLIS_P, "Enable for P frames", "p"},
- {MFX_TRELLIS_B, "Enable for B frames", "b"},
- {0, NULL, NULL}
- };
-
- if (!type) {
- type =
- g_flags_register_static ("GstMsdkH264EncTrellisQuantization", values);
- }
- return type;
-}
-
#define gst_msdkh264enc_parent_class parent_class
G_DEFINE_TYPE (GstMsdkH264Enc, gst_msdkh264enc, GST_TYPE_MSDKENC);
@@ -538,14 +496,14 @@ gst_msdkh264enc_class_init (GstMsdkH264EncClass * klass)
g_object_class_install_property (gobject_class, PROP_RC_LA_DOWNSAMPLING,
g_param_spec_enum ("rc-lookahead-ds", "Look-ahead Downsampling",
"Down sampling mode in look ahead bitrate control",
- gst_msdkh264enc_rc_lookahead_ds_get_type (),
+ gst_msdkenc_rc_lookahead_ds_get_type (),
PROP_RC_LA_DOWNSAMPLING_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_TRELLIS,
g_param_spec_flags ("trellis", "Trellis",
"Enable Trellis Quantization",
- gst_msdkh264enc_trellis_quantization_get_type (), _MFX_TRELLIS_NONE,
+ gst_msdkenc_trellis_quantization_get_type (), _MFX_TRELLIS_NONE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_static_metadata (element_class,
diff --git a/sys/msdk/meson.build b/sys/msdk/meson.build
index 9d6ba2634..106687ea9 100644
--- a/sys/msdk/meson.build
+++ b/sys/msdk/meson.build
@@ -19,6 +19,7 @@ msdk_sources = [
'gstmsdkvp8enc.c',
'gstmsdkvc1dec.c',
'msdk.c',
+ 'msdk-enum.c'
]
if host_machine.system() == 'windows'
diff --git a/sys/msdk/msdk-enums.c b/sys/msdk/msdk-enums.c
new file mode 100644
index 000000000..8e5da1aee
--- /dev/null
+++ b/sys/msdk/msdk-enums.c
@@ -0,0 +1,102 @@
+/* GStreamer Intel MSDK plugin
+ * Copyright (c) 2018, Intel corporation
+ * All rights reserved.
+ *
+ * Author:Sreerenj Balachandran <sreerenj.balachandran@intel.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "msdk-enums.h"
+
+GType
+gst_msdkenc_rate_control_get_type (void)
+{
+ static GType type = 0;
+
+ static const GEnumValue values[] = {
+ {MFX_RATECONTROL_CBR, "Constant Bitrate", "cbr"},
+ {MFX_RATECONTROL_VBR, "Variable Bitrate", "vbr"},
+ {MFX_RATECONTROL_CQP, "Constant Quantizer", "cqp"},
+ {MFX_RATECONTROL_AVBR, "Average Bitrate", "avbr"},
+ {MFX_RATECONTROL_LA, "VBR with look ahead (Non HRD compliant)", "la_vbr"},
+ {MFX_RATECONTROL_ICQ, "Intelligent CQP", "icq"},
+ {MFX_RATECONTROL_VCM, "Video Conferencing Mode (Non HRD compliant)", "vcm"},
+ {MFX_RATECONTROL_LA_ICQ, "Intelligent CQP with LA (Non HRD compliant)",
+ "la_icq"},
+#if 0
+ /* intended for one to N transcode scenario */
+ {MFX_RATECONTROL_LA_EXT, "Extended LA", "la_ext"},
+#endif
+ {MFX_RATECONTROL_LA_HRD, "HRD compliant LA", "la_hrd"},
+ {MFX_RATECONTROL_QVBR, "VBR with CQP", "qvbr"},
+ {0, NULL, NULL}
+ };
+
+ if (!type) {
+ type = g_enum_register_static ("GstMsdkEncRateControl", values);
+ }
+ return type;
+}
+
+GType
+gst_msdkenc_trellis_quantization_get_type (void)
+{
+ static GType type = 0;
+
+ static const GFlagsValue values[] = {
+ {_MFX_TRELLIS_NONE, "Disable for all frames", "None"},
+ {MFX_TRELLIS_I, "Enable for I frames", "i"},
+ {MFX_TRELLIS_P, "Enable for P frames", "p"},
+ {MFX_TRELLIS_B, "Enable for B frames", "b"},
+ {0, NULL, NULL}
+ };
+
+ if (!type) {
+ type = g_flags_register_static ("GstMsdkEncTrellisQuantization", values);
+ }
+ return type;
+}
+
+GType
+gst_msdkenc_rc_lookahead_ds_get_type (void)
+{
+ static GType type = 0;
+
+ static const GEnumValue values[] = {
+ {MFX_LOOKAHEAD_DS_UNKNOWN, "SDK desides what to do", "default"},
+ {MFX_LOOKAHEAD_DS_OFF, "No downsampling", "off"},
+ {MFX_LOOKAHEAD_DS_2x, "Down sample 2-times before estimation", "2x"},
+ {MFX_LOOKAHEAD_DS_4x, "Down sample 4-times before estimation", "4x"},
+ {0, NULL, NULL}
+ };
+
+ if (!type) {
+ type = g_enum_register_static ("GstMsdkEncRCLookAheadDownsampling", values);
+ }
+ return type;
+}
diff --git a/sys/msdk/msdk-enums.h b/sys/msdk/msdk-enums.h
new file mode 100644
index 000000000..3408fa333
--- /dev/null
+++ b/sys/msdk/msdk-enums.h
@@ -0,0 +1,53 @@
+/* GStreamer Intel MSDK plugin
+ * Copyright (c) 2018, Intel Corporation
+ *
+ * Author: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __MSDKENUMS_H__
+#define __MSDKENUMS_H__
+
+#include "msdk.h"
+
+G_BEGIN_DECLS
+
+#define _MFX_TRELLIS_NONE 0
+
+GType
+gst_msdkenc_rate_control_get_type (void);
+
+GType
+gst_msdkenc_trellis_quantization_get_type (void);
+
+GType
+gst_msdkenc_rc_lookahead_ds_get_type (void);
+
+G_END_DECLS
+#endif