} else if (gst_structure_has_name (structure, "video/x-raw-rgb")) {
int depth;
int bpp;
- int endianness;
- int red_mask;
- int green_mask;
- int blue_mask;
- int alpha_mask;
+ int endianness = 0;
+ int red_mask = 0;
+ int green_mask = 0;
+ int blue_mask = 0;
+ int alpha_mask = 0;
gboolean have_alpha;
ok &= gst_structure_get_int (structure, "depth", &depth);
ok &= gst_structure_get_int (structure, "bpp", &bpp);
- ok &= gst_structure_get_int (structure, "endianness", &endianness);
- ok &= gst_structure_get_int (structure, "red_mask", &red_mask);
- ok &= gst_structure_get_int (structure, "green_mask", &green_mask);
- ok &= gst_structure_get_int (structure, "blue_mask", &blue_mask);
+
+ if (bpp != 8) {
+ ok &= gst_structure_get_int (structure, "endianness", &endianness);
+ ok &= gst_structure_get_int (structure, "red_mask", &red_mask);
+ ok &= gst_structure_get_int (structure, "green_mask", &green_mask);
+ ok &= gst_structure_get_int (structure, "blue_mask", &blue_mask);
+ }
have_alpha = gst_structure_get_int (structure, "alpha_mask", &alpha_mask);
if (depth == 24 && bpp == 32 && endianness == G_BIG_ENDIAN) {
if (*format == GST_VIDEO_FORMAT_UNKNOWN) {
ok = FALSE;
}
+ } else if (depth == 8 && bpp == 8) {
+ *format = GST_VIDEO_FORMAT_RGB8_PALETTED;
} else {
ok = FALSE;
}
depth = 15;
have_alpha = FALSE;
break;
+ case GST_VIDEO_FORMAT_RGB8_PALETTED:
+ bpp = 8;
+ depth = 8;
+ have_alpha = FALSE;
default:
return NULL;
}
default:
return NULL;
}
- } else {
+ } else if (bpp != 8) {
return NULL;
}
caps = gst_caps_new_simple ("video/x-raw-rgb",
"bpp", G_TYPE_INT, bpp,
"depth", G_TYPE_INT, depth,
- "endianness", G_TYPE_INT, G_BIG_ENDIAN,
- "red_mask", G_TYPE_INT, red_mask,
- "green_mask", G_TYPE_INT, green_mask,
- "blue_mask", G_TYPE_INT, blue_mask,
"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);
+
+ if (bpp != 8) {
+ gst_caps_set_simple (caps,
+ "endianness", G_TYPE_INT, G_BIG_ENDIAN,
+ "red_mask", G_TYPE_INT, red_mask,
+ "green_mask", G_TYPE_INT, green_mask,
+ "blue_mask", G_TYPE_INT, blue_mask, NULL);
+ }
+
if (have_alpha) {
alpha_mask =
mask >> (8 * gst_video_format_get_component_offset (format, 3,
case GST_VIDEO_FORMAT_BGR16:
case GST_VIDEO_FORMAT_RGB15:
case GST_VIDEO_FORMAT_BGR15:
+ case GST_VIDEO_FORMAT_RGB8_PALETTED:
return TRUE;
default:
return FALSE;
case GST_VIDEO_FORMAT_BGR16:
case GST_VIDEO_FORMAT_RGB15:
case GST_VIDEO_FORMAT_BGR15:
+ case GST_VIDEO_FORMAT_RGB8_PALETTED:
return FALSE;
default:
return FALSE;
case GST_VIDEO_FORMAT_ARGB:
case GST_VIDEO_FORMAT_ABGR:
case GST_VIDEO_FORMAT_A420:
+ case GST_VIDEO_FORMAT_RGB8_PALETTED:
return TRUE;
case GST_VIDEO_FORMAT_RGBx:
case GST_VIDEO_FORMAT_BGRx:
} else {
return GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2);
}
+ case GST_VIDEO_FORMAT_RGB8_PALETTED:
+ return GST_ROUND_UP_4 (width);
default:
return 0;
}
case GST_VIDEO_FORMAT_UYVP:
/* UYVP is packed at the bit level, so pixel stride doesn't make sense */
return 0;
+ case GST_VIDEO_FORMAT_RGB8_PALETTED:
+ return 1;
default:
return 0;
}
case GST_VIDEO_FORMAT_GRAY16_LE:
case GST_VIDEO_FORMAT_Y800:
case GST_VIDEO_FORMAT_Y16:
+ case GST_VIDEO_FORMAT_RGB8_PALETTED:
return width;
case GST_VIDEO_FORMAT_A420:
if (component == 0 || component == 3) {
case GST_VIDEO_FORMAT_Y800:
case GST_VIDEO_FORMAT_Y16:
case GST_VIDEO_FORMAT_UYVP:
+ case GST_VIDEO_FORMAT_RGB8_PALETTED:
return height;
case GST_VIDEO_FORMAT_A420:
if (component == 0 || component == 3) {
2 * GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2) *
(GST_ROUND_UP_2 (height) / 2);
}
+ case GST_VIDEO_FORMAT_RGB8_PALETTED:
+ return 0;
default:
return 0;
}
return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) * 3 / 2;
case GST_VIDEO_FORMAT_GRAY8:
case GST_VIDEO_FORMAT_Y800:
+ case GST_VIDEO_FORMAT_RGB8_PALETTED:
return GST_ROUND_UP_4 (width) * height;
case GST_VIDEO_FORMAT_GRAY16_BE:
case GST_VIDEO_FORMAT_GRAY16_LE:
*in_still = ev_still_state;
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 = gst_buffer_ref (gst_value_get_buffer (p_v));
+
+ return p;
+}
* @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)
*
* Enum value describing the most common video formats.
*/
GST_VIDEO_FORMAT_RGB15,
GST_VIDEO_FORMAT_BGR15,
GST_VIDEO_FORMAT_UYVP,
- GST_VIDEO_FORMAT_A420
+ GST_VIDEO_FORMAT_A420,
+ GST_VIDEO_FORMAT_RGB8_PALETTED
} GstVideoFormat;
#define GST_VIDEO_BYTE1_MASK_32 "0xFF000000"
#define GST_VIDEO_CAPS_BGR_15 \
__GST_VIDEO_CAPS_MAKE_15 (3, 2, 1)
+/**
+ * GST_VIDEO_CAPS_RGB8_PALETTED:
+ *
+ * Generic caps string for 8-bit paletted RGB video, for use in pad templates.
+ *
+ * Since: 0.10.32
+ */
+#define GST_VIDEO_CAPS_RGB8_PALETTED \
+ "video/x-raw-rgb, bpp = (int)8, depth = (int)8, " \
+ "width = "GST_VIDEO_SIZE_RANGE" , " \
+ "height = " GST_VIDEO_SIZE_RANGE ", " \
+ "framerate = "GST_VIDEO_FPS_RANGE
+
/**
* GST_VIDEO_CAPS_YUV:
* @fourcc: YUV fourcc format that describes the pixel layout, as string
int *par_n, int *par_d);
const char *gst_video_parse_caps_color_matrix (GstCaps * caps);
const char *gst_video_parse_caps_chroma_site (GstCaps * caps);
+GstBuffer *gst_video_parse_caps_palette (GstCaps * caps);
GstCaps * gst_video_format_new_caps (GstVideoFormat format,
int width, int height, int framerate_n, int framerate_d,
int par_n, int par_d);