[MPlayer-dev-eng] [PATCH] Direct3D beautify info/error messages

Georgi Petrov gogothebee at gmail.com
Wed Feb 4 19:19:17 CET 2009


On Wed, Feb 4, 2009 at 8:15 PM, Diego Biurrun <diego at biurrun.de> wrote:
> On Wed, Feb 04, 2009 at 12:58:50PM +0200, Georgi Petrov wrote:
>>
>> 5. MSGL_ERR -> MSG_V in one of the messages to avoid spam every frame
>> when the video adapter is uncooperative
>
> That should be a separate patch/commit.

Removed from this patch. Attached the updated one.
-------------- next part --------------
Index: libvo/vo_direct3d.c
===================================================================
--- libvo/vo_direct3d.c	(revision 28461)
+++ libvo/vo_direct3d.c	(working copy)
@@ -190,7 +190,7 @@
     }
 
     mp_msg(MSGT_VO, MSGL_V,
-           "<vo_direct3d>Fullscreen Movie Rect: t: %ld, l: %ld, r: %ld, b:%ld\r\n",
+           "<vo_direct3d>Fullscreen movie rectangle: t: %ld, l: %ld, r: %ld, b:%ld\r\n",
            priv->fs_movie_rect.top,   priv->fs_movie_rect.left,
            priv->fs_movie_rect.right, priv->fs_movie_rect.bottom);
 
@@ -205,7 +205,7 @@
  */
 static void destroy_d3d_surfaces(void)
 {
-    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>destroy_d3d_surfaces called\r\n");
+    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>destroy_d3d_surfaces called.\r\n");
     /* Let's destroy the old (if any) D3D Surfaces */
 
     if (priv->locked_rect.pBits)
@@ -238,14 +238,14 @@
 {
     int osd_width = vo_dwidth, osd_height = vo_dheight;
     int tex_width = osd_width, tex_height = osd_height;
-    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d><INFO>create_d3d_surfaces called.\n");
+    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>create_d3d_surfaces called.\r\n");
 
     if (!priv->d3d_surface &&
         FAILED(IDirect3DDevice9_CreateOffscreenPlainSurface(
                priv->d3d_device, priv->src_width, priv->src_height,
                priv->movie_src_fmt, D3DPOOL_DEFAULT, &priv->d3d_surface, NULL))) {
         mp_msg(MSGT_VO, MSGL_ERR,
-               "<vo_direct3d><INFO>IDirect3D9_CreateOffscreenPlainSurface Failed.\n");
+               "<vo_direct3d>Allocating offscreen surface failed.\r\n");
         return 0;
     }
 
@@ -253,7 +253,7 @@
         FAILED(IDirect3DDevice9_GetBackBuffer(priv->d3d_device, 0, 0,
                                               D3DBACKBUFFER_TYPE_MONO,
                                               &priv->d3d_backbuf))) {
-        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Back Buffer address get failed\n");
+        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Allocating backbuffer failed.\r\n");
         return 0;
     }
 
@@ -284,7 +284,7 @@
     priv->osd_texture_width  = tex_width;
     priv->osd_texture_height = tex_height;
 
-    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d><INFO>surface (%d, %d) requested = (%d, %d)\n",
+    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>OSD texture size (%dx%d), requested (%dx%d).\r\n",
            vo_dwidth, vo_dheight, priv->osd_texture_width, priv->osd_texture_height);
 
     /* create OSD */
@@ -299,7 +299,7 @@
                                               &priv->d3d_texture_system,
                                               NULL))) {
         mp_msg(MSGT_VO,MSGL_ERR,
-               "<vo_direct3d><INFO>IDirect3DDevice9_CreateTexture Failed (d3d_texture_system).\n");
+               "<vo_direct3d>Allocating OSD texture in system RAM failed.\r\n");
         return 0;
     }
 
@@ -316,7 +316,7 @@
                                                   &priv->d3d_texture_osd,
                                                   NULL))) {
             mp_msg(MSGT_VO,MSGL_ERR,
-                   "<vo_direct3d><INFO>IDirect3DDevice9_CreateTexture Failed (d3d_texture_osd).\n");
+                   "<vo_direct3d>Allocating OSD texture in video RAM failed.\r\n");
             return 0;
         }
     }
@@ -383,19 +383,19 @@
                                        D3DCREATE_SOFTWARE_VERTEXPROCESSING,
                                        &present_params, &priv->d3d_device))) {
             mp_msg(MSGT_VO, MSGL_ERR,
-                   "<vo_direct3d><INFO>Could not create the D3D device\n");
+                   "<vo_direct3d>Creating Direct3D device failed.\r\n");
         return 0;
     }
 
     if (action == BACKBUFFER_RESET &&
         FAILED(IDirect3DDevice9_Reset(priv->d3d_device, &present_params))) {
             mp_msg(MSGT_VO, MSGL_ERR,
-                   "<vo_direct3d><INFO>Could not reset the D3D device\n");
+                   "<vo_direct3d>Reseting Direct3D device failed.\r\n");
         return 0;
     }
 
     mp_msg(MSGT_VO, MSGL_V,
-           "<vo_direct3d><INFO>New backbuffer: Width: %d, Height:%d. VO Dest Width:%d, Height: %d\n",
+           "<vo_direct3d>New backbuffer (%dx%d), VO (%dx%d).\r\n",
            present_params.BackBufferWidth, present_params.BackBufferHeight,
            vo_dwidth, vo_dheight);
 
@@ -411,7 +411,7 @@
     D3DDISPLAYMODE disp_mode;
     D3DVIEWPORT9 vp = {0, 0, vo_dwidth, vo_dheight, 0, 1};
 
-    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d><INFO>configure_d3d called\n");
+    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>configure_d3d called.\r\n");
 
     destroy_d3d_surfaces();
 
@@ -421,7 +421,7 @@
                                                 D3DADAPTER_DEFAULT,
                                                 &disp_mode))) {
         mp_msg(MSGT_VO, MSGL_ERR,
-               "<vo_direct3d><INFO>Could not read adapter display mode.\n");
+               "<vo_direct3d>Reading adapter display mode failed.\r\n");
         return 0;
     }
 
@@ -436,7 +436,7 @@
 
     if (FAILED(IDirect3DDevice9_SetViewport(priv->d3d_device,
                                             &vp))) {
-        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Unable to set the viewport\n");
+        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Setting viewport failed.\r\n");
         return 0;
     }
 
@@ -451,7 +451,7 @@
  */
 static int reconfigure_d3d(void)
 {
-    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d><INFO>reconfigure_d3d called.\n");
+    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>reconfigure_d3d called.\r\n");
 
     /* Destroy the offscreen, OSD and backbuffer surfaces */
     destroy_d3d_surfaces();
@@ -467,7 +467,7 @@
     /* Initialize Direct3D from the beginning */
     priv->d3d_handle = Direct3DCreate9(D3D_SDK_VERSION);
     if (!priv->d3d_handle) {
-        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Unable to initialize Direct3D\n");
+        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Initializing Direct3D failed.\r\n");
         return 0;
     }
 
@@ -485,7 +485,7 @@
 {
     D3DVIEWPORT9 vp = {0, 0, vo_dwidth, vo_dheight, 0, 1};
 
-    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d><INFO>resize_d3d called.\n");
+    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>resize_d3d called.\r\n");
 
     /* Make sure that backbuffer is large enough to accomodate the new
        viewport dimensions. Grow it if necessary. */
@@ -519,7 +519,7 @@
 
     if (FAILED(IDirect3DDevice9_SetViewport(priv->d3d_device,
                                             &vp))) {
-        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Unable to set the viewport\n");
+        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Setting viewport failed.\r\n");
         return 0;
     }
 
@@ -539,7 +539,7 @@
  */
 static void uninit_d3d(void)
 {
-    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>uninit_d3d called\r\n");
+    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>uninit_d3d called.\r\n");
 
     destroy_d3d_surfaces();
 
@@ -550,7 +550,7 @@
 
     /* Stop the whole D3D. */
     if (priv->d3d_handle) {
-        mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Calling IDirect3D9_Release\r\n");
+        mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Stopping Direct3D.\r\n");
         IDirect3D9_Release(priv->d3d_handle);
     }
     priv->d3d_handle = NULL;
@@ -583,7 +583,7 @@
     if (!priv->locked_rect.pBits) {
         if (FAILED(IDirect3DSurface9_LockRect(priv->d3d_surface,
                                               &priv->locked_rect, NULL, 0))) {
-            mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Surface lock failure\n");
+            mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Surface lock failed.\r\n");
             return VO_ERROR;
         }
     }
@@ -594,13 +594,13 @@
 skip_upload:
     /* This unlock is used for both slice_draw path and render_d3d_frame path. */
     if (FAILED(IDirect3DSurface9_UnlockRect(priv->d3d_surface))) {
-        mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Surface unlock failure\n");
+        mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Surface unlock failed.\r\n");
         return VO_ERROR;
     }
     priv->locked_rect.pBits = NULL;
 
     if (FAILED(IDirect3DDevice9_BeginScene(priv->d3d_device))) {
-        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>BeginScene failed\n");
+        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>BeginScene failed.\r\n");
         return VO_ERROR;
     }
 
@@ -617,12 +617,12 @@
                                             &priv->fs_movie_rect,
                                             D3DTEXF_LINEAR))) {
         mp_msg(MSGT_VO, MSGL_ERR,
-               "<vo_direct3d>Unable to copy the frame to the back buffer\n");
+               "<vo_direct3d>Copying frame to the backbuffer failed.\r\n");
         return VO_ERROR;
     }
 
     if (FAILED(IDirect3DDevice9_EndScene(priv->d3d_device))) {
-        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>EndScene failed\n");
+        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>EndScene failed.\r\n");
         return VO_ERROR;
     }
 
@@ -646,13 +646,13 @@
                                                               D3DDEVTYPE_HAL,
                                                               fmt_table[i].fourcc,
                                                               priv->desktop_fmt))) {
-                mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Rejected image format: %s\n",
+                mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Rejected image format: %s\r\n",
                        vo_format_name(fmt_table[i].mplayer_fmt));
                 return 0;
             }
 
             priv->movie_src_fmt = fmt_table[i].fourcc;
-            mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Accepted image format: %s\n",
+            mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Accepted image format: %s\r\n",
                    vo_format_name(fmt_table[i].mplayer_fmt));
             return (VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW
                     | VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN);
@@ -693,7 +693,7 @@
     /* Set to zero all global variables. */
     priv = calloc(1, sizeof(struct global_priv));
     if (!priv) {
-        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Not enough memory\r\n");
+        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Allocating private memory failed.\r\n");
         return -1;
     }
 
@@ -704,14 +704,14 @@
 
     priv->d3d_handle = Direct3DCreate9(D3D_SDK_VERSION);
     if (!priv->d3d_handle) {
-        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Unable to initialize Direct3D\n");
+        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Initializing Direct3D failed.\r\n");
         return -1;
     }
 
     if (FAILED(IDirect3D9_GetAdapterDisplayMode(priv->d3d_handle,
                                                 D3DADAPTER_DEFAULT,
                                                 &disp_mode))) {
-        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Could not read display mode\n");
+        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Reading display mode failed.\r\n");
         return -1;
     }
 
@@ -720,14 +720,14 @@
     priv->cur_backbuf_width = disp_mode.Width;
     priv->cur_backbuf_height = disp_mode.Height;
 
-    mp_msg(MSGT_VO, MSGL_V, "Setting backbuffer to the screen width: %d, height: %d\n",
+    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Setting backbuffer dimensions to (%dx%d).\r\n",
            disp_mode.Width, disp_mode.Height);
 
     if (FAILED(IDirect3D9_GetDeviceCaps(priv->d3d_handle,
                                         D3DADAPTER_DEFAULT,
                                         D3DDEVTYPE_HAL,
                                         &disp_caps))) {
-        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Could not read display capabilities\n");
+        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Reading display capabilities failed.\r\n");
         return -1;
     }
 
@@ -741,9 +741,9 @@
     priv->max_texture_width       = disp_caps.MaxTextureWidth;
     priv->max_texture_height      = disp_caps.MaxTextureHeight;
 
-    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>device_caps_power2_only %d, device_caps_square_only %d\n"
-                            "<vo_direct3d>device_texture_sys %d\n"
-                            "<vo_direct3d>max_texture_width %d, max_texture_height %d\n",
+    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>device_caps_power2_only %d, device_caps_square_only %d\r\n"
+                            "<vo_direct3d>device_texture_sys %d\r\n"
+                            "<vo_direct3d>max_texture_width %d, max_texture_height %d\r\n",
            priv->device_caps_power2_only, priv->device_caps_square_only,
            priv->device_texture_sys, priv->max_texture_width,
            priv->max_texture_height);
@@ -752,7 +752,7 @@
      * fullscreen dimensions and does other useful stuff.
      */
     if (!vo_w32_init()) {
-        mp_msg(MSGT_VO, MSGL_V, "Unable to configure onscreen window\r\n");
+        mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Configuring onscreen window failed.\r\n");
         return -1;
     }
 
@@ -771,7 +771,7 @@
         return query_format(*(uint32_t*) data);
     case VOCTRL_GET_IMAGE: /* Direct Rendering. Not implemented yet. */
         mp_msg(MSGT_VO, MSGL_V,
-               "<vo_direct3d>Direct Rendering request. Not implemented yet\n");
+               "<vo_direct3d>Direct Rendering request. Not implemented yet.\r\n");
         return VO_NOTIMPL;
     case VOCTRL_DRAW_IMAGE:
         return render_d3d_frame(data);
@@ -835,7 +835,7 @@
      * the given coordinates.
      */
     if (!vo_w32_config(d_width, d_height, options)) {
-        mp_msg(MSGT_VO, MSGL_V, "Unable to create onscreen window\r\n");
+        mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Creating onscreen window failed.\r\n");
         return VO_ERROR;
     }
 
@@ -866,13 +866,13 @@
     if (!priv->d3d_device ||
         FAILED(IDirect3DDevice9_Present(priv->d3d_device, &rect, 0, 0, 0))) {
         mp_msg(MSGT_VO, MSGL_V,
-               "<vo_direct3d>Trying to reinitialize uncooperative video adapter.\n");
+               "<vo_direct3d>Trying to reinitialize uncooperative video adapter.\r\n");
         if (!reconfigure_d3d()) {
-            mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Reinitialization failed.\n");
+            mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Reinitialization failed.\r\n");
             return;
         }
         else
-            mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Video adapter reinitialized.\n");
+            mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Video adapter reinitialized.\r\n");
     }
 }
 
@@ -881,7 +881,7 @@
  */
 static void uninit(void)
 {
-    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Uninitialization\r\n");
+    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>uninit called.\r\n");
 
     uninit_d3d();
     vo_w32_uninit(); /* w32_common framework call */
@@ -924,7 +924,7 @@
     if (!priv->locked_rect.pBits) {
         if (FAILED(IDirect3DSurface9_LockRect(priv->d3d_surface,
                                               &priv->locked_rect, NULL, 0))) {
-            mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Surface lock failure\n");
+            mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Surface lock failure.\r\n");
             return VO_FALSE;
         }
     }
@@ -971,7 +971,7 @@
  */
 static int draw_frame(uint8_t *src[])
 {
-    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>draw_frame called\n");
+    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>draw_frame called.\r\n");
     return VO_FALSE;
 }
 
@@ -1008,7 +1008,7 @@
 
     if (FAILED(IDirect3DTexture9_LockRect(priv->d3d_texture_system, 0,
                                           &locked_rect, NULL, 0))) {
-        mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>IDirect3DTexture9_LockRect failure.\n");
+        mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>OSD texture lock failed.\r\n");
         return;
     }
 
@@ -1017,7 +1017,7 @@
 
     /* this unlock is used for both slice_draw path and D3DRenderFrame path */
     if (FAILED(IDirect3DTexture9_UnlockRect(priv->d3d_texture_system, 0))) {
-        mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>IDirect3DTexture9_UnlockRect failure.\n");
+        mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>OSD texture unlock failed.\r\n");
         return;
     }
 
@@ -1039,7 +1039,7 @@
         /* clear the OSD */
         if (FAILED(IDirect3DTexture9_LockRect(priv->d3d_texture_system, 0,
                                               &locked_rect, NULL, 0))) {
-            mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>IDirect3DTexture9_LockRect failure.\n");
+            mp_msg(MSGT_VO,MSGL_ERR, "<vo_direct3d>OSD texture lock failed.\r\n");
             return;
         }
 
@@ -1048,7 +1048,7 @@
 
         /* this unlock is used for both slice_draw path and D3DRenderFrame path */
         if (FAILED(IDirect3DTexture9_UnlockRect(priv->d3d_texture_system, 0))) {
-            mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>IDirect3DTexture9_UnlockRect failure.\n");
+            mp_msg(MSGT_VO,MSGL_ERR, "<vo_direct3d>OSD texture unlock failed.\r\n");
             return;
         }
 
@@ -1064,7 +1064,7 @@
             if (FAILED(IDirect3DDevice9_UpdateTexture(priv->d3d_device,
                                                       (IDirect3DBaseTexture9 *)priv->d3d_texture_system,
                                                       (IDirect3DBaseTexture9 *)priv->d3d_texture_osd))) {
-                mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>IDirect3DDevice9_UpdateTexture failure.\n");
+                mp_msg(MSGT_VO,MSGL_ERR, "<vo_direct3d>OSD texture transfer failed.\r\n");
                 return;
             }
         }
@@ -1088,7 +1088,7 @@
             osd_quad_vb[3].tv = (float)priv->osd_height / priv->osd_texture_height;
 
         if (FAILED(IDirect3DDevice9_BeginScene(priv->d3d_device))) {
-            mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>BeginScene failed\n");
+            mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>BeginScene failed.\r\n");
             return;
         }
 
@@ -1109,7 +1109,7 @@
         IDirect3DDevice9_SetRenderState(priv->d3d_device, D3DRS_ALPHABLENDENABLE, FALSE);
 
         if (FAILED(IDirect3DDevice9_EndScene(priv->d3d_device))) {
-            mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>EndScene failed\n");
+            mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>EndScene failed.\r\n");
             return;
         }
     }


More information about the MPlayer-dev-eng mailing list