changeset 13462:01cc6b0a6e72

printf --> mp_msg transition in vo_yuv4mpeg patch by Sebastian Hegler <s_hegler at gmx dot de>
author diego
date Sat, 25 Sep 2004 16:10:55 +0000
parents 9654998c3577
children 1b0641cf7fd2
files help/help_mp-en.h libvo/vo_yuv4mpeg.c
diffstat 2 files changed, 40 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/help/help_mp-en.h	Sat Sep 25 15:48:25 2004 +0000
+++ b/help/help_mp-en.h	Sat Sep 25 16:10:55 2004 +0000
@@ -788,6 +788,20 @@
 #define MSGTR_VO_PNM_PGMType "Will write PGM files."
 #define MSGTR_VO_PNM_PGMYUVType "Will write PGMYUV files."
 
+// vo_yuv4mpeg.c
+#define MSGTR_VO_YUV4MPEG_InterlacedHeightDivisibleBy4 "Interlaced mode requires image height to be divisible by 4."
+#define MSGTR_VO_YUV4MPEG_InterlacedLineBufAllocFail "Unable to allocate line buffer for interlaced mode."
+#define MSGTR_VO_YUV4MPEG_InterlacedInputNotRGB "Input not RGB, can't separate chrominance by fields!"
+#define MSGTR_VO_YUV4MPEG_WidthDivisibleBy2 "Image width must be divisible by 2."
+#define MSGTR_VO_YUV4MPEG_NoMemRGBFrameBuf "Not enough memory to allocate RGB framebuffer."
+#define MSGTR_VO_YUV4MPEG_OutFileOpenError "Can't get memory or file handle to write \"stream.yuv\"!"
+#define MSGTR_VO_YUV4MPEG_OutFileWriteError "Error writing image to output!"
+#define MSGTR_VO_YUV4MPEG_UnknownSubDev "Unknown subdevice: %s"
+#define MSGTR_VO_YUV4MPEG_InterlacedTFFMode "Using interlaced output mode, top-field first."
+#define MSGTR_VO_YUV4MPEG_InterlacedBFFMode "Using interlaced output mode, bottom-field first."
+#define MSGTR_VO_YUV4MPEG_ProgressiveMode "Using (default) progressive frame mode."
+
+
 // ======================= AO Audio Output drivers ========================
 
 // libao2 
--- a/libvo/vo_yuv4mpeg.c	Sat Sep 25 15:48:25 2004 +0000
+++ b/libvo/vo_yuv4mpeg.c	Sat Sep 25 16:10:55 2004 +0000
@@ -32,6 +32,9 @@
 #include "video_out.h"
 #include "video_out_internal.h"
 
+#include "mp_msg.h"
+#include "help_mp.h"
+
 #include "sub.h"
 
 #include "fastmemcpy.h"
@@ -83,24 +86,28 @@
 	{
 		if (height % 4)
 		{
-			perror("yuv4mpeg: Interlaced mode requires image height to be divisable by 4");
+			mp_msg(MSGT_VO,MSGL_FATAL,
+				MSGTR_VO_YUV4MPEG_InterlacedHeightDivisibleBy4);
 			return -1;
 		}
 		
 		rgb_line_buffer = malloc(image_width * 3);
 		if (!rgb_line_buffer)
 		{
-			perror("yuv4mpeg: Unable to allocate line buffer for interlaced mode");
+			mp_msg(MSGT_VO,MSGL_FATAL,
+				MSGTR_VO_YUV4MPEG_InterlacedLineBufAllocFail);
 			return -1;
 		}
 		
 		if (using_format == IMGFMT_YV12)
-			printf("yuv4mpeg: WARNING: Input not RGB; Can't seperate chrominance by fields!\n");
+			mp_msg(MSGT_VO,MSGL_WARN,
+				MSGTR_VO_YUV4MPEG_InterlacedInputNotRGB);
 	}
 				
 	if (width % 2)
 	{
-		perror("yuv4mpeg: Image width must be divisable by 2");
+		mp_msg(MSGT_VO,MSGL_FATAL,
+			MSGTR_VO_YUV4MPEG_WidthDivisibleBy2);
 		return -1;
 	}	
 	
@@ -110,7 +117,8 @@
 		rgb_buffer = malloc(image_width * image_height * 3);
 		if (!rgb_buffer)
 		{
-			perror("yuv4mpeg: Not enough memory to allocate RGB framebuffer");
+			mp_msg(MSGT_VO,MSGL_FATAL,
+				MSGTR_VO_YUV4MPEG_NoMemRGBFrameBuf);
 			return -1;
 		}
 	}
@@ -121,7 +129,8 @@
 	yuv_out = fopen("stream.yuv", "wb");
 	if (!yuv_out || image == 0) 
 	{
-		perror("yuv4mpeg: Can't get memory or file handle to write stream.yuv");
+		mp_msg(MSGT_VO,MSGL_FATAL,
+			MSGTR_VO_YUV4MPEG_OutFileOpenError);
 		return -1;
 	}
 	image_y = image;
@@ -220,7 +229,8 @@
 static void vo_y4m_write(const void *ptr, const size_t num_bytes)
 {
 	if (fwrite(ptr, 1, num_bytes, yuv_out) != num_bytes)
-		perror("yuv4mpeg: Error writing image to output!");
+		mp_msg(MSGT_VO,MSGL_ERR,
+			MSGTR_VO_YUV4MPEG_OutFileWriteError);
 }
 
 static int write_last_frame(void)
@@ -480,8 +490,9 @@
         /* If both tests failed the argument is invalid */
         if (arg_unrecognized == 2)
         {
-	        printf("vo_yuv4mpeg: Unknown subdevice: %s\n", arg);
-			return ENOSYS;
+	        mp_msg(MSGT_VO,MSGL_FATAL,
+			MSGTR_VO_YUV4MPEG_UnknownSubDev,arg);
+			return -ENOSYS;
 		}
     }
 
@@ -489,13 +500,16 @@
     switch (config_interlace)
     {
         case Y4M_ILACE_TOP_FIRST:
-            printf("vo_yuv4mpeg: Interlaced output mode, top-field first\n");
+	    mp_msg(MSGT_VO,MSGL_STATUS,
+	    	    MSGTR_VO_YUV4MPEG_InterlacedTFFMode);
             break;
         case Y4M_ILACE_BOTTOM_FIRST:
-            printf("vo_yuv4mpeg: Interlaced output mode, bottom-field first\n");
+	    mp_msg(MSGT_VO,MSGL_STATUS,
+	    	    MSGTR_VO_YUV4MPEG_InterlacedBFFMode);
             break;
         default:
-            printf("vo_yuv4mpeg: Using (default) progressive frame mode\n");
+	    mp_msg(MSGT_VO,MSGL_STATUS,
+	    	    MSGTR_VO_YUV4MPEG_ProgressiveMode);
             break;
     }
     return 0;