video: Add support for r210

This commit is contained in:
David Schleef 2011-02-25 19:37:07 -08:00
parent e0a658a664
commit 1265a42124
2 changed files with 40 additions and 3 deletions

View file

@ -367,7 +367,9 @@ gst_video_format_parse_caps (GstCaps * caps, GstVideoFormat * format,
}
have_alpha = gst_structure_get_int (structure, "alpha_mask", &alpha_mask);
if (depth == 24 && bpp == 32 && endianness == G_BIG_ENDIAN) {
if (depth == 30 && bpp == 32 && endianness == G_BIG_ENDIAN) {
*format = GST_VIDEO_FORMAT_r210;
} else if (depth == 24 && bpp == 32 && endianness == G_BIG_ENDIAN) {
*format = gst_video_format_from_rgb32_masks (red_mask, green_mask,
blue_mask);
if (*format == GST_VIDEO_FORMAT_UNKNOWN) {
@ -629,10 +631,20 @@ gst_video_format_new_caps (GstVideoFormat format, int width,
depth = 64;
have_alpha = TRUE;
break;
case GST_VIDEO_FORMAT_r210:
bpp = 32;
depth = 30;
have_alpha = FALSE;
break;
default:
return NULL;
}
if (bpp == 32 || bpp == 24 || bpp == 64) {
if (bpp == 32 && depth == 30) {
red_mask = 0x3ff00000;
green_mask = 0x000ffc00;
blue_mask = 0x000003ff;
have_alpha = FALSE;
} else if (bpp == 32 || bpp == 24 || bpp == 64) {
if (bpp == 32) {
mask = 0xff000000;
} else {
@ -1036,6 +1048,7 @@ gst_video_format_is_rgb (GstVideoFormat format)
case GST_VIDEO_FORMAT_BGR15:
case GST_VIDEO_FORMAT_RGB8_PALETTED:
case GST_VIDEO_FORMAT_ARGB64:
case GST_VIDEO_FORMAT_r210:
return TRUE;
default:
return FALSE;
@ -1095,6 +1108,7 @@ gst_video_format_is_yuv (GstVideoFormat format)
case GST_VIDEO_FORMAT_BGR15:
case GST_VIDEO_FORMAT_RGB8_PALETTED:
case GST_VIDEO_FORMAT_ARGB64:
case GST_VIDEO_FORMAT_r210:
return FALSE;
default:
return FALSE;
@ -1181,6 +1195,7 @@ gst_video_format_has_alpha (GstVideoFormat format)
case GST_VIDEO_FORMAT_BGR16:
case GST_VIDEO_FORMAT_RGB15:
case GST_VIDEO_FORMAT_BGR15:
case GST_VIDEO_FORMAT_r210:
return FALSE;
default:
return FALSE;
@ -1246,6 +1261,7 @@ gst_video_format_get_component_depth (GstVideoFormat format, int component)
return 8;
case GST_VIDEO_FORMAT_v210:
case GST_VIDEO_FORMAT_UYVP:
case GST_VIDEO_FORMAT_r210:
return 10;
case GST_VIDEO_FORMAT_Y16:
case GST_VIDEO_FORMAT_v216:
@ -1303,6 +1319,7 @@ gst_video_format_get_row_stride (GstVideoFormat format, int component,
case GST_VIDEO_FORMAT_BGRA:
case GST_VIDEO_FORMAT_ARGB:
case GST_VIDEO_FORMAT_ABGR:
case GST_VIDEO_FORMAT_r210:
return width * 4;
case GST_VIDEO_FORMAT_RGB16:
case GST_VIDEO_FORMAT_BGR16:
@ -1420,6 +1437,7 @@ gst_video_format_get_pixel_stride (GstVideoFormat format, int component)
case GST_VIDEO_FORMAT_BGRA:
case GST_VIDEO_FORMAT_ARGB:
case GST_VIDEO_FORMAT_ABGR:
case GST_VIDEO_FORMAT_r210:
return 4;
case GST_VIDEO_FORMAT_RGB16:
case GST_VIDEO_FORMAT_BGR16:
@ -1539,6 +1557,7 @@ gst_video_format_get_component_width (GstVideoFormat format,
case GST_VIDEO_FORMAT_RGB8_PALETTED:
case GST_VIDEO_FORMAT_ARGB64:
case GST_VIDEO_FORMAT_AYUV64:
case GST_VIDEO_FORMAT_r210:
return width;
case GST_VIDEO_FORMAT_A420:
if (component == 0 || component == 3) {
@ -1617,6 +1636,7 @@ gst_video_format_get_component_height (GstVideoFormat format,
case GST_VIDEO_FORMAT_IYU1:
case GST_VIDEO_FORMAT_ARGB64:
case GST_VIDEO_FORMAT_AYUV64:
case GST_VIDEO_FORMAT_r210:
return height;
case GST_VIDEO_FORMAT_A420:
if (component == 0 || component == 3) {
@ -1800,6 +1820,7 @@ gst_video_format_get_component_offset (GstVideoFormat format,
case GST_VIDEO_FORMAT_Y444:
return GST_ROUND_UP_4 (width) * height * component;
case GST_VIDEO_FORMAT_v210:
case GST_VIDEO_FORMAT_r210:
/* v210 is bit-packed, so this doesn't make sense */
return 0;
case GST_VIDEO_FORMAT_v216:
@ -1939,6 +1960,7 @@ gst_video_format_get_size (GstVideoFormat format, int width, int height)
case GST_VIDEO_FORMAT_BGRA:
case GST_VIDEO_FORMAT_ARGB:
case GST_VIDEO_FORMAT_ABGR:
case GST_VIDEO_FORMAT_r210:
return width * 4 * height;
case GST_VIDEO_FORMAT_RGB16:
case GST_VIDEO_FORMAT_BGR16:

View file

@ -71,6 +71,7 @@ G_BEGIN_DECLS
* @GST_VIDEO_FORMAT_IYU1: packed 4:1:1 YUV (Cb-Y0-Y1-Cr-Y2-Y3 ...) (Since: 0.10.32)
* @GST_VIDEO_FORMAT_ARGB64: rgb with alpha channel first, 16 bits per channel (Since: 0.10.33)
* @GST_VIDEO_FORMAT_AY64: packed 4:4:4 YUV with alpha channel, 16 bits per channel (A0-Y0-U0-V0 ...) (Since: 0.10.33)
* @GST_VIDEO_FORMAT_r210: packed 4:4:4 RGB, 10 bits per channel (Since: 0.10.33)
*
* Enum value describing the most common video formats.
*/
@ -116,7 +117,8 @@ typedef enum {
GST_VIDEO_FORMAT_YVU9,
GST_VIDEO_FORMAT_IYU1,
GST_VIDEO_FORMAT_ARGB64,
GST_VIDEO_FORMAT_AYUV64
GST_VIDEO_FORMAT_AYUV64,
GST_VIDEO_FORMAT_r210
} GstVideoFormat;
#define GST_VIDEO_BYTE1_MASK_32 "0xFF000000"
@ -313,6 +315,19 @@ typedef enum {
#define GST_VIDEO_CAPS_BGR_15 \
__GST_VIDEO_CAPS_MAKE_15 (3, 2, 1)
/* 30 bit */
#define GST_VIDEO_CAPS_r210 \
"video/x-raw-rgb, " \
"bpp = (int) 32, " \
"depth = (int) 30, " \
"endianness = (int) BIG_ENDIAN, " \
"red_mask = (int) 0x3ff00000, " \
"green_mask = (int) 0x000ffc00, " \
"blue_mask = (int) 0x000003ff, " \
"width = " GST_VIDEO_SIZE_RANGE ", " \
"height = " GST_VIDEO_SIZE_RANGE ", " \
"framerate = " GST_VIDEO_FPS_RANGE
/* 64 bit alpha */
#define GST_VIDEO_CAPS_ARGB_64 \