diff options
Diffstat (limited to 'media-libs/gst-plugins-base/files/gst-0.10.32-0019-video-more-flexible-video-caps-utility.patch')
-rw-r--r-- | media-libs/gst-plugins-base/files/gst-0.10.32-0019-video-more-flexible-video-caps-utility.patch | 228 |
1 files changed, 228 insertions, 0 deletions
diff --git a/media-libs/gst-plugins-base/files/gst-0.10.32-0019-video-more-flexible-video-caps-utility.patch b/media-libs/gst-plugins-base/files/gst-0.10.32-0019-video-more-flexible-video-caps-utility.patch new file mode 100644 index 0000000..fcf4fd6 --- /dev/null +++ b/media-libs/gst-plugins-base/files/gst-0.10.32-0019-video-more-flexible-video-caps-utility.patch @@ -0,0 +1,228 @@ +From ecac5f6e2cab295e742784f6d4d11800b1f37c6d Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Mon, 13 Sep 2010 19:04:47 -0500 +Subject: [PATCH 19/24] video: more flexible video caps utility + +Add gst_video_format_new_caps_simple() to allow for more flexible video +caps builder, which could be used for template caps and non-fixed caps. +--- + gst-libs/gst/video/video.c | 129 ++++++++++++++++++++++++++------------------ + gst-libs/gst/video/video.h | 2 + + 2 files changed, 78 insertions(+), 53 deletions(-) + +diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c +index ff9c4fb..ef8edcc 100644 +--- a/gst-libs/gst/video/video.c ++++ b/gst-libs/gst/video/video.c +@@ -590,15 +590,12 @@ gst_video_format_new_caps_interlaced (GstVideoFormat format, + } + + /** +- * gst_video_format_new_caps_strided: ++ * gst_video_format_new_caps_simple: + * @format: the #GstVideoFormat describing the raw video format +- * @width: width of video +- * @height: height of video +- * @rowstride: the rowstride (in bytes), or 0 if no rowstride +- * @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 ++ * @rowstride: 0 for unstrided, -1 for any stride (unfixed), or other ++ * for fixed stride ++ * @fieldname: first field to set ++ * @...: additional arguments + * + * Creates a new #GstCaps object based on the parameters provided. + * +@@ -607,25 +604,20 @@ gst_video_format_new_caps_interlaced (GstVideoFormat format, + * Returns: a new #GstCaps object, or NULL if there was an error + */ + GstCaps * +-gst_video_format_new_caps_strided (GstVideoFormat format, +- int width, int height, int rowstride, +- int framerate_n, int framerate_d, int par_n, int par_d) ++gst_video_format_new_caps_simple (GstVideoFormat format, int rowstride, ++ const char *fieldname, ...) + { +- GstCaps *caps = NULL; ++ va_list varargs; ++ GstStructure *s; + + g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, NULL); +- g_return_val_if_fail (width > 0 && height > 0, NULL); + + if (gst_video_format_is_yuv (format)) { +- caps = gst_caps_new_simple ( +- rowstride ? "video/x-raw-yuv-strided" : "video/x-raw-yuv", ++ s = gst_structure_new (rowstride ? ++ "video/x-raw-yuv-strided" : "video/x-raw-yuv", + "format", GST_TYPE_FOURCC, gst_video_format_to_fourcc (format), +- "width", G_TYPE_INT, width, +- "height", G_TYPE_INT, height, +- "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d, +- "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL); ++ NULL); + } else if (gst_video_format_is_rgb (format)) { +- GstCaps *caps; + int red_mask = 0; + int blue_mask = 0; + int green_mask = 0; +@@ -684,15 +676,12 @@ gst_video_format_new_caps_strided (GstVideoFormat format, + } else { + mask = 0xff0000; + } +- red_mask = +- mask >> (8 * gst_video_format_get_component_offset (format, 0, +- width, height)); +- green_mask = +- mask >> (8 * gst_video_format_get_component_offset (format, 1, +- width, height)); +- blue_mask = +- mask >> (8 * gst_video_format_get_component_offset (format, 2, +- width, height)); ++ red_mask = mask >> ++ (8 * gst_video_format_get_component_offset (format, 0, 1, 1)); ++ green_mask = mask >> ++ (8 * gst_video_format_get_component_offset (format, 1, 1, 1)); ++ blue_mask = mask >> ++ (8 * gst_video_format_get_component_offset (format, 2, 1, 1)); + } else if (bpp == 16) { + switch (format) { + case GST_VIDEO_FORMAT_RGB16: +@@ -723,17 +712,13 @@ gst_video_format_new_caps_strided (GstVideoFormat format, + return NULL; + } + +- caps = gst_caps_new_simple ( ++ s = gst_structure_new ( + rowstride ? "video/x-raw-rgb-strided" : "video/x-raw-rgb", + "bpp", G_TYPE_INT, bpp, +- "depth", G_TYPE_INT, depth, +- "width", G_TYPE_INT, width, +- "height", G_TYPE_INT, height, +- "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d, +- "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL); ++ "depth", G_TYPE_INT, depth, NULL); + + if (bpp != 8) { +- gst_caps_set_simple (caps, ++ gst_structure_set (s, + "endianness", G_TYPE_INT, G_BIG_ENDIAN, + "red_mask", G_TYPE_INT, red_mask, + "green_mask", G_TYPE_INT, green_mask, +@@ -741,10 +726,12 @@ gst_video_format_new_caps_strided (GstVideoFormat format, + } + + if (have_alpha) { +- alpha_mask = +- mask >> (8 * gst_video_format_get_component_offset (format, 3, +- width, height)); +- gst_caps_set_simple (caps, "alpha_mask", G_TYPE_INT, alpha_mask, NULL); ++ /* note: we are passing a bogus width/height to get_component_offset(), ++ * but those parameters are ignored for the packed formats so it is ok ++ */ ++ alpha_mask = mask >> ++ (8 * gst_video_format_get_component_offset (format, 3, 1, 1)); ++ gst_structure_set (s, "alpha_mask", G_TYPE_INT, alpha_mask, NULL); + } + } else if (gst_video_format_is_gray (format)) { + int bpp; +@@ -770,32 +757,68 @@ gst_video_format_new_caps_strided (GstVideoFormat format, + } + + if (bpp > 8) { +- caps = gst_caps_new_simple ("video/x-raw-gray", ++ s = gst_structure_new (rowstride ? ++ "video/x-raw-gray-strided" : "video/x-raw-gray", + "bpp", G_TYPE_INT, bpp, + "depth", G_TYPE_INT, depth, +- "width", G_TYPE_INT, width, +- "height", G_TYPE_INT, height, +- "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d, +- "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL); ++ NULL); + } else { +- caps = gst_caps_new_simple ("video/x-raw-gray", ++ s = gst_structure_new (rowstride ? ++ "video/x-raw-gray-strided" : "video/x-raw-gray", + "bpp", G_TYPE_INT, bpp, + "depth", G_TYPE_INT, depth, + "endianness", G_TYPE_INT, G_BIG_ENDIAN, +- "width", G_TYPE_INT, width, +- "height", G_TYPE_INT, height, +- "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d, +- "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL); ++ NULL); + } + } else { + return NULL; + } + +- if (rowstride) { +- gst_caps_set_simple (caps, "rowstride", G_TYPE_INT, rowstride, NULL); ++ if (rowstride > 0) { ++ gst_structure_set (s, "rowstride", ++ G_TYPE_INT, rowstride, NULL); ++ } else if (rowstride < 0) { ++ gst_structure_set (s, "rowstride", ++ GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); + } + +- return caps; ++ va_start (varargs, fieldname); ++ gst_structure_set_valist (s, fieldname, varargs); ++ va_end (varargs); ++ ++ return gst_caps_new_full (s, NULL); ++} ++ ++/** ++ * gst_video_format_new_caps_strided: ++ * @format: the #GstVideoFormat describing the raw video format ++ * @width: width of video ++ * @height: height of video ++ * @rowstride: the rowstride (in bytes), or 0 if no rowstride ++ * @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: ??? ++ * ++ * Returns: a new #GstCaps object, or NULL if there was an error ++ */ ++GstCaps * ++gst_video_format_new_caps_strided (GstVideoFormat format, ++ int width, int height, int rowstride, ++ int framerate_n, int framerate_d, int par_n, int par_d) ++{ ++ g_return_val_if_fail (width > 0 && height > 0, NULL); ++ ++ return gst_video_format_new_caps_simple (format, rowstride, ++ "width", G_TYPE_INT, width, ++ "height", G_TYPE_INT, height, ++ "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d, ++ "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, ++ NULL); + } + + /** +diff --git a/gst-libs/gst/video/video.h b/gst-libs/gst/video/video.h +index 5bac21f..bbd33f7 100644 +--- a/gst-libs/gst/video/video.h ++++ b/gst-libs/gst/video/video.h +@@ -430,6 +430,8 @@ GstCaps * gst_video_format_new_caps_interlaced (GstVideoFormat format, + GstCaps * gst_video_format_new_caps_strided (GstVideoFormat format, + int width, int height, int rowstride, + int framerate_n, int framerate_d, int par_n, int par_d); ++GstCaps * gst_video_format_new_caps_simple (GstVideoFormat format, ++ int rowstride, const char *fieldname, ...); + GstVideoFormat gst_video_format_from_fourcc (guint32 fourcc); + guint32 gst_video_format_to_fourcc (GstVideoFormat format); + gboolean gst_video_format_is_rgb (GstVideoFormat format); +-- +1.7.1 + |