/* depths: bits, n_components, shift, depth */
#define DPTH0 0, 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
#define DPTH8 8, 1, { 0, 0, 0, 0 }, { 8, 0, 0, 0 }
+#define DPTH8_32 8, 2, { 0, 0, 0, 0 }, { 8, 32, 0, 0 }
#define DPTH888 8, 3, { 0, 0, 0, 0 }, { 8, 8, 8, 0 }
#define DPTH8888 8, 4, { 0, 0, 0, 0 }, { 8, 8, 8, 8 }
#define DPTH10_10_10 10, 3, { 0, 0, 0, 0 }, { 10, 10, 10, 0 }
/* pixel strides */
#define PSTR0 { 0, 0, 0, 0 }
#define PSTR1 { 1, 0, 0, 0 }
+#define PSTR14 { 1, 4, 0, 0 }
#define PSTR111 { 1, 1, 1, 0 }
#define PSTR1111 { 1, 1, 1, 1 }
#define PSTR122 { 1, 2, 2, 0 }
/* planes */
#define PLANE_NA 0, { 0, 0, 0, 0 }
#define PLANE0 1, { 0, 0, 0, 0 }
+#define PLANE01 2, { 0, 1, 0, 0 }
#define PLANE011 2, { 0, 1, 1, 0 }
#define PLANE012 3, { 0, 1, 2, 0 }
#define PLANE0123 4, { 0, 1, 2, 3 }
#define SUB420 { 0, 1, 1, 0 }, { 0, 1, 1, 0 }
#define SUB422 { 0, 1, 1, 0 }, { 0, 0, 0, 0 }
#define SUB4 { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
+#define SUB44 { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
#define SUB444 { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
#define SUB4444 { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
#define SUB4204 { 0, 1, 1, 0 }, { 0, 1, 1, 0 }
{ 0x00000000, {GST_VIDEO_FORMAT_ ##name, G_STRINGIFY(name), desc, GST_VIDEO_FORMAT_FLAG_RGB | GST_VIDEO_FORMAT_FLAG_LE, depth, pstride, plane, offs, sub, pack } }
#define MAKE_RGBA_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, 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_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 } }
MAKE_YUVA_FORMAT (A420, "raw video", GST_MAKE_FOURCC ('A', '4', '2', '0'),
DPTH8888,
PSTR1111, PLANE0123, OFFS0, SUB4204, PACK_A420),
- MAKE_RGBA_FORMAT (RGB8_PALETTED, "raw video", DPTH8888, PSTR1111, PLANE0,
- OFFS0, SUB4444, PACK_RGB8P),
+ 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),
format = gst_video_format_from_rgb16_masks (red_mask, green_mask,
blue_mask);
} else if (depth == 8 && bpp == 8) {
- format = GST_VIDEO_FORMAT_RGB8_PALETTED;
+ format = GST_VIDEO_FORMAT_RGB8P;
} else if (depth == 64 && bpp == 64) {
format = gst_video_format_from_rgba32_masks (red_mask, green_mask,
blue_mask, alpha_mask);
&& dinfo->height == sinfo->height, FALSE);
n_planes = dinfo->finfo->n_planes;
+ if (GST_VIDEO_FORMAT_INFO_HAS_PALETTE (sinfo->finfo)) {
+ memcpy (dest->data[1], src->data[1], 256 * 4);
+ n_planes = 1;
+ }
for (i = 0; i < n_planes; i++)
gst_video_frame_copy_plane (dest, src, i);
info->offset[0] = 0;
info->size = info->stride[0] * height;
break;
- case GST_VIDEO_FORMAT_RGB8_PALETTED:
+ case GST_VIDEO_FORMAT_RGB8P:
info->stride[0] = GST_ROUND_UP_4 (width);
+ info->stride[1] = 4;
info->offset[0] = 0;
- info->size = info->stride[0] * height;
+ info->offset[1] = info->stride[0] * height;
+ info->size = info->offset[1] + (4 * 256);
break;
case GST_VIDEO_FORMAT_IYU1:
info->stride[0] = GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) +
return TRUE;
}
-/**
- * gst_video_parse_caps_palette:
- * @caps: #GstCaps to parse
- *
- * Returns the palette data from the caps as a #GstBuffer. For
- * #GST_VIDEO_FORMAT_RGB8_PALETTED this is containing 256 #guint32
- * values, each containing ARGB colors in native endianness.
- *
- * Returns: a #GstBuffer containing the palette data. Unref after usage.
- * Since: 0.10.32
- */
-GstBuffer *
-gst_video_parse_caps_palette (GstCaps * caps)
-{
- GstStructure *s;
- const GValue *p_v;
- GstBuffer *p;
-
- if (!gst_caps_is_fixed (caps))
- return NULL;
-
- s = gst_caps_get_structure (caps, 0);
-
- p_v = gst_structure_get_value (s, "palette_data");
- if (!p_v || !GST_VALUE_HOLDS_BUFFER (p_v))
- return NULL;
-
- p = g_value_dup_boxed (p_v);
-
- return p;
-}
-
#define GST_VIDEO_EVENT_FORCE_KEY_UNIT_NAME "GstForceKeyUnit"
/**
* @GST_VIDEO_FORMAT_BGR15: reverse rgb 5-5-5 bits per component (Since: 0.10.30)
* @GST_VIDEO_FORMAT_UYVP: packed 10-bit 4:2:2 YUV (U0-Y0-V0-Y1 U2-Y2-V2-Y3 U4 ...) (Since: 0.10.31)
* @GST_VIDEO_FORMAT_A420: planar 4:4:2:0 AYUV (Since: 0.10.31)
- * @GST_VIDEO_FORMAT_RGB8_PALETTED: 8-bit paletted RGB (Since: 0.10.32)
+ * @GST_VIDEO_FORMAT_RGB8P: 8-bit paletted RGB (Since: 0.10.32)
* @GST_VIDEO_FORMAT_YUV9: planar 4:1:0 YUV (Since: 0.10.32)
* @GST_VIDEO_FORMAT_YVU9: planar 4:1:0 YUV (like YUV9 but UV planes swapped) (Since: 0.10.32)
* @GST_VIDEO_FORMAT_IYU1: packed 4:1:1 YUV (Cb-Y0-Y1-Cr-Y2-Y3 ...) (Since: 0.10.32)
GST_VIDEO_FORMAT_BGR15,
GST_VIDEO_FORMAT_UYVP,
GST_VIDEO_FORMAT_A420,
- GST_VIDEO_FORMAT_RGB8_PALETTED,
+ GST_VIDEO_FORMAT_RGB8P,
GST_VIDEO_FORMAT_YUV9,
GST_VIDEO_FORMAT_YVU9,
GST_VIDEO_FORMAT_IYU1,
* the number 3.
* @GST_VIDEO_FORMAT_FLAG_LE: The video format has data stored in little
* endianness.
- * @GST_VIDEO_FORMAT_FLAG_PALETTE: The video format has a palette.
+ * @GST_VIDEO_FORMAT_FLAG_PALETTE: The video format has a palette. The palette
+ * 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_COMPLEX = (1 << 6)
} GstVideoFormatFlags;
+/* YUV components */
#define GST_VIDEO_COMP_Y 0
#define GST_VIDEO_COMP_U 1
#define GST_VIDEO_COMP_V 2
+/* RGB components */
#define GST_VIDEO_COMP_R 0
#define GST_VIDEO_COMP_G 1
#define GST_VIDEO_COMP_B 2
+/* alpha component */
#define GST_VIDEO_COMP_A 3
+/* palette components */
+#define GST_VIDEO_COMP_INDEX 0
+#define GST_VIDEO_COMP_PALETTE 1
+
/**
* GstVideoPackFlags:
* @GST_VIDEO_PACK_FLAG_NONE: No flag
* @size: the default size of one frame
* @chroma_site: a #GstVideoChromaSite.
* @colorimetry: the colorimetry info
- * @palette: a buffer with palette data
* @par_n: the pixel-aspect-ratio numerator
* @par_d: the pixel-aspect-ratio demnominator
* @fps_n: the framerate numerator
GstVideoChromaSite chroma_site;
GstVideoColorimetry colorimetry;
- GstBuffer *palette;
-
gint par_n;
gint par_d;
gint fps_n;
#define GST_VIDEO_FORMATS_ALL "{ I420, YV12, YUY2, UYVY, AYUV, RGBx, " \
"BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, " \
"YVYU, Y444, v210, v216, NV12, NV21, GRAY8, GRAY16_BE, GRAY16_LE, " \
- "v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8_PALETTED, " \
- "YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE }"
+ "v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, " \
+ "IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE }"
/**
* GST_VIDEO_CAPS_MAKE:
guint display_par_n,
guint display_par_d);
-GstBuffer * gst_video_parse_caps_palette (GstCaps * caps);
-
/* video still frame event creation and parsing */
GstEvent * gst_video_event_new_still_frame (gboolean in_still);