aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-06-03 23:23:03 +0000
committerGravatar arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-06-03 23:23:03 +0000
commitf1748e040ee1df06849d374caa0415ebd8ff53cb (patch)
tree0b38e6390e76455e470bf821d1567fd128fdc887
parentc7b4ae2a593c37bfd080b5d7953cb35e0ddea74e (diff)
msg/i18n fixes and some printf->mp_msg
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6297 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--help_mp-hu.h2
-rw-r--r--libao2/ao_oss.c44
-rw-r--r--libvo/vo_xmga.c20
-rw-r--r--libvo/x11_common.c42
-rw-r--r--mp_msg.h1
-rw-r--r--subreader.c39
6 files changed, 72 insertions, 76 deletions
diff --git a/help_mp-hu.h b/help_mp-hu.h
index 252df8906e..e5c778ce73 100644
--- a/help_mp-hu.h
+++ b/help_mp-hu.h
@@ -64,7 +64,7 @@ static char help_text[]=
#define MSGTR_Exit_quit "Kilépés"
#define MSGTR_Exit_eof "Vége a file-nak"
#define MSGTR_Exit_error "Végzetes hiba"
-#define MSGTR_IntBySignal "\nAz MPlayer futása %d szignál miatt megszakadt a %s modulban\n"
+#define MSGTR_IntBySignal "\nAz MPlayer futása %d-es szignál miatt megszakadt a %s modulban\n"
#define MSGTR_NoHomeDir "Nem találom a HOME konyvtárat\n"
#define MSGTR_GetpathProblem "get_path(\"config\") probléma\n"
#define MSGTR_CreatingCfgFile "Konfigurációs file létrehozása: %s\n"
diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c
index 96170eccd8..231a28ac07 100644
--- a/libao2/ao_oss.c
+++ b/libao2/ao_oss.c
@@ -12,6 +12,7 @@
//#include <sys/soundcard.h>
#include "../config.h"
+#include "../mp_msg.h"
#include "../mixer.h"
#include "afmt.h"
@@ -91,8 +92,7 @@ static int control(int cmd,int arg){
// return: 1=success 0=fail
static int init(int rate,int channels,int format,int flags){
- if (verbose)
- printf("ao2: %d Hz %d chans %s\n",rate,channels,
+ mp_msg(MSGT_AO,MSGL_V,"ao2: %d Hz %d chans %s\n",rate,channels,
audio_out_format_name(format));
if (ao_subdevice)
@@ -101,8 +101,7 @@ static int init(int rate,int channels,int format,int flags){
if(mixer_device)
oss_mixer_device=mixer_device;
- if (verbose)
- printf("audio_setup: using '%s' dsp device\n", dsp);
+ mp_msg(MSGT_AO,MSGL_V,"audio_setup: using '%s' dsp device\n", dsp);
#ifdef __linux__
audio_fd=open(dsp, O_WRONLY | O_NONBLOCK);
@@ -110,14 +109,14 @@ static int init(int rate,int channels,int format,int flags){
audio_fd=open(dsp, O_WRONLY);
#endif
if(audio_fd<0){
- printf("Can't open audio device %s: %s\n", dsp, strerror(errno));
+ mp_msg(MSGT_AO,MSGL_ERR,"audio_setup: Can't open audio device %s: %s\n", dsp, strerror(errno));
return 0;
}
#ifdef __linux__
/* Remove the non-blocking flag */
if(fcntl(audio_fd, F_SETFL, 0) < 0) {
- printf("Can't make filedescriptor non-blocking: %s\n", strerror(errno));
+ mp_msg(MSGT_AO,MSGL_ERR,"audio_setup: Can't make filedescriptor non-blocking: %s\n", strerror(errno));
return 0;
}
#endif
@@ -135,7 +134,7 @@ ac3_retry:
ao_data.format=format;
if( ioctl(audio_fd, SNDCTL_DSP_SETFMT, &ao_data.format)<0 ||
ao_data.format != format) if(format == AFMT_AC3){
- printf("Can't set audio device %s to AC3 output, trying S16...\n", dsp);
+ mp_msg(MSGT_AO,MSGL_WARN,"Can't set audio device %s to AC3 output, trying S16...\n", dsp);
#ifdef WORDS_BIGENDIAN
format=AFMT_S16_BE;
#else
@@ -143,7 +142,7 @@ ac3_retry:
#endif
goto ac3_retry;
}
- printf("audio_setup: sample format: %s (requested: %s)\n",
+ mp_msg(MSGT_AO,MSGL_V,"audio_setup: sample format: %s (requested: %s)\n",
audio_out_format_name(ao_data.format), audio_out_format_name(format));
if(format != AFMT_AC3) {
@@ -152,35 +151,37 @@ ac3_retry:
if (ao_data.channels > 2) {
if ( ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &ao_data.channels) == -1 ||
ao_data.channels != channels ) {
- printf("audio_setup: Failed to set audio device to %d channels\n", channels);
+ mp_msg(MSGT_AO,MSGL_ERR,"audio_setup: Failed to set audio device to %d channels\n", channels);
return 0;
}
}
else {
int c = ao_data.channels-1;
if (ioctl (audio_fd, SNDCTL_DSP_STEREO, &c) == -1) {
- printf("audio_setup: Failed to set audio device to %d channels\n", ao_data.channels);
+ mp_msg(MSGT_AO,MSGL_ERR,"audio_setup: Failed to set audio device to %d channels\n", ao_data.channels);
return 0;
}
}
- printf("audio_setup: using %d channels (requested: %d)\n", ao_data.channels, channels);
+ mp_msg(MSGT_AO,MSGL_V,"audio_setup: using %d channels (requested: %d)\n", ao_data.channels, channels);
// set rate
ao_data.samplerate=rate;
ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_data.samplerate);
- printf("audio_setup: using %d Hz samplerate (requested: %d)\n",ao_data.samplerate,rate);
+ mp_msg(MSGT_AO,MSGL_V,"audio_setup: using %d Hz samplerate (requested: %d)\n",ao_data.samplerate,rate);
+ if(ao_data.samplerate!=rate)
+ mp_msg(MSGT_AO,MSGL_WARN,"WARNING! Your soundcard does NOT support %d Hz samplerate! A-V sync problems are possible! Try with '-aop list=resample:fout=%d'\n",rate);
}
if(ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &zz)==-1){
int r=0;
- printf("audio_setup: driver doesn't support SNDCTL_DSP_GETOSPACE :-(\n");
+ mp_msg(MSGT_AO,MSGL_WARN,"audio_setup: driver doesn't support SNDCTL_DSP_GETOSPACE :-(\n");
if(ioctl(audio_fd, SNDCTL_DSP_GETBLKSIZE, &r)==-1){
- printf("audio_setup: %d bytes/frag (config.h)\n",ao_data.outburst);
+ mp_msg(MSGT_AO,MSGL_V,"audio_setup: %d bytes/frag (config.h)\n",ao_data.outburst);
} else {
ao_data.outburst=r;
- printf("audio_setup: %d bytes/frag (GETBLKSIZE)\n",ao_data.outburst);
+ mp_msg(MSGT_AO,MSGL_V,"audio_setup: %d bytes/frag (GETBLKSIZE)\n",ao_data.outburst);
}
} else {
- printf("audio_setup: frags: %3d/%d (%d bytes/frag) free: %6d\n",
+ mp_msg(MSGT_AO,MSGL_V,"audio_setup: frags: %3d/%d (%d bytes/frag) free: %6d\n",
zz.fragments, zz.fragstotal, zz.fragsize, zz.bytes);
if(ao_data.buffersize==-1) ao_data.buffersize=zz.bytes;
ao_data.outburst=zz.fragsize;
@@ -203,8 +204,8 @@ ac3_retry:
}
free(data);
if(ao_data.buffersize==0){
- printf("\n *** Your audio driver DOES NOT support select() ***\n");
- printf("Recompile mplayer with #undef HAVE_AUDIO_SELECT in config.h !\n\n");
+ mp_msg(MSGT_AO,MSGL_ERR,"\n *** Your audio driver DOES NOT support select() ***\n"
+ "Recompile mplayer with #undef HAVE_AUDIO_SELECT in config.h !\n\n");
return 0;
}
#endif
@@ -227,14 +228,9 @@ static void uninit(){
// stop playing and empty buffers (for seeking/pause)
static void reset(){
uninit();
-#ifdef __linux__
- audio_fd=open(dsp, O_WRONLY | O_NONBLOCK);
- if(audio_fd < 0 || fcntl(audio_fd, F_SETFL, 0) < 0){
-#else
audio_fd=open(dsp, O_WRONLY);
if(audio_fd < 0){
-#endif
- printf("\nFatal error: *** CANNOT RE-OPEN / RESET AUDIO DEVICE *** %s\n", strerror(errno));
+ mp_msg(MSGT_AO,MSGL_ERR,"\nFatal error: *** CANNOT RE-OPEN / RESET AUDIO DEVICE *** %s\n", strerror(errno));
return;
}
diff --git a/libvo/vo_xmga.c b/libvo/vo_xmga.c
index 90ed5acbd9..5e5fce7ee6 100644
--- a/libvo/vo_xmga.c
+++ b/libvo/vo_xmga.c
@@ -29,6 +29,8 @@
#include <string.h>
#include "config.h"
+#include "mp_msg.h"
+
#include "video_out.h"
#include "video_out_internal.h"
@@ -106,10 +108,10 @@ static void set_window(){
if ( WinID )
{
XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
- fprintf( stderr,"[xmga] x: %d y: %d w: %d h: %d\n",drwX,drwY,drwWidth,drwHeight );
+ mp_msg(MSGT_VO,MSGL_V,"[xmga] x: %d y: %d w: %d h: %d\n",drwX,drwY,drwWidth,drwHeight );
drwX=0; drwY=0;
XTranslateCoordinates( mDisplay,vo_window,mRoot,0,0,&drwcX,&drwcY,&mRoot );
- fprintf( stderr,"[xmga] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
+ mp_msg(MSGT_VO,MSGL_V,"[xmga] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
}
else { drwX=drwcX=vo_dx; drwY=drwcY=vo_dy; drwWidth=vo_dwidth; drwHeight=vo_dheight; }
@@ -123,7 +125,7 @@ static void set_window(){
drwcY+=drwY;
drwWidth=(dwidth > vo_screenwidth?vo_screenwidth:dwidth);
drwHeight=(dheight > vo_screenheight?vo_screenheight:dheight);
- fprintf( stderr,"[xmga-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
+ mp_msg(MSGT_VO,MSGL_V,"[xmga-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
}
mDrawColorKey();
@@ -166,7 +168,7 @@ static void check_events(void)
if ( !(e&VO_EVENT_RESIZE) && !(e&VO_EVENT_EXPOSE) ) return;
set_window();
mDrawColorKey();
- if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) ) printf( "Error in mga_vid_config ioctl (wrong mga_vid.o version?)" );
+ if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) ) mp_msg(MSGT_VO,MSGL_WARN,"Error in mga_vid_config ioctl (wrong mga_vid.o version?)" );
}
static void draw_osd(void)
@@ -176,7 +178,7 @@ static void flip_page(void){
#ifdef SHOW_TIME
unsigned int t;
t=GetTimer();
- printf(" [timer: %08X diff: %6d dd: %6d ] \n",t,t-timer,(t-timer)-timerd);
+ mp_msg(MSGT_VO,MSGL_STATUS," [timer: %08X diff: %6d dd: %6d ] \n",t,t-timer,(t-timer)-timerd);
timerd=t-timer;
timer=t;
#endif
@@ -218,7 +220,9 @@ static uint32_t config( uint32_t width, uint32_t height, uint32_t d_width, uint3
mga_vid_config.format=MGA_VID_FORMAT_UYVY;
mga_vid_config.frame_size=( ( width + 31 ) & ~31 ) * height * 2;
break;
- default: printf("mga: invalid output format %0X\n",format); return (-1);
+ default:
+ mp_msg(MSGT_VO,MSGL_ERR,"mga: invalid output format %0X\n",format);
+ return -1;
}
aspect_save_orig(width,height);
@@ -237,7 +241,7 @@ static uint32_t config( uint32_t width, uint32_t height, uint32_t d_width, uint3
case 24: fgColor=0x00ff00ffL; break;
case 16: fgColor=0xf81fL; break;
case 15: fgColor=0x7c1fL; break;
- default: printf( "Sorry, this (%d) color depth not supported.\n",vo_depthonscreen ); return -1;
+ default: mp_msg(MSGT_VO,MSGL_ERR,"Sorry, this (%d) color depth not supported.\n",vo_depthonscreen ); return -1;
}
inited=1;
@@ -335,6 +339,6 @@ uninit(void)
mga_uninit();
saver_on(mDisplay);
vo_x11_uninit();
- printf("vo: uninit!\n");
+ mp_msg(MSGT_VO,MSGL_V,"vo: uninit!\n");
}
diff --git a/libvo/x11_common.c b/libvo/x11_common.c
index 769f207261..a39a0e319d 100644
--- a/libvo/x11_common.c
+++ b/libvo/x11_common.c
@@ -128,8 +128,7 @@ int vo_find_depth_from_visuals(Display *dpy, int screen, Visual **visual_return)
&nvisuals);
if (visuals != NULL) {
for (i = 0; i < nvisuals; i++) {
- if (verbose)
- printf("vo: X11 truecolor visual %#x, depth %d, R:%lX G:%lX B:%lX\n",
+ mp_msg(MSGT_VO,MSGL_V,"vo: X11 truecolor visual %#x, depth %d, R:%lX G:%lX B:%lX\n",
visuals[i].visualid, visuals[i].depth,
visuals[i].red_mask, visuals[i].green_mask,
visuals[i].blue_mask);
@@ -163,15 +162,12 @@ static int x11_errorhandler(Display *display, XErrorEvent *event)
XGetErrorText(display, event->error_code, (char *)&msg, MSGLEN);
- printf("X11 error: %s\n", msg);
+ mp_msg(MSGT_VO,MSGL_ERR,"X11 error: %s\n", msg);
- if (verbose)
- {
- printf("Type: %x, display: %x, resourceid: %x, serial: %x\n",
+ mp_msg(MSGT_VO,MSGL_V,"Type: %x, display: %x, resourceid: %x, serial: %x\n",
event->type, event->display, event->resourceid, event->serial);
- printf("Error code: %x, request code: %x, minor code: %x\n",
+ mp_msg(MSGT_VO,MSGL_V,"Error code: %x, request code: %x, minor code: %x\n",
event->error_code, event->request_code, event->minor_code);
- }
abort();
//exit_player("X11 error");
@@ -267,13 +263,12 @@ int vo_init( void )
dispName = XDisplayName(mDisplayName);
#endif
- if (verbose)
- printf("X11 opening display: %s\n", dispName);
+ mp_msg(MSGT_VO,MSGL_V,"X11 opening display: %s\n", dispName);
mDisplay=XOpenDisplay(dispName);
if ( !mDisplay )
{
- printf( "vo: couldn't open the X11 display (%s)!\n",dispName );
+ mp_msg(MSGT_VO,MSGL_ERR,"vo: couldn't open the X11 display (%s)!\n",dispName );
return 0;
}
mScreen=DefaultScreen( mDisplay ); // Screen ID.
@@ -345,8 +340,7 @@ int vo_init( void )
bpp=mXImage->bits_per_pixel;
if((vo_depthonscreen+7)/8 != (bpp+7)/8) vo_depthonscreen=bpp; // by A'rpi
mask=mXImage->red_mask|mXImage->green_mask|mXImage->blue_mask;
- if(verbose)
- printf("vo: X11 color mask: %X (R:%lX G:%lX B:%lX)\n",
+ mp_msg(MSGT_VO,MSGL_V,"vo: X11 color mask: %X (R:%lX G:%lX B:%lX)\n",
mask,mXImage->red_mask,mXImage->green_mask,mXImage->blue_mask);
XDestroyImage( mXImage );
}
@@ -361,7 +355,7 @@ int vo_init( void )
else if ( strncmp(dispName, "localhost:", 10) == 0)
dispName += 9;
if (*dispName==':') mLocalDisplay=1; else mLocalDisplay=0;
- printf("vo: X11 running at %dx%d with depth %d and %d bits/pixel (\"%s\" => %s display)\n",
+ mp_msg(MSGT_VO,MSGL_INFO,"vo: X11 running at %dx%d with depth %d and %d bpp (\"%s\" => %s display)\n",
vo_screenwidth,vo_screenheight,
depth, vo_depthonscreen,
dispName,mLocalDisplay?"local":"remote");
@@ -379,7 +373,7 @@ void vo_uninit( void )
return;
}
// if( !vo_depthonscreen ) return;
- printf("vo: uninit ...\n" );
+ mp_msg(MSGT_VO,MSGL_V,"vo: uninit ...\n" );
XSetErrorHandler(NULL);
XCloseDisplay( mDisplay );
vo_depthonscreen = 0;
@@ -780,16 +774,16 @@ void saver_on(Display *mDisplay) {
if (DPMSQueryExtension(mDisplay, &nothing, &nothing))
{
if (!DPMSEnable(mDisplay)) { // restoring power saving settings
- printf("DPMS not available?\n");
+ mp_msg(MSGT_VO,MSGL_WARN,"DPMS not available?\n");
} else {
// DPMS does not seem to be enabled unless we call DPMSInfo
BOOL onoff;
CARD16 state;
DPMSInfo(mDisplay, &state, &onoff);
if (onoff) {
- printf ("Successfully enabled DPMS\n");
+ mp_msg(MSGT_VO,MSGL_INFO,"Successfully enabled DPMS\n");
} else {
- printf ("Could not enable DPMS\n");
+ mp_msg(MSGT_VO,MSGL_WARN,"Could not enable DPMS\n");
}
}
}
@@ -820,10 +814,10 @@ void saver_off(Display *mDisplay) {
if (onoff)
{
Status stat;
- printf ("Disabling DPMS\n");
+ mp_msg(MSGT_VO,MSGL_INFO,"Disabling DPMS\n");
dpms_disabled=1;
stat = DPMSDisable(mDisplay); // monitor powersave off
- printf ("stat: %d\n", stat);
+ mp_msg(MSGT_VO,MSGL_V,"DPMSDisable stat: %d\n", stat);
}
}
#endif
@@ -857,10 +851,10 @@ void vo_vm_switch(uint32_t X, uint32_t Y, int* modeline_width, int* modeline_hei
if (XF86VidModeQueryExtension(mDisplay, &vm_event, &vm_error)) {
XF86VidModeQueryVersion(mDisplay, &vm_ver, &vm_rev);
- printf("XF86VidMode Extension v%i.%i\n", vm_ver, vm_rev);
+ mp_msg(MSGT_VO,MSGL_V,"XF86VidMode Extension v%i.%i\n", vm_ver, vm_rev);
have_vm=1;
} else
- printf("XF86VidMode Extenstion not available.\n");
+ mp_msg(MSGT_VO,MSGL_WARN,"XF86VidMode Extenstion not available.\n");
if (have_vm) {
if (vidmodes==NULL)
@@ -878,7 +872,7 @@ void vo_vm_switch(uint32_t X, uint32_t Y, int* modeline_width, int* modeline_hei
j=i;
}
- printf("XF86VM: Selected video mode %dx%d for image size %dx%d.\n",*modeline_width, *modeline_height, X, Y);
+ mp_msg(MSGT_VO,MSGL_INFO,"XF86VM: Selected video mode %dx%d for image size %dx%d.\n",*modeline_width, *modeline_height, X, Y);
XF86VidModeLockModeSwitch(mDisplay,mScreen,0);
XF86VidModeSwitchToMode(mDisplay,mScreen,vidmodes[j]);
XF86VidModeSwitchToMode(mDisplay,mScreen,vidmodes[j]);
@@ -904,7 +898,7 @@ void vo_vm_close(Display *dpy)
for (i=0; i<modecount; i++)
if ((vidmodes[i]->hdisplay == vo_screenwidth) && (vidmodes[i]->vdisplay == vo_screenheight))
{
- printf("\nReturning to original mode %dx%d\n", vo_screenwidth, vo_screenheight);
+ mp_msg(MSGT_VO,MSGL_INFO,"\nReturning to original mode %dx%d\n", vo_screenwidth, vo_screenheight);
break;
}
diff --git a/mp_msg.h b/mp_msg.h
index db149c64f8..07340b8c0c 100644
--- a/mp_msg.h
+++ b/mp_msg.h
@@ -79,6 +79,7 @@ extern int verbose; // defined in mplayer.c
#define MSGT_SWS 34
#define MSGT_VOBSUB 35
+#define MSGT_SUBREADER 36
#define MSGT_MAX 64
diff --git a/subreader.c b/subreader.c
index 003303d63e..ef613ee73c 100644
--- a/subreader.c
+++ b/subreader.c
@@ -13,6 +13,7 @@
#include <ctype.h>
#include "config.h"
+#include "mp_msg.h"
#include "subreader.h"
#define ERR ((void *) -1)
@@ -188,7 +189,7 @@ subtitle *sub_read_line_microdvd(FILE *fd,subtitle *current) {
while ((next =sub_readtext (next, &(current->text[i])))) {
if (current->text[i]==ERR) {return ERR;}
i++;
- if (i>=SUB_MAX_TEXT) { printf ("Too many lines in a subtitle\n");current->lines=i;return current;}
+ if (i>=SUB_MAX_TEXT) { mp_msg(MSGT_SUBREADER,MSGL_WARN,"Too many lines in a subtitle\n");current->lines=i;return current;}
}
current->lines= ++i;
@@ -325,7 +326,7 @@ subtitle *sub_read_line_vplayer(FILE *fd,subtitle *current) {
while ((next =sub_readtext (next, &(current->text[i])))) {
if (current->text[i]==ERR) {return ERR;}
i++;
- if (i>=SUB_MAX_TEXT) { printf ("Too many lines in a subtitle\n");current->lines=i;return current;}
+ if (i>=SUB_MAX_TEXT) { mp_msg(MSGT_SUBREADER,MSGL_WARN,"Too many lines in a subtitle\n");current->lines=i;return current;}
}
current->lines=i+1;
}
@@ -366,7 +367,7 @@ subtitle *sub_read_line_rt(FILE *fd,subtitle *current) {
while ((next =sub_readtext (next, &(current->text[i])))) {
if (current->text[i]==ERR) {return ERR;}
i++;
- if (i>=SUB_MAX_TEXT) { printf ("Too many lines in a subtitle\n");current->lines=i;return current;}
+ if (i>=SUB_MAX_TEXT) { mp_msg(MSGT_SUBREADER,MSGL_WARN,"Too many lines in a subtitle\n");current->lines=i;return current;}
}
}
current->lines=i+1;
@@ -505,7 +506,7 @@ subtitle *sub_read_line_aqt(FILE *fd,subtitle *current) {
while ((next =sub_readtext (next, &(current->text[i])))) {
if (current->text[i]==ERR) {return ERR;}
i++;
- if (i>=SUB_MAX_TEXT) { printf ("Too many lines in a subtitle\n");current->lines=i;return current;}
+ if (i>=SUB_MAX_TEXT) { mp_msg(MSGT_SUBREADER,MSGL_WARN,"Too many lines in a subtitle\n");current->lines=i;return current;}
}
current->lines=i+1;
@@ -551,7 +552,7 @@ subtitle *sub_read_line_subrip09(FILE *fd,subtitle *current) {
while ((next =sub_readtext (next, &(current->text[i])))) {
if (current->text[i]==ERR) {return ERR;}
i++;
- if (i>=SUB_MAX_TEXT) { printf ("Too many lines in a subtitle\n");current->lines=i;return current;}
+ if (i>=SUB_MAX_TEXT) { mp_msg(MSGT_SUBREADER,MSGL_WARN,"Too many lines in a subtitle\n");current->lines=i;return current;}
}
current->lines=i+1;
@@ -633,10 +634,10 @@ void subcp_open (void)
icdsc = (iconv_t)(-1);
if (sub_cp){
if ((icdsc = iconv_open (tocp, sub_cp)) != (iconv_t)(-1)){
- printf ("SUB: opened iconv descriptor.\n");
+ mp_msg(MSGT_SUBREADER,MSGL_V,"SUB: opened iconv descriptor.\n");
sub_utf8 = 2;
} else
- printf ("SUB: error opening iconv descriptor.\n");
+ mp_msg(MSGT_SUBREADER,MSGL_ERR,"SUB: error opening iconv descriptor.\n");
}
}
@@ -644,7 +645,7 @@ void subcp_close (void)
{
if (icdsc != (iconv_t)(-1)){
(void) iconv_close (icdsc);
- printf ("SUB: closed iconv descriptor.\n");
+ mp_msg(MSGT_SUBREADER,MSGL_V,"SUB: closed iconv descriptor.\n");
}
}
@@ -665,12 +666,12 @@ subtitle* subcp_recode (subtitle *sub)
if (iconv(icdsc, &ip, &ileft,
&op, &oleft) == (size_t)(-1)) {
- printf ("SUB: error recoding line.\n");
+ mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: error recoding line.\n");
l++;
break;
}
if (!(ot = (char *)malloc(op - icbuffer + 1))){
- printf ("SUB: error allocating mem.\n");
+ mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: error allocating mem.\n");
l++;
break;
}
@@ -714,7 +715,7 @@ static void adjust_subs_time(subtitle* sub, float subtime, float fps){
sub = nextsub;
m = 0;
}
- if (n) printf ("SUB: Adjusted %d subtitle(s).\n", n);
+ if (n) mp_msg(MSGT_SUBREADER,MSGL_INFO,"SUB: Adjusted %d subtitle(s).\n", n);
}
subtitle* sub_read_file (char *filename, float fps) {
@@ -743,8 +744,8 @@ subtitle* sub_read_file (char *filename, float fps) {
fd=fopen (filename, "r"); if (!fd) return NULL;
sub_format=sub_autodetect (fd);
- if (sub_format==SUB_INVALID) {printf ("SUB: Could not determine file format\n");return NULL;}
- printf ("SUB: Detected subtitle file format: %s\n", fmtname[sub_format]);
+ if (sub_format==SUB_INVALID) {mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: Could not determine file format\n");return NULL;}
+ mp_msg(MSGT_SUBREADER,MSGL_INFO,"SUB: Detected subtitle file format: %s\n", fmtname[sub_format]);
rewind (fd);
@@ -779,9 +780,9 @@ subtitle* sub_read_file (char *filename, float fps) {
#endif
// printf ("SUB: Subtitle format %s time.\n", sub_uses_time?"uses":"doesn't use");
- printf ("SUB: Read %i subtitles", sub_num);
- if (sub_errs) printf (", %i bad line(s).\n", sub_errs);
- else printf (".\n");
+ mp_msg(MSGT_SUBREADER,MSGL_INFO,"SUB: Read %i subtitles", sub_num);
+ if (sub_errs) mp_msg(MSGT_SUBREADER,MSGL_INFO,", %i bad line(s).\n", sub_errs);
+ else mp_msg(MSGT_SUBREADER,MSGL_INFO,".\n");
if(sub_num<=0){
free(first);
@@ -861,7 +862,7 @@ char * sub_filename(char* path, char * fname )
// printf("trying: '%s'\n",sub_name);
if((f=fopen( sub_name,"rt" ))) {
fclose( f );
- printf( "SUB: Detected sub file: %s\n",sub_name );
+ mp_msg(MSGT_SUBREADER,MSGL_INFO,"SUB: Detected sub file: %s\n",sub_name );
if (i<2) sub_utf8=1;
return sub_name;
}
@@ -929,7 +930,7 @@ unsigned long temp;
fprintf(fd,"\n");
}
fclose(fd);
- printf ("SUB: Subtitles dumped in \'dumpsub.srt\'.\n");
+ mp_msg(MSGT_SUBREADER,MSGL_INFO,"SUB: Subtitles dumped in \'dumpsub.srt\'.\n");
}
void dump_mpsub(subtitle* subs, float fps){
@@ -976,7 +977,7 @@ void dump_mpsub(subtitle* subs, float fps){
fprintf (fd, "\n");
}
fclose (fd);
- printf ("SUB: Subtitles dumped in \'dump.mpsub\'.\n");
+ mp_msg(MSGT_SUBREADER,MSGL_INFO,"SUB: Subtitles dumped in \'dump.mpsub\'.\n");
}
void sub_free( subtitle * subs )