mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 00:06:36 +00:00
libs/video: Fix gst_video_format_new_caps* functions.
Only add a 'interlaced=True' property to caps *IF* it is interlaced, else don't add anything.
This commit is contained in:
parent
32b1b7904d
commit
5ce5433152
1 changed files with 33 additions and 28 deletions
|
@ -431,6 +431,37 @@ GstCaps *
|
||||||
gst_video_format_new_caps_interlaced (GstVideoFormat format, int width,
|
gst_video_format_new_caps_interlaced (GstVideoFormat format, int width,
|
||||||
int height, int framerate_n, int framerate_d, int par_n, int par_d,
|
int height, int framerate_n, int framerate_d, int par_n, int par_d,
|
||||||
gboolean interlaced)
|
gboolean interlaced)
|
||||||
|
{
|
||||||
|
GstCaps *res;
|
||||||
|
|
||||||
|
res =
|
||||||
|
gst_video_format_new_caps (format, width, height, framerate_n,
|
||||||
|
framerate_d, par_n, par_d);
|
||||||
|
if (interlaced && (res != NULL))
|
||||||
|
gst_caps_set_simple (res, "interlaced", G_TYPE_BOOLEAN, TRUE, NULL);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_video_format_new_caps:
|
||||||
|
* @format: the #GstVideoFormat describing the raw video format
|
||||||
|
* @width: width of video
|
||||||
|
* @height: height of video
|
||||||
|
* @framerate_n: numerator of frame rate
|
||||||
|
* @framerate_d: denominator of frame rate
|
||||||
|
* @par_n: numerator of pixel aspect ratio
|
||||||
|
* @par_d: denominator of pixel aspect ratio
|
||||||
|
*
|
||||||
|
* Creates a new #GstCaps object based on the parameters provided.
|
||||||
|
*
|
||||||
|
* Since: 0.10.16
|
||||||
|
*
|
||||||
|
* Returns: a new #GstCaps object, or NULL if there was an error
|
||||||
|
*/
|
||||||
|
GstCaps *
|
||||||
|
gst_video_format_new_caps (GstVideoFormat format, int width, int height,
|
||||||
|
int framerate_n, int framerate_d, int par_n, int par_d)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, NULL);
|
g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, NULL);
|
||||||
g_return_val_if_fail (width > 0 && height > 0, NULL);
|
g_return_val_if_fail (width > 0 && height > 0, NULL);
|
||||||
|
@ -441,8 +472,7 @@ gst_video_format_new_caps_interlaced (GstVideoFormat format, int width,
|
||||||
"width", G_TYPE_INT, width,
|
"width", G_TYPE_INT, width,
|
||||||
"height", G_TYPE_INT, height,
|
"height", G_TYPE_INT, height,
|
||||||
"framerate", GST_TYPE_FRACTION, framerate_n, framerate_d,
|
"framerate", GST_TYPE_FRACTION, framerate_n, framerate_d,
|
||||||
"pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d,
|
"pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL);
|
||||||
"interlaced", G_TYPE_BOOLEAN, interlaced, NULL);
|
|
||||||
}
|
}
|
||||||
if (gst_video_format_is_rgb (format)) {
|
if (gst_video_format_is_rgb (format)) {
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
@ -506,8 +536,7 @@ gst_video_format_new_caps_interlaced (GstVideoFormat format, int width,
|
||||||
"width", G_TYPE_INT, width,
|
"width", G_TYPE_INT, width,
|
||||||
"height", G_TYPE_INT, height,
|
"height", G_TYPE_INT, height,
|
||||||
"framerate", GST_TYPE_FRACTION, framerate_n, framerate_d,
|
"framerate", GST_TYPE_FRACTION, framerate_n, framerate_d,
|
||||||
"pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d,
|
"pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL);
|
||||||
"interlaced", G_TYPE_BOOLEAN, interlaced, NULL);
|
|
||||||
if (have_alpha) {
|
if (have_alpha) {
|
||||||
alpha_mask =
|
alpha_mask =
|
||||||
mask >> (8 * gst_video_format_get_component_offset (format, 3, width,
|
mask >> (8 * gst_video_format_get_component_offset (format, 3, width,
|
||||||
|
@ -519,30 +548,6 @@ gst_video_format_new_caps_interlaced (GstVideoFormat format, int width,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_video_format_new_caps:
|
|
||||||
* @format: the #GstVideoFormat describing the raw video format
|
|
||||||
* @width: width of video
|
|
||||||
* @height: height of video
|
|
||||||
* @framerate_n: numerator of frame rate
|
|
||||||
* @framerate_d: denominator of frame rate
|
|
||||||
* @par_n: numerator of pixel aspect ratio
|
|
||||||
* @par_d: denominator of pixel aspect ratio
|
|
||||||
*
|
|
||||||
* Creates a new #GstCaps object based on the parameters provided.
|
|
||||||
*
|
|
||||||
* Since: 0.10.16
|
|
||||||
*
|
|
||||||
* Returns: a new #GstCaps object, or NULL if there was an error
|
|
||||||
*/
|
|
||||||
GstCaps *
|
|
||||||
gst_video_format_new_caps (GstVideoFormat format, int width, int height,
|
|
||||||
int framerate_n, int framerate_d, int par_n, int par_d)
|
|
||||||
{
|
|
||||||
return gst_video_format_new_caps_interlaced (format, width, height,
|
|
||||||
framerate_n, framerate_d, par_n, par_d, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_video_format_from_fourcc:
|
* gst_video_format_from_fourcc:
|
||||||
* @fourcc: a FOURCC value representing raw YUV video
|
* @fourcc: a FOURCC value representing raw YUV video
|
||||||
|
|
Loading…
Reference in a new issue