static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN "; "
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (" { "
#if G_BYTE_ORDER == G_BIG_ENDIAN
- GST_VIDEO_CAPS_RGB "; "
+ "\"xRGB\", " "\"RGB\", "
#else
- GST_VIDEO_CAPS_BGR "; "
+ "\"BGRx\", " "\"BGR\", "
#endif
- GST_VIDEO_CAPS_RGB_16)
+ "\"RGB16\" } "))
);
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_DEBUG_OBJECT (visual, "libvisual plugin supports depths %u (0x%04x)",
depths, depths);
/* if (depths & VISUAL_VIDEO_DEPTH_32BIT) Always supports 32bit output */
- gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN));
+#if G_BYTE_ORDER == G_BIG_ENDIAN
+ gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("xRGB")));
+#else
+ gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("BGRx")));
+#endif
if (depths & VISUAL_VIDEO_DEPTH_24BIT) {
#if G_BYTE_ORDER == G_BIG_ENDIAN
- gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_RGB));
+ gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("RGB")));
#else
- gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_BGR));
+ gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("BGR")));
#endif
}
if (depths & VISUAL_VIDEO_DEPTH_16BIT) {
- gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_RGB_16));
+ gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("RGB16")));
}
beach:
gboolean res;
GstStructure *structure;
gint depth, pitch;
+ const gchar *fmt;
structure = gst_caps_get_structure (caps, 0);
goto error;
if (!gst_structure_get_int (structure, "height", &visual->height))
goto error;
- if (!gst_structure_get_int (structure, "bpp", &depth))
+ if (!(fmt = gst_structure_get_string (structure, "format")))
goto error;
if (!gst_structure_get_fraction (structure, "framerate", &visual->fps_n,
&visual->fps_d))
goto error;
+ if (!strcmp (fmt, "BGR") || !strcmp (fmt, "RGB"))
+ depth = 24;
+ else if (!strcmp (fmt, "BGRx") || !strcmp (fmt, "xRGB"))
+ depth = 32;
+ else
+ depth = 16;
+
visual_video_set_depth (visual->video,
visual_video_depth_enum_from_value (depth));
visual_video_set_dimension (visual->video, visual->width, visual->height);
target = gst_caps_copy (caps);
gst_caps_unref (caps);
}
+ GST_DEBUG_OBJECT (visual, "before fixate caps %" GST_PTR_FORMAT, target);
/* fixate in case something is not fixed. This does nothing if the value is
* already fixed. For video we always try to fixate to something like
* 320x240x25 by convention. */
structure = gst_caps_get_structure (target, 0);
gst_structure_fixate_field_nearest_int (structure, "width", DEFAULT_WIDTH);
+ gst_structure_fixate_field_nearest_int (structure, "width", DEFAULT_WIDTH);
gst_structure_fixate_field_nearest_int (structure, "height", DEFAULT_HEIGHT);
gst_structure_fixate_field_nearest_fraction (structure, "framerate",
DEFAULT_FPS_N, DEFAULT_FPS_D);
+ gst_pad_fixate_caps (visual->srcpad, target);
+
+ GST_DEBUG_OBJECT (visual, "after fixate caps %" GST_PTR_FORMAT, target);
+
gst_visual_src_setcaps (visual, target);
/* try to get a bufferpool now */
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
visual->actor =
- visual_actor_new (GST_VISUAL_GET_CLASS (visual)->plugin->info->
- plugname);
+ visual_actor_new (GST_VISUAL_GET_CLASS (visual)->plugin->
+ info->plugname);
visual->video = visual_video_new ();
visual->audio = visual_audio_new ();
/* can't have a play without actors */
* <refsect2>
* <title>Example pipelines</title>
* |[
- * gst-launch v4l2src num-buffers=500 ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! theoraenc ! oggmux ! filesink location=video.ogg
+ * gst-launch v4l2src num-buffers=500 ! video/x-raw,width=320,height=240 ! ffmpegcolorspace ! theoraenc ! oggmux ! filesink location=video.ogg
* ]| Encodes a video stream captured from a v4l2-compatible camera to Ogg/Theora
* (the encoding will stop automatically after 500 frames)
* </refsect2>
PROP_LAST
};
+#define VIDEO_FORMATS "{ BGRx, RGBx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, AYUV, I420, UYVY, NV12, NV21 } "
+
static GstStaticPadTemplate src_template_factory =
- GST_STATIC_PAD_TEMPLATE ("src",
+GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx ";"
- GST_VIDEO_CAPS_RGBx ";"
- GST_VIDEO_CAPS_xRGB ";"
- GST_VIDEO_CAPS_xBGR ";"
- GST_VIDEO_CAPS_RGBA ";"
- GST_VIDEO_CAPS_BGRA ";"
- GST_VIDEO_CAPS_ARGB ";"
- GST_VIDEO_CAPS_ABGR ";"
- GST_VIDEO_CAPS_YUV ("{AYUV, I420, UYVY, NV12, NV21}"))
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (VIDEO_FORMATS))
);
static GstStaticPadTemplate video_sink_template_factory =
- GST_STATIC_PAD_TEMPLATE ("video_sink",
+GST_STATIC_PAD_TEMPLATE ("video_sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx ";"
- GST_VIDEO_CAPS_RGBx ";"
- GST_VIDEO_CAPS_xRGB ";"
- GST_VIDEO_CAPS_xBGR ";"
- GST_VIDEO_CAPS_RGBA ";"
- GST_VIDEO_CAPS_BGRA ";"
- GST_VIDEO_CAPS_ARGB ";"
- GST_VIDEO_CAPS_ABGR ";"
- GST_VIDEO_CAPS_YUV ("{AYUV, I420, UYVY, NV12, NV21}"))
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (VIDEO_FORMATS))
);
#define GST_TYPE_BASE_TEXT_OVERLAY_VALIGN (gst_base_text_overlay_valign_get_type())
PROP_FONT_DESC
};
+#define VIDEO_FORMATS "{ AYUV, ARGB } "
static GstStaticPadTemplate src_template_factory =
- GST_STATIC_PAD_TEMPLATE ("src",
+GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("AYUV") ";" GST_VIDEO_CAPS_ARGB)
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (VIDEO_FORMATS))
);
static GstStaticPadTemplate sink_template_factory =
/* Check if AYUV or ARGB is first */
for (i = 0; i < n; i++) {
- GstStructure *s = gst_caps_get_structure (peer_caps, i);
- if (gst_structure_has_name (s, "video/x-raw-rgb") &&
- gst_structure_has_field (s, "alpha_mask")) {
- render->use_ARGB = TRUE;
- break;
- } else if (gst_structure_has_name (s, "video/x-raw-yuv")) {
- guint fourcc;
- if (gst_structure_get_fourcc (s, "format", &fourcc) &&
- fourcc == GST_MAKE_FOURCC ('A', 'Y', 'U', 'V')) {
- render->use_ARGB = FALSE;
- break;
- }
- }
+ GstStructure *s;
+ GstVideoFormat vformat;
+ const gchar *fmt;
+
+ s = gst_caps_get_structure (peer_caps, i);
+ if (!gst_structure_has_name (s, "video/x-raw"))
+ continue;
+
+ fmt = gst_structure_get_string (s, "format");
+ if (fmt == NULL)
+ continue;
+
+ vformat = gst_video_format_from_string (fmt);
+ render->use_ARGB = gst_video_format_has_alpha (vformat);
}
gst_caps_unref (peer_caps);
}
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-yuv, "
- "format = (fourcc) { I420, Y42B, Y444 }, "
+ GST_STATIC_CAPS ("video/x-raw, "
+ "format = (string) { I420, Y42B, Y444 }, "
"framerate = (fraction) [0/1, MAX], "
"width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]")
);
gint par_num, par_den;
GstFlowReturn ret = GST_FLOW_OK;
GList *walk;
- guint32 fourcc;
GST_DEBUG_OBJECT (dec, "fps %d/%d, PAR %d/%d",
dec->info.fps_numerator, dec->info.fps_denominator,
case TH_PF_444:
dec->output_bpp = 24;
dec->format = GST_VIDEO_FORMAT_Y444;
- fourcc = GST_MAKE_FOURCC ('Y', '4', '4', '4');
break;
case TH_PF_420:
dec->output_bpp = 12; /* Average bits per pixel. */
dec->format = GST_VIDEO_FORMAT_I420;
- fourcc = GST_MAKE_FOURCC ('I', '4', '2', '0');
break;
case TH_PF_422:
dec->output_bpp = 16;
dec->format = GST_VIDEO_FORMAT_Y42B;
- fourcc = GST_MAKE_FOURCC ('Y', '4', '2', 'B');
break;
default:
goto invalid_format;
GST_WARNING_OBJECT (dec, "Could not enable BITS mode visualisation");
}
- caps = gst_caps_new_simple ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, fourcc,
+ caps = gst_caps_new_simple ("video/x-raw",
+ "format", G_TYPE_STRING, gst_video_format_to_string (dec->format),
"framerate", GST_TYPE_FRACTION,
dec->info.fps_numerator, dec->info.fps_denominator,
"pixel-aspect-ratio", GST_TYPE_FRACTION, par_num, par_den,
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-yuv, "
- "format = (fourcc) { I420, Y42B, Y444 }, "
+ GST_STATIC_CAPS ("video/x-raw, "
+ "format = (string) { I420, Y42B, Y444 }, "
"framerate = (fraction) [1/MAX, MAX], "
"width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]")
);
"encode raw YUV video to a theora stream",
"Wim Taymans <wim@fluendo.com>");
- caps_string = g_strdup_printf ("video/x-raw-yuv, "
- "format = (fourcc) { %s }, "
+ caps_string = g_strdup_printf ("video/x-raw, "
+ "format = (string) { %s }, "
"framerate = (fraction) [1/MAX, MAX], "
"width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]",
theora_enc_get_supported_formats ());
for (i = 0; i < n; i++) {
s = gst_caps_get_structure (peer_caps, i);
- gst_structure_set_name (s, "video/x-raw-yuv");
+ gst_structure_set_name (s, "video/x-raw");
gst_structure_remove_field (s, "streamheader");
}
#define DEFAULT_AVOID_REENCODING FALSE
#define DEFAULT_RAW_CAPS \
- "video/x-raw-yuv; " \
- "video/x-raw-rgb; " \
- "video/x-raw-gray; " \
+ "video/x-raw; " \
"audio/x-raw-int; " \
"audio/x-raw-float; " \
"text/plain; " \
gst_element_factory_list_get_elements (GST_ELEMENT_FACTORY_TYPE_PARSER,
GST_RANK_MARGINAL);
- encode_bin->raw_video_caps =
- gst_caps_from_string ("video/x-raw-yuv;video/x-raw-rgb;video/x-raw-gray");
+ encode_bin->raw_video_caps = gst_caps_from_string ("video/x-raw");
encode_bin->raw_audio_caps =
gst_caps_from_string ("audio/x-raw-int;audio/x-raw-float");
/* encode_bin->raw_text_caps = */
namea = gst_structure_get_name (sa);
nameb = gst_structure_get_name (sb);
- if (g_strrstr (namea, "video/x-raw-"))
+ if (g_strrstr (namea, "video/x-raw"))
va = 0;
else if (g_strrstr (namea, "video/"))
va = 1;
else
va = 4;
- if (g_strrstr (nameb, "video/x-raw-"))
+ if (g_strrstr (nameb, "video/x-raw"))
vb = 0;
else if (g_strrstr (nameb, "video/"))
vb = 1;
name = gst_structure_get_name (s);
- if (g_str_has_prefix (name, "video/x-raw-") ||
- g_str_has_prefix (name, "audio/x-raw-"))
+ if (g_str_has_prefix (name, "video/x-raw") ||
+ g_str_has_prefix (name, "audio/x-raw"))
return TRUE;
return FALSE;
}
s = gst_caps_get_structure (caps, 0);
name = gst_structure_get_name (s);
- if (g_str_has_prefix (name, "audio/x-raw-")) {
+ if (g_str_has_prefix (name, "audio/x-raw")) {
if (!self->raw && !gst_pad_is_blocked (self->sink_proxypad)) {
GST_DEBUG_OBJECT (self, "Changing caps from non-raw to raw");
reconfigure = TRUE;
s = gst_caps_get_structure (caps, 0);
name = gst_structure_get_name (s);
- if (g_str_has_prefix (name, "video/x-raw-")) {
+ if (g_str_has_prefix (name, "video/x-raw")) {
if (!self->raw && !gst_pad_is_blocked (self->sink_proxypad)) {
GST_DEBUG_OBJECT (self, "Changing caps from non-raw to raw");
reconfigure = TRUE;
G_BEGIN_DECLS
#define DEFAULT_RAW_CAPS \
- "video/x-raw-yuv; " \
- "video/x-raw-rgb; " \
- "video/x-raw-gray; " \
+ "video/x-raw; " \
"audio/x-raw-int; " \
"audio/x-raw-float; " \
"text/plain; " \
/**
* SECTION:element-videoconvert
*
- * Convert video frames between a great variety of videoconvert formats.
+ * Convert video frames between a great variety of video formats.
*
* <refsect2>
* <title>Example launch line</title>
* |[
- * gst-launch -v videotestsrc ! video/x-raw-yuv,format=\(fourcc\)YUY2 ! videoconvert ! ximagesink
+ * gst-launch -v videotestsrc ! video/x-raw,format=\(fourcc\)YUY2 ! videoconvert ! ximagesink
* ]|
* </refsect2>
*/
PROP_DITHER
};
-#define CSP_VIDEO_CAPS \
- "video/x-raw-yuv, width = "GST_VIDEO_SIZE_RANGE" , " \
- "height="GST_VIDEO_SIZE_RANGE",framerate="GST_VIDEO_FPS_RANGE"," \
- "format= (fourcc) { I420 , NV12 , NV21 , YV12 , YUY2 , Y42B , Y444 , YUV9 , YVU9 , Y41B , Y800 , Y8 , GREY , Y16 , UYVY , YVYU , IYU1 , v308 , AYUV, v210, v216, A420, AY64 } ;" \
- GST_VIDEO_CAPS_RGB";" \
- GST_VIDEO_CAPS_BGR";" \
- GST_VIDEO_CAPS_RGBx";" \
- GST_VIDEO_CAPS_xRGB";" \
- GST_VIDEO_CAPS_BGRx";" \
- GST_VIDEO_CAPS_xBGR";" \
- GST_VIDEO_CAPS_RGBA";" \
- GST_VIDEO_CAPS_ARGB";" \
- GST_VIDEO_CAPS_BGRA";" \
- GST_VIDEO_CAPS_ABGR";" \
- GST_VIDEO_CAPS_RGB_16";" \
- GST_VIDEO_CAPS_BGR_16";" \
- GST_VIDEO_CAPS_RGB_15";" \
- GST_VIDEO_CAPS_BGR_15";" \
- GST_VIDEO_CAPS_RGB8_PALETTED "; " \
- GST_VIDEO_CAPS_GRAY8";" \
- GST_VIDEO_CAPS_GRAY16("BIG_ENDIAN")";" \
- GST_VIDEO_CAPS_GRAY16("LITTLE_ENDIAN")";" \
- GST_VIDEO_CAPS_r210";" \
- GST_VIDEO_CAPS_ARGB_64
+#define CSP_VIDEO_CAPS GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL)
static GstStaticPadTemplate gst_video_convert_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
static GstFlowReturn gst_video_convert_transform (GstBaseTransform * btrans,
GstBuffer * inbuf, GstBuffer * outbuf);
-static GQuark _QRAWRGB; /* "video/x-raw-rgb" */
-static GQuark _QRAWYUV; /* "video/x-raw-yuv" */
-static GQuark _QALPHAMASK; /* "alpha_mask" */
-
-
static GType
dither_method_get_type (void)
{
static GstCaps *
gst_video_convert_caps_remove_format_info (GstCaps * caps)
{
- GstStructure *yuvst, *rgbst, *grayst;
+ GstStructure *st;
gint i, n;
GstCaps *res;
n = gst_caps_get_size (caps);
for (i = 0; i < n; i++) {
- yuvst = gst_caps_get_structure (caps, i);
+ st = gst_caps_get_structure (caps, i);
/* If this is already expressed by the existing caps
* skip this structure */
- if (i > 0 && gst_caps_is_subset_structure (res, yuvst))
+ if (i > 0 && gst_caps_is_subset_structure (res, st))
continue;
- yuvst = gst_structure_copy (yuvst);
- gst_structure_set_name (yuvst, "video/x-raw-yuv");
- gst_structure_remove_fields (yuvst, "format", "endianness", "depth",
- "bpp", "red_mask", "green_mask", "blue_mask", "alpha_mask",
- "palette_data", NULL);
-
- rgbst = gst_structure_copy (yuvst);
- gst_structure_set_name (rgbst, "video/x-raw-rgb");
- gst_structure_remove_fields (rgbst, "color-matrix", "chroma-site", NULL);
+ st = gst_structure_copy (st);
+ gst_structure_remove_fields (st, "format", "palette_data",
+ "color-matrix", "chroma-site", NULL);
- grayst = gst_structure_copy (rgbst);
- gst_structure_set_name (grayst, "video/x-raw-gray");
-
- gst_caps_append_structure (res, yuvst);
- gst_caps_append_structure (res, rgbst);
- gst_caps_append_structure (res, grayst);
+ gst_caps_append_structure (res, st);
}
return res;
"Converts video from one colorspace to another",
"GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
- _QRAWRGB = g_quark_from_string ("video/x-raw-rgb");
- _QRAWYUV = g_quark_from_string ("video/x-raw-yuv");
- _QALPHAMASK = g_quark_from_string ("alpha_mask");
-
gstbasetransform_class->transform_caps =
GST_DEBUG_FUNCPTR (gst_video_convert_transform_caps);
gstbasetransform_class->set_caps =
* <refsect2>
* <title>Example pipelines</title>
* |[
- * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! videorate ! video/x-raw-yuv,framerate=15/1 ! xvimagesink
+ * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! videorate ! video/x-raw,framerate=15/1 ! xvimagesink
* ]| Decode an Ogg/Theora file and adjust the framerate to 15 fps before playing.
* To create the test Ogg/Theora file refer to the documentation of theoraenc.
* |[
- * gst-launch -v v4l2src ! videorate ! video/x-raw-yuv,framerate=25/2 ! theoraenc ! oggmux ! filesink location=recording.ogg
+ * gst-launch -v v4l2src ! videorate ! video/x-raw,framerate=25/2 ! theoraenc ! oggmux ! filesink location=recording.ogg
* ]| Capture video from a V4L device, and adjust the stream to 12.5 fps before
* encoding to Ogg/Theora.
* </refsect2>
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-yuv;"
- "video/x-raw-rgb;" "video/x-raw-gray;" "image/jpeg;" "image/png")
+ GST_STATIC_CAPS ("video/x-raw;" "image/jpeg;" "image/png")
);
static GstStaticPadTemplate gst_video_rate_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-yuv;"
- "video/x-raw-rgb;" "video/x-raw-gray;" "image/jpeg;" "image/png")
+ GST_STATIC_CAPS ("video/x-raw;" "image/jpeg;" "image/png")
);
static void gst_video_rate_swap_prev (GstVideoRate * videorate,
/**
* SECTION:element-videoscale
- * @see_also: videorate, ffmpegcolorspace
+ * @see_also: videorate, videoconvert
*
* This element resizes video frames. By default the element will try to
* negotiate to the same size on the source and sinkpad so that no scaling
* <refsect2>
* <title>Example pipelines</title>
* |[
- * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! ffmpegcolorspace ! videoscale ! ximagesink
+ * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! videoconvert ! videoscale ! ximagesink
* ]| Decode an Ogg/Theora and display the video using ximagesink. Since
* ximagesink cannot perform scaling, the video scaling will be performed by
* videoscale when you resize the video window.
* To create the test Ogg/Theora file refer to the documentation of theoraenc.
* |[
- * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! videoscale ! video/x-raw-yuv, width=50 ! xvimagesink
+ * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! videoscale ! video/x-raw, width=50 ! xvimagesink
* ]| Decode an Ogg/Theora and display the video using xvimagesink with a width
* of 50.
* </refsect2>
#undef GST_VIDEO_SIZE_RANGE
#define GST_VIDEO_SIZE_RANGE "(int) [ 1, 32767]"
+#define GST_VIDEO_FORMATS "{ \"I420\", \"YV12\", \"YUY2\", \"UYVY\", \"AYUV\", \"RGBx\", " \
+ "\"BGRx\", \"xRGB\", \"xBGR\", \"RGBA\", \"BGRA\", \"ARGB\", \"ABGR\", \"RGB\", " \
+ "\"BGR\", \"Y41B\", \"Y42B\", \"YVYU\", \"Y444\", \"GRAY8\", \"GRAY16_BE\", \"GRAY16_LE\", " \
+ "\"v308\", \"Y800\", \"Y16\", \"RGB16\", \"RGB15\", \"ARGB64\", \"AYUV64\" } "
+
+
static GstStaticCaps gst_video_scale_format_caps[] = {
- GST_STATIC_CAPS (GST_VIDEO_CAPS_RGBA),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_ARGB),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRA),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_ABGR),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("AYUV")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_RGBx),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_xBGR),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("Y444")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("v308")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_BGR),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("Y42B")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("YUY2")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("YVYU")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("UYVY")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("YV12")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("Y41B")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB_16),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB_15),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_GRAY16 ("BYTE_ORDER")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("Y16 ")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_GRAY8),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("Y800")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("Y8 ")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("GREY")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("AY64")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_ARGB_64)
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS))
};
#define GST_TYPE_VIDEO_SCALE_METHOD (gst_video_scale_method_get_type())
int i;
caps = gst_caps_new_empty ();
- for (i = 0; i < n_fourccs; i++) {
- structure = paint_get_structure (fourcc_list + i);
+ for (i = 0; i < n_formats; i++) {
+ structure = paint_get_structure (format_list + i);
gst_structure_set (structure,
"width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
"height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
static gboolean
gst_video_test_src_parse_caps (const GstCaps * caps,
gint * width, gint * height, gint * rate_numerator, gint * rate_denominator,
- struct fourcc_list_struct **fourcc, GstVideoTestSrcColorSpec * color_spec)
+ struct format_list_struct **format, GstVideoTestSrcColorSpec * color_spec)
{
const GstStructure *structure;
GstPadLinkReturn ret;
structure = gst_caps_get_structure (caps, 0);
- if (!(*fourcc = paintinfo_find_by_structure (structure)))
+ if (!(*format = paintinfo_find_by_structure (structure)))
goto unknown_format;
ret = gst_structure_get_int (structure, "width", width);
{
gboolean res;
gint width, height, rate_denominator, rate_numerator;
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
GstVideoTestSrc *videotestsrc;
GstVideoTestSrcColorSpec color_spec;
videotestsrc = GST_VIDEO_TEST_SRC (bsrc);
res = gst_video_test_src_parse_caps (caps, &width, &height,
- &rate_numerator, &rate_denominator, &fourcc, &color_spec);
+ &rate_numerator, &rate_denominator, &format, &color_spec);
if (!res)
goto parse_failed;
/* looks ok here */
- videotestsrc->fourcc = fourcc;
+ videotestsrc->format = format;
videotestsrc->width = width;
videotestsrc->height = height;
videotestsrc->rate_numerator = rate_numerator;
videotestsrc->rate_denominator = rate_denominator;
- videotestsrc->bpp = videotestsrc->fourcc->bitspp;
+ videotestsrc->bpp = videotestsrc->format->bitspp;
videotestsrc->color_spec = color_spec;
videotestsrc->size =
gst_video_test_src_get_size (videotestsrc, width, height);
src = GST_VIDEO_TEST_SRC (psrc);
- if (G_UNLIKELY (src->fourcc == NULL))
+ if (G_UNLIKELY (src->format == NULL))
goto not_negotiated;
/* 0 framerate and we are at the second frame, eos */
char *format_name;
gint width;
gint height;
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
gint bpp;
gint rate_numerator;
gint rate_denominator;
static void convert_hline_GRAY8 (paintinfo * p, int y);
static void convert_hline_GRAY16 (paintinfo * p, int y);
-struct fourcc_list_struct fourcc_list[] = {
+struct format_list_struct format_list[] = {
/* packed */
{VTS_YUV, "YUY2", "YUY2", 16, paint_setup_YUY2, convert_hline_YUY2},
{VTS_YUV, "UYVY", "UYVY", 16, paint_setup_UYVY, convert_hline_YUY2},
/* Not exactly YUV but it's the same as above */
{VTS_GRAY, "GRAY8", "GRAY8", 8, paint_setup_GRAY8, convert_hline_GRAY8},
- {VTS_GRAY, "GRAY16", "GRAY16", 16, paint_setup_GRAY16, convert_hline_GRAY16},
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+ {VTS_GRAY, "GRAY16_LE", "GRAY16", 16, paint_setup_GRAY16,
+ convert_hline_GRAY16},
+#else
+ {VTS_GRAY, "GRAY16_BE", "GRAY16", 16, paint_setup_GRAY16,
+ convert_hline_GRAY16},
+#endif
- {VTS_RGB, "RGB ", "xRGB8888", 32, paint_setup_xRGB8888, convert_hline_str4,
+ {VTS_RGB, "xRGB", "xRGB8888", 32, paint_setup_xRGB8888, convert_hline_str4,
24,
0x00ff0000, 0x0000ff00, 0x000000ff},
- {VTS_RGB, "RGB ", "xBGR8888", 32, paint_setup_xBGR8888, convert_hline_str4,
+ {VTS_RGB, "xBGR", "xBGR8888", 32, paint_setup_xBGR8888, convert_hline_str4,
24,
0x000000ff, 0x0000ff00, 0x00ff0000},
- {VTS_RGB, "RGB ", "RGBx8888", 32, paint_setup_RGBx8888, convert_hline_str4,
+ {VTS_RGB, "RGBx", "RGBx8888", 32, paint_setup_RGBx8888, convert_hline_str4,
24,
0xff000000, 0x00ff0000, 0x0000ff00},
- {VTS_RGB, "RGB ", "BGRx8888", 32, paint_setup_BGRx8888, convert_hline_str4,
+ {VTS_RGB, "BGRx", "BGRx8888", 32, paint_setup_BGRx8888, convert_hline_str4,
24,
0x0000ff00, 0x00ff0000, 0xff000000},
- {VTS_RGB, "RGB ", "ARGB8888", 32, paint_setup_ARGB8888, convert_hline_astr4,
+ {VTS_RGB, "ARGB", "ARGB8888", 32, paint_setup_ARGB8888, convert_hline_astr4,
32,
0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000},
- {VTS_RGB, "RGB ", "ABGR8888", 32, paint_setup_ABGR8888, convert_hline_astr4,
+ {VTS_RGB, "ABGR", "ABGR8888", 32, paint_setup_ABGR8888, convert_hline_astr4,
32,
0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000},
- {VTS_RGB, "RGB ", "RGBA8888", 32, paint_setup_RGBA8888, convert_hline_astr4,
+ {VTS_RGB, "RGBA", "RGBA8888", 32, paint_setup_RGBA8888, convert_hline_astr4,
32,
0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff},
- {VTS_RGB, "RGB ", "BGRA8888", 32, paint_setup_BGRA8888, convert_hline_astr4,
+ {VTS_RGB, "BGRA", "BGRA8888", 32, paint_setup_BGRA8888, convert_hline_astr4,
32,
0x0000ff00, 0x00ff0000, 0xff000000, 0x000000ff},
- {VTS_RGB, "RGB ", "RGB888", 24, paint_setup_RGB888, convert_hline_str3, 24,
+ {VTS_RGB, "RGB", "RGB888", 24, paint_setup_RGB888, convert_hline_str3, 24,
0x00ff0000, 0x0000ff00, 0x000000ff},
- {VTS_RGB, "RGB ", "BGR888", 24, paint_setup_BGR888, convert_hline_str3, 24,
+ {VTS_RGB, "BGR", "BGR888", 24, paint_setup_BGR888, convert_hline_str3, 24,
0x000000ff, 0x0000ff00, 0x00ff0000},
- {VTS_RGB, "RGB ", "RGB565", 16, paint_setup_RGB565, convert_hline_RGB565, 16,
+ {VTS_RGB, "RGB16", "RGB565", 16, paint_setup_RGB565, convert_hline_RGB565, 16,
0x0000f800, 0x000007e0, 0x0000001f},
- {VTS_RGB, "RGB ", "xRGB1555", 16, paint_setup_xRGB1555,
+ {VTS_RGB, "RGB15", "xRGB1555", 16, paint_setup_xRGB1555,
convert_hline_xRGB1555,
15,
0x00007c00, 0x000003e0, 0x0000001f},
- {VTS_RGB, "RGB ", "ARGB8888", 64, paint_setup_ARGB64, convert_hline_astr8,
+ {VTS_RGB, "ARGB64", "ARGB8888", 64, paint_setup_ARGB64, convert_hline_astr8,
64,
0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000},
{VTS_BAYER, "gbrg", "Bayer", 8, paint_setup_bayer_gbrg, convert_hline_bayer}
};
-int n_fourccs = G_N_ELEMENTS (fourcc_list);
+int n_formats = G_N_ELEMENTS (format_list);
-struct fourcc_list_struct *
+struct format_list_struct *
paintinfo_find_by_structure (const GstStructure * structure)
{
int i;
const char *media_type = gst_structure_get_name (structure);
- int ret;
g_return_val_if_fail (structure, NULL);
- if (strcmp (media_type, "video/x-raw-gray") == 0) {
- gint bpp, depth, endianness = 0;
-
- ret = gst_structure_get_int (structure, "bpp", &bpp) &&
- gst_structure_get_int (structure, "depth", &depth);
- if (!ret || bpp != depth || (depth != 8 && depth != 16))
- return NULL;
-
- ret = gst_structure_get_int (structure, "endianness", &endianness);
- if ((!ret || endianness != G_BYTE_ORDER) && bpp == 16)
- return NULL;
-
- for (i = 0; i < n_fourccs; i++) {
- if (fourcc_list[i].type == VTS_GRAY && fourcc_list[i].bitspp == bpp) {
- return fourcc_list + i;
- }
- }
- } else if (strcmp (media_type, "video/x-raw-yuv") == 0) {
- const char *s;
- int fourcc;
- guint32 format;
-
- ret = gst_structure_get_fourcc (structure, "format", &format);
- if (!ret)
- return NULL;
- for (i = 0; i < n_fourccs; i++) {
- s = fourcc_list[i].fourcc;
- /* g_print("testing %" GST_FOURCC_FORMAT " and %s\n", GST_FOURCC_ARGS(format), s); */
- fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], s[3]);
- if (fourcc_list[i].type == VTS_YUV && fourcc == format) {
- return fourcc_list + i;
- }
- }
- } else if (strcmp (media_type, "video/x-raw-rgb") == 0) {
- int red_mask;
- int green_mask;
- int blue_mask;
- int alpha_mask;
- int depth;
- int bpp;
-
- ret = gst_structure_get_int (structure, "red_mask", &red_mask);
- ret &= gst_structure_get_int (structure, "green_mask", &green_mask);
- ret &= gst_structure_get_int (structure, "blue_mask", &blue_mask);
- ret &= gst_structure_get_int (structure, "depth", &depth);
- ret &= gst_structure_get_int (structure, "bpp", &bpp);
-
- if (depth == 32) {
- ret &= gst_structure_get_int (structure, "alpha_mask", &alpha_mask);
- ret &= (alpha_mask != 0);
- } else {
- alpha_mask = 0;
- }
+ if (strcmp (media_type, "video/x-raw") == 0) {
+ const gchar *format;
- if (!ret) {
+ format = gst_structure_get_string (structure, "format");
+ if (!format) {
GST_WARNING ("incomplete caps structure: %" GST_PTR_FORMAT, structure);
return NULL;
}
- for (i = 0; i < n_fourccs; i++) {
- if (fourcc_list[i].type == VTS_RGB &&
- fourcc_list[i].red_mask == red_mask &&
- fourcc_list[i].green_mask == green_mask &&
- fourcc_list[i].blue_mask == blue_mask &&
- (alpha_mask == 0 || fourcc_list[i].alpha_mask == alpha_mask) &&
- fourcc_list[i].depth == depth && fourcc_list[i].bitspp == bpp) {
- return fourcc_list + i;
+ for (i = 0; i < n_formats; i++) {
+ if (g_str_equal (format, format_list[i].format)) {
+ return format_list + i;
}
}
return NULL;
return NULL;
}
- for (i = 0; i < n_fourccs; i++) {
- if (fourcc_list[i].type == VTS_BAYER &&
- g_str_equal (format, fourcc_list[i].fourcc)) {
- return fourcc_list + i;
+ for (i = 0; i < n_formats; i++) {
+ if (format_list[i].type == VTS_BAYER &&
+ g_str_equal (format, format_list[i].format)) {
+ return format_list + i;
}
}
return NULL;
return NULL;
}
-struct fourcc_list_struct *
-paintrect_find_fourcc (int find_fourcc)
+struct format_list_struct *
+paintrect_find_format (const gchar * find_format)
{
int i;
- for (i = 0; i < n_fourccs; i++) {
- const char *s;
- int fourcc;
-
- s = fourcc_list[i].fourcc;
- fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], s[3]);
- if (find_fourcc == fourcc) {
- /* If YUV format, it's good */
- if (!fourcc_list[i].type == VTS_YUV) {
- return fourcc_list + i;
- }
-
- return fourcc_list + i;
+ for (i = 0; i < n_formats; i++) {
+ if (strcmp (find_format, format_list[i].format) == 0) {
+ return format_list + i;
}
}
return NULL;
}
-struct fourcc_list_struct *
+struct format_list_struct *
paintrect_find_name (const char *name)
{
int i;
- for (i = 0; i < n_fourccs; i++) {
- if (strcmp (name, fourcc_list[i].name) == 0) {
- return fourcc_list + i;
+ for (i = 0; i < n_formats; i++) {
+ if (strcmp (name, format_list[i].name) == 0) {
+ return format_list + i;
}
}
return NULL;
GstStructure *
-paint_get_structure (struct fourcc_list_struct * format)
+paint_get_structure (struct format_list_struct * format)
{
GstStructure *structure = NULL;
- unsigned int fourcc;
- int endianness;
g_return_val_if_fail (format, NULL);
- fourcc =
- GST_MAKE_FOURCC (format->fourcc[0], format->fourcc[1], format->fourcc[2],
- format->fourcc[3]);
-
switch (format->type) {
case VTS_RGB:
- if (format->bitspp == 16) {
- endianness = G_BYTE_ORDER;
- } else {
- endianness = G_BIG_ENDIAN;
- }
- structure = gst_structure_new ("video/x-raw-rgb",
- "bpp", G_TYPE_INT, format->bitspp,
- "endianness", G_TYPE_INT, endianness,
- "depth", G_TYPE_INT, format->depth,
- "red_mask", G_TYPE_INT, format->red_mask,
- "green_mask", G_TYPE_INT, format->green_mask,
- "blue_mask", G_TYPE_INT, format->blue_mask, NULL);
- if (format->depth == 32 && format->alpha_mask > 0) {
- gst_structure_set (structure, "alpha_mask", G_TYPE_INT,
- format->alpha_mask, NULL);
- }
- break;
case VTS_GRAY:
- structure = gst_structure_new ("video/x-raw-gray",
- "bpp", G_TYPE_INT, format->bitspp, "depth", G_TYPE_INT,
- format->bitspp, NULL);
- if (format->bitspp == 16)
- gst_structure_set (structure, "endianness", G_TYPE_INT, G_BYTE_ORDER,
- NULL);
+ structure = gst_structure_new ("video/x-raw",
+ "format", G_TYPE_STRING, format->format, NULL);
break;
case VTS_YUV:
{
GValue value_list = { 0 };
GValue value = { 0 };
- structure = gst_structure_new ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, fourcc, NULL);
+ structure = gst_structure_new ("video/x-raw",
+ "format", G_TYPE_STRING, format->format, NULL);
- if (fourcc != GST_STR_FOURCC ("Y800")) {
+ if (strcmp (format->format, "Y800") != 0) {
g_value_init (&value_list, GST_TYPE_LIST);
g_value_init (&value, G_TYPE_STRING);
gst_structure_set_value (structure, "color-matrix", &value_list);
g_value_reset (&value_list);
- if (fourcc != GST_STR_FOURCC ("AYUV") &&
- fourcc != GST_STR_FOURCC ("v308") &&
- fourcc != GST_STR_FOURCC ("v410") &&
- fourcc != GST_STR_FOURCC ("Y444")) {
+ if (strcmp (format->format, "AYUV") &&
+ strcmp (format->format, "v308") &&
+ strcmp (format->format, "v410") &&
+ strcmp (format->format, "Y444")) {
g_value_set_static_string (&value, "mpeg2");
gst_value_list_append_value (&value_list, &value);
break;
case VTS_BAYER:
structure = gst_structure_new ("video/x-raw-bayer",
- "format", G_TYPE_STRING, format->fourcc, NULL);
+ "format", G_TYPE_STRING, format->format, NULL);
break;
default:
g_assert_not_reached ();
}
/* returns the size in bytes for one video frame of the given dimensions
- * given the fourcc in GstVideoTestSrc */
+ * given the format in GstVideoTestSrc */
int
gst_video_test_src_get_size (GstVideoTestSrc * v, int w, int h)
{
paintinfo pi = { NULL, };
paintinfo *p = π
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
p->width = w;
p->height = h;
- fourcc = v->fourcc;
- if (fourcc == NULL)
+ format = v->format;
+ if (format == NULL)
return 0;
- fourcc->paint_setup (p, NULL);
+ format->paint_setup (p, NULL);
return (unsigned long) p->endptr;
}
p->width = w;
p->height = h;
- p->convert_tmpline = v->fourcc->convert_hline;
- if (v->fourcc->type == VTS_RGB || v->fourcc->type == VTS_BAYER) {
+ p->convert_tmpline = v->format->convert_hline;
+ if (v->format->type == VTS_RGB || v->format->type == VTS_BAYER) {
p->paint_tmpline = paint_tmpline_ARGB;
} else {
p->paint_tmpline = paint_tmpline_AYUV;
struct vts_color_struct *a, struct vts_color_struct *b, int n)
{
int i;
- if (v->fourcc->type == VTS_RGB || v->fourcc->type == VTS_BAYER) {
+ if (v->format->type == VTS_RGB || v->format->type == VTS_BAYER) {
for (i = 0; i < n; i++) {
dest[i * 4 + 0] = BLEND (a->A, b->A, src[i]);
dest[i * 4 + 1] = BLEND (a->R, b->R, src[i]);
int j;
paintinfo pi = { NULL, };
paintinfo *p = π
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
videotestsrc_setup_paintinfo (v, p, w, h);
- fourcc = v->fourcc;
- if (fourcc == NULL)
+ format = v->format;
+ if (format == NULL)
return;
- fourcc->paint_setup (p, dest);
+ format->paint_setup (p, dest);
y1 = 2 * h / 3;
y2 = h * 0.75;
int j;
paintinfo pi = { NULL, };
paintinfo *p = π
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
videotestsrc_setup_paintinfo (v, p, w, h);
if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
} else {
p->colors = vts_colors_bt709_ycbcr_75;
}
- fourcc = v->fourcc;
- if (fourcc == NULL)
+ format = v->format;
+ if (format == NULL)
return;
- fourcc->paint_setup (p, dest);
+ format->paint_setup (p, dest);
/* color bars */
for (j = 0; j < h; j++) {
int j;
paintinfo pi = { NULL, };
paintinfo *p = π
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
videotestsrc_setup_paintinfo (v, p, w, h);
- fourcc = v->fourcc;
- if (fourcc == NULL)
+ format = v->format;
+ if (format == NULL)
return;
- fourcc->paint_setup (p, dest);
+ format->paint_setup (p, dest);
/* color bars */
for (j = 0; j < h; j++) {
int j;
paintinfo pi = { NULL, };
paintinfo *p = π
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
videotestsrc_setup_paintinfo (v, p, w, h);
- fourcc = v->fourcc;
- if (fourcc == NULL)
+ format = v->format;
+ if (format == NULL)
return;
- fourcc->paint_setup (p, dest);
+ format->paint_setup (p, dest);
for (j = 0; j < h; j++) {
/* use fixed size for now */
int j;
paintinfo pi = { NULL, };
paintinfo *p = π
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
struct vts_color_struct color;
videotestsrc_setup_paintinfo (v, p, w, h);
- fourcc = v->fourcc;
- if (fourcc == NULL)
+ format = v->format;
+ if (format == NULL)
return;
- fourcc->paint_setup (p, dest);
+ format->paint_setup (p, dest);
color = p->colors[COLOR_BLACK];
p->color = &color;
int i;
paintinfo pi = { NULL, };
paintinfo *p = π
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
videotestsrc_setup_paintinfo (v, p, w, h);
- fourcc = v->fourcc;
- if (fourcc == NULL)
+ format = v->format;
+ if (format == NULL)
return;
- fourcc->paint_setup (p, dest);
+ format->paint_setup (p, dest);
p->color = p->colors + color_index;
if (color_index == COLOR_BLACK) {
int i;
paintinfo pi = { NULL, };
paintinfo *p = π
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
videotestsrc_setup_paintinfo (v, p, w, h);
- fourcc = v->fourcc;
- if (fourcc == NULL)
+ format = v->format;
+ if (format == NULL)
return;
- fourcc->paint_setup (p, dest);
+ format->paint_setup (p, dest);
if (v->n_frames & 1) {
p->color = &p->foreground_color;
int i;
paintinfo pi = { NULL, };
paintinfo *p = π
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
videotestsrc_setup_paintinfo (v, p, w, h);
- fourcc = v->fourcc;
- if (fourcc == NULL)
+ format = v->format;
+ if (format == NULL)
return;
- fourcc->paint_setup (p, dest);
+ format->paint_setup (p, dest);
p->color = &p->foreground_color;
int x, y;
paintinfo pi = { NULL, };
paintinfo *p = π
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
videotestsrc_setup_paintinfo (v, p, w, h);
- fourcc = v->fourcc;
- if (fourcc == NULL)
+ format = v->format;
+ if (format == NULL)
return;
- fourcc->paint_setup (p, dest);
+ format->paint_setup (p, dest);
for (y = 0; y < h; y++) {
for (x = 0; x < w; x++) {
int x, y;
paintinfo pi = { NULL, };
paintinfo *p = π
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
videotestsrc_setup_paintinfo (v, p, w, h);
- fourcc = v->fourcc;
- if (fourcc == NULL)
+ format = v->format;
+ if (format == NULL)
return;
- fourcc->paint_setup (p, dest);
+ format->paint_setup (p, dest);
for (y = 0; y < h; y++) {
for (x = 0; x < w; x += 2) {
int x, y;
paintinfo pi = { NULL, };
paintinfo *p = π
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
videotestsrc_setup_paintinfo (v, p, w, h);
- fourcc = v->fourcc;
- if (fourcc == NULL)
+ format = v->format;
+ if (format == NULL)
return;
- fourcc->paint_setup (p, dest);
+ format->paint_setup (p, dest);
for (y = 0; y < h; y++) {
for (x = 0; x < w; x += 4) {
int x, y;
paintinfo pi = { NULL, };
paintinfo *p = π
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
videotestsrc_setup_paintinfo (v, p, w, h);
- fourcc = v->fourcc;
- if (fourcc == NULL)
+ format = v->format;
+ if (format == NULL)
return;
- fourcc->paint_setup (p, dest);
+ format->paint_setup (p, dest);
for (y = 0; y < h; y++) {
for (x = 0; x < w; x += 8) {
int j;
paintinfo pi = { NULL, };
paintinfo *p = π
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
struct vts_color_struct color;
int t = v->n_frames;
int xreset = -(w / 2) - v->xoffset; /* starting values for x^2 and y^2, centering the ellipse */
int scale_kx2 = 0xffff / w;
videotestsrc_setup_paintinfo (v, p, w, h);
- fourcc = v->fourcc;
- if (fourcc == NULL)
+ format = v->format;
+ if (format == NULL)
return;
- fourcc->paint_setup (p, dest);
+ format->paint_setup (p, dest);
color = p->colors[COLOR_BLACK];
p->color = &color;
int j;
paintinfo pi = { NULL, };
paintinfo *p = π
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
struct vts_color_struct color;
int t = v->n_frames;
int scale_kx2 = 0xffff / w;
videotestsrc_setup_paintinfo (v, p, w, h);
- fourcc = v->fourcc;
- if (fourcc == NULL)
+ format = v->format;
+ if (format == NULL)
return;
- fourcc->paint_setup (p, dest);
+ format->paint_setup (p, dest);
color = p->colors[COLOR_BLACK];
p->color = &color;
int j;
paintinfo pi = { NULL, };
paintinfo *p = π
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
double freq[8];
int d;
videotestsrc_setup_paintinfo (v, p, w, h);
- fourcc = v->fourcc;
- if (fourcc == NULL)
+ format = v->format;
+ if (format == NULL)
return;
- fourcc->paint_setup (p, dest);
+ format->paint_setup (p, dest);
for (i = 1; i < 8; i++) {
freq[i] = 200 * pow (2.0, -(i - 1) / 4.0);
int x, y;
paintinfo pi = { NULL, };
paintinfo *p = π
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
struct vts_color_struct yuv_primary;
struct vts_color_struct yuv_secondary;
videotestsrc_setup_paintinfo (v, p, w, h);
- fourcc = v->fourcc;
- if (fourcc == NULL)
+ format = v->format;
+ if (format == NULL)
return;
- fourcc->paint_setup (p, dest);
+ format->paint_setup (p, dest);
for (y = 0; y < h; y++) {
int region = (y * 4) / h;
int i;
paintinfo pi = { NULL, };
paintinfo *p = π
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
int t = v->n_frames;
double x, y;
int radius = 20;
videotestsrc_setup_paintinfo (v, p, w, h);
- fourcc = v->fourcc;
- if (fourcc == NULL)
+ format = v->format;
+ if (format == NULL)
return;
- fourcc->paint_setup (p, dest);
+ format->paint_setup (p, dest);
x = radius + (0.5 + 0.5 * sin (2 * G_PI * t / 200)) * (w - 2 * radius);
y = radius + (0.5 + 0.5 * sin (2 * G_PI * sqrt (2) * t / 200)) * (h -
struct vts_color_struct background_color;
};
-struct fourcc_list_struct
+struct format_list_struct
{
int type;
- const char *fourcc;
+ const char *format;
const char *name;
int bitspp;
void (*paint_setup) (paintinfo * p, unsigned char *dest);
unsigned int alpha_mask;
};
-struct fourcc_list_struct *
- paintrect_find_fourcc (int find_fourcc);
-struct fourcc_list_struct *
+struct format_list_struct *
+ paintrect_find_format (const gchar *find_format);
+struct format_list_struct *
paintrect_find_name (const char *name);
-struct fourcc_list_struct *
+struct format_list_struct *
paintinfo_find_by_structure (const GstStructure *structure);
GstStructure *
- paint_get_structure (struct fourcc_list_struct *format);
+ paint_get_structure (struct format_list_struct *format);
int gst_video_test_src_get_size (GstVideoTestSrc * v, int w, int h);
void gst_video_test_src_smpte (GstVideoTestSrc * v,
unsigned char *dest, int w, int h);
void gst_video_test_src_bar (GstVideoTestSrc * v,
unsigned char *dest, int w, int h);
-extern struct fourcc_list_struct fourcc_list[];
-extern int n_fourccs;
+extern struct format_list_struct format_list[];
+extern int n_formats;
#endif
* the button and a red one where you released it. (The navigationtest element
* is part of gst-plugins-good.)
* |[
- * gst-launch -v videotestsrc ! video/x-raw-rgb, pixel-aspect-ratio=(fraction)4/3 ! videoscale ! ximagesink
+ * gst-launch -v videotestsrc ! video/x-raw, pixel-aspect-ratio=(fraction)4/3 ! videoscale ! ximagesink
* ]| This is faking a 4/3 pixel aspect ratio caps on video frames produced by
* videotestsrc, in most cases the pixel aspect ratio of the display will be
* 1/1. This means that videoscale will have to do the scaling to convert
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-rgb, "
+ GST_STATIC_CAPS ("video/x-raw, "
"framerate = (fraction) [ 0, MAX ], "
"width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]")
);
GstXContext *xcontext = NULL;
XPixmapFormatValues *px_formats = NULL;
gint nb_formats = 0, i;
+ gint endianness;
+ GstVideoFormat vformat;
g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), NULL);
XFree (px_formats);
- xcontext->endianness =
- (ImageByteOrder (xcontext->disp) ==
+ endianness = (ImageByteOrder (xcontext->disp) ==
LSBFirst) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN;
/* Search for XShm extension support */
GST_DEBUG ("ximagesink is not using XShm extension");
}
- /* our caps system handles 24/32bpp RGB as big-endian. */
- if ((xcontext->bpp == 24 || xcontext->bpp == 32) &&
- xcontext->endianness == G_LITTLE_ENDIAN) {
- xcontext->endianness = G_BIG_ENDIAN;
- xcontext->visual->red_mask = GUINT32_TO_BE (xcontext->visual->red_mask);
- xcontext->visual->green_mask = GUINT32_TO_BE (xcontext->visual->green_mask);
- xcontext->visual->blue_mask = GUINT32_TO_BE (xcontext->visual->blue_mask);
- if (xcontext->bpp == 24) {
- xcontext->visual->red_mask >>= 8;
- xcontext->visual->green_mask >>= 8;
- xcontext->visual->blue_mask >>= 8;
- }
- }
+ vformat = gst_video_format_from_masks (xcontext->depth, xcontext->bpp,
+ endianness, xcontext->visual->red_mask, xcontext->visual->green_mask,
+ xcontext->visual->blue_mask, 0);
+
+ if (vformat == GST_VIDEO_FORMAT_UNKNOWN)
+ goto unknown_format;
/* update object's par with calculated one if not set yet */
if (!ximagesink->par) {
gst_value_init_and_copy (ximagesink->par, xcontext->par);
GST_DEBUG_OBJECT (ximagesink, "set calculated PAR on object's PAR");
}
- xcontext->caps = gst_caps_new_simple ("video/x-raw-rgb",
- "bpp", G_TYPE_INT, xcontext->bpp,
- "depth", G_TYPE_INT, xcontext->depth,
- "endianness", G_TYPE_INT, xcontext->endianness,
- "red_mask", G_TYPE_INT, xcontext->visual->red_mask,
- "green_mask", G_TYPE_INT, xcontext->visual->green_mask,
- "blue_mask", G_TYPE_INT, xcontext->visual->blue_mask,
+ xcontext->caps = gst_caps_new_simple ("video/x-raw",
+ "format", G_TYPE_STRING, gst_video_format_to_string (vformat),
"width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
"height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
g_mutex_unlock (ximagesink->x_lock);
return xcontext;
+
+ /* ERRORS */
+unknown_format:
+ {
+ GST_ERROR_OBJECT (ximagesink, "unknown format");
+ return NULL;
+ }
}
/* This function cleans the X context. Closing the Display and unrefing the
gint depth;
gint bpp;
- gint endianness;
gint width, height;
gint widthmm, heightmm;
* position. This also handles borders correctly, limiting coordinates to the
* image area
* |[
- * gst-launch -v videotestsrc ! video/x-raw-yuv, pixel-aspect-ratio=(fraction)4/3 ! xvimagesink
+ * gst-launch -v videotestsrc ! video/x-raw, pixel-aspect-ratio=(fraction)4/3 ! xvimagesink
* ]| This is faking a 4/3 pixel aspect ratio caps on video frames produced by
* videotestsrc, in most cases the pixel aspect ratio of the display will be
* 1/1. This means that XvImageSink will have to do the scaling to convert
/* Default template - initiated with class struct to allow gst-register to work
without X running */
static GstStaticPadTemplate gst_xvimagesink_sink_template_factory =
- GST_STATIC_PAD_TEMPLATE ("sink",
+GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-rgb, "
- "framerate = (fraction) [ 0, MAX ], "
- "width = (int) [ 1, MAX ], "
- "height = (int) [ 1, MAX ]; "
- "video/x-raw-yuv, "
+ GST_STATIC_CAPS ("video/x-raw, "
"framerate = (fraction) [ 0, MAX ], "
"width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]")
);
case XvRGB:
{
XvImageFormatValues *fmt = &(formats[i]);
- gint endianness = G_BIG_ENDIAN;
-
- if (fmt->byte_order == LSBFirst) {
- /* our caps system handles 24/32bpp RGB as big-endian. */
- if (fmt->bits_per_pixel == 24 || fmt->bits_per_pixel == 32) {
- fmt->red_mask = GUINT32_TO_BE (fmt->red_mask);
- fmt->green_mask = GUINT32_TO_BE (fmt->green_mask);
- fmt->blue_mask = GUINT32_TO_BE (fmt->blue_mask);
-
- if (fmt->bits_per_pixel == 24) {
- fmt->red_mask >>= 8;
- fmt->green_mask >>= 8;
- fmt->blue_mask >>= 8;
- }
- } else
- endianness = G_LITTLE_ENDIAN;
- }
+ gint endianness;
+ GstVideoFormat vformat;
+
+ endianness =
+ (fmt->byte_order == LSBFirst ? G_LITTLE_ENDIAN : G_BIG_ENDIAN);
+
+ vformat = gst_video_format_from_masks (fmt->depth, fmt->bits_per_pixel,
+ endianness, fmt->red_mask, fmt->green_mask, fmt->blue_mask, 0);
- format_caps = gst_caps_new_simple ("video/x-raw-rgb",
- "endianness", G_TYPE_INT, endianness,
- "depth", G_TYPE_INT, fmt->depth,
- "bpp", G_TYPE_INT, fmt->bits_per_pixel,
- "red_mask", G_TYPE_INT, fmt->red_mask,
- "green_mask", G_TYPE_INT, fmt->green_mask,
- "blue_mask", G_TYPE_INT, fmt->blue_mask,
+ format_caps = gst_caps_new_simple ("video/x-raw",
+ "format", G_TYPE_STRING, gst_video_format_to_string (vformat),
"width", GST_TYPE_INT_RANGE, 1, max_w,
"height", GST_TYPE_INT_RANGE, 1, max_h,
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
break;
}
case XvYUV:
- format_caps = gst_caps_new_simple ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, formats[i].id,
+ {
+ GstVideoFormat vformat;
+
+ vformat = gst_video_format_from_fourcc (formats[i].id);
+
+ format_caps = gst_caps_new_simple ("video/x-raw",
+ "format", G_TYPE_STRING, gst_video_format_to_string (vformat),
"width", GST_TYPE_INT_RANGE, 1, max_w,
"height", GST_TYPE_INT_RANGE, 1, max_h,
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
break;
+ }
default:
g_assert_not_reached ();
break;