mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
vdpau: use G_N_ELEMENTS instead of hardcoding array sizes
This commit is contained in:
parent
9661b77ea1
commit
f1799ce0d6
3 changed files with 8 additions and 11 deletions
|
@ -39,13 +39,13 @@ gst_vdp_video_to_yuv_caps (GstCaps * caps, GstVdpDevice * device)
|
|||
|
||||
if (gst_structure_get_int (structure, "chroma-type", &chroma_type)) {
|
||||
/* calculate fourcc from chroma_type */
|
||||
for (i = 0; i < N_FORMATS; i++) {
|
||||
for (i = 0; i < G_N_ELEMENTS (formats); i++) {
|
||||
if (formats[i].chroma_type == chroma_type) {
|
||||
fourcc = g_slist_append (fourcc, GINT_TO_POINTER (formats[i].fourcc));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < N_FORMATS; i++) {
|
||||
for (i = 0; i < G_N_ELEMENTS (formats); i++) {
|
||||
fourcc = g_slist_append (fourcc, GINT_TO_POINTER (formats[i].fourcc));
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ gst_vdp_yuv_to_video_caps (GstCaps * caps, GstVdpDevice * device)
|
|||
gint chroma_type = -1;
|
||||
|
||||
/* calculate chroma type from fourcc */
|
||||
for (i = 0; i < N_FORMATS; i++) {
|
||||
for (i = 0; i < G_N_ELEMENTS (formats); i++) {
|
||||
if (formats[i].fourcc == fourcc) {
|
||||
chroma_type = formats[i].chroma_type;
|
||||
break;
|
||||
|
|
|
@ -144,7 +144,7 @@ gst_vdp_video_buffer_get_allowed_yuv_caps (GstVdpDevice * device)
|
|||
gint i;
|
||||
|
||||
caps = gst_caps_new_empty ();
|
||||
for (i = 0; i < N_CHROMA_TYPES; i++) {
|
||||
for (i = 0; i < G_N_ELEMENTS (chroma_types); i++) {
|
||||
VdpStatus status;
|
||||
VdpBool is_supported;
|
||||
guint32 max_w, max_h;
|
||||
|
@ -164,7 +164,7 @@ gst_vdp_video_buffer_get_allowed_yuv_caps (GstVdpDevice * device)
|
|||
if (is_supported) {
|
||||
gint j;
|
||||
|
||||
for (j = 0; j < N_FORMATS; j++) {
|
||||
for (j = 0; j < G_N_ELEMENTS (formats); j++) {
|
||||
if (formats[j].chroma_type != chroma_types[i])
|
||||
continue;
|
||||
|
||||
|
@ -204,7 +204,7 @@ gst_vdp_video_buffer_get_allowed_video_caps (GstVdpDevice * device)
|
|||
gint i;
|
||||
|
||||
caps = gst_caps_new_empty ();
|
||||
for (i = 0; i < N_CHROMA_TYPES; i++) {
|
||||
for (i = 0; i < G_N_ELEMENTS (chroma_types); i++) {
|
||||
VdpStatus status;
|
||||
VdpBool is_supported;
|
||||
guint32 max_w, max_h;
|
||||
|
|
|
@ -51,13 +51,10 @@ typedef struct
|
|||
guint32 fourcc;
|
||||
} GstVdpVideoBufferFormats;
|
||||
|
||||
#define N_CHROMA_TYPES 3
|
||||
#define N_FORMATS 7
|
||||
|
||||
static const VdpChromaType chroma_types[N_CHROMA_TYPES] =
|
||||
static const VdpChromaType chroma_types[] =
|
||||
{ VDP_CHROMA_TYPE_420, VDP_CHROMA_TYPE_422, VDP_CHROMA_TYPE_444 };
|
||||
|
||||
static const GstVdpVideoBufferFormats formats[N_FORMATS] = {
|
||||
static const GstVdpVideoBufferFormats formats[] = {
|
||||
{
|
||||
VDP_CHROMA_TYPE_420,
|
||||
VDP_YCBCR_FORMAT_YV12,
|
||||
|
|
Loading…
Reference in a new issue