v4l2object: Move type declaration to the top

This commit is contained in:
Nicolas Dufresne 2014-03-13 18:21:41 +01:00
parent b4d89b9809
commit 8cf1c330d5

View file

@ -64,6 +64,85 @@ enum
V4L2_STD_OBJECT_PROPS, V4L2_STD_OBJECT_PROPS,
}; };
/*
* common format / caps utilities:
*/
typedef enum
{
GST_V4L2_RAW = 1 << 0,
GST_V4L2_CODEC = 1 << 1,
GST_V4L2_TRANSPORT = 1 << 2,
GST_V4L2_NO_PARSE = 1 << 3,
GST_V4L2_ALL = 0xffff
} GstV4L2FormatFlags;
typedef struct
{
guint32 format;
gboolean dimensions;
GstV4L2FormatFlags flags;
} GstV4L2FormatDesc;
static const GstV4L2FormatDesc gst_v4l2_formats[] = {
/* from Linux 2.6.15 videodev2.h */
{V4L2_PIX_FMT_RGB332, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_RGB555, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_RGB565, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_RGB555X, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_RGB565X, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_BGR24, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_RGB24, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_BGR32, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_RGB32, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_GREY, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_YVU410, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_YVU420, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_YUYV, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_UYVY, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_YUV422P, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_YUV411P, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_Y41P, TRUE, GST_V4L2_RAW},
/* two planes -- one Y, one Cr + Cb interleaved */
{V4L2_PIX_FMT_NV12, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_NV12M, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_NV12MT, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_NV21, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_NV21M, TRUE, GST_V4L2_RAW},
/* The following formats are not defined in the V4L2 specification */
{V4L2_PIX_FMT_YUV410, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_YUV420, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_YYUV, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_HI240, TRUE, GST_V4L2_RAW},
/* see http://www.siliconimaging.com/RGB%20Bayer.htm */
{V4L2_PIX_FMT_SBGGR8, TRUE, GST_V4L2_CODEC},
/* compressed formats */
{V4L2_PIX_FMT_MJPEG, FALSE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_JPEG, FALSE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_PJPG, FALSE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_DV, FALSE, GST_V4L2_TRANSPORT},
{V4L2_PIX_FMT_MPEG, FALSE, GST_V4L2_TRANSPORT},
{V4L2_PIX_FMT_MPEG1, FALSE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_MPEG2, FALSE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_MPEG4, FALSE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_H263, FALSE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_H264, FALSE, GST_V4L2_CODEC},
/* VP8 not parseable */
{V4L2_PIX_FMT_VP8, FALSE, GST_V4L2_CODEC | GST_V4L2_NO_PARSE},
/* Vendor-specific formats */
{V4L2_PIX_FMT_WNVA, TRUE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_SN9C10X, TRUE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_PWC1, TRUE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_PWC2, TRUE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_YVYU, TRUE, GST_V4L2_RAW},
};
#define GST_V4L2_FORMAT_COUNT (G_N_ELEMENTS (gst_v4l2_formats))
static GSList *gst_v4l2_object_get_format_list (GstV4l2Object * v4l2object); static GSList *gst_v4l2_object_get_format_list (GstV4l2Object * v4l2object);
@ -703,88 +782,6 @@ gst_v4l2_object_close (GstV4l2Object * v4l2object)
return TRUE; return TRUE;
} }
/*
* common format / caps utilities:
*/
typedef enum
{
GST_V4L2_RAW = 1 << 0,
GST_V4L2_CODEC = 1 << 1,
GST_V4L2_TRANSPORT = 1 << 2,
GST_V4L2_NO_PARSE = 1 << 3,
GST_V4L2_ALL = 0xffff
} GstV4L2FormatFlags;
typedef struct
{
guint32 format;
gboolean dimensions;
GstV4L2FormatFlags flags;
} GstV4L2FormatDesc;
static const GstV4L2FormatDesc gst_v4l2_formats[] = {
/* from Linux 2.6.15 videodev2.h */
{V4L2_PIX_FMT_RGB332, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_RGB555, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_RGB565, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_RGB555X, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_RGB565X, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_BGR24, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_RGB24, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_BGR32, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_RGB32, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_GREY, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_YVU410, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_YVU420, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_YUYV, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_UYVY, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_YUV422P, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_YUV411P, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_Y41P, TRUE, GST_V4L2_RAW},
/* two planes -- one Y, one Cr + Cb interleaved */
{V4L2_PIX_FMT_NV12, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_NV12M, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_NV12MT, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_NV21, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_NV21M, TRUE, GST_V4L2_RAW},
/* The following formats are not defined in the V4L2 specification */
{V4L2_PIX_FMT_YUV410, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_YUV420, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_YYUV, TRUE, GST_V4L2_RAW},
{V4L2_PIX_FMT_HI240, TRUE, GST_V4L2_RAW},
/* see http://www.siliconimaging.com/RGB%20Bayer.htm */
{V4L2_PIX_FMT_SBGGR8, TRUE, GST_V4L2_CODEC},
/* compressed formats */
{V4L2_PIX_FMT_MJPEG, FALSE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_JPEG, FALSE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_PJPG, FALSE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_DV, FALSE, GST_V4L2_TRANSPORT},
{V4L2_PIX_FMT_MPEG, FALSE, GST_V4L2_TRANSPORT},
{V4L2_PIX_FMT_MPEG1, FALSE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_MPEG2, FALSE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_MPEG4, FALSE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_H263, FALSE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_H264, FALSE, GST_V4L2_CODEC},
/* VP8 not parseable */
{V4L2_PIX_FMT_VP8, FALSE, GST_V4L2_CODEC | GST_V4L2_NO_PARSE},
/* Vendor-specific formats */
{V4L2_PIX_FMT_WNVA, TRUE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_SN9C10X, TRUE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_PWC1, TRUE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_PWC2, TRUE, GST_V4L2_CODEC},
{V4L2_PIX_FMT_YVYU, TRUE, GST_V4L2_RAW},
};
#define GST_V4L2_FORMAT_COUNT (G_N_ELEMENTS (gst_v4l2_formats))
static struct v4l2_fmtdesc * static struct v4l2_fmtdesc *
gst_v4l2_object_get_format_from_fourcc (GstV4l2Object * v4l2object, gst_v4l2_object_get_format_from_fourcc (GstV4l2Object * v4l2object,
guint32 fourcc) guint32 fourcc)