Mercurial > mplayer.hg
changeset 33815:4d75b3bf9561
Split out read/write part from data struct and make read-only
struct const.
author | reimar |
---|---|
date | Sun, 24 Jul 2011 19:29:10 +0000 |
parents | ccbef55f408c |
children | 65c7223dd37a |
files | libvo/vo_directx.c |
diffstat | 1 files changed, 22 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/vo_directx.c Sun Jul 24 19:22:58 2011 +0000 +++ b/libvo/vo_directx.c Sun Jul 24 19:29:10 2011 +0000 @@ -83,29 +83,31 @@ typedef struct directx_fourcc_caps { char *img_format_name; //human readable name uint32_t img_format; //as MPlayer image format - uint32_t drv_caps; //what hw supports with this format DDPIXELFORMAT g_ddpfOverlay; //as Directx Sourface description } directx_fourcc_caps; -static directx_fourcc_caps g_ddpf[] = { - { "YV12 ", IMGFMT_YV12, 0, { sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y', 'V', '1', '2'), 0, 0, 0, 0, 0 } }, - { "I420 ", IMGFMT_I420, 0, { sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('I', '4', '2', '0'), 0, 0, 0, 0, 0 } }, //yv12 with swapped uv - { "IYUV ", IMGFMT_IYUV, 0, { sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('I', 'Y', 'U', 'V'), 0, 0, 0, 0, 0 } }, //same as i420 - { "YVU9 ", IMGFMT_YVU9, 0, { sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y', 'V', 'U', '9'), 0, 0, 0, 0, 0 } }, - { "YUY2 ", IMGFMT_YUY2, 0, { sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y', 'U', 'Y', '2'), 0, 0, 0, 0, 0 } }, - { "UYVY ", IMGFMT_UYVY, 0, { sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('U', 'Y', 'V', 'Y'), 0, 0, 0, 0, 0 } }, - { "BGR8 ", IMGFMT_BGR8, 0, { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 8, 0x00000000, 0x00000000, 0x00000000, 0 } }, - { "RGB15", IMGFMT_RGB15, 0, { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 16, 0x0000001F, 0x000003E0, 0x00007C00, 0 } }, //RGB 5:5:5 - { "BGR15", IMGFMT_BGR15, 0, { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 16, 0x00007C00, 0x000003E0, 0x0000001F, 0 } }, - { "RGB16", IMGFMT_RGB16, 0, { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 16, 0x0000001F, 0x000007E0, 0x0000F800, 0 } }, //RGB 5:6:5 - { "BGR16", IMGFMT_BGR16, 0, { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 16, 0x0000F800, 0x000007E0, 0x0000001F, 0 } }, - { "RGB24", IMGFMT_RGB24, 0, { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 24, 0x000000FF, 0x0000FF00, 0x00FF0000, 0 } }, - { "BGR24", IMGFMT_BGR24, 0, { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 24, 0x00FF0000, 0x0000FF00, 0x000000FF, 0 } }, - { "RGB32", IMGFMT_RGB32, 0, { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0 } }, - { "BGR32", IMGFMT_BGR32, 0, { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0 } } +static const directx_fourcc_caps g_ddpf[] = { + { "YV12 ", IMGFMT_YV12, { sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y', 'V', '1', '2'), 0, 0, 0, 0, 0 } }, + { "I420 ", IMGFMT_I420, { sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('I', '4', '2', '0'), 0, 0, 0, 0, 0 } }, //yv12 with swapped uv + { "IYUV ", IMGFMT_IYUV, { sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('I', 'Y', 'U', 'V'), 0, 0, 0, 0, 0 } }, //same as i420 + { "YVU9 ", IMGFMT_YVU9, { sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y', 'V', 'U', '9'), 0, 0, 0, 0, 0 } }, + { "YUY2 ", IMGFMT_YUY2, { sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('Y', 'U', 'Y', '2'), 0, 0, 0, 0, 0 } }, + { "UYVY ", IMGFMT_UYVY, { sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('U', 'Y', 'V', 'Y'), 0, 0, 0, 0, 0 } }, + { "BGR8 ", IMGFMT_BGR8, { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 8, 0x00000000, 0x00000000, 0x00000000, 0 } }, + { "RGB15", IMGFMT_RGB15, { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 16, 0x0000001F, 0x000003E0, 0x00007C00, 0 } }, //RGB 5:5:5 + { "BGR15", IMGFMT_BGR15, { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 16, 0x00007C00, 0x000003E0, 0x0000001F, 0 } }, + { "RGB16", IMGFMT_RGB16, { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 16, 0x0000001F, 0x000007E0, 0x0000F800, 0 } }, //RGB 5:6:5 + { "BGR16", IMGFMT_BGR16, { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 16, 0x0000F800, 0x000007E0, 0x0000001F, 0 } }, + { "RGB24", IMGFMT_RGB24, { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 24, 0x000000FF, 0x0000FF00, 0x00FF0000, 0 } }, + { "BGR24", IMGFMT_BGR24, { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 24, 0x00FF0000, 0x0000FF00, 0x000000FF, 0 } }, + { "RGB32", IMGFMT_RGB32, { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0 } }, + { "BGR32", IMGFMT_BGR32, { sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0 } } }; #define NUM_FORMATS (sizeof(g_ddpf) / sizeof(g_ddpf[0])) +// what hw supports with corresponding format in g_ddpf +static uint32_t drv_caps[NUM_FORMATS]; + static const vo_info_t info = { "Directx DDraw YUV/RGB/BGR renderer", "directx", @@ -160,7 +162,7 @@ uint32_t i = 0; while (i < NUM_FORMATS) { if (g_ddpf[i].img_format == format) - return g_ddpf[i].drv_caps; + return drv_caps[i]; i++; } return 0; @@ -685,7 +687,7 @@ ddrval = g_lpdd->lpVtbl->CreateSurface(g_lpdd, &ddsdOverlay, &g_lpddsOverlay, NULL); if (ddrval == DD_OK) { mp_msg(MSGT_VO, MSGL_V, "<vo_directx><FORMAT OVERLAY>%i %s supported\n", i, g_ddpf[i].img_format_name); - g_ddpf[i].drv_caps = VFCAP_CSP_SUPPORTED | VFCAP_OSD | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP; + drv_caps[i] = VFCAP_CSP_SUPPORTED | VFCAP_OSD | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP; formatcount++; } else mp_msg(MSGT_VO, MSGL_V, "<vo_directx><FORMAT OVERLAY>%i %s not supported\n", i, g_ddpf[i].img_format_name); @@ -734,7 +736,7 @@ if (g_ddpf[i].g_ddpfOverlay.dwRGBBitCount == ddpf.dwRGBBitCount) { if (g_ddpf[i].g_ddpfOverlay.dwRBitMask == ddpf.dwRBitMask) { mp_msg(MSGT_VO, MSGL_V, "<vo_directx><FORMAT PRIMARY>%i %s supported\n", i, g_ddpf[i].img_format_name); - g_ddpf[i].drv_caps = VFCAP_CSP_SUPPORTED | VFCAP_OSD; + drv_caps[i] = VFCAP_CSP_SUPPORTED | VFCAP_OSD; formatcount++; primary_image_format = g_ddpf[i].img_format; }