vdpau: move definition of the VdpChromaType array and the VdpauFormats to gstdevice.h

This commit is contained in:
Carl-Anton Ingmarsson 2009-04-09 16:54:27 +02:00 committed by Jan Schmidt
parent 072f869548
commit 86cd9b20f8
3 changed files with 55 additions and 91 deletions

View file

@ -70,6 +70,57 @@ struct _GstVdpauDevice
VdpDecoderGetParameters *vdp_decoder_get_parameters;
};
typedef struct
{
VdpChromaType chroma_type;
VdpYCbCrFormat format;
guint32 fourcc;
} VdpauFormats;
#define N_CHROMA_TYPES 3
#define N_FORMATS 7
static const VdpChromaType chroma_types[N_CHROMA_TYPES] =
{ VDP_CHROMA_TYPE_420, VDP_CHROMA_TYPE_422, VDP_CHROMA_TYPE_444 };
static const VdpauFormats formats[N_FORMATS] = {
{
VDP_CHROMA_TYPE_420,
VDP_YCBCR_FORMAT_NV12,
GST_MAKE_FOURCC ('N', 'V', '1', '2')
},
{
VDP_CHROMA_TYPE_422,
VDP_YCBCR_FORMAT_UYVY,
GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y')
},
{
VDP_CHROMA_TYPE_444,
VDP_YCBCR_FORMAT_V8U8Y8A8,
GST_MAKE_FOURCC ('A', 'Y', 'U', 'V')
},
{
VDP_CHROMA_TYPE_444,
VDP_YCBCR_FORMAT_Y8U8V8A8,
GST_MAKE_FOURCC ('A', 'V', 'U', 'Y')
},
{
VDP_CHROMA_TYPE_422,
VDP_YCBCR_FORMAT_YUYV,
GST_MAKE_FOURCC ('Y', 'U', 'Y', 'V')
},
{
VDP_CHROMA_TYPE_420,
VDP_YCBCR_FORMAT_YV12,
GST_MAKE_FOURCC ('Y', 'V', '1', '2')
},
{
VDP_CHROMA_TYPE_420,
VDP_YCBCR_FORMAT_YV12,
GST_MAKE_FOURCC ('I', '4', '2', '0')
}
};
GType gst_vdpau_device_get_type (void) G_GNUC_CONST;
GstVdpauDevice *gst_vdpau_device_new (const gchar *display_name);

View file

@ -178,46 +178,6 @@ gst_vdpau_video_yuv_chain (GstPad * pad, GstBuffer * buffer)
return GST_FLOW_ERROR;
}
typedef struct
{
VdpChromaType chroma_type;
VdpYCbCrFormat format;
guint32 fourcc;
} VdpauFormats;
static VdpauFormats formats[6] = {
{
VDP_CHROMA_TYPE_420,
VDP_YCBCR_FORMAT_NV12,
GST_MAKE_FOURCC ('N', 'V', '1', '2')
},
{
VDP_CHROMA_TYPE_422,
VDP_YCBCR_FORMAT_UYVY,
GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y')
},
{
VDP_CHROMA_TYPE_444,
VDP_YCBCR_FORMAT_V8U8Y8A8,
GST_MAKE_FOURCC ('A', 'Y', 'U', 'V')
},
{
VDP_CHROMA_TYPE_444,
VDP_YCBCR_FORMAT_Y8U8V8A8,
GST_MAKE_FOURCC ('A', 'V', 'U', 'Y')
},
{
VDP_CHROMA_TYPE_422,
VDP_YCBCR_FORMAT_YUYV,
GST_MAKE_FOURCC ('Y', 'U', 'Y', 'V')
},
{
VDP_CHROMA_TYPE_420,
VDP_YCBCR_FORMAT_YV12,
GST_MAKE_FOURCC ('Y', 'V', '1', '2')
}
};
static GstCaps *
gst_vdpau_video_yuv_get_caps (GstVdpauVideoYUV * video_yuv,
GstVdpauDevice * device, gint chroma_type, gint width, gint height,
@ -229,7 +189,7 @@ gst_vdpau_video_yuv_get_caps (GstVdpauVideoYUV * video_yuv,
caps = gst_caps_new_empty ();
for (i = 0; i < 6; i++) {
for (i = 0; i < N_FORMATS; i++) {
VdpStatus status;
VdpBool is_supported;

View file

@ -196,53 +196,6 @@ gst_vdpau_yuv_video_chain (GstPad * pad, GstBuffer * buffer)
return GST_FLOW_ERROR;
}
typedef struct
{
VdpChromaType chroma_type;
VdpYCbCrFormat format;
guint32 fourcc;
} VdpauFormats;
static VdpChromaType chroma_types[3] =
{ VDP_CHROMA_TYPE_420, VDP_CHROMA_TYPE_422, VDP_CHROMA_TYPE_444 };
static VdpauFormats formats[7] = {
{
VDP_CHROMA_TYPE_420,
VDP_YCBCR_FORMAT_NV12,
GST_MAKE_FOURCC ('N', 'V', '1', '2')
},
{
VDP_CHROMA_TYPE_422,
VDP_YCBCR_FORMAT_UYVY,
GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y')
},
{
VDP_CHROMA_TYPE_444,
VDP_YCBCR_FORMAT_V8U8Y8A8,
GST_MAKE_FOURCC ('A', 'Y', 'U', 'V')
},
{
VDP_CHROMA_TYPE_444,
VDP_YCBCR_FORMAT_Y8U8V8A8,
GST_MAKE_FOURCC ('A', 'V', 'U', 'Y')
},
{
VDP_CHROMA_TYPE_422,
VDP_YCBCR_FORMAT_YUYV,
GST_MAKE_FOURCC ('Y', 'U', 'Y', 'V')
},
{
VDP_CHROMA_TYPE_420,
VDP_YCBCR_FORMAT_YV12,
GST_MAKE_FOURCC ('Y', 'V', '1', '2')
},
{
VDP_CHROMA_TYPE_420,
VDP_YCBCR_FORMAT_YV12,
GST_MAKE_FOURCC ('I', '4', '2', '0')
}
};
static GstCaps *
gst_vdpau_yuv_video_get_caps (GstVdpauYUVVideo * yuv_video)
{
@ -254,7 +207,7 @@ gst_vdpau_yuv_video_get_caps (GstVdpauYUVVideo * yuv_video)
caps = gst_caps_new_empty ();
for (i = 0; i < 3; i++) {
for (i = 0; i < N_CHROMA_TYPES; i++) {
VdpStatus status;
VdpBool is_supported;
guint32 max_w, max_h;
@ -274,7 +227,7 @@ gst_vdpau_yuv_video_get_caps (GstVdpauYUVVideo * yuv_video)
if (is_supported) {
gint j;
for (j = 0; j < 7; j++) {
for (j = 0; j < N_FORMATS; j++) {
if (formats[j].chroma_type != chroma_types[i])
continue;
@ -337,7 +290,7 @@ gst_vdpau_yuv_video_sink_setcaps (GstPad * pad, GstCaps * caps)
gst_structure_get_fraction (structure, "pixel-aspect-ratio",
&par_numerator, &par_denominator);
for (i = 0; i < 7; i++) {
for (i = 0; i < N_FORMATS; i++) {
if (formats[i].fourcc == fourcc) {
chroma_type = formats[i].chroma_type;
break;