changeset 11988:ccb15c72f331

printf -> mp_msg patch by Reimar Dffinger <Reimar.Doeffinger@stud.uni-karlsruhe.de>
author attila
date Sun, 22 Feb 2004 15:30:01 +0000
parents 5f780dae2cf3
children 644d59147048
files libvo/vo_gl.c libvo/vo_gl2.c
diffstat 2 files changed, 30 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_gl.c	Sun Feb 22 15:27:15 2004 +0000
+++ b/libvo/vo_gl.c	Sun Feb 22 15:30:01 2004 +0000
@@ -6,6 +6,7 @@
 #include <math.h>
 #include <errno.h>
 
+#include "mp_msg.h"
 #include "config.h"
 #include "video_out.h"
 #include "video_out_internal.h"
@@ -55,7 +56,7 @@
 static int slice_height=1;
 
 static void resize(int x,int y){
-  printf("[gl] Resize: %dx%d\n",x,y);
+  mp_msg(MSGT_VO, MSGL_V, "[gl] Resize: %dx%d\n",x,y);
   glViewport( 0, 0, x, y );
 
   glMatrixMode(GL_PROJECTION);
@@ -113,7 +114,7 @@
   vinfo=glXChooseVisual( mDisplay,mScreen,wsGLXAttrib );
   if (vinfo == NULL)
   {
-    printf("[gl] no GLX support present\n");
+    mp_msg(MSGT_VO, MSGL_ERR, "[gl] no GLX support present\n");
     return -1;
   }
 
@@ -176,7 +177,7 @@
 
   glEnable(GL_TEXTURE_2D);
 
-  printf("[gl] Creating %dx%d texture...\n",texture_width,texture_height);
+  mp_msg(MSGT_VO, MSGL_V, "[gl] Creating %dx%d texture...\n",texture_width,texture_height);
 
 #if 1
 //  glBindTexture(GL_TEXTURE_2D, texture_id);
@@ -302,7 +303,7 @@
     {
 	    slice_height = 4;
     }
-    printf("[vo_gl] Using %d as slice_height (0 means image_height).\n", slice_height);
+    mp_msg(MSGT_VO, MSGL_INFO, "[vo_gl] Using %d as slice_height (0 means image_height).\n", slice_height);
 
     if( !vo_init() ) return -1; // Can't open X11
 
--- a/libvo/vo_gl2.c	Sun Feb 22 15:27:15 2004 +0000
+++ b/libvo/vo_gl2.c	Sun Feb 22 15:30:01 2004 +0000
@@ -153,7 +153,7 @@
 
     if (format != gl_internal_format)
     {
-      fprintf (stderr, "[gl2] Needed texture [%dx%d] too big, trying ",
+      mp_msg (MSGT_VO, MSGL_V, "[gl2] Needed texture [%dx%d] too big, trying ",
 		texture_height, texture_width);
 
       if (texture_width > texture_height)
@@ -171,11 +171,11 @@
 	  texture_height *= 2;
       }
 
-      fprintf (stderr, "[%dx%d] !\n", texture_height, texture_width);
+      mp_msg (MSGT_VO, MSGL_V, "[%dx%d] !\n", texture_height, texture_width);
 
       if(texture_width < 64 || texture_height < 64)
       {
-      	fprintf (stderr, "GLERROR: Give up .. usable texture size not avaiable, or texture config error !\n");
+      	mp_msg (MSGT_VO, MSGL_FATAL, "[gl2] Give up .. usable texture size not avaiable, or texture config error !\n");
 	return -1;
       }
     }
@@ -190,7 +190,7 @@
   if ((image_height % texture_height) > 0)
     texnumy++;
 
-  printf("[gl2] Creating %dx%d textures of size %dx%d ...\n",
+  mp_msg(MSGT_VO, MSGL_V, "[gl2] Creating %dx%d textures of size %dx%d ...\n",
 	texnumx, texnumy, texture_width,texture_height);
 
   /* Allocate the texture memory */
@@ -215,11 +215,9 @@
 
   memory_x_len = raw_line_len / image_bytes;
 
-#ifndef NDEBUG
-  fprintf (stderr, "[gl2] texture-usage %d*width=%d, %d*height=%d\n",
+  mp_msg (MSGT_VO, MSGL_DBG2, "[gl2] texture-usage %d*width=%d, %d*height=%d\n",
 		 (int) texnumx, (int) texture_width, (int) texnumy,
 		 (int) texture_height);
-#endif
 
   for (y = 0; y < texnumy; y++)
   {
@@ -265,12 +263,12 @@
       err = glGetError ();
       if(err==GL_INVALID_ENUM)
       {
-	fprintf (stderr, "GLERROR glBindTexture (glGenText) := GL_INVALID_ENUM, texnum x=%d, y=%d, texture=%d\n", x, y, tsq->texobj);
+	mp_msg (MSGT_VO, MSGL_ERR, "GLERROR glBindTexture (glGenText) := GL_INVALID_ENUM, texnum x=%d, y=%d, texture=%d\n", x, y, tsq->texobj);
       } 
 
       if(glIsTexture(tsq->texobj) == GL_FALSE)
       {
-	fprintf (stderr, "GLERROR ain't a texture (glGenText): texnum x=%d, y=%d, texture=%d\n",
+	mp_msg (MSGT_VO, MSGL_ERR, "GLERROR ain't a texture (glGenText): texnum x=%d, y=%d, texture=%d\n",
 		x, y, tsq->texobj);
       } else {
         tsq->isTexture=GL_TRUE;
@@ -422,33 +420,32 @@
 				GL_NEAREST);
 			glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 
 				GL_NEAREST);
-			printf("[gl2] bilinear off\n");
+			mp_msg(MSGT_VO, MSGL_INFO, "[gl2] bilinear off\n");
 			break;
 		case 1:
 			glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, 
 				GL_LINEAR);
 			glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 
 				GL_LINEAR);
-			printf("[gl2] bilinear linear\n");
+			mp_msg(MSGT_VO, MSGL_INFO, "[gl2] bilinear linear\n");
 			break;
 		case 2:
 			glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, 
 				GL_LINEAR_MIPMAP_NEAREST);
 			glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 
 				GL_LINEAR_MIPMAP_NEAREST);
-			printf("[gl2] bilinear mipmap nearest\n");
+			mp_msg(MSGT_VO, MSGL_INFO, "[gl2] bilinear mipmap nearest\n");
 			break;
 		case 3:
 			glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, 
 				GL_LINEAR_MIPMAP_LINEAR);
 			glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 
 				GL_LINEAR_MIPMAP_LINEAR);
-			printf("[gl2] bilinear mipmap linear\n");
+			mp_msg(MSGT_VO, MSGL_INFO, "[gl2] bilinear mipmap linear\n");
 			break;
         }
       }
   }
-  fflush(0);
 }
 
 static void gl_set_antialias (int val)
@@ -461,7 +458,7 @@
     glEnable (GL_POLYGON_SMOOTH);
     glEnable (GL_LINE_SMOOTH);
     glEnable (GL_POINT_SMOOTH);
-    printf("[gl2] antialiasing on\n");
+    mp_msg(MSGT_VO, MSGL_INFO, "[gl2] antialiasing on\n");
   }
   else
   {
@@ -469,9 +466,8 @@
     glDisable (GL_POLYGON_SMOOTH);
     glDisable (GL_LINE_SMOOTH);
     glDisable (GL_POINT_SMOOTH);
-    printf("[gl2] antialiasing off\n");
+    mp_msg(MSGT_VO, MSGL_INFO, "[gl2] antialiasing off\n");
   }
-  fflush(0);
 }
 
 
@@ -491,10 +487,8 @@
 
       if(square->isTexture==GL_FALSE)
       {
-	#ifndef NDEBUG
-	  fprintf (stderr, "[gl2] ain't a texture(update): texnum x=%d, y=%d, texture=%d\n",
+        mp_msg (MSGT_VO, MSGL_V, "[gl2] ain't a texture(update): texnum x=%d, y=%d, texture=%d\n",
 	  	x, y, square->texobj);
-	#endif
       	continue;
       }
 
@@ -502,18 +496,16 @@
       err = glGetError ();
       if(err==GL_INVALID_ENUM)
       {
-	fprintf (stderr, "GLERROR glBindTexture := GL_INVALID_ENUM, texnum x=%d, y=%d, texture=%d\n", x, y, square->texobj);
+	mp_msg (MSGT_VO, MSGL_ERR, "GLERROR glBindTexture := GL_INVALID_ENUM, texnum x=%d, y=%d, texture=%d\n", x, y, square->texobj);
       }
-      #ifndef NDEBUG
 	      else if(err==GL_INVALID_OPERATION) {
-		fprintf (stderr, "GLERROR glBindTexture := GL_INVALID_OPERATION, texnum x=%d, y=%d, texture=%d\n", x, y, square->texobj);
+		mp_msg (MSGT_VO, MSGL_V, "GLERROR glBindTexture := GL_INVALID_OPERATION, texnum x=%d, y=%d, texture=%d\n", x, y, square->texobj);
 	      }
-      #endif
 
       if(glIsTexture(square->texobj) == GL_FALSE)
       {
         square->isTexture=GL_FALSE;
-	fprintf (stderr, "GLERROR ain't a texture(update): texnum x=%d, y=%d, texture=%d\n",
+	mp_msg (MSGT_VO, MSGL_ERR, "GLERROR ain't a texture(update): texnum x=%d, y=%d, texture=%d\n",
 		x, y, square->texobj);
       }
 
@@ -528,10 +520,8 @@
         square->dirtyXoff=0; square->dirtyYoff=0; square->dirtyWidth=-1; square->dirtyHeight=-1;
       }
 
-#ifndef NDEBUG
-        fprintf (stdout, "[gl2] glTexSubImage2D texnum x=%d, y=%d, %d/%d - %d/%d\n", 
+        mp_msg (MSGT_VO, MSGL_DBG2, "[gl2] glTexSubImage2D texnum x=%d, y=%d, %d/%d - %d/%d\n", 
 		x, y, square->dirtyXoff, square->dirtyYoff, square->dirtyWidth, square->dirtyHeight);
-#endif
 
 	glBegin(GL_QUADS);
 
@@ -713,7 +703,7 @@
   vinfo = choose_glx_visual(mDisplay,mScreen,&vinfo_buf) < 0 ? NULL : &vinfo_buf;
   if (vinfo == NULL)
   {
-    printf("[gl2] no GLX support present\n");
+    mp_msg(MSGT_VO, MSGL_FATAL, "[gl2] no GLX support present\n");
     return -1;
   }
 
@@ -824,7 +814,7 @@
   
   drawTextureDisplay ();
 
-  printf("[gl2] Using image_bpp=%d, image_bytes=%d, isBGR=%d, \n\tgl_bitmap_format=%s, gl_bitmap_type=%s, \n\tgl_alignment=%d, rgb_size=%d (%d,%d,%d), a_sz=%d, \n\tgl_internal_format=%s\n",
+  mp_msg(MSGT_VO, MSGL_V, "[gl2] Using image_bpp=%d, image_bytes=%d, isBGR=%d, \n\tgl_bitmap_format=%s, gl_bitmap_type=%s, \n\tgl_alignment=%d, rgb_size=%d (%d,%d,%d), a_sz=%d, \n\tgl_internal_format=%s\n",
   	image_bpp, image_bytes, image_mode==MODE_BGR, 
         gl_bitmap_format_s, gl_bitmap_type_s, gl_alignment,
 	rgb_sz, r_sz, g_sz, b_sz, a_sz, gl_internal_format_s);
@@ -868,8 +858,8 @@
 	
   glVersion = glGetString(GL_VERSION);
 
-  printf("[gl2] OpenGL Driver Information:\n");
-  printf("\tvendor: %s,\n\trenderer %s,\n\tversion %s\n", 
+  mp_msg(MSGT_VO, MSGL_V, "[gl2] OpenGL Driver Information:\n");
+  mp_msg(MSGT_VO, MSGL_V, "\tvendor: %s,\n\trenderer %s,\n\tversion %s\n", 
   	glGetString(GL_VENDOR), 
 	glGetString(GL_RENDERER),
 	glVersion);
@@ -882,9 +872,9 @@
 
   if(isGL12)
   {
-	printf("[gl2] You have OpenGL >= 1.2 capable drivers, GOOD (16bpp and BGR is ok!)\n");
+	mp_msg(MSGT_VO, MSGL_INFO, "[gl2] You have OpenGL >= 1.2 capable drivers, GOOD (16bpp and BGR is ok!)\n");
   } else {
-	printf("[gl2] You have OpenGL < 1.2 drivers, BAD (16bpp and BGR may be damaged!)\n");
+	mp_msg(MSGT_VO, MSGL_INFO, "[gl2] You have OpenGL < 1.2 drivers, BAD (16bpp and BGR may be damaged!)\n");
   }
 
   rgb_sz=r_sz+g_sz+b_sz;
@@ -1159,7 +1149,7 @@
 {
     if(arg) 
     {
-	printf("[gl2] Unknown subdevice: %s\n",arg);
+	mp_msg(MSGT_VO, MSGL_FATAL, "[gl2] Unknown subdevice: %s\n",arg);
 	return ENOSYS;
     }
     if( !vo_init() ) return -1; // Can't open X11