mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
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
This commit is contained in:
parent
b7dbcb26b8
commit
ddd02be0de
7 changed files with 163 additions and 77 deletions
|
@ -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 \
|
||||
|
|
|
@ -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] =
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -19,6 +19,7 @@ msdk_sources = [
|
|||
'gstmsdkvp8enc.c',
|
||||
'gstmsdkvc1dec.c',
|
||||
'msdk.c',
|
||||
'msdk-enum.c'
|
||||
]
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
|
|
102
sys/msdk/msdk-enums.c
Normal file
102
sys/msdk/msdk-enums.c
Normal file
|
@ -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;
|
||||
}
|
53
sys/msdk/msdk-enums.h
Normal file
53
sys/msdk/msdk-enums.h
Normal file
|
@ -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
|
Loading…
Reference in a new issue