mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
rawvideoparse: allow setting the colorimetry
You can neither guess nor parse the colorimetry from the input stream. Signed-off-by: Randy Li <ayaka@soulik.info>
This commit is contained in:
parent
18ee5e57fd
commit
e85b856d30
2 changed files with 34 additions and 1 deletions
|
@ -93,7 +93,8 @@ enum
|
||||||
PROP_TOP_FIELD_FIRST,
|
PROP_TOP_FIELD_FIRST,
|
||||||
PROP_PLANE_STRIDES,
|
PROP_PLANE_STRIDES,
|
||||||
PROP_PLANE_OFFSETS,
|
PROP_PLANE_OFFSETS,
|
||||||
PROP_FRAME_SIZE
|
PROP_FRAME_SIZE,
|
||||||
|
PROP_COLORIMETRY,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_WIDTH 320
|
#define DEFAULT_WIDTH 320
|
||||||
|
@ -309,6 +310,13 @@ gst_raw_video_parse_class_init (GstRawVideoParseClass * klass)
|
||||||
0, G_MAXUINT,
|
0, G_MAXUINT,
|
||||||
DEFAULT_FRAME_STRIDE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
|
DEFAULT_FRAME_STRIDE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
|
||||||
);
|
);
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_COLORIMETRY,
|
||||||
|
g_param_spec_string ("colorimetry",
|
||||||
|
"Colorimetry",
|
||||||
|
"The video source colorimetry",
|
||||||
|
NULL, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)
|
||||||
|
);
|
||||||
|
|
||||||
gst_element_class_set_static_metadata (element_class,
|
gst_element_class_set_static_metadata (element_class,
|
||||||
"rawvideoparse",
|
"rawvideoparse",
|
||||||
|
@ -610,6 +618,28 @@ gst_raw_video_parse_set_property (GObject * object, guint prop_id,
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case PROP_COLORIMETRY:
|
||||||
|
{
|
||||||
|
GstVideoColorimetry new_cinfo;
|
||||||
|
|
||||||
|
if (!gst_video_colorimetry_from_string (&new_cinfo,
|
||||||
|
g_value_get_string (value)))
|
||||||
|
break;
|
||||||
|
|
||||||
|
GST_RAW_BASE_PARSE_CONFIG_MUTEX_LOCK (object);
|
||||||
|
if (!gst_video_colorimetry_is_equal (&new_cinfo,
|
||||||
|
&(props_cfg->info.colorimetry))) {
|
||||||
|
|
||||||
|
props_cfg->colorimetry = new_cinfo;
|
||||||
|
gst_raw_video_parse_update_info (props_cfg);
|
||||||
|
|
||||||
|
if (!gst_raw_video_parse_is_using_sink_caps (raw_video_parse))
|
||||||
|
gst_raw_base_parse_invalidate_src_caps (raw_base_parse);
|
||||||
|
}
|
||||||
|
GST_RAW_BASE_PARSE_CONFIG_MUTEX_UNLOCK (object);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
@ -1078,6 +1108,8 @@ gst_raw_video_parse_update_info (GstRawVideoParseConfig * config)
|
||||||
gst_video_info_set_format (info, config->format, config->width,
|
gst_video_info_set_format (info, config->format, config->width,
|
||||||
config->height);
|
config->height);
|
||||||
|
|
||||||
|
info->colorimetry = config->colorimetry;
|
||||||
|
|
||||||
GST_VIDEO_INFO_PAR_N (info) = config->pixel_aspect_ratio_n;
|
GST_VIDEO_INFO_PAR_N (info) = config->pixel_aspect_ratio_n;
|
||||||
GST_VIDEO_INFO_PAR_D (info) = config->pixel_aspect_ratio_d;
|
GST_VIDEO_INFO_PAR_D (info) = config->pixel_aspect_ratio_d;
|
||||||
GST_VIDEO_INFO_FPS_N (info) = config->framerate_n;
|
GST_VIDEO_INFO_FPS_N (info) = config->framerate_n;
|
||||||
|
|
|
@ -62,6 +62,7 @@ struct _GstRawVideoParseConfig
|
||||||
gboolean interlaced;
|
gboolean interlaced;
|
||||||
gsize plane_offsets[GST_VIDEO_MAX_PLANES];
|
gsize plane_offsets[GST_VIDEO_MAX_PLANES];
|
||||||
gint plane_strides[GST_VIDEO_MAX_PLANES];
|
gint plane_strides[GST_VIDEO_MAX_PLANES];
|
||||||
|
GstVideoColorimetry colorimetry;
|
||||||
|
|
||||||
/* If TRUE, then TFF flags are added to outgoing buffers and
|
/* If TRUE, then TFF flags are added to outgoing buffers and
|
||||||
* their video metadata */
|
* their video metadata */
|
||||||
|
|
Loading…
Reference in a new issue