diff options
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/matrixview.c | 22 | ||||
-rw-r--r-- | libvo/matrixview.h | 4 | ||||
-rw-r--r-- | libvo/vo_aa.c | 4 | ||||
-rw-r--r-- | libvo/vo_direct3d.c | 37 | ||||
-rw-r--r-- | libvo/vo_gl.c | 1 | ||||
-rw-r--r-- | libvo/vo_matrixview.c | 109 | ||||
-rw-r--r-- | libvo/vo_vesa.c | 4 | ||||
-rw-r--r-- | libvo/vo_x11.c | 2 |
8 files changed, 107 insertions, 76 deletions
diff --git a/libvo/matrixview.c b/libvo/matrixview.c index 287ff2d497..5b80984de4 100644 --- a/libvo/matrixview.c +++ b/libvo/matrixview.c @@ -30,12 +30,12 @@ #include "matrixview.h" #include "matrixview_font.h" -static float matrix_contrast = 1.5; +static float matrix_contrast = 1.5; static float matrix_brightness = 1.0; // Settings for our light. Try playing with these (or add more lights). -static float Light_Ambient[] = { 0.1f, 0.1f, 0.1f, 1.0f }; -static float Light_Diffuse[] = { 1.2f, 1.2f, 1.2f, 1.0f }; +static float Light_Ambient[] = { 0.1f, 0.1f, 0.1f, 1.0f }; +static float Light_Diffuse[] = { 1.2f, 1.2f, 1.2f, 1.0f }; static float Light_Position[] = { 2.0f, 2.0f, 0.0f, 1.0f }; static const uint8_t flare[4][4] = { @@ -134,7 +134,7 @@ static void draw_text(uint8_t *pic) for (y = _text_y; y > -_text_y; y--) { for (x = -_text_x; x < _text_x; x++) { - c = text_light[p] - (text[p] >> 1); + c = text_light[p] - (text[p] >> 1); c += pic_fade; if (c > 255) c = 255; @@ -167,7 +167,8 @@ static void draw_text(uint8_t *pic) text_depth[p] /= 1.1; if (text_light[p] > 128 && text_light[p + text_x] < 10) - draw_illuminatedchar(text[p] + 1, x, y, text_depth[p] + bump_pic[p]); + draw_illuminatedchar(text[p] + 1, x, y, + text_depth[p] + bump_pic[p]); p++; } @@ -182,7 +183,7 @@ static void draw_flares(void) for (y = _text_y; y > -_text_y; y--) { for (x = -_text_x; x < _text_x; x++) { if (text_light[p] > 128 && text_light[p + text_x] < 10) - draw_flare(x, y, text_depth[p] + bump_pic[p]); + draw_flare(x, y, text_depth[p] + bump_pic[p]); p++; } } @@ -249,12 +250,14 @@ static void make_text(void) static void ourBuildTextures(void) { - TexImage2D(GL_TEXTURE_2D, 0, 1, 128, 64, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, font_texture); + TexImage2D(GL_TEXTURE_2D, 0, 1, 128, 64, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, + font_texture); TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); BindTexture(GL_TEXTURE_2D, 1); - TexImage2D(GL_TEXTURE_2D, 0, 1, 4, 4, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, flare); + TexImage2D(GL_TEXTURE_2D, 0, 1, 4, 4, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, + flare); TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); @@ -309,7 +312,8 @@ void matrixview_reshape(int w, int h) } -void matrixview_draw(int w, int h, double currentTime, float frameTime, uint8_t *data) +void matrixview_draw(int w, int h, double currentTime, float frameTime, + uint8_t *data) { Enable(GL_BLEND); Enable(GL_TEXTURE_2D); diff --git a/libvo/matrixview.h b/libvo/matrixview.h index db76729906..d96597c243 100644 --- a/libvo/matrixview.h +++ b/libvo/matrixview.h @@ -2,9 +2,11 @@ #define MPLAYER_MATRIXVIEW_H #include <stdint.h> + void matrixview_init (int w, int h); void matrixview_reshape (int w, int h); -void matrixview_draw (int w, int h, double currentTime, float frameTime, uint8_t *data); +void matrixview_draw (int w, int h, double currentTime, float frameTime, + uint8_t *data); void matrixview_matrix_resize(int w, int h); void matrixview_contrast_set(float contrast); void matrixview_brightness_set(float brightness); diff --git a/libvo/vo_aa.c b/libvo/vo_aa.c index 5e9dfbae10..c1ff5efa27 100644 --- a/libvo/vo_aa.c +++ b/libvo/vo_aa.c @@ -350,7 +350,7 @@ draw_frame(uint8_t *src[]) { break; } - sws_scale_ordered(sws,src,stride,0,src_height,image,image_stride); + sws_scale(sws,src,stride,0,src_height,image,image_stride); /* Now 'ASCIInate' the image */ if (fast) @@ -370,7 +370,7 @@ draw_slice(uint8_t *src[], int stride[], int dx2 = screen_x + ((x+w) * screen_w / src_width); int dy2 = screen_y + ((y+h) * screen_h / src_height); - sws_scale_ordered(sws,src,stride,y,h,image,image_stride); + sws_scale(sws,src,stride,y,h,image,image_stride); /* Now 'ASCIInate' the image */ if (fast) diff --git a/libvo/vo_direct3d.c b/libvo/vo_direct3d.c index 7094af8823..384dcb477b 100644 --- a/libvo/vo_direct3d.c +++ b/libvo/vo_direct3d.c @@ -70,6 +70,10 @@ static struct global_priv { the movie's codec) */ D3DFORMAT desktop_fmt; /**< Desktop (screen) colorspace format. Usually XRGB */ + + HANDLE d3d9_dll; /**< d3d9 Library HANDLE */ + IDirect3D9 * (WINAPI *pDirect3DCreate9)(UINT); /**< pointer to Direct3DCreate9 function */ + LPDIRECT3D9 d3d_handle; /**< Direct3D Handle */ LPDIRECT3DDEVICE9 d3d_device; /**< The Direct3D Adapter */ IDirect3DSurface9 *d3d_surface; /**< Offscreen Direct3D Surface. MPlayer @@ -441,7 +445,7 @@ static int reconfigure_d3d(void) IDirect3D9_Release(priv->d3d_handle); /* Initialize Direct3D from the beginning */ - priv->d3d_handle = Direct3DCreate9(D3D_SDK_VERSION); + priv->d3d_handle = priv->pDirect3DCreate9(D3D_SDK_VERSION); if (!priv->d3d_handle) { mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Initializing Direct3D failed.\n"); return 0; @@ -670,7 +674,7 @@ static int preinit(const char *arg) priv = calloc(1, sizeof(struct global_priv)); if (!priv) { mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Allocating private memory failed.\n"); - return -1; + goto err_out; } /* FIXME @@ -678,17 +682,29 @@ static int preinit(const char *arg) > an example of how to use it. */ - priv->d3d_handle = Direct3DCreate9(D3D_SDK_VERSION); + priv->d3d9_dll = LoadLibraryA("d3d9.dll"); + if (!priv->d3d9_dll) { + mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Unable to dynamically load d3d9.dll\n"); + goto err_out; + } + + priv->pDirect3DCreate9 = (void *)GetProcAddress(priv->d3d9_dll, "Direct3DCreate9"); + if (!priv->pDirect3DCreate9) { + mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Unable to find entry point of Direct3DCreate9\n"); + goto err_out; + } + + priv->d3d_handle = priv->pDirect3DCreate9(D3D_SDK_VERSION); if (!priv->d3d_handle) { mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Initializing Direct3D failed.\n"); - return -1; + goto err_out; } if (FAILED(IDirect3D9_GetAdapterDisplayMode(priv->d3d_handle, D3DADAPTER_DEFAULT, &disp_mode))) { mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Reading display mode failed.\n"); - return -1; + goto err_out; } /* Store in priv->desktop_fmt the user desktop's colorspace. Usually XRGB. */ @@ -704,7 +720,7 @@ static int preinit(const char *arg) D3DDEVTYPE_HAL, &disp_caps))) { mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Reading display capabilities failed.\n"); - return -1; + goto err_out; } /* Store relevant information reguarding caps of device */ @@ -729,10 +745,14 @@ static int preinit(const char *arg) */ if (!vo_w32_init()) { mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Configuring onscreen window failed.\n"); - return -1; + goto err_out; } return 0; + +err_out: + uninit(); + return -1; } @@ -859,6 +879,9 @@ static void uninit(void) uninit_d3d(); vo_w32_uninit(); /* w32_common framework call */ + if (priv->d3d9_dll) + FreeLibrary(priv->d3d9_dll); + priv->d3d9_dll = NULL; free(priv); priv = NULL; } diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index b0c3a1507c..e86425dbe7 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -446,6 +446,7 @@ static void autodetectGlExtensions(void) { const char *version = GetString(GL_VERSION); int is_ati = strstr(vendor, "ATI") != NULL; int ati_broken_pbo = 0; + mp_msg(MSGT_VO, MSGL_V, "[gl] Running on OpenGL by '%s', versions '%s'\n", vendor, version); if (is_ati && strncmp(version, "2.1.", 4) == 0) { int ver = atoi(version + 4); mp_msg(MSGT_VO, MSGL_V, "[gl] Detected ATI driver version: %i\n", ver); diff --git a/libvo/vo_matrixview.c b/libvo/vo_matrixview.c index efc5097fde..06d599ca66 100644 --- a/libvo/vo_matrixview.c +++ b/libvo/vo_matrixview.c @@ -37,8 +37,7 @@ #include "matrixview.h" -static const vo_info_t info = -{ +static const vo_info_t info = { "MatrixView (OpenGL)", "matrixview", "Pigeon <pigeon@pigeond.net>", @@ -88,7 +87,8 @@ static void contrast_set(int value) { float contrast = value * CONTRAST_MULTIPLIER + DEFAULT_CONTRAST; eq_contrast = value; - if (contrast < 0) contrast = 0; + if (contrast < 0) + contrast = 0; matrixview_contrast_set(contrast); } @@ -97,54 +97,56 @@ static void brightness_set(int value) { float brightness = value * BRIGHTNESS_MULTIPLIER + DEFAULT_BRIGHTNESS; eq_brightness = value; - if (brightness < 0) brightness = 0; + if (brightness < 0) + brightness = 0; matrixview_brightness_set(brightness); } -static int -config(uint32_t width, uint32_t height, - uint32_t d_width, uint32_t d_height, - uint32_t flags, char *title, uint32_t format) +static int config(uint32_t width, uint32_t height, + uint32_t d_width, uint32_t d_height, + uint32_t flags, char *title, uint32_t format) { image_height = height; - image_width = width; + image_width = width; image_format = format; int_pause = 0; #ifdef CONFIG_GL_WIN32 - if (glctx.type == GLTYPE_W32 && !vo_w32_config(d_width, d_height, flags)) - return -1; + if (glctx.type == GLTYPE_W32 && !vo_w32_config(d_width, d_height, flags)) + return -1; #endif #ifdef CONFIG_GL_X11 - if (glctx.type == GLTYPE_X11) { - XVisualInfo *vinfo=glXChooseVisual( mDisplay,mScreen,wsGLXAttrib ); - if (vinfo == NULL) - { - mp_msg(MSGT_VO, MSGL_ERR, "[matrixview] no GLX support present\n"); - return -1; - } - mp_msg(MSGT_VO, MSGL_V, "[matrixview] GLX chose visual with ID 0x%x\n", (int)vinfo->visualid); + if (glctx.type == GLTYPE_X11) { + XVisualInfo *vinfo=glXChooseVisual( mDisplay,mScreen,wsGLXAttrib ); + if (vinfo == NULL) { + mp_msg(MSGT_VO, MSGL_ERR, "[matrixview] no GLX support present\n"); + return -1; + } + mp_msg(MSGT_VO, MSGL_V, "[matrixview] GLX chose visual with ID 0x%x\n", + (int)vinfo->visualid); - vo_x11_create_vo_window(vinfo, vo_dx, vo_dy, d_width, d_height, flags, - XCreateColormap(mDisplay, mRootWin, vinfo->visual, AllocNone), - "matrixview", title); - } + vo_x11_create_vo_window(vinfo, vo_dx, vo_dy, d_width, d_height, flags, + XCreateColormap(mDisplay, mRootWin, + vinfo->visual, AllocNone), + "matrixview", title); + } #endif /* CONFIG_GL_WIN32 */ if (glctx.setGlWindow(&glctx) == SET_WINDOW_FAILED) return -1; - if(sws) + if (sws) sws_freeContext(sws); - sws = sws_getContextFromCmdLine(image_width, image_height, image_format, matrix_cols, matrix_rows, IMGFMT_Y8); + sws = sws_getContextFromCmdLine(image_width, image_height, image_format, + matrix_cols, matrix_rows, IMGFMT_Y8); if (!sws) { mp_msg(MSGT_VO, MSGL_ERR, "[matrixview] Cannot create SwsContext context\n"); return -1; } - if(!map_image[0]) + if (!map_image[0]) map_image[0] = calloc(matrix_cols, matrix_rows); map_stride[0] = matrix_cols; @@ -161,11 +163,12 @@ config(uint32_t width, uint32_t height, static void check_events(void) { - int e=glctx.check_events(); - if(e & VO_EVENT_RESIZE) { + int e = glctx.check_events(); + if (e & VO_EVENT_RESIZE) { matrixview_reshape(vo_dwidth, vo_dheight); } - if(e & VO_EVENT_EXPOSE && int_pause) flip_page(); + if (e & VO_EVENT_EXPOSE && int_pause) + flip_page(); } @@ -200,18 +203,18 @@ static int query_format(uint32_t format) { int caps = VFCAP_CSP_SUPPORTED | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_ACCEPT_STRIDE; - switch(format) { - case IMGFMT_YV12: - case IMGFMT_BGR32: - case IMGFMT_BGR24: - case IMGFMT_BGR16: - case IMGFMT_BGR15: - case IMGFMT_RGB32: - case IMGFMT_RGB24: - case IMGFMT_ARGB: - return caps; - default: - break; + switch (format) { + case IMGFMT_YV12: + case IMGFMT_BGR32: + case IMGFMT_BGR24: + case IMGFMT_BGR16: + case IMGFMT_BGR15: + case IMGFMT_RGB32: + case IMGFMT_RGB24: + case IMGFMT_ARGB: + return caps; + default: + break; } return 0; @@ -220,7 +223,8 @@ static int query_format(uint32_t format) static void uninit(void) { - if (!vo_config_count) return; + if (!vo_config_count) + return; uninit_mpglcontext(&glctx); free(map_image[0]); map_image[0] = NULL; @@ -231,8 +235,8 @@ static void uninit(void) static const opt_t subopts[] = { - { "rows", OPT_ARG_INT, &matrix_rows, int_pos }, - { "cols", OPT_ARG_INT, &matrix_cols, int_pos }, + { "rows", OPT_ARG_INT, &matrix_rows, int_pos }, + { "cols", OPT_ARG_INT, &matrix_cols, int_pos }, { NULL } }; @@ -243,12 +247,13 @@ static int preinit(const char *arg) #ifdef CONFIG_GL_WIN32 gltype = GLTYPE_W32; #endif - if(!init_mpglcontext(&glctx, gltype)) return -1; + if (!init_mpglcontext(&glctx, gltype)) + return -1; matrix_rows = DEFAULT_MATRIX_ROWS; matrix_cols = DEFAULT_MATRIX_COLS; - if(subopt_parse(arg, subopts) != 0) { + if (subopt_parse(arg, subopts) != 0) { mp_msg(MSGT_VO, MSGL_FATAL, "\n-vo matrixview command line help:\n" "Example: mplayer -vo matrixview:cols=320:rows=240\n" @@ -293,12 +298,10 @@ static int control(uint32_t request, void *data) case VOCTRL_GET_EQUALIZER: { struct voctrl_get_equalizer_args *args = data; - if (strcasecmp(args->name, "contrast") == 0) - { + if (strcasecmp(args->name, "contrast") == 0) { *args->valueptr = eq_contrast; } - else if (strcasecmp(args->name, "brightness") == 0) - { + else if (strcasecmp(args->name, "brightness") == 0) { *args->valueptr = eq_brightness; } } @@ -306,12 +309,10 @@ static int control(uint32_t request, void *data) case VOCTRL_SET_EQUALIZER: { struct voctrl_set_equalizer_args *args = data; - if (strcasecmp(args->name, "contrast") == 0) - { + if (strcasecmp(args->name, "contrast") == 0) { contrast_set(args->value); } - else if (strcasecmp(args->name, "brightness") == 0) - { + else if (strcasecmp(args->name, "brightness") == 0) { brightness_set(args->value); } } diff --git a/libvo/vo_vesa.c b/libvo/vo_vesa.c index 1ab3cdd184..1dd328149b 100644 --- a/libvo/vo_vesa.c +++ b/libvo/vo_vesa.c @@ -291,7 +291,7 @@ static int draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) dstStride[1]= dstStride[2]=dstStride[0]>>1; if(HAS_DGA()) dst[0] += y_offset*SCREEN_LINE_SIZE(PIXEL_SIZE())+x_offset*PIXEL_SIZE(); - sws_scale_ordered(sws,image,stride,y,h,dst,dstStride); + sws_scale(sws,image,stride,y,h,dst,dstStride); flip_trigger = 1; return 0; } @@ -436,7 +436,7 @@ static int draw_frame(uint8_t *src[]) else srcStride[0] = srcW*2; if(HAS_DGA()) dst[0] += y_offset*SCREEN_LINE_SIZE(PIXEL_SIZE())+x_offset*PIXEL_SIZE(); - sws_scale_ordered(sws,src,srcStride,0,srcH,dst,dstStride); + sws_scale(sws,src,srcStride,0,srcH,dst,dstStride); flip_trigger=1; } return 0; diff --git a/libvo/vo_x11.c b/libvo/vo_x11.c index 938640a809..11c563d05d 100644 --- a/libvo/vo_x11.c +++ b/libvo/vo_x11.c @@ -554,7 +554,7 @@ static int draw_slice(uint8_t * src[], int stride[], int w, int h, dst[0] += dstStride[0] * (image_height - 1); dstStride[0] = -dstStride[0]; } - sws_scale_ordered(swsContext, src, stride, y, h, dst, dstStride); + sws_scale(swsContext, src, stride, y, h, dst, dstStride); return 0; } |