Commit c2112cb4 authored by Wim Taymans's avatar Wim Taymans
Browse files

video: mark unpack formats with a flag

Add a new _UNPACK flag and use it to mark potential unpack formats.
parent 462c4cc3
......@@ -1337,6 +1337,8 @@ typedef struct
{ fourcc, {GST_VIDEO_FORMAT_ ##name, G_STRINGIFY(name), desc, GST_VIDEO_FORMAT_FLAG_YUV | GST_VIDEO_FORMAT_FLAG_LE, depth, pstride, plane, offs, sub, pack } }
#define MAKE_YUVA_FORMAT(name, desc, fourcc, depth, pstride, plane, offs, sub, pack) \
{ fourcc, {GST_VIDEO_FORMAT_ ##name, G_STRINGIFY(name), desc, GST_VIDEO_FORMAT_FLAG_YUV | GST_VIDEO_FORMAT_FLAG_ALPHA, depth, pstride, plane, offs, sub, pack } }
#define MAKE_YUVA_PACK_FORMAT(name, desc, fourcc, depth, pstride, plane, offs, sub, pack) \
{ fourcc, {GST_VIDEO_FORMAT_ ##name, G_STRINGIFY(name), desc, GST_VIDEO_FORMAT_FLAG_YUV | GST_VIDEO_FORMAT_FLAG_ALPHA | GST_VIDEO_FORMAT_FLAG_UNPACK, depth, pstride, plane, offs, sub, pack } }
#define MAKE_YUV_C_FORMAT(name, desc, fourcc, depth, pstride, plane, offs, sub, pack) \
{ fourcc, {GST_VIDEO_FORMAT_ ##name, G_STRINGIFY(name), desc, GST_VIDEO_FORMAT_FLAG_YUV | GST_VIDEO_FORMAT_FLAG_COMPLEX, depth, pstride, plane, offs, sub, pack } }
......@@ -1348,6 +1350,8 @@ typedef struct
{ 0x00000000, {GST_VIDEO_FORMAT_ ##name, G_STRINGIFY(name), desc, GST_VIDEO_FORMAT_FLAG_RGB | GST_VIDEO_FORMAT_FLAG_ALPHA, depth, pstride, plane, offs, sub, pack } }
#define MAKE_RGBAP_FORMAT(name, desc, depth, pstride, plane, offs, sub, pack) \
{ 0x00000000, {GST_VIDEO_FORMAT_ ##name, G_STRINGIFY(name), desc, GST_VIDEO_FORMAT_FLAG_RGB | GST_VIDEO_FORMAT_FLAG_ALPHA | GST_VIDEO_FORMAT_FLAG_PALETTE, depth, pstride, plane, offs, sub, pack } }
#define MAKE_RGBA_PACK_FORMAT(name, desc, depth, pstride, plane, offs, sub, pack) \
{ 0x00000000, {GST_VIDEO_FORMAT_ ##name, G_STRINGIFY(name), desc, GST_VIDEO_FORMAT_FLAG_RGB | GST_VIDEO_FORMAT_FLAG_ALPHA | GST_VIDEO_FORMAT_FLAG_UNPACK, depth, pstride, plane, offs, sub, pack } }
#define MAKE_GRAY_FORMAT(name, desc, depth, pstride, plane, offs, sub, pack) \
{ 0x00000000, {GST_VIDEO_FORMAT_ ##name, G_STRINGIFY(name), desc, GST_VIDEO_FORMAT_FLAG_GRAY, depth, pstride, plane, offs, sub, pack } }
......@@ -1356,26 +1360,20 @@ typedef struct
static VideoFormat formats[] = {
{0x00000000, {GST_VIDEO_FORMAT_UNKNOWN, "UNKNOWN", "unknown video", 0, DPTH0,
PSTR0, PLANE_NA,
OFFS0}},
PSTR0, PLANE_NA, OFFS0}},
{0x00000000, {GST_VIDEO_FORMAT_ENCODED, "ENCODED", "encoded video",
GST_VIDEO_FORMAT_FLAG_COMPLEX, DPTH0, PSTR0, PLANE_NA, OFFS0}},
MAKE_YUV_FORMAT (I420, "raw video", GST_MAKE_FOURCC ('I', '4', '2', '0'),
DPTH888, PSTR111,
PLANE012, OFFS0, SUB420, PACK_420),
DPTH888, PSTR111, PLANE012, OFFS0, SUB420, PACK_420),
MAKE_YUV_FORMAT (YV12, "raw video", GST_MAKE_FOURCC ('Y', 'V', '1', '2'),
DPTH888, PSTR111,
PLANE021, OFFS0, SUB420, PACK_420),
DPTH888, PSTR111, PLANE021, OFFS0, SUB420, PACK_420),
MAKE_YUV_FORMAT (YUY2, "raw video", GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'),
DPTH888, PSTR244,
PLANE0, OFFS013, SUB422, PACK_YUY2),
DPTH888, PSTR244, PLANE0, OFFS013, SUB422, PACK_YUY2),
MAKE_YUV_FORMAT (UYVY, "raw video", GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'),
DPTH888, PSTR244,
PLANE0, OFFS102, SUB422, PACK_UYVY),
MAKE_YUVA_FORMAT (AYUV, "raw video", GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'),
DPTH8888,
PSTR4444, PLANE0, OFFS1230, SUB4444, PACK_AYUV),
DPTH888, PSTR244, PLANE0, OFFS102, SUB422, PACK_UYVY),
MAKE_YUVA_PACK_FORMAT (AYUV, "raw video", GST_MAKE_FOURCC ('A', 'Y', 'U',
'V'), DPTH8888, PSTR4444, PLANE0, OFFS1230, SUB4444, PACK_AYUV),
MAKE_RGB_FORMAT (RGBx, "raw video", DPTH888, PSTR444, PLANE0, OFFS012,
SUB444, PACK_RGBA),
MAKE_RGB_FORMAT (BGRx, "raw video", DPTH888, PSTR444, PLANE0, OFFS210,
......@@ -1388,8 +1386,8 @@ static VideoFormat formats[] = {
SUB4444, PACK_RGBA),
MAKE_RGBA_FORMAT (BGRA, "raw video", DPTH8888, PSTR4444, PLANE0, OFFS2103,
SUB4444, PACK_BGRA),
MAKE_RGBA_FORMAT (ARGB, "raw video", DPTH8888, PSTR4444, PLANE0, OFFS1230,
SUB4444, PACK_ARGB),
MAKE_RGBA_PACK_FORMAT (ARGB, "raw video", DPTH8888, PSTR4444, PLANE0,
OFFS1230, SUB4444, PACK_ARGB),
MAKE_RGBA_FORMAT (ABGR, "raw video", DPTH8888, PSTR4444, PLANE0, OFFS3210,
SUB4444, PACK_ABGR),
MAKE_RGB_FORMAT (RGB, "raw video", DPTH888, PSTR333, PLANE0, OFFS012, SUB444,
......@@ -1398,29 +1396,21 @@ static VideoFormat formats[] = {
PACK_BGR),
MAKE_YUV_FORMAT (Y41B, "raw video", GST_MAKE_FOURCC ('Y', '4', '1', 'B'),
DPTH888, PSTR111,
PLANE012, OFFS0, SUB411, PACK_Y41B),
DPTH888, PSTR111, PLANE012, OFFS0, SUB411, PACK_Y41B),
MAKE_YUV_FORMAT (Y42B, "raw video", GST_MAKE_FOURCC ('Y', '4', '2', 'B'),
DPTH888, PSTR111,
PLANE012, OFFS0, SUB422, PACK_Y42B),
DPTH888, PSTR111, PLANE012, OFFS0, SUB422, PACK_Y42B),
MAKE_YUV_FORMAT (YVYU, "raw video", GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'),
DPTH888, PSTR244,
PLANE0, OFFS031, SUB422, PACK_YVYU),
DPTH888, PSTR244, PLANE0, OFFS031, SUB422, PACK_YVYU),
MAKE_YUV_FORMAT (Y444, "raw video", GST_MAKE_FOURCC ('Y', '4', '4', '4'),
DPTH888, PSTR111,
PLANE012, OFFS0, SUB444, PACK_Y444),
DPTH888, PSTR111, PLANE012, OFFS0, SUB444, PACK_Y444),
MAKE_YUV_C_FORMAT (v210, "raw video", GST_MAKE_FOURCC ('v', '2', '1', '0'),
DPTH10_10_10,
PSTR0, PLANE0, OFFS0, SUB422, PACK_v210),
DPTH10_10_10, PSTR0, PLANE0, OFFS0, SUB422, PACK_v210),
MAKE_YUV_FORMAT (v216, "raw video", GST_MAKE_FOURCC ('v', '2', '1', '6'),
DPTH16_16_16,
PSTR488, PLANE0, OFFS204, SUB422, PACK_v216),
DPTH16_16_16, PSTR488, PLANE0, OFFS204, SUB422, PACK_v216),
MAKE_YUV_FORMAT (NV12, "raw video", GST_MAKE_FOURCC ('N', 'V', '1', '2'),
DPTH888, PSTR122,
PLANE011, OFFS001, SUB420, PACK_NV12),
DPTH888, PSTR122, PLANE011, OFFS001, SUB420, PACK_NV12),
MAKE_YUV_FORMAT (NV21, "raw video", GST_MAKE_FOURCC ('N', 'V', '2', '1'),
DPTH888, PSTR122,
PLANE011, OFFS010, SUB420, PACK_NV21),
DPTH888, PSTR122, PLANE011, OFFS010, SUB420, PACK_NV21),
MAKE_GRAY_FORMAT (GRAY8, "raw video", DPTH8, PSTR1, PLANE0, OFFS0, SUB4,
PACK_GRAY8),
......@@ -1430,8 +1420,7 @@ static VideoFormat formats[] = {
SUB4, PACK_GRAY16_LE),
MAKE_YUV_FORMAT (v308, "raw video", GST_MAKE_FOURCC ('v', '3', '0', '8'),
DPTH888, PSTR333,
PLANE0, OFFS012, SUB444, PACK_v308),
DPTH888, PSTR333, PLANE0, OFFS012, SUB444, PACK_v308),
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
MAKE_RGB_LE_FORMAT (RGB16, "raw video", DPTH565, PSTR222, PLANE0, OFFS0,
......@@ -1454,31 +1443,23 @@ static VideoFormat formats[] = {
#endif
MAKE_YUV_C_FORMAT (UYVP, "raw video", GST_MAKE_FOURCC ('U', 'Y', 'V', 'P'),
DPTH10_10_10,
PSTR0, PLANE0, OFFS0, SUB422, PACK_UYVP),
DPTH10_10_10, PSTR0, PLANE0, OFFS0, SUB422, PACK_UYVP),
MAKE_YUVA_FORMAT (A420, "raw video", GST_MAKE_FOURCC ('A', '4', '2', '0'),
DPTH8888,
PSTR1111, PLANE0123, OFFS0, SUB4204, PACK_A420),
DPTH8888, PSTR1111, PLANE0123, OFFS0, SUB4204, PACK_A420),
MAKE_RGBAP_FORMAT (RGB8P, "raw video", DPTH8_32, PSTR14, PLANE01,
OFFS0, SUB44, PACK_RGB8P),
MAKE_YUV_FORMAT (YUV9, "raw video", GST_MAKE_FOURCC ('Y', 'U', 'V', '9'),
DPTH888, PSTR111,
PLANE012, OFFS0, SUB410, PACK_410),
DPTH888, PSTR111, PLANE012, OFFS0, SUB410, PACK_410),
MAKE_YUV_FORMAT (YVU9, "raw video", GST_MAKE_FOURCC ('Y', 'V', 'U', '9'),
DPTH888, PSTR111,
PLANE021, OFFS0, SUB410, PACK_410),
DPTH888, PSTR111, PLANE021, OFFS0, SUB410, PACK_410),
MAKE_YUV_FORMAT (IYU1, "raw video", GST_MAKE_FOURCC ('I', 'Y', 'U', '1'),
DPTH888, PSTR0,
PLANE0, OFFS104, SUB411, PACK_IYU1),
MAKE_RGBA_FORMAT (ARGB64, "raw video", DPTH16_16_16_16, PSTR8888, PLANE0,
OFFS2460,
SUB444, PACK_ARGB64),
MAKE_YUVA_FORMAT (AYUV64, "raw video", 0x00000000, DPTH16_16_16_16, PSTR8888,
PLANE0,
OFFS2460, SUB444, PACK_AYUV64),
DPTH888, PSTR0, PLANE0, OFFS104, SUB411, PACK_IYU1),
MAKE_RGBA_PACK_FORMAT (ARGB64, "raw video", DPTH16_16_16_16, PSTR8888, PLANE0,
OFFS2460, SUB444, PACK_ARGB64),
MAKE_YUVA_PACK_FORMAT (AYUV64, "raw video", 0x00000000, DPTH16_16_16_16,
PSTR8888, PLANE0, OFFS2460, SUB444, PACK_AYUV64),
MAKE_YUV_FORMAT (r210, "raw video", GST_MAKE_FOURCC ('r', '2', '1', '0'),
DPTH10_10_10,
PSTR444, PLANE0, OFFS0, SUB444, PACK_r210),
DPTH10_10_10, PSTR444, PLANE0, OFFS0, SUB444, PACK_r210),
MAKE_YUV_FORMAT (I420_10BE, "raw video", 0x00000000, DPTH10_10_10,
PSTR222, PLANE012, OFFS0, SUB420, PACK_I420_10BE),
MAKE_YUV_LE_FORMAT (I420_10LE, "raw video", 0x00000000, DPTH10_10_10,
......
......@@ -173,6 +173,8 @@ const gchar * gst_video_chroma_to_string (GstVideoChromaSite site);
* is stored in the second plane and indexes are stored in the first plane.
* @GST_VIDEO_FORMAT_FLAG_COMPLEX: The video format has a complex layout that
* can't be described with the usual information in the #GstVideoFormatInfo.
* @GST_VIDEO_FORMAT_FLAG_UNPACK: This format can be used in a
* #GstVideoFormatUnpack and #GstVideoFormatPack function.
*
* The different video flags that a format info can have.
*/
......@@ -184,7 +186,8 @@ typedef enum
GST_VIDEO_FORMAT_FLAG_ALPHA = (1 << 3),
GST_VIDEO_FORMAT_FLAG_LE = (1 << 4),
GST_VIDEO_FORMAT_FLAG_PALETTE = (1 << 5),
GST_VIDEO_FORMAT_FLAG_COMPLEX = (1 << 6)
GST_VIDEO_FORMAT_FLAG_COMPLEX = (1 << 6),
GST_VIDEO_FORMAT_FLAG_UNPACK = (1 << 7)
} GstVideoFormatFlags;
/* YUV components */
......@@ -290,7 +293,8 @@ typedef void (*GstVideoFormatPack) (const GstVideoFormatInfo *info,
* GST_VIDEO_SUB_SCALE to scale a width.
* @h_sub: subsampling factor of the height for the component. Use
* GST_VIDEO_SUB_SCALE to scale a height.
* @unpack_format: the format of the unpacked pixels.
* @unpack_format: the format of the unpacked pixels. This format must have the
* #GST_VIDEO_FORMAT_FLAG_UNPACK flag set.
* @unpack_func: an unpack function for this format
* @pack_lines: the amount of lines that will be packed
* @pack_func: an pack function for this format
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment