From: Marko Ollonen Date: Tue, 12 Feb 2013 12:47:54 +0000 (+0200) Subject: add static pad template for caps, dropping unneeded pixelformats. X-Git-Tag: 2.1b_release~6^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3054a82267b713a11e608592c606c5e4af07da72;p=adaptation%2Fintel_mfld%2Fgst-plugins-atomisp.git add static pad template for caps, dropping unneeded pixelformats. Change-Id: I33efb6f29cc57646063388a6e1f83f41ca9b9c91 --- diff --git a/gst/mfldv4l2cam/gstv4l2camsrc.c b/gst/mfldv4l2cam/gstv4l2camsrc.c index b189d92..3018020 100644 --- a/gst/mfldv4l2cam/gstv4l2camsrc.c +++ b/gst/mfldv4l2cam/gstv4l2camsrc.c @@ -133,7 +133,30 @@ typedef enum } GstV4L2CamSrcProperties; - +static GstStaticPadTemplate gst_v4l2camsrc_template = + GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("video/x-raw-yuv, " + "format = (fourcc) NV12, " + "framerate = (fraction) [ 0, 200 ], " + "width = (int) [ 1, MAX ], " + "height = (int) [ 1, MAX ];" + "video/x-raw-yuv, " + "format = (fourcc) I420, " + "framerate = (fraction) [ 0, 200 ], " + "width = (int) [ 1, MAX ], " + "height = (int) [ 1, MAX ];" + "video/x-raw-yuv, " + "format = (fourcc) BA10, " + "framerate = (fraction) [ 0, 200 ], " + "width = (int) [ 1, MAX ], " + "height = (int) [ 1, MAX ];" + "video/x-vaapi-sharing, " + "type = vaapi, " + "width = (int) [ 1, MAX ], " + "height = (int) [ 1, MAX ], " + "framerate = (fraction) [ 0, MAX ]")); #define DEFAULT_PROP_DEVICE_NAME NULL #define DEFAULT_PROP_DEVICE "/dev/video0" @@ -642,82 +665,6 @@ gst_v4l2camsrc_get_num_buffers (GstCameraSrc * camsrc) return v4l2camsrc->num_buffers; } -/* - * common format / caps utilities: - */ -typedef struct -{ - guint32 format; - gboolean dimensions; -} GstV4L2FormatDesc; - -static const GstV4L2FormatDesc gst_v4l2_formats[] = { - /* from Linux 2.6.15 videodev2.h */ - {V4L2_PIX_FMT_YUV420, TRUE}, - {V4L2_PIX_FMT_YVU420, TRUE}, - {V4L2_PIX_FMT_YUV422P, TRUE}, - {V4L2_PIX_FMT_YUV444, TRUE}, - - {V4L2_PIX_FMT_NV12, TRUE}, - {V4L2_PIX_FMT_NV21, TRUE}, - - {V4L2_PIX_FMT_NV16, TRUE}, - {V4L2_PIX_FMT_NV61, TRUE}, - - {V4L2_PIX_FMT_YUYV, TRUE}, - {V4L2_PIX_FMT_UYVY, TRUE}, - - {V4L2_PIX_FMT_SBGGR16, TRUE}, - - {V4L2_PIX_FMT_SBGGR8, TRUE}, - {V4L2_PIX_FMT_SGBRG8, TRUE}, - {V4L2_PIX_FMT_SGRBG8, TRUE}, - {V4L2_PIX_FMT_SRGGB8, TRUE}, - - {V4L2_PIX_FMT_SBGGR10, TRUE}, - {V4L2_PIX_FMT_SGBRG10, TRUE}, - {V4L2_PIX_FMT_SGRBG10, TRUE}, - {V4L2_PIX_FMT_SRGGB10, TRUE}, - - {V4L2_PIX_FMT_RGB24, TRUE}, - {V4L2_PIX_FMT_RGB32, TRUE}, - {V4L2_PIX_FMT_RGB565, TRUE}, -}; - -#define GST_V4L2_FORMAT_COUNT (G_N_ELEMENTS (gst_v4l2_formats)) -#define GST_V4L2_MAX_SIZE (1<<15) /* 2^15 == 32768 */ - -GstCaps * -gst_v4l2camsrc_get_all_caps (void) -{ - static GstCaps *caps = NULL; - - if (caps == NULL) { - GstStructure *structure; - - guint i; - - caps = gst_caps_new_empty (); - for (i = 0; i < GST_V4L2_FORMAT_COUNT; i++) { - structure = - gst_v4l2camsrc_v4l2fourcc_to_structure (gst_v4l2_formats[i].format); - if (structure) { - if (gst_v4l2_formats[i].dimensions) { - gst_structure_set (structure, - "width", GST_TYPE_INT_RANGE, 1, GST_V4L2_MAX_SIZE, - "height", GST_TYPE_INT_RANGE, 1, GST_V4L2_MAX_SIZE, - "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 100, 1, NULL); - } - gst_caps_append_structure (caps, structure); - } - } - structure = gst_structure_from_string(surface_string, NULL); - gst_caps_append_structure (caps, structure); - } - - return gst_caps_ref (caps); -} - /* * gst_v4l2camsrc_base_init: @@ -736,8 +683,7 @@ gst_v4l2camsrc_base_init (gpointer klass) "Maemo Multimedia "); gst_element_class_add_pad_template (element_class, - gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - gst_v4l2camsrc_get_all_caps ())); + gst_static_pad_template_get (&gst_v4l2camsrc_template)); } gboolean gst_v4l2camsrc_set_autofocus (GstCameraSrc * camsrc, gboolean on);