mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
videoconvert: Expose some properties from the videoconverter API
Expose chroma resampler, alpha mode, alpha value, chroma mode, matrix mode, gamma mode and primaries mode from the videoconverter API. https://bugzilla.gnome.org/show_bug.cgi?id=749105
This commit is contained in:
parent
c9cfd0196f
commit
327efa9805
2 changed files with 117 additions and 2 deletions
|
@ -58,12 +58,26 @@ G_DEFINE_TYPE (GstVideoConvert, gst_video_convert, GST_TYPE_VIDEO_FILTER);
|
|||
|
||||
#define DEFAULT_PROP_DITHER GST_VIDEO_DITHER_BAYER
|
||||
#define DEFAULT_PROP_DITHER_QUANTIZATION 1
|
||||
#define DEFAULT_PROP_CHROMA_RESAMPLER GST_VIDEO_RESAMPLER_METHOD_LINEAR
|
||||
#define DEFAULT_PROP_ALPHA_MODE GST_VIDEO_ALPHA_MODE_COPY
|
||||
#define DEFAULT_PROP_ALPHA_VALUE 1.0
|
||||
#define DEFAULT_PROP_CHROMA_MODE GST_VIDEO_CHROMA_MODE_FULL
|
||||
#define DEFAULT_PROP_MATRIX_MODE GST_VIDEO_MATRIX_MODE_FULL
|
||||
#define DEFAULT_PROP_GAMMA_MODE GST_VIDEO_GAMMA_MODE_NONE
|
||||
#define DEFAULT_PROP_PRIMARIES_MODE GST_VIDEO_PRIMARIES_MODE_NONE
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_DITHER,
|
||||
PROP_DITHER_QUANTIZATION
|
||||
PROP_DITHER_QUANTIZATION,
|
||||
PROP_CHROMA_RESAMPLER,
|
||||
PROP_ALPHA_MODE,
|
||||
PROP_ALPHA_VALUE,
|
||||
PROP_CHROMA_MODE,
|
||||
PROP_MATRIX_MODE,
|
||||
PROP_GAMMA_MODE,
|
||||
PROP_PRIMARIES_MODE
|
||||
};
|
||||
|
||||
#define CSP_VIDEO_CAPS GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ";" \
|
||||
|
@ -434,7 +448,21 @@ gst_video_convert_set_info (GstVideoFilter * filter,
|
|||
GST_VIDEO_CONVERTER_OPT_DITHER_METHOD, GST_TYPE_VIDEO_DITHER_METHOD,
|
||||
space->dither,
|
||||
GST_VIDEO_CONVERTER_OPT_DITHER_QUANTIZATION, G_TYPE_UINT,
|
||||
space->dither_quantization, NULL));
|
||||
space->dither_quantization,
|
||||
GST_VIDEO_CONVERTER_OPT_CHROMA_RESAMPLER_METHOD,
|
||||
GST_TYPE_VIDEO_RESAMPLER_METHOD, space->chroma_resampler,
|
||||
GST_VIDEO_CONVERTER_OPT_ALPHA_MODE,
|
||||
GST_TYPE_VIDEO_ALPHA_MODE, space->alpha_mode,
|
||||
GST_VIDEO_CONVERTER_OPT_ALPHA_VALUE,
|
||||
G_TYPE_DOUBLE, space->alpha_value,
|
||||
GST_VIDEO_CONVERTER_OPT_CHROMA_MODE,
|
||||
GST_TYPE_VIDEO_CHROMA_MODE, space->chroma_mode,
|
||||
GST_VIDEO_CONVERTER_OPT_MATRIX_MODE,
|
||||
GST_TYPE_VIDEO_MATRIX_MODE, space->matrix_mode,
|
||||
GST_VIDEO_CONVERTER_OPT_GAMMA_MODE,
|
||||
GST_TYPE_VIDEO_GAMMA_MODE, space->gamma_mode,
|
||||
GST_VIDEO_CONVERTER_OPT_PRIMARIES_MODE,
|
||||
GST_TYPE_VIDEO_PRIMARIES_MODE, space->primaries_mode, NULL));
|
||||
if (space->convert == NULL)
|
||||
goto no_convert;
|
||||
|
||||
|
@ -515,6 +543,37 @@ gst_video_convert_class_init (GstVideoConvertClass * klass)
|
|||
g_param_spec_uint ("dither-quantization", "Dither Quantize",
|
||||
"Quantizer to use", 0, G_MAXUINT, DEFAULT_PROP_DITHER_QUANTIZATION,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_class, PROP_CHROMA_RESAMPLER,
|
||||
g_param_spec_enum ("chroma-resampler", "Chroma resampler",
|
||||
"Chroma resampler method", gst_video_resampler_method_get_type (),
|
||||
DEFAULT_PROP_CHROMA_RESAMPLER,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_class, PROP_ALPHA_MODE,
|
||||
g_param_spec_enum ("alpha-mode", "Alpha Mode",
|
||||
"Alpha Mode to use", gst_video_alpha_mode_get_type (),
|
||||
DEFAULT_PROP_ALPHA_MODE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_class, PROP_ALPHA_VALUE,
|
||||
g_param_spec_double ("alpha-value", "Alpha Value",
|
||||
"Alpha Value to use", 0.0, 1.0,
|
||||
DEFAULT_PROP_ALPHA_VALUE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_class, PROP_CHROMA_MODE,
|
||||
g_param_spec_enum ("chroma-mode", "Chroma Mode", "Chroma Resampling Mode",
|
||||
gst_video_chroma_mode_get_type (), DEFAULT_PROP_CHROMA_MODE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_class, PROP_MATRIX_MODE,
|
||||
g_param_spec_enum ("matrix-mode", "Matrix Mode", "Matrix Conversion Mode",
|
||||
gst_video_matrix_mode_get_type (), DEFAULT_PROP_MATRIX_MODE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_class, PROP_GAMMA_MODE,
|
||||
g_param_spec_enum ("gamma-mode", "Gamma Mode", "Gamma Conversion Mode",
|
||||
gst_video_gamma_mode_get_type (), DEFAULT_PROP_GAMMA_MODE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_class, PROP_PRIMARIES_MODE,
|
||||
g_param_spec_enum ("primaries-mode", "Primaries Mode",
|
||||
"Primaries Conversion Mode", gst_video_primaries_mode_get_type (),
|
||||
DEFAULT_PROP_PRIMARIES_MODE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -522,6 +581,13 @@ gst_video_convert_init (GstVideoConvert * space)
|
|||
{
|
||||
space->dither = DEFAULT_PROP_DITHER;
|
||||
space->dither_quantization = DEFAULT_PROP_DITHER_QUANTIZATION;
|
||||
space->chroma_resampler = DEFAULT_PROP_CHROMA_RESAMPLER;
|
||||
space->alpha_mode = DEFAULT_PROP_ALPHA_MODE;
|
||||
space->alpha_value = DEFAULT_PROP_ALPHA_VALUE;
|
||||
space->chroma_mode = DEFAULT_PROP_CHROMA_MODE;
|
||||
space->matrix_mode = DEFAULT_PROP_MATRIX_MODE;
|
||||
space->gamma_mode = DEFAULT_PROP_GAMMA_MODE;
|
||||
space->primaries_mode = DEFAULT_PROP_PRIMARIES_MODE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -536,6 +602,27 @@ gst_video_convert_set_property (GObject * object, guint property_id,
|
|||
case PROP_DITHER:
|
||||
csp->dither = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_CHROMA_RESAMPLER:
|
||||
csp->chroma_resampler = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_ALPHA_MODE:
|
||||
csp->alpha_mode = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_ALPHA_VALUE:
|
||||
csp->alpha_value = g_value_get_double (value);
|
||||
break;
|
||||
case PROP_CHROMA_MODE:
|
||||
csp->chroma_mode = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_MATRIX_MODE:
|
||||
csp->matrix_mode = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_GAMMA_MODE:
|
||||
csp->gamma_mode = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_PRIMARIES_MODE:
|
||||
csp->primaries_mode = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_DITHER_QUANTIZATION:
|
||||
csp->dither_quantization = g_value_get_uint (value);
|
||||
break;
|
||||
|
@ -557,6 +644,27 @@ gst_video_convert_get_property (GObject * object, guint property_id,
|
|||
case PROP_DITHER:
|
||||
g_value_set_enum (value, csp->dither);
|
||||
break;
|
||||
case PROP_CHROMA_RESAMPLER:
|
||||
g_value_set_enum (value, csp->chroma_resampler);
|
||||
break;
|
||||
case PROP_ALPHA_MODE:
|
||||
g_value_set_enum (value, csp->alpha_mode);
|
||||
break;
|
||||
case PROP_ALPHA_VALUE:
|
||||
g_value_set_double (value, csp->alpha_value);
|
||||
break;
|
||||
case PROP_CHROMA_MODE:
|
||||
g_value_set_enum (value, csp->chroma_mode);
|
||||
break;
|
||||
case PROP_MATRIX_MODE:
|
||||
g_value_set_enum (value, csp->matrix_mode);
|
||||
break;
|
||||
case PROP_GAMMA_MODE:
|
||||
g_value_set_enum (value, csp->gamma_mode);
|
||||
break;
|
||||
case PROP_PRIMARIES_MODE:
|
||||
g_value_set_enum (value, csp->primaries_mode);
|
||||
break;
|
||||
case PROP_DITHER_QUANTIZATION:
|
||||
g_value_set_uint (value, csp->dither_quantization);
|
||||
break;
|
||||
|
|
|
@ -49,6 +49,13 @@ struct _GstVideoConvert {
|
|||
GstVideoConverter *convert;
|
||||
GstVideoDitherMethod dither;
|
||||
guint dither_quantization;
|
||||
GstVideoResamplerMethod chroma_resampler;
|
||||
GstVideoAlphaMode alpha_mode;
|
||||
GstVideoChromaMode chroma_mode;
|
||||
GstVideoMatrixMode matrix_mode;
|
||||
GstVideoGammaMode gamma_mode;
|
||||
GstVideoPrimariesMode primaries_mode;
|
||||
gdouble alpha_value;
|
||||
};
|
||||
|
||||
struct _GstVideoConvertClass
|
||||
|
|
Loading…
Reference in a new issue