diff options
160 files changed, 2596 insertions, 2236 deletions
diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index 2d851b30b..890a0e280 100644 --- a/src/audio_out/audio_alsa_out.c +++ b/src/audio_out/audio_alsa_out.c @@ -26,7 +26,7 @@ * (c) 2001 James Courtier-Dutton <James@superbug.demon.co.uk> * * - * $Id: audio_alsa_out.c,v 1.118 2003/11/26 23:44:08 f1rmb Exp $ + * $Id: audio_alsa_out.c,v 1.119 2003/12/05 15:54:56 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -150,13 +150,15 @@ static void *ao_alsa_handle_event_thread(void *data) { if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &left_vol)) < 0) { - printf("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); continue; } if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT, &right_vol)) < 0) { - printf("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); continue; } @@ -239,7 +241,7 @@ static void error_callback(const char *file, int line, int n, size = 100; printf("%s:%s:%d entered\n", __FILE__, __FUNCTION__, __LINE__ ); - if((buf = xine_xmalloc(size)) == NULL) + if(!(buf = xine_xmalloc(size))) return; while(1) { @@ -352,7 +354,8 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int NULL); break; default: - printf ("audio_alsa_out: ALSA Driver does not support the requested mode: 0x%X\n",mode); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: ALSA Driver does not support the requested mode: 0x%X\n",mode); return 0; } @@ -362,8 +365,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int #endif if (this->audio_fd) { - xine_log (this->class->xine, XINE_LOG_MSG, - "audio_alsa_out:Already open...WHY!"); + xine_log (this->class->xine, XINE_LOG_MSG, _("audio_alsa_out:Already open...WHY!")); snd_pcm_close (this->audio_fd); this->audio_fd = NULL; } @@ -377,8 +379,10 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int */ err=snd_pcm_open(&this->audio_fd, pcm_device, direction, open_mode); if(err <0 ) { - printf ("audio_alsa_out: snd_pcm_open() of %s failed: %s\n", pcm_device, snd_strerror(err)); - printf ("audio_alsa_out: >>> check if another program don't already use PCM <<<\n"); + xprintf (this->class->xine, XINE_VERBOSITY_LOG, + _("audio_alsa_out: snd_pcm_open() of %s failed: %s\n"), pcm_device, snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_LOG, + _("audio_alsa_out: >>> check if another program don't already use PCM <<<\n")); return 0; } /* printf ("audio_alsa_out: snd_pcm_open() opened %s\n", pcm_device); */ @@ -390,7 +394,9 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int */ err = snd_pcm_hw_params_any(this->audio_fd, params); if (err < 0) { - printf ("audio_alsa_out: broken configuration for this PCM: no configurations available: %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_LOG, + _("audio_alsa_out: broken configuration for this PCM: no configurations available: %s\n"), + snd_strerror(err)); goto __close; } /* set interleaved access */ @@ -402,7 +408,8 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_COMPLEX); err = snd_pcm_hw_params_set_access_mask(this->audio_fd, params, mask); if (err < 0) { - printf ("audio_alsa_out: mmap not availiable, falling back to compatiblity mode\n"); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: mmap not availiable, falling back to compatiblity mode\n"); this->mmap=0; err = snd_pcm_hw_params_set_access(this->audio_fd, params, SND_PCM_ACCESS_RW_INTERLEAVED); @@ -413,7 +420,8 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int } if (err < 0) { - printf ("audio_alsa_out: access type not available: %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: access type not available: %s\n", snd_strerror(err)); goto __close; } /* set the sample format ([SU]{8,16{LE,BE}})*/ @@ -425,26 +433,31 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int #endif : SND_PCM_FORMAT_U8); if (err < 0) { - printf ("audio_alsa_out: sample format non available: %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: sample format non available: %s\n", snd_strerror(err)); goto __close; } /* set the number of channels */ err = snd_pcm_hw_params_set_channels(this->audio_fd, params, this->num_channels); if (err < 0) { - printf ("audio_alsa_out: Cannot set number of channels to %d (err=%d:%s)\n", this->num_channels, err, snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: Cannot set number of channels to %d (err=%d:%s)\n", + this->num_channels, err, snd_strerror(err)); goto __close; } /* set the stream rate [Hz] */ dir=0; err = snd_pcm_hw_params_set_rate_near(this->audio_fd, params, &rate, &dir); if (err < 0) { - printf ("audio_alsa_out: rate not available: %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: rate not available: %s\n", snd_strerror(err)); goto __close; } this->output_sample_rate = (uint32_t)rate; if (this->input_sample_rate != this->output_sample_rate) { - printf ("audio_alsa_out: audio rate : %d requested, %d provided by device/sec\n", - this->input_sample_rate, this->output_sample_rate); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: audio rate : %d requested, %d provided by device/sec\n", + this->input_sample_rate, this->output_sample_rate); } buffer_time_to_size = ( (uint64_t)buffer_time * rate) / 1000000; err = snd_pcm_hw_params_get_buffer_size_min(params, &buffer_size_min); @@ -474,14 +487,16 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int periods=8; err = snd_pcm_hw_params_set_periods_near(this->audio_fd, params, &periods ,&dir); if (err < 0) { - printf ("audio_alsa_out: unable to set any periods: %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: unable to set any periods: %s\n", snd_strerror(err)); goto __close; } /* set the ring-buffer time [us] (large enough for x us|y samples ...) */ dir=0; err = snd_pcm_hw_params_set_buffer_time_near(this->audio_fd, params, &buffer_time, &dir); if (err < 0) { - printf ("audio_alsa_out: buffer time not available: %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: buffer time not available: %s\n", snd_strerror(err)); goto __close; } #endif @@ -490,7 +505,8 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int dir=0; err = snd_pcm_hw_params_set_period_size_near(this->audio_fd, params, &period_size, &dir); if (err < 0) { - printf ("audio_alsa_out: period time not available: %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: period time not available: %s\n", snd_strerror(err)); goto __close; } #endif @@ -500,7 +516,8 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int dir=0; err = snd_pcm_hw_params_set_buffer_size_near(this->audio_fd, params, &this->buffer_size); if (err < 0) { - printf ("audio_alsa_out: buffer time not available: %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: buffer time not available: %s\n", snd_strerror(err)); goto __close; } err = snd_pcm_hw_params_get_buffer_size(params, &(this->buffer_size)); @@ -509,20 +526,23 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int printf("was set buffer_size = %ld\n",this->buffer_size); #endif if (2*period_size > this->buffer_size) { - printf ("audio_alsa_out: buffer to small, could not use\n"); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: buffer to small, could not use\n"); goto __close; } /* write the parameters to device */ err = snd_pcm_hw_params(this->audio_fd, params); if (err < 0) { - printf ("audio_alsa_out: pcm hw_params failed: %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: pcm hw_params failed: %s\n", snd_strerror(err)); goto __close; } /* Check for pause/resume support */ this->has_pause_resume = ( snd_pcm_hw_params_can_pause (params) && snd_pcm_hw_params_can_resume (params) ); - xprintf(this->class->xine, XINE_VERBOSITY_LOG, "audio_alsa_out:open pause_resume=%d\n", this->has_pause_resume); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out:open pause_resume=%d\n", this->has_pause_resume); this->sample_rate_factor = (double) this->output_sample_rate / (double) this->input_sample_rate; this->bytes_per_frame = snd_pcm_frames_to_bytes (this->audio_fd, 1); /* @@ -531,39 +551,45 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int /* Copy current parameters into swparams */ err = snd_pcm_sw_params_current(this->audio_fd, swparams); if (err < 0) { - printf ("audio_alsa_out: Unable to determine current swparams: %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: Unable to determine current swparams: %s\n", snd_strerror(err)); goto __close; } /* align all transfers to 1 sample */ err = snd_pcm_sw_params_set_xfer_align(this->audio_fd, swparams, 1); if (err < 0) { - printf ("audio_alsa_out: Unable to set transfer alignment: %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: Unable to set transfer alignment: %s\n", snd_strerror(err)); goto __close; } /* allow the transfer when at least period_size samples can be processed */ err = snd_pcm_sw_params_set_avail_min(this->audio_fd, swparams, period_size); if (err < 0) { - printf ("audio_alsa_out: Unable to set available min: %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: Unable to set available min: %s\n", snd_strerror(err)); goto __close; } /* start the transfer when the buffer contains at least period_size samples */ err = snd_pcm_sw_params_set_start_threshold(this->audio_fd, swparams, period_size); if (err < 0) { - printf ("audio_alsa_out: Unable to set start threshold: %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: Unable to set start threshold: %s\n", snd_strerror(err)); goto __close; } /* never stop the transfer, even on xruns */ err = snd_pcm_sw_params_set_stop_threshold(this->audio_fd, swparams, this->buffer_size); if (err < 0) { - printf ("audio_alsa_out: Unable to set stop threshold: %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: Unable to set stop threshold: %s\n", snd_strerror(err)); goto __close; } /* Install swparams into current parameters */ err = snd_pcm_sw_params(this->audio_fd, swparams); if (err < 0) { - printf ("audio_alsa_out: Unable to set swparams: %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: Unable to set swparams: %s\n", snd_strerror(err)); goto __close; } #ifdef ALSA_LOG @@ -652,9 +678,9 @@ static void xrun(alsa_driver_t *this) timersub(&now, &tstamp, &diff); printf ("audio_alsa_out: xrun!!! (at least %.3f ms long)\n", diff.tv_sec * 1000 + diff.tv_usec / 1000.0); */ - printf ("audio_alsa_out: XRUN!!!\n"); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: XRUN!!!\n"); if ((res = snd_pcm_prepare(this->audio_fd))<0) { - printf ("audio_alsa_out: xrun: prepare error: %s", snd_strerror(res)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: xrun: prepare error: %s", snd_strerror(res)); return; } return; /* ok, data should be accepted again */ @@ -704,7 +730,8 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { if ( (state != SND_PCM_STATE_PREPARED) && (state != SND_PCM_STATE_RUNNING) && (state != SND_PCM_STATE_DRAINING) ) { - printf("audio_alsa_out:write:BAD STATE, state = %d\n",state); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out:write:BAD STATE, state = %d\n",state); } while( number_of_frames > 0) { @@ -732,7 +759,8 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { if ( (state != SND_PCM_STATE_PREPARED) && (state != SND_PCM_STATE_RUNNING) && (state != SND_PCM_STATE_DRAINING) ) { - printf("audio_alsa_out:write:BAD STATE2, state = %d, going to try XRUN\n",state); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out:write:BAD STATE2, state = %d, going to try XRUN\n",state); if ((res = snd_pcm_prepare(this->audio_fd))<0) { XINE_ASSERT(0, "audio_alsa_out: xrun: prepare error: %s", snd_strerror(res)); } @@ -823,13 +851,15 @@ static int ao_alsa_get_property (ao_driver_t *this_gen, int property) { if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &this->mixer.left_vol)) < 0) { - printf("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); goto __done; } if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT, &this->mixer.right_vol)) < 0) { - printf("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); goto __done; } @@ -869,14 +899,16 @@ static int ao_alsa_set_property (ao_driver_t *this_gen, int property, int value) if((err = snd_mixer_selem_set_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, this->mixer.left_vol)) < 0) { - printf("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); pthread_mutex_unlock(&this->mixer.mutex); return ~value; } if((err = snd_mixer_selem_set_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT, this->mixer.right_vol)) < 0) { - printf("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); pthread_mutex_unlock(&this->mixer.mutex); return ~value; } @@ -938,19 +970,23 @@ static int ao_alsa_ctrl(ao_driver_t *this_gen, int cmd, ...) { if (this->audio_fd) { if (this->has_pause_resume) { if ((err=snd_pcm_pause(this->audio_fd, 1)) < 0) { - printf("audio_alsa_out: Pause call failed. (err=%d:%s)\n",err, snd_strerror(err)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: Pause call failed. (err=%d:%s)\n",err, snd_strerror(err)); this->has_pause_resume = 0; ao_alsa_ctrl(this_gen, AO_CTRL_PLAY_PAUSE); } } else { if ((err=snd_pcm_reset(this->audio_fd)) < 0) { - printf("audio_alsa_out: Reset call failed. (err=%d:%s)\n",err, snd_strerror(err)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: Reset call failed. (err=%d:%s)\n",err, snd_strerror(err)); } if ((err=snd_pcm_drain(this->audio_fd)) < 0) { - printf("audio_alsa_out: Drain call failed. (err=%d:%s)\n",err, snd_strerror(err)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: Drain call failed. (err=%d:%s)\n",err, snd_strerror(err)); } if ((err=snd_pcm_prepare(this->audio_fd)) < 0) { - printf("audio_alsa_out: Prepare call failed. (err=%d:%s)\n",err, snd_strerror(err)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: Prepare call failed. (err=%d:%s)\n",err, snd_strerror(err)); } } } @@ -961,10 +997,13 @@ static int ao_alsa_ctrl(ao_driver_t *this_gen, int cmd, ...) { if (this->has_pause_resume) { if ((err=snd_pcm_pause(this->audio_fd, 0)) < 0) { if (err == -77) { - printf("audio_alsa_out: Warning: How am I supposed to RESUME, if I am not PAUSED. audio_out.c, please don't call me!\n"); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: Warning: How am I supposed to RESUME, if I am not PAUSED. " + "audio_out.c, please don't call me!\n"); break; } - printf("audio_alsa_out: Resume call failed. (err=%d:%s)\n",err, snd_strerror(err)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: Resume call failed. (err=%d:%s)\n",err, snd_strerror(err)); this->has_pause_resume = 0; } } @@ -974,10 +1013,12 @@ static int ao_alsa_ctrl(ao_driver_t *this_gen, int cmd, ...) { case AO_CTRL_FLUSH_BUFFERS: if (this->audio_fd) { if ((err=snd_pcm_drop(this->audio_fd)) < 0) { - printf("audio_alsa_out: Drop call failed. (err=%d:%s)\n",err, snd_strerror(err)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: Drop call failed. (err=%d:%s)\n",err, snd_strerror(err)); } if ((err=snd_pcm_prepare(this->audio_fd)) < 0) { - printf("audio_alsa_out: Prepare call failed. (err=%d:%s)\n",err, snd_strerror(err)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: Prepare call failed. (err=%d:%s)\n",err, snd_strerror(err)); } } break; @@ -1015,12 +1056,13 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { NULL); if ((err = snd_ctl_open (&ctl_handle, pcm_device, 0)) < 0) { - printf ("audio_alsa_out: snd_ctl_open(): %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_ctl_open(): %s\n", snd_strerror(err)); return; } if ((err = snd_ctl_card_info (ctl_handle, hw_info)) < 0) { - printf ("audio_alsa_out: snd_ctl_card_info(): %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: snd_ctl_card_info(): %s\n", snd_strerror(err)); snd_ctl_close(ctl_handle); return; } @@ -1031,31 +1073,36 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { * Open mixer device */ if ((err = snd_mixer_open (&this->mixer.handle, 0)) < 0) { - printf ("audio_alsa_out: snd_mixer_open(): %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: snd_mixer_open(): %s\n", snd_strerror(err)); return; } if ((err = snd_mixer_attach (this->mixer.handle, pcm_device)) < 0) { - printf ("audio_alsa_out: snd_mixer_attach(): %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: snd_mixer_attach(): %s\n", snd_strerror(err)); snd_mixer_close(this->mixer.handle); return; } if ((err = snd_mixer_selem_register (this->mixer.handle, NULL, NULL)) < 0) { - printf ("audio_alsa_out: snd_mixer_selem_register(): %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: snd_mixer_selem_register(): %s\n", snd_strerror(err)); snd_mixer_close(this->mixer.handle); return; } if ((err = snd_mixer_load (this->mixer.handle)) < 0) { - printf ("audio_alsa_out: snd_mixer_load(): %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: snd_mixer_load(): %s\n", snd_strerror(err)); snd_mixer_close(this->mixer.handle); return; } mixer_sid = alloca(snd_mixer_selem_id_sizeof() * snd_mixer_get_count(this->mixer.handle)); if (mixer_sid == NULL) { - printf ("audio_alsa_out: alloca() failed: %s\n", strerror(errno)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: alloca() failed: %s\n", strerror(errno)); snd_mixer_close(this->mixer.handle); return; } @@ -1084,14 +1131,16 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { &this->mixer.min, &this->mixer.max); if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &this->mixer.left_vol)) < 0) { - printf("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); snd_mixer_close(this->mixer.handle); return; } if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT, &this->mixer.right_vol)) < 0) { - printf ("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); snd_mixer_close(this->mixer.handle); return; } @@ -1205,14 +1254,13 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da char *pcm_device; snd_pcm_hw_params_t *params; - this = (alsa_driver_t *) malloc (sizeof (alsa_driver_t)); - memset( this, 0, sizeof( alsa_driver_t ) ); /* Set all those pointers to 0 (NULL) */ + this = (alsa_driver_t *) xine_xmalloc (sizeof (alsa_driver_t)); this->class = class; err = snd_lib_error_set_handler(error_callback); if(err < 0) - xine_log(this->class->xine, XINE_LOG_MSG, "snd_lib_error_set_handler() failed: %d", err); + xine_log(this->class->xine, XINE_LOG_MSG, _("snd_lib_error_set_handler() failed: %d"), err); snd_pcm_hw_params_alloca(¶ms); /* Fill the .xinerc file with options */ @@ -1277,9 +1325,9 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da err=snd_pcm_open(&this->audio_fd, pcm_device, SND_PCM_STREAM_PLAYBACK, 1); /* NON-BLOCK mode */ if(err <0 ) { xine_log (this->class->xine, XINE_LOG_MSG, - "snd_pcm_open() failed:%d:%s\n", err, snd_strerror(err)); + _("snd_pcm_open() failed:%d:%s\n"), err, snd_strerror(err)); xine_log (this->class->xine, XINE_LOG_MSG, - ">>> Check if another program don't already use PCM <<<\n"); + _(">>> Check if another program don't already use PCM <<<\n")); return NULL; } @@ -1288,30 +1336,32 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da */ err = snd_pcm_hw_params_any(this->audio_fd, params); if (err < 0) { - printf ("audio_alsa_out: broken configuration for this PCM: no configurations available\n"); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: broken configuration for this PCM: no configurations available\n"); return NULL; } err = snd_pcm_hw_params_set_access(this->audio_fd, params, SND_PCM_ACCESS_RW_INTERLEAVED); if (err < 0) { - printf ("audio_alsa_out: access type not available"); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: access type not available"); return NULL; } this->capabilities = 0; - xprintf(class->xine, XINE_VERBOSITY_LOG, "audio_alsa_out : supported modes are "); + xprintf(class->xine, XINE_VERBOSITY_LOG, _("audio_alsa_out : supported modes are ")); if (!(snd_pcm_hw_params_test_format(this->audio_fd, params, SND_PCM_FORMAT_U8))) { this->capabilities |= AO_CAP_8BITS; - xprintf(class->xine, XINE_VERBOSITY_LOG, "8bit "); + xprintf(class->xine, XINE_VERBOSITY_LOG, _("8bit ")); } if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 1))) { this->capabilities |= AO_CAP_MODE_MONO; - xprintf(class->xine, XINE_VERBOSITY_LOG, "mono "); + xprintf(class->xine, XINE_VERBOSITY_LOG, _("mono ")); } if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 2))) { this->capabilities |= AO_CAP_MODE_STEREO; - xprintf(class->xine, XINE_VERBOSITY_LOG, "stereo "); + xprintf(class->xine, XINE_VERBOSITY_LOG, _("stereo ")); } if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 4)) && config->register_bool (config, @@ -1322,10 +1372,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da 0, NULL, NULL) ) { this->capabilities |= AO_CAP_MODE_4CHANNEL; - xprintf(class->xine, XINE_VERBOSITY_LOG, "4-channel "); + xprintf(class->xine, XINE_VERBOSITY_LOG, _("4-channel ")); } else - xprintf(class->xine, XINE_VERBOSITY_LOG, "(4-channel not enabled in xine config) "); + xprintf(class->xine, XINE_VERBOSITY_LOG, _("(4-channel not enabled in xine config) ")); if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) && config->register_bool (config, @@ -1336,10 +1386,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da 0, NULL, NULL) ) { this->capabilities |= AO_CAP_MODE_4_1CHANNEL; - xprintf(class->xine, XINE_VERBOSITY_LOG, "4.1-channel "); + xprintf(class->xine, XINE_VERBOSITY_LOG, _("4.1-channel ")); } else - xprintf(class->xine, XINE_VERBOSITY_LOG, "(4.1-channel not enabled in xine config) "); + xprintf(class->xine, XINE_VERBOSITY_LOG, _("(4.1-channel not enabled in xine config) ")); if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) && config->register_bool (config, @@ -1350,10 +1400,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da 0, NULL, NULL) ) { this->capabilities |= AO_CAP_MODE_5CHANNEL; - xprintf(class->xine, XINE_VERBOSITY_LOG, "5-channel "); + xprintf(class->xine, XINE_VERBOSITY_LOG, _("5-channel ")); } else - xprintf(class->xine, XINE_VERBOSITY_LOG, "(5-channel not enabled in xine config) "); + xprintf(class->xine, XINE_VERBOSITY_LOG, _("(5-channel not enabled in xine config) ")); if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) && config->register_bool (config, @@ -1364,10 +1414,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da 0, NULL, NULL) ) { this->capabilities |= AO_CAP_MODE_5_1CHANNEL; - xprintf(class->xine, XINE_VERBOSITY_LOG, "5.1-channel "); + xprintf(class->xine, XINE_VERBOSITY_LOG, _("5.1-channel ")); } else - xprintf(class->xine, XINE_VERBOSITY_LOG, "(5.1-channel not enabled in xine config) "); + xprintf(class->xine, XINE_VERBOSITY_LOG, _("(5.1-channel not enabled in xine config) ")); this->has_pause_resume = 0; /* This is checked at open time instead */ @@ -1402,10 +1452,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da this) ) { this->capabilities |= AO_CAP_MODE_A52; this->capabilities |= AO_CAP_MODE_AC5; - xprintf(class->xine, XINE_VERBOSITY_LOG, "a/52 and DTS pass-through "); + xprintf(class->xine, XINE_VERBOSITY_LOG, _("a/52 and DTS pass-through ")); } else - xprintf(class->xine, XINE_VERBOSITY_LOG, "(a/52 and DTS pass-through not enabled in xine config)"); + xprintf(class->xine, XINE_VERBOSITY_LOG, _("(a/52 and DTS pass-through not enabled in xine config)")); /* printf("audio_alsa_out: capabilities 0x%X\n",this->capabilities); */ @@ -1459,7 +1509,7 @@ static void *init_class (xine_t *xine, void *data) { alsa_class_t *this; - this = (alsa_class_t *) malloc (sizeof (alsa_class_t)); + this = (alsa_class_t *) xine_xmalloc (sizeof (alsa_class_t)); this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; diff --git a/src/audio_out/audio_arts_out.c b/src/audio_out/audio_arts_out.c index 9b93f0ea4..143e3db6e 100644 --- a/src/audio_out/audio_arts_out.c +++ b/src/audio_out/audio_arts_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_arts_out.c,v 1.20 2002/12/21 12:56:46 miguelfreitas Exp $ + * $Id: audio_arts_out.c,v 1.21 2003/12/05 15:54:56 f1rmb Exp $ */ #ifndef __sun /* _XOPEN_SOURCE causes build prob's on sunos */ @@ -54,6 +54,8 @@ typedef struct arts_driver_s { ao_driver_t ao_driver; + xine_t *xine; + arts_stream_t audio_stream; int capabilities; int mode; @@ -75,9 +77,9 @@ typedef struct arts_driver_s { } arts_driver_t; typedef struct { - audio_driver_class_t driver_class; + audio_driver_class_t driver_class; - config_values_t *config; + xine_t *xine; } arts_class_t; /* @@ -103,10 +105,11 @@ static int ao_arts_open(ao_driver_t *this_gen, { arts_driver_t *this = (arts_driver_t *) this_gen; - printf ("audio_arts_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "audio_arts_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode); if ( (mode & this->capabilities) == 0 ) { - printf ("audio_arts_out: unsupported mode %08x\n", mode); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_arts_out: unsupported mode %08x\n", mode); return 0; } @@ -134,7 +137,7 @@ static int ao_arts_open(ao_driver_t *this_gen, this->bytes_per_frame=(this->bits_per_sample*this->num_channels)/8; - printf ("audio_arts_out: %d channels output\n",this->num_channels); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_arts_out: %d channels output\n", this->num_channels); this->audio_stream=arts_play_stream(this->sample_rate, bits, this->num_channels, "xine"); @@ -152,7 +155,7 @@ static int ao_arts_open(ao_driver_t *this_gen, this->latency = arts_stream_get (this->audio_stream, ARTS_P_TOTAL_LATENCY); } - printf ("audio_arts_out : latency %d ms\n", this->latency); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_arts_out : latency %d ms\n", this->latency); return this->sample_rate; } @@ -293,21 +296,18 @@ static int ao_arts_ctrl(ao_driver_t *this_gen, int cmd, ...) { return 0; } -static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, - const void *data) { - - /* arts_class_t *class = (arts_class_t *) class_gen; */ - /* config_values_t *config = class->config; */ - arts_driver_t *this; - int rc; +static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *data) { + arts_class_t *class = (arts_class_t *) class_gen; + arts_driver_t *this; + int rc; - printf ("audio_arts_out: open_plugin called\n"); + lprintf ("audio_arts_out: open_plugin called\n"); - this = (arts_driver_t *) malloc (sizeof (arts_driver_t)); + this = (arts_driver_t *) xine_xmalloc (sizeof (arts_driver_t)); rc = arts_init(); if (rc < 0) { - printf ("audio_arts_out: arts_init failed: %s\n", arts_error_text(rc)); + xprintf (this->xine, XINE_VERBOSITY_DEBUG,"audio_arts_out: arts_init failed: %s\n", arts_error_text(rc)); return NULL; } @@ -317,17 +317,17 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, this->mixer.mute = 0; this->mixer.vol_scale = 60; this->mixer.v_mixer = 0; - + + this->xine = class->xine; /* * set capabilities */ this->capabilities = 0; - printf ("audio_arts_out : supported modes are "); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_arts_out : supported modes are "); this->capabilities |= AO_CAP_MODE_MONO | AO_CAP_MIXER_VOL | AO_CAP_PCM_VOL | AO_CAP_MUTE_VOL; - printf ("mono "); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "mono "); this->capabilities |= AO_CAP_MODE_STEREO | AO_CAP_MIXER_VOL | AO_CAP_PCM_VOL | AO_CAP_MUTE_VOL; - printf ("stereo "); - printf ("\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "stereo "); this->sample_rate = 0; this->audio_stream = NULL; @@ -371,16 +371,16 @@ static void *init_class (xine_t *xine, void *data) { arts_class_t *this; - printf ("audio_arts_out: init class\n"); + lprintf ("audio_arts_out: init class\n"); - this = (arts_class_t *) malloc (sizeof (arts_class_t)); + this = (arts_class_t *) xine_xmalloc (sizeof (arts_class_t)); this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; this->driver_class.get_description = get_description; this->driver_class.dispose = dispose_class; - this->config = xine->config; + this->xine = xine; return this; } diff --git a/src/audio_out/audio_directx_out.c b/src/audio_out/audio_directx_out.c index 1956eccd3..c4de81cff 100755 --- a/src/audio_out/audio_directx_out.c +++ b/src/audio_out/audio_directx_out.c @@ -20,7 +20,7 @@ * audio_directx_out.c, direct sound audio output plugin for xine * by Matthew Grooms <elon@altavista.com> * - * $Id: audio_directx_out.c,v 1.5 2003/11/26 19:43:26 f1rmb Exp $ + * $Id: audio_directx_out.c,v 1.6 2003/12/05 15:54:56 f1rmb Exp $ */ typedef unsigned char boolean; @@ -57,6 +57,8 @@ typedef unsigned char boolean; typedef struct { ao_driver_t ao_driver; int capabilities; + + xine_t *xine; /* directx objects */ LPDIRECTSOUND dsobj; @@ -89,6 +91,7 @@ typedef struct { audio_driver_class_t driver_class; config_values_t *config; char *device_name; + xine_t *xine; } audiox_class_t; /* ------------------------------------------- @@ -523,27 +526,27 @@ static int ao_directx_open( ao_driver_t * ao_driver, uint32_t bits, uint32_t rat { case AO_CAP_MODE_MONO: ao_directx->chnn = 1; - printf( "ao_directx : opened in AO_CAP_MODE_MONO mode\n" ); + xprintf(ao_directx->xine, XINE_VERBOSITY_DEBUG, "ao_directx : opened in AO_CAP_MODE_MONO mode\n" ); break; case AO_CAP_MODE_STEREO: ao_directx->chnn = 2; - printf( "ao_directx : opened in AO_CAP_MODE_STEREO mode\n" ); + xprintf(ao_directx->xine, XINE_VERBOSITY_DEBUG, "ao_directx : opened in AO_CAP_MODE_STEREO mode\n" ); break; case AO_CAP_MODE_4CHANNEL: ao_directx->chnn = 4; - printf( "ao_directx : opened in AO_CAP_MODE_4CHANNEL mode\n" ); + xprintf(ao_directx->xine, XINE_VERBOSITY_DEBUG, "ao_directx : opened in AO_CAP_MODE_4CHANNEL mode\n" ); break; case AO_CAP_MODE_5CHANNEL: ao_directx->chnn = 5; - printf( "ao_directx : opened in AO_CAP_MODE_5CHANNEL mode\n" ); + xprintf(ao_directx->xine, XINE_VERBOSITY_DEBUG, "ao_directx : opened in AO_CAP_MODE_5CHANNEL mode\n" ); break; case AO_CAP_MODE_5_1CHANNEL: ao_directx->chnn = 6; - printf( "ao_directx : opened in AO_CAP_MODE_5_1CHANNEL mode\n" ); + xprintf(ao_directx->xine, XINE_VERBOSITY_DEBUG, "ao_directx : opened in AO_CAP_MODE_5_1CHANNEL mode\n" ); break; case AO_CAP_MODE_A52: @@ -739,7 +742,8 @@ static int ao_directx_set_property( ao_driver_t * ao_driver, int property, int v if( !ao_directx->mute && ao_directx->dsbuffer ) IDirectSoundBuffer_SetVolume( ao_directx->dsbuffer, ao_directx->volume ); - printf( "ao_directx : volume set to %d - directX volume = %d\n", value, ao_directx->volume); + xprintf(ao_directx->xine, XINE_VERBOSITY_DEBUG, + "ao_directx : volume set to %d - directX volume = %d\n", value, ao_directx->volume); return value; @@ -756,7 +760,7 @@ static int ao_directx_set_property( ao_driver_t * ao_driver, int property, int v if( ao_directx->mute && ao_directx->dsbuffer ) IDirectSoundBuffer_SetVolume( ao_directx->dsbuffer, DSBVOLUME_MIN ); - printf( "ao_directx : mute toggled" ); + xprintf(ao_directx->xine, XINE_VERBOSITY_DEBUG, "ao_directx : mute toggled" ); return value; @@ -770,13 +774,16 @@ static int ao_directx_set_property( ao_driver_t * ao_driver, int property, int v static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *data) { - ao_directx_t *ao_directx = ( ao_directx_t * ) malloc( sizeof( ao_directx_t ) ); - - memset( ao_directx, 0, sizeof( ao_directx_t ) ); - + audiox_class_t *class = (audiox_class_t *) class_gen; + ao_directx_t *ao_directx; + + ao_directx = ( ao_directx_t * ) xine_xmalloc( sizeof( ao_directx_t ) ); + lprintf("open_plugin(%08x, %08x) Enter\n", (unsigned long)class_gen, (unsigned long)data); lprintf("open_plugin: ao_directx=%08x\n", (unsigned long)ao_directx); + ao_driverx->xine = class->xine; + ao_directx->ao_driver.get_capabilities = ao_directx_get_capabilities; ao_directx->ao_driver.get_property = ao_directx_get_property; ao_directx->ao_driver.set_property = ao_directx_set_property; @@ -825,14 +832,14 @@ static void *init_class (xine_t *xine, void *data) { /* * from this point on, nothing should go wrong anymore */ - audiox = (audiox_class_t *) malloc (sizeof (audiox_class_t)); - memset( audiox, 0, sizeof( audiox_class_t ) ); - + audiox = (audiox_class_t *) xine_xmalloc (sizeof (audiox_class_t)); + audiox->driver_class.open_plugin = open_plugin; audiox->driver_class.get_identifier = get_identifier; audiox->driver_class.get_description = get_description; audiox->driver_class.dispose = dispose_class; + audiox->xine = xine; audiox->config = xine->config; audiox->device_name = device_name; diff --git a/src/audio_out/audio_esd_out.c b/src/audio_out/audio_esd_out.c index 402858e11..b12634c75 100644 --- a/src/audio_out/audio_esd_out.c +++ b/src/audio_out/audio_esd_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_esd_out.c,v 1.27 2003/10/06 15:27:10 mroi Exp $ + * $Id: audio_esd_out.c,v 1.28 2003/12/05 15:54:56 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -49,6 +49,8 @@ typedef struct esd_driver_s { ao_driver_t ao_driver; + xine_t *xine; + int audio_fd; int capabilities; int mode; @@ -94,8 +96,7 @@ typedef struct esd_driver_s { typedef struct { audio_driver_class_t driver_class; - - config_values_t *config; + xine_t *xine; } esd_class_t; @@ -108,11 +109,11 @@ static int ao_esd_open(ao_driver_t *this_gen, esd_driver_t *this = (esd_driver_t *) this_gen; esd_format_t format; - printf ("audio_esd_out: ao_open bits=%d rate=%d, mode=%d\n", - bits, rate, mode); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "audio_esd_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode); if ( (mode & this->capabilities) == 0 ) { - printf ("audio_esd_out: unsupported mode %08x\n", mode); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_esd_out: unsupported mode %08x\n", mode); return 0; } @@ -145,7 +146,7 @@ static int ao_esd_open(ao_driver_t *this_gen, this->num_channels = 2; break; } - printf ("audio_esd_out: %d channels output\n",this->num_channels); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_esd_out: %d channels output\n",this->num_channels); this->bytes_per_frame=(bits*this->num_channels)/8; @@ -162,8 +163,9 @@ static int ao_esd_open(ao_driver_t *this_gen, this->audio_fd = esd_play_stream(format, this->output_sample_rate, NULL, this->pname); if (this->audio_fd < 0) { char *server = getenv("ESPEAKER"); - printf("audio_esd_out: connecting to ESD server %s: %s\n", - server ? server : "<default>", strerror(errno)); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("audio_esd_out: connecting to ESD server %s: %s\n"), + server ? server : "<default>", strerror(errno)); return 0; } @@ -295,9 +297,9 @@ static int ao_esd_write(ao_driver_t *this_gen, nwritten = writev(this->audio_fd, iov, iovcnt); if (nwritten != num_bytes) { if (nwritten < 0) - printf("audio_esd_out: writev failed: %s\n", strerror(errno)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_esd_out: writev failed: %s\n", strerror(errno)); else - printf("audio_esd_out: warning, incomplete write: %d\n", nwritten); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_esd_out: warning, incomplete write: %d\n", nwritten); } if (nwritten > 0) this->bytes_in_buffer += nwritten; @@ -469,7 +471,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *data) { esd_class_t *class = (esd_class_t *) class_gen; - config_values_t *config = class->config; + config_values_t *config = class->xine->config; esd_driver_t *this; int audio_fd; int err; @@ -492,21 +494,22 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, sigemptyset(&vo_mask); sigaddset(&vo_mask, SIGALRM); if (sigprocmask(SIG_UNBLOCK, &vo_mask, &vo_mask_orig)) - printf("audio_esd_out: cannot unblock SIGALRM: %s\n", strerror(errno)); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "audio_esd_out: cannot unblock SIGALRM: %s\n", strerror(errno)); - printf("audio_esd_out: connecting to esd server...\n"); + xprintf(class->xine, XINE_VERBOSITY_LOG, _("audio_esd_out: connecting to esd server...\n")); audio_fd = esd_open_sound(NULL); err = errno; if (sigprocmask(SIG_SETMASK, &vo_mask_orig, NULL)) - printf("audio_esd_out: cannot block SIGALRM: %s\n", strerror(errno)); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "audio_esd_out: cannot block SIGALRM: %s\n", strerror(errno)); if(audio_fd < 0) { char *server = getenv("ESPEAKER"); /* print a message so the user knows why ESD failed */ - printf("audio_esd_out: can't connect to %s ESD server: %s\n", - server ? server : "<default>", strerror(err)); + xprintf(class->xine, XINE_VERBOSITY_LOG, + _("audio_esd_out: can't connect to %s ESD server: %s\n"), + server ? server : "<default>", strerror(err)); return NULL; } @@ -522,6 +525,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, this = (esd_driver_t *) xine_xmalloc (sizeof (esd_driver_t)); + this->xine = class->xine; this->pname = strdup("xine esd audio output plugin"); this->output_sample_rate = 0; this->server_sample_rate = server_sample_rate; @@ -571,14 +575,14 @@ static void *init_class (xine_t *xine, void *data) { esd_class_t *this; - this = (esd_class_t *) malloc (sizeof (esd_class_t)); + this = (esd_class_t *) xine_xmalloc (sizeof (esd_class_t)); this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; this->driver_class.get_description = get_description; this->driver_class.dispose = dispose_class; - this->config = xine->config; + this->xine = xine; return this; } diff --git a/src/audio_out/audio_none_out.c b/src/audio_out/audio_none_out.c index 1db1cbbe8..56b93de16 100644 --- a/src/audio_out/audio_none_out.c +++ b/src/audio_out/audio_none_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_none_out.c,v 1.4 2003/10/06 15:27:10 mroi Exp $ + * $Id: audio_none_out.c,v 1.5 2003/12/05 15:54:56 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -48,6 +48,8 @@ typedef struct none_driver_s { ao_driver_t ao_driver; + xine_t *xine; + int capabilities; int mode; @@ -61,20 +63,21 @@ typedef struct none_driver_s { } none_driver_t; typedef struct { - audio_driver_class_t driver_class; + audio_driver_class_t driver_class; - config_values_t *config; + config_values_t *config; + xine_t *xine; } none_class_t; /* * open the audio device for writing to */ -static int ao_none_open(ao_driver_t *this_gen, - uint32_t bits, uint32_t rate, int mode) +static int ao_none_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int mode) { none_driver_t *this = (none_driver_t *) this_gen; - printf ("audio_none_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "audio_none_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode); this->mode = mode; this->sample_rate = rate; @@ -179,14 +182,15 @@ static int ao_none_ctrl(ao_driver_t *this_gen, int cmd, ...) { static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *data) { - /* none_class_t *class = (none_class_t *) class_gen; */ + none_class_t *class = (none_class_t *) class_gen; /* config_values_t *config = class->config; */ none_driver_t *this; - printf ("audio_none_out: open_plugin called\n"); + lprintf ("audio_none_out: open_plugin called\n"); - this = (none_driver_t *) malloc (sizeof (none_driver_t)); + this = (none_driver_t *) xine_xmalloc (sizeof (none_driver_t)); + this->xine = class->xine; this->capabilities = AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO; this->sample_rate = 0; @@ -230,9 +234,9 @@ static void *init_class (xine_t *xine, void *data) { none_class_t *this; - printf ("audio_none_out: init class\n"); + lprintf ("audio_none_out: init class\n"); - this = (none_class_t *) malloc (sizeof (none_class_t)); + this = (none_class_t *) xine_xmalloc (sizeof (none_class_t)); this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; @@ -240,6 +244,7 @@ static void *init_class (xine_t *xine, void *data) { this->driver_class.dispose = dispose_class; this->config = xine->config; + this->xine = xine; return this; } diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c index af3d6207a..8a6ac5d92 100644 --- a/src/audio_out/audio_oss_out.c +++ b/src/audio_out/audio_oss_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_oss_out.c,v 1.94 2003/11/26 23:44:08 f1rmb Exp $ + * $Id: audio_oss_out.c,v 1.95 2003/12/05 15:54:56 f1rmb Exp $ * * 20-8-2001 First implementation of Audio sync and Audio driver separation. * Copyright (C) 2001 James Courtier-Dutton James@superbug.demon.co.uk @@ -165,11 +165,11 @@ static int ao_oss_open(ao_driver_t *this_gen, oss_driver_t *this = (oss_driver_t *) this_gen; int tmp; - xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_oss_out: ao_open rate=%d, mode=%d, dev=%s\n", - rate, mode, this->audio_dev); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "audio_oss_out: ao_open rate=%d, mode=%d, dev=%s\n", rate, mode, this->audio_dev); if ( (mode & this->capabilities) == 0 ) { - printf ("audio_oss_out: unsupported mode %08x\n", mode); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: unsupported mode %08x\n", mode); return 0; } @@ -195,8 +195,8 @@ static int ao_oss_open(ao_driver_t *this_gen, this->audio_fd=open(this->audio_dev,O_WRONLY|O_NONBLOCK); if (this->audio_fd < 0) { - printf("audio_oss_out: Opening audio device %s: %s\n", - this->audio_dev, strerror(errno)); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("audio_oss_out: Opening audio device %s: %s\n"), this->audio_dev, strerror(errno)); return 0; } @@ -216,20 +216,21 @@ static int ao_oss_open(ao_driver_t *this_gen, tmp = this->input_sample_rate; if (ioctl(this->audio_fd,SNDCTL_DSP_SPEED, &tmp) == -1) { - + xprintf(this->xine, XINE_VERBOSITY_LOG, - "audio_oss_out: warning: sampling rate %d Hz not supported, trying 44100 Hz\n", this->input_sample_rate); + _("audio_oss_out: warning: sampling rate %d Hz not supported, trying 44100 Hz\n"), + this->input_sample_rate); tmp = 44100; if (ioctl(this->audio_fd,SNDCTL_DSP_SPEED, &tmp) == -1) { - printf ("audio_oss_out: error: 44100 Hz sampling rate not supported\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: error: 44100 Hz sampling rate not supported\n"); return 0; } } this->output_sample_rate = tmp; this->output_sample_k_rate = this->output_sample_rate / 1000; xprintf(this->xine, XINE_VERBOSITY_LOG, - "audio_oss_out: audio rate : %d requested, %d provided by device/sec\n", + _("audio_oss_out: audio rate : %d requested, %d provided by device/sec\n"), this->input_sample_rate, this->output_sample_rate); } /* @@ -272,7 +273,7 @@ static int ao_oss_open(ao_driver_t *this_gen, break; } - xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_oss_out: %d channels output\n",this->num_channels); + xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_oss_out: %d channels output\n", this->num_channels); this->bytes_per_frame=(this->bits_per_sample*this->num_channels)/8; /* @@ -292,18 +293,18 @@ static int ao_oss_open(ao_driver_t *this_gen, if (ioctl(this->audio_fd, SNDCTL_DSP_SETFMT, &tmp) < 0 || (tmp!=AFMT_S16_NE && tmp!=AFMT_U8)) { if (bits==8) { - printf("audio_oss_out: SNDCTL_DSP_SETFMT failed for AFMT_U8.\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: SNDCTL_DSP_SETFMT failed for AFMT_U8.\n"); if (tmp != AFMT_U8) - printf("audio_oss_out: ioctl succeeded but set format to 0x%x.\n",tmp); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: ioctl succeeded but set format to 0x%x.\n",tmp); else - printf("audio_oss_out: The AFMT_U8 ioctl failed.\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: The AFMT_U8 ioctl failed.\n"); return 0; } else { - printf("audio_oss_out: SNDCTL_DSP_SETFMT failed for AFMT_S16_NE.\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: SNDCTL_DSP_SETFMT failed for AFMT_S16_NE.\n"); if (tmp != AFMT_S16_NE) - printf("audio_oss_out: ioctl succeeded but set format to 0x%x.\n",tmp); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: ioctl succeeded but set format to 0x%x.\n",tmp); else - printf("audio_oss_out: The AFMT_S16_NE ioctl failed.\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: The AFMT_S16_NE ioctl failed.\n"); return 0; } } @@ -319,7 +320,8 @@ static int ao_oss_open(ao_driver_t *this_gen, ioctl(this->audio_fd, SNDCTL_DSP_CHANNELS, &tmp); tmp = AFMT_AC3; if (ioctl(this->audio_fd, SNDCTL_DSP_SETFMT, &tmp) < 0 || tmp != AFMT_AC3) { - printf("audio_oss_out: AC3 SNDCTL_DSP_SETFMT failed. %d. Using alternative.\n",tmp); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "audio_oss_out: AC3 SNDCTL_DSP_SETFMT failed. %d. Using alternative.\n",tmp); tmp = AFMT_S16_LE; ioctl(this->audio_fd, SNDCTL_DSP_SETFMT, &tmp); } @@ -536,8 +538,8 @@ static int ao_oss_get_property (ao_driver_t *this_gen, int property) { this->mixer.volume = (((v & 0xFF00) >> 8) + (v & 0x00FF)) / 2; close(mixer_fd); } else { - printf("audio_oss_out: open() %s failed: %s\n", - this->mixer.name, strerror(errno)); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("audio_oss_out: open() %s failed: %s\n"), this->mixer.name, strerror(errno)); return -1; } } @@ -587,8 +589,8 @@ static int ao_oss_set_property (ao_driver_t *this_gen, int property, int value) } else - printf("audio_oss_out: open() %s failed: %s\n", - this->mixer.name, strerror(errno)); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("audio_oss_out: open() %s failed: %s\n"), this->mixer.name, strerror(errno)); } else this->mixer.volume = value; @@ -623,8 +625,8 @@ static int ao_oss_set_property (ao_driver_t *this_gen, int property, int value) } else - printf("audio_oss_out: open() %s failed: %s\n", - this->mixer.name, strerror(errno)); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("audio_oss_out: open() %s failed: %s\n"), this->mixer.name, strerror(errno)); } else (void) ao_oss_set_property(&this->ao_driver, this->mixer.prop, this->mixer.volume); @@ -694,13 +696,13 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da int num_channels, bits, status, arg; static char *sync_methods[] = {"auto", "getodelay", "getoptr", "softsync", "probebuffer", NULL}; - this = (oss_driver_t *) malloc (sizeof (oss_driver_t)); + this = (oss_driver_t *) xine_xmalloc (sizeof (oss_driver_t)); /* * find best device driver/channel */ - xprintf(class->xine, XINE_VERBOSITY_LOG, "audio_oss_out: Opening audio device...\n"); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: Opening audio device...\n"); best_rate = 0; devnum = config->register_num (config, "audio.oss_device_num", -1, @@ -745,13 +747,13 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da */ xprintf(class->xine, XINE_VERBOSITY_LOG, - "audio_oss_out: using device >%s<\n", this->audio_dev); + _("audio_oss_out: using device >%s<\n"), this->audio_dev); audio_fd=open(this->audio_dev, O_WRONLY|O_NONBLOCK); if (audio_fd < 0) { - printf("audio_oss_out: opening audio device %s failed:\n%s\n", - this->audio_dev, strerror(errno)); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("audio_oss_out: opening audio device %s failed:\n%s\n"), this->audio_dev, strerror(errno)); free (this); return NULL; @@ -784,10 +786,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da */ if (ioctl(audio_fd, SNDCTL_DSP_GETODELAY, &info) != -1) { - xprintf(class->xine, XINE_VERBOSITY_LOG, "audio_oss_out: using SNDCTL_DSP_GETODELAY\n"); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: using SNDCTL_DSP_GETODELAY\n"); this->sync_method = OSS_SYNC_GETODELAY; } else if (ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &info) != -1) { - xprintf(class->xine, XINE_VERBOSITY_LOG, "audio_oss_out: using SNDCTL_DSP_GETOPTR\n"); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: using SNDCTL_DSP_GETOPTR\n"); this->sync_method = OSS_SYNC_GETOPTR; } else { this->sync_method = OSS_SYNC_SOFTSYNC; @@ -796,9 +798,9 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da if (this->sync_method == OSS_SYNC_SOFTSYNC) { xprintf(class->xine, XINE_VERBOSITY_LOG, - "audio_oss_out: Audio driver realtime sync disabled...\n" - "audio_oss_out: ...will use system real-time clock for soft-sync instead\n" - "audio_oss_out: ...there may be audio/video synchronization issues\n"); + _("audio_oss_out: Audio driver realtime sync disabled...\n" + "audio_oss_out: ...will use system real-time clock for soft-sync instead\n" + "audio_oss_out: ...there may be audio/video synchronization issues\n")); gettimeofday(&this->start_time, NULL); } @@ -807,8 +809,8 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da int c; xprintf(class->xine, XINE_VERBOSITY_LOG, - "audio_oss_out: Audio driver realtime sync disabled...\n" - "audio_oss_out: ...probing output buffer size: "); + _("audio_oss_out: Audio driver realtime sync disabled...\n" + "audio_oss_out: ...probing output buffer size: ")); this->buffer_size = 0; if( (buf=malloc(1024)) != NULL ) { @@ -824,15 +826,14 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da } close(audio_fd); xprintf(class->xine, XINE_VERBOSITY_LOG, - "%d bytes\n" - "audio_oss_out: ...there may be audio/video synchronization issues\n", this->buffer_size); + _("%d bytes\naudio_oss_out: ...there may be audio/video synchronization issues\n"), this->buffer_size); audio_fd=open(this->audio_dev, O_WRONLY|O_NONBLOCK); if(audio_fd < 0) { - printf("audio_oss_out: opening audio device %s failed:\n%s\n", - this->audio_dev, strerror(errno)); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("audio_oss_out: opening audio device %s failed:\n%s\n"), this->audio_dev, strerror(errno)); free (this); return NULL; @@ -854,23 +855,23 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da /* switch back to 16bits, because some soundcards otherwise do not report all their capabilities */ bits = 16; if (ioctl(audio_fd, SNDCTL_DSP_SAMPLESIZE, &bits) == -1) { - printf("audio_oss_out: switching the soundcard to 16 bits mode failed\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: switching the soundcard to 16 bits mode failed\n"); free(this); return NULL; } - - xprintf(class->xine, XINE_VERBOSITY_LOG, "audio_oss_out: supported modes are "); + + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: supported modes are "); num_channels = 1; status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); if ( (status != -1) && (num_channels==1) ) { this->capabilities |= AO_CAP_MODE_MONO; - xprintf(class->xine, XINE_VERBOSITY_LOG, "mono "); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "mono "); } num_channels = 2; status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); if ( (status != -1) && (num_channels==2) ) { this->capabilities |= AO_CAP_MODE_STEREO; - xprintf(class->xine, XINE_VERBOSITY_LOG, "stereo "); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "stereo "); } num_channels = 4; status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); @@ -879,10 +880,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da _("Enable 4.0 channel analog surround output"), NULL, 0, NULL, NULL)) { this->capabilities |= AO_CAP_MODE_4CHANNEL; - xprintf(class->xine, XINE_VERBOSITY_LOG, "4-channel "); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "4-channel "); } else - xprintf(class->xine, XINE_VERBOSITY_LOG, "(4-channel not enabled in xine config) " ); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "(4-channel not enabled in xine config) " ); } num_channels = 5; status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); @@ -891,10 +892,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da _("Enable 5.0 channel analog surround output"), NULL, 0, NULL, NULL)) { this->capabilities |= AO_CAP_MODE_5CHANNEL; - xprintf(class->xine, XINE_VERBOSITY_LOG,"5-channel "); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "5-channel "); } else - xprintf(class->xine, XINE_VERBOSITY_LOG, "(5-channel not enabled in xine config) " ); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "(5-channel not enabled in xine config) " ); } num_channels = 6; status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); @@ -903,10 +904,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da _("Enable 5.1 channel analog surround output"), NULL, 0, NULL, NULL)) { this->capabilities |= AO_CAP_MODE_5_1CHANNEL; - xprintf(class->xine, XINE_VERBOSITY_LOG, "5.1-channel "); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "5.1-channel "); } else - xprintf(class->xine, XINE_VERBOSITY_LOG, "(5.1-channel not enabled in xine config) " ); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "(5.1-channel not enabled in xine config) " ); } ioctl(audio_fd,SNDCTL_DSP_GETFMTS,&caps); @@ -919,10 +920,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da NULL, 0, NULL, NULL)) { this->capabilities |= AO_CAP_MODE_A52; this->capabilities |= AO_CAP_MODE_AC5; - xprintf(class->xine, XINE_VERBOSITY_LOG, "a/52-pass-through "); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "a/52-pass-through "); } else - xprintf(class->xine, XINE_VERBOSITY_LOG, "(a/52-pass-through not enabled in xine config)"); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "(a/52-pass-through not enabled in xine config)"); } /* @@ -965,8 +966,8 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da close(mixer_fd); } else - printf ("audio_oss_out: open() mixer %s failed: %s\n", - this->mixer.name, strerror(errno)); + xprintf (class->xine, XINE_VERBOSITY_LOG, + _("audio_oss_out: open() mixer %s failed: %s\n"), this->mixer.name, strerror(errno)); this->mixer.mute = 0; this->mixer.volume = ao_oss_get_property (&this->ao_driver, this->mixer.prop); @@ -1019,7 +1020,7 @@ static void *init_class (xine_t *xine, void *data) { oss_class_t *this; - this = (oss_class_t *) malloc (sizeof (oss_class_t)); + this = (oss_class_t *) xine_xmalloc (sizeof (oss_class_t)); this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; diff --git a/src/audio_out/audio_sun_out.c b/src/audio_out/audio_sun_out.c index 5de3841d9..8a8882761 100644 --- a/src/audio_out/audio_sun_out.c +++ b/src/audio_out/audio_sun_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_sun_out.c,v 1.32 2003/11/29 15:41:37 miguelfreitas Exp $ + * $Id: audio_sun_out.c,v 1.33 2003/12/05 15:54:56 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -126,7 +126,7 @@ typedef struct sun_driver_s { * try to figure out, if the soundcard driver provides usable (precise) * sample counter information */ -static int realtime_samplecounter_available(char *dev) +static int realtime_samplecounter_available(xine_t *xine, char *dev) { int fd = -1; audio_info_t info; @@ -162,17 +162,17 @@ static int realtime_samplecounter_available(char *dev) info.play.encoding = AUDIO_ENCODING_LINEAR; info.play.samples = 0; if (ioctl(fd, AUDIO_SETINFO, &info)) { - fprintf(stderr, "rtsc: SETINFO failed\n"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "rtsc: SETINFO failed\n"); goto error; } if (write(fd, silence, len) != len) { - fprintf(stderr, "rtsc: write failed\n"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "rtsc: write failed\n"); goto error; } if (ioctl(fd, AUDIO_GETINFO, &info)) { - fprintf(stderr, "rtsc: GETINFO1, %s\n", strerror(errno)); + xprintf(xine, XINE_VERBOSITY_DEBUG, "rtsc: GETINFO1, %s\n", strerror(errno)); goto error; } @@ -194,11 +194,11 @@ static int realtime_samplecounter_available(char *dev) break; if (ioctl(fd, AUDIO_GETINFO, &info)) { - fprintf(stderr, "rtsc: GETINFO2 failed, %s\n", strerror(errno)); + xprintf(xine, XINE_VERBOSITY_DEBUG, "rtsc: GETINFO2 failed, %s\n", strerror(errno)); goto error; } if (info.play.samples < last_samplecnt) { - fprintf(stderr, "rtsc: %u > %u?\n", last_samplecnt, info.play.samples); + xprintf(xine, XINE_VERBOSITY_DEBUG, "rtsc: %u > %u?\n", last_samplecnt, info.play.samples); goto error; } @@ -412,10 +412,10 @@ static int ao_sun_open(ao_driver_t *this_gen, int pass; int ok; - xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_sun_out: ao_sun_open rate=%d, mode=%d\n", rate, mode); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_sun_out: ao_sun_open rate=%d, mode=%d\n", rate, mode); if ( (mode & this->capabilities) == 0 ) { - xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_sun_out: unsupported mode %08x\n", mode); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_sun_out: unsupported mode %08x\n", mode); return 0; } @@ -437,8 +437,8 @@ static int ao_sun_open(ao_driver_t *this_gen, this->audio_fd = open(this->audio_dev, O_WRONLY|O_NONBLOCK); if(this->audio_fd < 0) { - fprintf(stderr, "audio_sun_out: Opening audio device %s failed: %s\n", - this->audio_dev, strerror(errno)); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("audio_sun_out: Opening audio device %s failed: %s\n"), this->audio_dev, strerror(errno)); return 0; } @@ -514,8 +514,8 @@ static int ao_sun_open(ao_driver_t *this_gen, } if (!ok) { - fprintf(stderr, "audio_sun_out: Cannot configure audio device for " - "%dhz, %d channel, %d bits: %s\n", + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "audio_sun_out: Cannot configure audio device for %dhz, %d channel, %d bits: %s\n", rate, info.play.channels, bits, strerror(errno)); close(this->audio_fd); this->audio_fd = -1; @@ -542,7 +542,7 @@ static int ao_sun_open(ao_driver_t *this_gen, this->input_sample_rate, this->output_sample_rate); */ - xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_sun_out: %d channels output\n",this->num_channels); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_sun_out: %d channels output\n",this->num_channels); return this->output_sample_rate; } @@ -567,8 +567,9 @@ static int ao_sun_delay(ao_driver_t *this_gen) (this->frames_in_buffer == 0 || info.play.samples > 0)) { if (info.play.samples < this->last_samplecnt) { - fprintf(stderr, "audio_sun_out: broken sound driver, sample counter runs backwards, cur %u < prev %u\n", - info.play.samples, this->last_samplecnt); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "audio_sun_out: broken sound driver, sample counter runs backwards, cur %u < prev %u\n", + info.play.samples, this->last_samplecnt); } this->last_samplecnt = info.play.samples; @@ -875,7 +876,7 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_class_t *class_gen, const v int status; audio_info_t info; - this = (sun_driver_t *) malloc (sizeof (sun_driver_t)); + this = (sun_driver_t *) xine_xmalloc (sizeof (sun_driver_t)); this->xine = class->xine; @@ -894,7 +895,7 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_class_t *class_gen, const v * find best device driver/channel */ - xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_sun_out: Opening audio device %s...\n", devname); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_sun_out: Opening audio device %s...\n", devname); /* * open the device @@ -904,8 +905,8 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_class_t *class_gen, const v if(audio_fd < 0) { - fprintf(stderr, "audio_sun_out: opening audio device %s failed: %s\n", - devname, strerror(errno)); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("audio_sun_out: opening audio device %s failed: %s\n"), devname, strerror(errno)); free (this); return NULL; @@ -933,7 +934,7 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_class_t *class_gen, const v this->xine = class->xine; this->audio_fd = -1; - this->use_rtsc = realtime_samplecounter_available(this->audio_dev); + this->use_rtsc = realtime_samplecounter_available(this->xine, this->audio_dev); this->output_sample_rate = 0; this->ao_driver.get_capabilities = ao_sun_get_capabilities; @@ -974,7 +975,7 @@ static void ao_sun_dispose_class (audio_driver_class_t *this_gen) { static void *ao_sun_init_class (xine_t *xine, void *data) { sun_class_t *this; - this = (sun_class_t *) malloc (sizeof (sun_class_t)); + this = (sun_class_t *) xine_xmalloc (sizeof (sun_class_t)); this->driver_class.open_plugin = ao_sun_open_plugin; this->driver_class.get_identifier = ao_sun_get_identifier; diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index 0036fdbe9..2596ab40f 100644 --- a/src/demuxers/demux_asf.c +++ b/src/demuxers/demux_asf.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_asf.c,v 1.144 2003/11/26 23:44:09 f1rmb Exp $ + * $Id: demux_asf.c,v 1.145 2003/12/05 15:54:57 f1rmb Exp $ * * demultiplexer for asf streams * @@ -429,8 +429,7 @@ static int asf_read_header (demux_asf_t *this) { * Parse the end of the header but do not demux the stream. */ xine_log(this->stream->xine, XINE_LOG_MSG, - _("demux_asf: warning: The stream id=%d is encrypted\n."), - stream_id); + _("demux_asf: warning: The stream id=%d is encrypted\n."), stream_id); _x_message(this->stream, XINE_MSG_ENCRYPTED_SOURCE, _("Media stream scrambled/encrypted"), NULL); this->mode = ASF_MODE_ENCRYPTED_CONTENT; @@ -469,7 +468,8 @@ static int asf_read_header (demux_asf_t *this) { this->streams[this->num_streams].buf_type = _x_formattag_to_buf_audio ( wavex->wFormatTag ); if ( !this->streams[this->num_streams].buf_type ) { - printf ("demux_asf: unknown audio type 0x%x\n", wavex->wFormatTag); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_asf: unknown audio type 0x%x\n", wavex->wFormatTag); this->streams[this->num_streams].buf_type = BUF_AUDIO_UNKNOWN; } @@ -505,8 +505,8 @@ static int asf_read_header (demux_asf_t *this) { this->streams[this->num_streams].buf_type = _x_fourcc_to_buf_video(bih->biCompression); if( !this->streams[this->num_streams].buf_type ) { - printf ("demux_asf: unknown video format %.4s\n", - (char*)&bih->biCompression); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_asf: unknown video format %.4s\n", (char*)&bih->biCompression); this->streams[this->num_streams].buf_type = BUF_VIDEO_UNKNOWN; } @@ -517,7 +517,8 @@ static int asf_read_header (demux_asf_t *this) { this->streams[this->num_streams].defrag = 0; } else - printf ("demux_asf: invalid bih_size received (%d), v_stream ignored.\n", i ); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_asf: invalid bih_size received (%d), v_stream ignored.\n", i ); lprintf ("found a video stream id=%d, buf_type=%08x \n", stream_id, this->streams[this->num_streams].buf_type); @@ -651,7 +652,7 @@ static int demux_asf_send_headers_common (demux_asf_t *this, int send_ctrl_start stream_id = this->streams[i].stream_id; bitrate = this->bitrates[stream_id]; - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_asf: stream: %d, bitrate %d bps\n", stream_id, bitrate); if ((buf_type == BUF_VIDEO_BASE) && @@ -679,8 +680,8 @@ static int demux_asf_send_headers_common (demux_asf_t *this, int send_ctrl_start _x_stream_info_set(this->stream, XINE_STREAM_INFO_BITRATE, bitrate); - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_asf: video stream_id: %d, audio stream_id: %d\n", - this->video_stream_id, this->audio_stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_asf: video stream_id: %d, audio stream_id: %d\n", this->video_stream_id, this->audio_stream_id); if(_x_stream_info_get(this->stream, XINE_STREAM_INFO_HAS_AUDIO)) asf_send_audio_header(this, this->audio_stream); @@ -790,13 +791,14 @@ static void asf_send_buffer_nodefrag (demux_asf_t *this, asf_stream_t *stream, /* cannot continue current packet: free it */ if (frag_offset != 0) { /* cannot create new packet, will die soon */ - printf ("demux_asf: asf_send_buffer_nodefrag: invalid offset\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_asf: asf_send_buffer_nodefrag: invalid offset\n"); this->input->seek (this->input, frag_len, SEEK_CUR); return ; } else { /* create new packet */ - printf ("demux_asf: asf_send_buffer_nodefrag: packet not complete\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_asf: asf_send_buffer_nodefrag: packet not complete\n"); stream->seq = seq; stream->frag_offset = 0; } @@ -884,13 +886,13 @@ static void asf_send_buffer_defrag (demux_asf_t *this, asf_stream_t *stream, /* cannot continue current packet: free it */ if (frag_offset != 0) { /* cannot create new packet, will die soon */ - printf ("demux_asf: asf_send_buffer_defrag: invalid offset\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_asf: asf_send_buffer_defrag: invalid offset\n"); this->input->seek (this->input, frag_len, SEEK_CUR); return ; } else { /* create new packet */ - printf ("demux_asf: asf_send_buffer_defrag: packet not complete\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_asf: asf_send_buffer_defrag: packet not complete\n"); stream->seq = seq; stream->frag_offset = 0; } @@ -898,7 +900,7 @@ static void asf_send_buffer_defrag (demux_asf_t *this, asf_stream_t *stream, } if( stream->frag_offset + frag_len > DEFRAG_BUFSIZE ) { - printf ("demux_asf: buffer overflow on defrag!\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_asf: buffer overflow on defrag!\n"); } else { this->input->read (this->input, &stream->buffer[stream->frag_offset], frag_len); stream->frag_offset += frag_len; @@ -1010,7 +1012,7 @@ static int asf_parse_packet_header(demux_asf_t *this) { g.Data4[i] = get_byte(this); } if (get_guid_id(this, g) == GUID_ASF_HEADER) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "demux_asf: new asf header detected\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_asf: new asf header detected\n"); if (demux_asf_send_headers_common(this, 0)) return 1; invalid_packet = 1; @@ -1187,7 +1189,8 @@ static int asf_parse_packet_payload_common(demux_asf_t *this, exp_seq = (*stream)->seq; } if (exp_seq != *seq) { - printf ("demux_asf: bad seq: seq = %d, expected = %d, stream seq = %d!\n", *seq, exp_seq, (*stream)->seq); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_asf: bad seq: seq = %d, expected = %d, stream seq = %d!\n", *seq, exp_seq, (*stream)->seq); /* the stream is corrupted, reset the decoder and restart at a new keyframe */ if ((*stream)->fifo) { @@ -1496,7 +1499,7 @@ static int demux_asf_parse_http_references( demux_asf_t *this) { memcpy(href, "mmsh", 4); } - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "demux_asf: http ref: %s\n", href); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_asf: http ref: %s\n", href); uevent.type = XINE_EVENT_MRL_REFERENCE; uevent.stream = this->stream; uevent.data_length = strlen(href) + sizeof(xine_mrl_reference_data_t); @@ -1675,14 +1678,17 @@ static int demux_asf_parse_asx_references( demux_asf_t *this) { } } else - printf("demux_asf: Wrong ASX version: %s\n", asx_prop->value); - + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("demux_asf: Wrong ASX version: %s\n"), asx_prop->value); + } else - printf("demux_asf: Unable to find VERSION tag from ASX.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_asf: Unable to find VERSION tag from ASX.\n"); } else - printf("demux_asf: Unsupported XML type: '%s'.\n", xml_tree->name); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_asf: Unsupported XML type: '%s'.\n", xml_tree->name); xml_parser_free_tree(xml_tree); __failure: @@ -1880,12 +1886,12 @@ static int demux_asf_seek (demux_plugin_t *this_gen, lprintf ("demux_asf_seek: seek back\n"); if (this->input->seek (this->input, start_pos, SEEK_SET) != start_pos) { - printf ("demux_asf: demux_asf_seek: seek failed\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_asf: demux_asf_seek: seek failed\n"); goto error; } if (asf_parse_packet_header(this)) { - printf ("demux_asf: demux_asf_seek: get_packet failed\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_asf: demux_asf_seek: get_packet failed\n"); goto error; } @@ -1985,9 +1991,9 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *stream, input_plugin_t *input) { - demux_asf_t *this; - uint8_t buf[MAX_PREVIEW_SIZE+1]; - int len; + demux_asf_t *this; + uint8_t buf[MAX_PREVIEW_SIZE+1]; + int len; switch (stream->content_detection_method) { case METHOD_BY_CONTENT: @@ -2055,8 +2061,8 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, break; default: - printf ("demux_asf: warning, unkown method %d\n", - stream->content_detection_method); + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, + "demux_asf: warning, unkown method %d\n", stream->content_detection_method); return NULL; } diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c index 40b132183..0e65514b0 100644 --- a/src/demuxers/demux_film.c +++ b/src/demuxers/demux_film.c @@ -21,7 +21,7 @@ * For more information on the FILM file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_film.c,v 1.72 2003/11/26 19:43:30 f1rmb Exp $ + * $Id: demux_film.c,v 1.73 2003/12/05 15:54:57 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -185,8 +185,7 @@ static int open_film_file(demux_film_t *film) { /* sanity check the chunk size */ if (i + chunk_size > film_header_size) { - xine_log(film->stream->xine, XINE_LOG_MSG, - _("invalid FILM chunk size\n")); + xine_log(film->stream->xine, XINE_LOG_MSG, _("invalid FILM chunk size\n")); free (film->interleave_buffer); free (film->sample_table); free (film_header); @@ -340,8 +339,7 @@ static int open_film_file(demux_film_t *film) { break; default: - xine_log(film->stream->xine, XINE_LOG_MSG, - _("unrecognized FILM chunk\n")); + xine_log(film->stream->xine, XINE_LOG_MSG, _("unrecognized FILM chunk\n")); free (film->interleave_buffer); free (film->sample_table); free (film_header); diff --git a/src/demuxers/demux_mng.c b/src/demuxers/demux_mng.c index 222d42477..f94babc8b 100644 --- a/src/demuxers/demux_mng.c +++ b/src/demuxers/demux_mng.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_mng.c,v 1.16 2003/11/26 19:43:30 f1rmb Exp $ + * $Id: demux_mng.c,v 1.17 2003/12/05 15:54:57 f1rmb Exp $ * * demux_mng.c, Demuxer plugin for Multiple-image Network Graphics format * @@ -76,7 +76,7 @@ static void mymng_free(mng_ptr p, mng_uint32 size){ free(p); } -mng_bool mymng_open_stream(mng_handle mngh){ +static mng_bool mymng_open_stream(mng_handle mngh){ demux_mng_t *this = (demux_mng_t*)mng_get_userdata(mngh); if (this->input->get_current_pos(this->input) != 0) { @@ -89,7 +89,7 @@ mng_bool mymng_open_stream(mng_handle mngh){ return MNG_TRUE; } -mng_bool mymng_close_stream(mng_handle mngh){ +static mng_bool mymng_close_stream(mng_handle mngh){ demux_mng_t *this = (demux_mng_t*)mng_get_userdata(mngh); this->status = DEMUX_FINISHED; @@ -97,7 +97,7 @@ mng_bool mymng_close_stream(mng_handle mngh){ return MNG_TRUE; } -mng_bool mymng_read_stream(mng_handle mngh, mng_ptr buffer, mng_uint32 size, mng_uint32 *bytesread){ +static mng_bool mymng_read_stream(mng_handle mngh, mng_ptr buffer, mng_uint32 size, mng_uint32 *bytesread){ demux_mng_t *this = (demux_mng_t*)mng_get_userdata(mngh); *bytesread = this->input->read(this->input, buffer, size); @@ -105,7 +105,7 @@ mng_bool mymng_read_stream(mng_handle mngh, mng_ptr buffer, mng_uint32 size, mng return MNG_TRUE; } -mng_bool mymng_process_header(mng_handle mngh, mng_uint32 width, mng_uint32 height){ +static mng_bool mymng_process_header(mng_handle mngh, mng_uint32 width, mng_uint32 height){ demux_mng_t *this = (demux_mng_t*)mng_get_userdata(mngh); this->bih.biWidth = width; @@ -118,13 +118,13 @@ mng_bool mymng_process_header(mng_handle mngh, mng_uint32 width, mng_uint32 heig return MNG_TRUE; } -mng_uint32 mymng_get_tick_count(mng_handle mngh){ +static mng_uint32 mymng_get_tick_count(mng_handle mngh){ demux_mng_t *this = (demux_mng_t*)mng_get_userdata(mngh); return this->tick_count; } -mng_bool mymng_set_timer(mng_handle mngh, mng_uint32 msecs){ +static mng_bool mymng_set_timer(mng_handle mngh, mng_uint32 msecs){ demux_mng_t *this = (demux_mng_t*)mng_get_userdata(mngh); this->timer_count = msecs; @@ -132,13 +132,13 @@ mng_bool mymng_set_timer(mng_handle mngh, mng_uint32 msecs){ return MNG_TRUE; } -mng_ptr mymng_get_canvas_line(mng_handle mngh, mng_uint32 line){ +static mng_ptr mymng_get_canvas_line(mng_handle mngh, mng_uint32 line){ demux_mng_t *this = (demux_mng_t*)mng_get_userdata(mngh); return this->image + line * this->bih.biWidth * 3; } -mng_bool mymng_refresh(mng_handle mngh, mng_uint32 x, mng_uint32 y, mng_uint32 w, mng_uint32 h){ +static mng_bool mymng_refresh(mng_handle mngh, mng_uint32 x, mng_uint32 y, mng_uint32 w, mng_uint32 h){ return MNG_TRUE; } diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c index 59fec5df8..6b26aa106 100644 --- a/src/demuxers/demux_mpeg_block.c +++ b/src/demuxers/demux_mpeg_block.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpeg_block.c,v 1.202 2003/11/26 19:43:30 f1rmb Exp $ + * $Id: demux_mpeg_block.c,v 1.203 2003/12/05 15:54:57 f1rmb Exp $ * * demultiplexer for mpeg 1/2 program streams * used with fixed blocksize devices (like dvd/vcd) @@ -235,9 +235,9 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m while(p < (buf->content + this->blocksize)) { if (p[0] || p[1] || (p[2] != 1)) { - printf ("demux_mpeg_block: error! %02x %02x %02x (should be 0x000001)\n", - p[0], p[1], p[2]); - printf ("demux_mpeg_block: bad block. skipping.\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_mpeg_block: error! %02x %02x %02x (should be 0x000001)\n", p[0], p[1], p[2]); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_mpeg_block: bad block. skipping.\n"); /* FIXME: We should find some way for the input plugin to inform us of: - * 1) Normal sector read. * 2) Sector error read due to bad crc etc. @@ -304,7 +304,9 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m } else if (this->stream_id == 0xFF) { result = parse_program_stream_directory(this, p, buf); } else { - printf("xine-lib:demux_mpeg_block: Unrecognised stream_id 0x%02x. Please report this to xine developers.\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("xine-lib:demux_mpeg_block: " + "Unrecognised stream_id 0x%02x. Please report this to xine developers.\n"), this->stream_id); buf->free_buffer (buf); return; } @@ -313,7 +315,8 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m } p+=result; } - printf ("demux_mpeg_block: error! freeing. Please report this to xine developers.\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + _("demux_mpeg_block: error! freeing. Please report this to xine developers.\n")); buf->free_buffer (buf); return ; } @@ -325,85 +328,99 @@ static int32_t parse_padding_stream(demux_mpeg_block_t *this, uint8_t *p, buf_el } static int32_t parse_program_stream_map(demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x.\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x.\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_ecm_stream(demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_emm_stream(demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_dsmcc_stream(demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_iec_13522_stream(demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_h222_typeA_stream(demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_h222_typeB_stream(demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_h222_typeC_stream(demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_h222_typeD_stream(demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_h222_typeE_stream(demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_IEC14496_SL_packetized_stream(demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_IEC14496_FlexMux_stream(demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_program_stream_directory(demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_ancillary_stream(demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_block: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } @@ -640,11 +657,11 @@ static int32_t parse_pes_for_pts(demux_mpeg_block_t *this, uint8_t *p, buf_eleme /* check PES scrambling_control */ if ((p[6] & 0x30) != 0) { - printf("demux_mpeg_block: warning: PES header indicates that this stream may be encrypted (encryption mode %d)\n", (p[6] & 0x30) >> 4); - xine_log (this->stream->xine, XINE_LOG_MSG, - _("demux_mpeg_block: warning: PES header indicates that this stream may be encrypted (encryption mode %d)\n"), (p[6] & 0x30) >> 4); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("demux_mpeg_block: warning: PES header indicates that this stream " + "may be encrypted (encryption mode %d)\n"), (p[6] & 0x30) >> 4); _x_message (this->stream, XINE_MSG_ENCRYPTED_SOURCE, - "Media stream scrambled/encrypted", NULL); + "Media stream scrambled/encrypted", NULL); this->status = DEMUX_FINISHED; buf->free_buffer(buf); return -1; @@ -899,8 +916,8 @@ static int32_t parse_private_stream_1(demux_mpeg_block_t *this, uint8_t *p, buf_ switch ((p[5]>>6) & 3) { case 3: /* illegal, use 16-bits? */ default: - printf ("illegal lpcm sample format (%d), assume 16-bit samples\n", - (p[5]>>6) & 3 ); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "illegal lpcm sample format (%d), assume 16-bit samples\n", (p[5]>>6) & 3 ); case 0: bits_per_sample = 16; break; case 1: bits_per_sample = 20; break; case 2: bits_per_sample = 24; break; @@ -935,7 +952,8 @@ static int32_t parse_private_stream_1(demux_mpeg_block_t *this, uint8_t *p, buf_ /* Some new streams have been encountered. 1) DVD+RW disc recorded with a Philips DVD recorder: - new unknown sub-stream id of 0xff */ - printf("demux_mpeg_block:Unrecognised private stream 1 0x%02x. Please report this to xine developers.\n", p[0]); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + "demux_mpeg_block:Unrecognised private stream 1 0x%02x. Please report this to xine developers.\n", p[0]); buf->free_buffer(buf); return -1; } @@ -1073,8 +1091,8 @@ static int demux_mpeg_block_estimate_rate (demux_mpeg_block_t *this) { /* we should now have a PES packet here */ if (p[0] || p[1] || (p[2] != 1)) { - printf ("demux_mpeg_block: error %02x %02x %02x (should be 0x000001) \n", - p[0], p[1], p[2]); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_mpeg_block: error %02x %02x %02x (should be 0x000001) \n", p[0], p[1], p[2]); buf->free_buffer (buf); return rate; } diff --git a/src/demuxers/demux_mpeg_pes.c b/src/demuxers/demux_mpeg_pes.c index d1753d907..ecaeedc38 100644 --- a/src/demuxers/demux_mpeg_pes.c +++ b/src/demuxers/demux_mpeg_pes.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpeg_pes.c,v 1.18 2003/11/26 19:43:30 f1rmb Exp $ + * $Id: demux_mpeg_pes.c,v 1.19 2003/12/05 15:54:57 f1rmb Exp $ * * demultiplexer for mpeg 2 PES (Packetized Elementary Streams) * reads streams of variable blocksizes @@ -302,8 +302,11 @@ static void demux_mpeg_pes_parse_pack (demux_mpeg_pes_t *this, int preview_mode) } else if (this->stream_id == 0xFF) { result = parse_program_stream_directory(this, p, buf); } else { - printf("xine-lib:demux_mpeg_pes: Unrecognised stream_id 0x%02x. Please report this to xine developers.\n", this->stream_id); - printf("xine-lib:demux_mpeg_pes: packet_len=%d\n", this->packet_len); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("xine-lib:demux_mpeg_pes: Unrecognised stream_id 0x%02x. " + "Please report this to xine developers.\n"), this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_pes: packet_len=%d\n", this->packet_len); buf->free_buffer (buf); return; } @@ -323,85 +326,99 @@ static int32_t parse_padding_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_elem } static int32_t parse_program_stream_map(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x.\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x.\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_ecm_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_emm_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_dsmcc_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_iec_13522_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_h222_typeA_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_h222_typeB_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_h222_typeC_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_h222_typeD_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_h222_typeE_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_IEC14496_SL_packetized_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_IEC14496_FlexMux_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_program_stream_directory(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } static int32_t parse_ancillary_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_element_t *buf) { /* FIXME: Implement */ - printf("xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:demux_mpeg_pes: Unhandled stream_id 0x%02x\n", this->stream_id); buf->free_buffer (buf); return -1; } @@ -663,9 +680,9 @@ static int32_t parse_pes_for_pts(demux_mpeg_pes_t *this, uint8_t *p, buf_element /* check PES scrambling_control */ if ((p[6] & 0x30) != 0) { - printf("demux_mpeg_pes: warning: PES header indicates that this stream may be encrypted (encryption mode %d)\n", (p[6] & 0x30) >> 4); - xine_log (this->stream->xine, XINE_LOG_MSG, - _("demux_mpeg_pes: warning: PES header indicates that this stream may be encrypted (encryption mode %d)\n"), (p[6] & 0x30) >> 4); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("demux_mpeg_pes: warning: PES header indicates that " + "this stream may be encrypted (encryption mode %d)\n"), (p[6] & 0x30) >> 4); _x_message (this->stream, XINE_MSG_ENCRYPTED_SOURCE, "Media stream scrambled/encrypted", NULL); this->status = DEMUX_FINISHED; @@ -831,7 +848,8 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el switch ((p[5]>>6) & 3) { case 3: /* illegal, use 16-bits? */ default: - printf ("illegal lpcm sample format (%d), assume 16-bit samples\n", + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "illegal lpcm sample format (%d), assume 16-bit samples\n", (p[5]>>6) & 3 ); case 0: bits_per_sample = 16; break; case 1: bits_per_sample = 20; break; @@ -897,7 +915,8 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el /* Some new streams have been encountered. 1) DVD+RW disc recorded with a Philips DVD recorder: - new unknown sub-stream id of 0xff */ - printf("demux_mpeg_pes:Unrecognised private stream 1 0x%02x. Please report this to xine developers.\n", p[0]); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("demux_mpeg_pes:Unrecognised private stream 1 0x%02x. Please report this to xine developers.\n"), p[0]); buf->free_buffer(buf); return this->packet_len + result; } @@ -1063,8 +1082,8 @@ static int demux_mpeg_pes_estimate_rate (demux_mpeg_pes_t *this) { /* we should now have a PES packet here */ if (p[0] || p[1] || (p[2] != 1)) { - printf ("demux_mpeg_pes: error %02x %02x %02x (should be 0x000001) \n", - p[0], p[1], p[2]); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_mpeg_pes: error %02x %02x %02x (should be 0x000001) \n", p[0], p[1], p[2]); buf->free_buffer (buf); return rate; } diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 21eb10ef5..86f35c0ac 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpgaudio.c,v 1.129 2003/11/26 22:40:25 tmattern Exp $ + * $Id: demux_mpgaudio.c,v 1.130 2003/12/05 15:54:57 f1rmb Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -641,11 +641,11 @@ static int id3v22_parse_tag(demux_mpgaudio_t *this, int8_t *mp3_frame_header) { if (tag_frame_header.id && tag_frame_header.size) { if ((pos + tag_frame_header.size) <= tag_header.size) { if (!id3v22_interp_frame(this, &tag_frame_header)) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "id2v22: invalid frame content\n"); } } else { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "id3v22: invalid frame header\n"); this->input->seek (this->input, tag_header.size - pos, SEEK_CUR); return 1; @@ -657,7 +657,7 @@ static int id3v22_parse_tag(demux_mpgaudio_t *this, int8_t *mp3_frame_header) { return 1; } } else { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "id2v22: id3v2_parse_frame_header problem\n"); return 0; } @@ -665,8 +665,7 @@ static int id3v22_parse_tag(demux_mpgaudio_t *this, int8_t *mp3_frame_header) { } return 1; } else { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - "id3v22: id3v2_parse_header problem\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "id3v22: id3v2_parse_header problem\n"); return 0; } } diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index 31ac698ea..daadead45 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_ogg.c,v 1.121 2003/12/03 03:07:07 miguelfreitas Exp $ + * $Id: demux_ogg.c,v 1.122 2003/12/05 15:54:57 f1rmb Exp $ * * demultiplexer for ogg streams * @@ -1118,7 +1118,8 @@ static void demux_ogg_send_header (demux_ogg_t *this) { } else if (!strncmp (&op.packet[1], "theora", 4)) { #ifdef HAVE_THEORA - printf ("demux_ogg: Theorastreamsupport is highly alpha at the moment\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_ogg: Theorastreamsupport is highly alpha at the moment\n"); if (theora_decode_header(&this->t_info, &this->t_comment, &op)>=0) { diff --git a/src/demuxers/demux_realaudio.c b/src/demuxers/demux_realaudio.c index 88bdfc9e8..70ddddb53 100644 --- a/src/demuxers/demux_realaudio.c +++ b/src/demuxers/demux_realaudio.c @@ -22,7 +22,7 @@ * RealAudio File Demuxer by Mike Melanson (melanson@pcisys.net) * improved by James Stembridge (jstembridge@users.sourceforge.net) * - * $Id: demux_realaudio.c,v 1.27 2003/11/16 23:33:43 f1rmb Exp $ + * $Id: demux_realaudio.c,v 1.28 2003/12/05 15:54:57 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -103,7 +103,7 @@ static int open_ra_file(demux_ra_t *this) { else if (version == 4) hdr_size = BE_32(&file_header[0x12]) + 16; else { - printf("demux_realaudio: unknown version number %d\n", version); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_realaudio: unknown version number %d\n", version); return 0; } @@ -111,7 +111,7 @@ static int open_ra_file(demux_ra_t *this) { audio_header = xine_xmalloc(hdr_size); if (_x_demux_read_header(this->input, audio_header, hdr_size) != hdr_size) { - printf("demux_realaudio: unable to read header\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_realaudio: unable to read header\n"); free(audio_header); return 0; } @@ -144,14 +144,15 @@ static int open_ra_file(demux_ra_t *this) { if(audio_header[0x3D] == 4) audio_fourcc = ME_32(&audio_header[0x3E]); else { - printf("demux_realaudio: invalid fourcc size %d\n", audio_header[0x3D]); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_realaudio: invalid fourcc size %d\n", audio_header[0x3D]); free(audio_header); return 0; } offset = 0x45; } else { - printf("demux_realaudio: header too small\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_realaudio: header too small\n"); free(audio_header); return 0; } @@ -188,7 +189,8 @@ static int open_ra_file(demux_ra_t *this) { if(audio_header[offset+2] == 4) audio_fourcc = ME_32(&audio_header[offset+3]); else { - printf("demux_realaudio: invalid fourcc size %d\n", audio_header[offset+2]); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_realaudio: invalid fourcc size %d\n", audio_header[offset+2]); free(audio_header); return 0; } @@ -201,7 +203,7 @@ static int open_ra_file(demux_ra_t *this) { this->data_start = hdr_size; if (this->input->seek(this->input, this->data_start, SEEK_SET) != this->data_start) { - printf("demux_realaudio: unable to seek to data start\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_realaudio: unable to seek to data start\n"); return 0; } diff --git a/src/demuxers/demux_snd.c b/src/demuxers/demux_snd.c index 0ac0f4a8c..dea265fb4 100644 --- a/src/demuxers/demux_snd.c +++ b/src/demuxers/demux_snd.c @@ -21,7 +21,7 @@ /* * SND/AU File Demuxer by Mike Melanson (melanson@pcisys.net) * - * $Id: demux_snd.c,v 1.36 2003/11/16 23:33:43 f1rmb Exp $ + * $Id: demux_snd.c,v 1.37 2003/12/05 15:54:57 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -101,7 +101,7 @@ static int open_snd_file(demux_snd_t *this) { if ((!this->audio_sample_rate) || (!this->audio_channels)) { xine_log(this->stream->xine, XINE_LOG_MSG, - _("demux_snd: bad header parameters\n")); + _("demux_snd: bad header parameters\n")); return 0; } @@ -136,7 +136,7 @@ static int open_snd_file(demux_snd_t *this) { default: xine_log(this->stream->xine, XINE_LOG_MSG, - _("demux_snd: unsupported audio type: %d\n"), encoding); + _("demux_snd: unsupported audio type: %d\n"), encoding); return 0; break; } diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 6efce42c4..2e4001827 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_ts.c,v 1.97 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: demux_ts.c,v 1.98 2003/12/05 15:54:57 f1rmb Exp $ * * Demultiplexer for MPEG2 Transport Streams. * @@ -452,8 +452,8 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, * indicator set. */ if (!pusi) { - printf ("demux_ts: demux error! PAT without payload unit " - "start indicator\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_ts: demux error! PAT without payload unit start indicator\n"); return; } @@ -462,7 +462,8 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, */ pkt += pkt[4]; if (pkt - original_pkt > PKT_SIZE) { - printf ("demux_ts: demux error! PAT with invalid pointer\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_ts: demux error! PAT with invalid pointer\n"); return; } table_id = (unsigned int)pkt[5] ; @@ -495,13 +496,14 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, } if (pkt - original_pkt > BODY_SIZE - 1 - 3 - section_length) { - printf ("demux_ts: FIXME: (unsupported )PAT spans multiple TS packets\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_ts: FIXME: (unsupported )PAT spans multiple TS packets\n"); return; } if ((section_number != 0) || (last_section_number != 0)) { - printf ("demux_ts: FIXME: (unsupported) PAT consists of multiple (%d) sections\n", - last_section_number); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_ts: FIXME: (unsupported) PAT consists of multiple (%d) sections\n", last_section_number); return; } @@ -509,8 +511,9 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, calc_crc32 = demux_ts_compute_crc32 (this, pkt+5, section_length+3-4, 0xffffffff); if (crc32 != calc_crc32) { - printf ("demux_ts: demux error! PAT with invalid CRC32: packet_crc32: %.8x calc_crc32: %.8x\n", - crc32,calc_crc32); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_ts: demux error! PAT with invalid CRC32: packet_crc32: %.8x calc_crc32: %.8x\n", + crc32,calc_crc32); return; } #ifdef TS_PAT_LOG @@ -573,7 +576,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, } } -static int demux_ts_parse_pes_header (demux_ts_media *m, +static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, uint8_t *buf, int packet_len, xine_stream_t *stream) { @@ -589,8 +592,8 @@ static int demux_ts_parse_pes_header (demux_ts_media *m, /* we should have a PES packet here */ if (p[0] || p[1] || (p[2] != 1)) { - printf ("demux_ts: error %02x %02x %02x (should be 0x000001) \n", - p[0], p[1], p[2]); + xprintf (xine, XINE_VERBOSITY_DEBUG, + "demux_ts: error %02x %02x %02x (should be 0x000001) \n", p[0], p[1], p[2]); return 0 ; } @@ -636,8 +639,8 @@ static int demux_ts_parse_pes_header (demux_ts_media *m, /* sometimes corruption on header_len causes segfault in memcpy below */ if (header_len + 9 > pkt_len) { - printf ("demux_ts: illegal value for PES_header_data_length (0x%x)\n", - header_len); + xprintf (xine, XINE_VERBOSITY_DEBUG, + "demux_ts: illegal value for PES_header_data_length (0x%x)\n", header_len); return 0; } @@ -755,8 +758,8 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, case (i.e. adaptation field only) when it does not get bumped. */ if (m->counter != INVALID_CC) { if ((m->counter & 0x0f) != cc) { - printf("demux_ts: PID 0x%.4x: unexpected cc %d (expected %d)\n", - m->pid, cc, m->counter); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_ts: PID 0x%.4x: unexpected cc %d (expected %d)\n", m->pid, cc, m->counter); } } m->counter = cc; @@ -787,9 +790,10 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, #endif } - if (!demux_ts_parse_pes_header(m, ts, len, this->stream)) { + if (!demux_ts_parse_pes_header(this->stream->xine, m, ts, len, this->stream)) { m->corrupted_pes = 1; - printf("demux_ts: PID 0x%.4x: corrupted pes encountered\n", m->pid); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_ts: PID 0x%.4x: corrupted pes encountered\n", m->pid); } else { @@ -872,12 +876,12 @@ static void demux_ts_get_lang_desc(demux_ts_t *this, char *dest, { memcpy(dest, d + 2, 3); dest[3] = 0; - printf("demux_ts: found ISO 639 lang: %s\n", dest); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: found ISO 639 lang: %s\n", dest); return; } d += 2 + d[1]; } - printf("demux_ts: found no ISO 639 lang\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: found no ISO 639 lang\n"); memset(dest, 0, 4); } @@ -896,12 +900,13 @@ static void demux_ts_get_reg_desc(demux_ts_t *this, uint32_t *dest, { *dest = (d[2] << 24) | (d[3] << 16) | (d[4] << 8) | d[5]; - printf("demux_ts: found registration format identifier: 0x%.4x\n", *dest); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_ts: found registration format identifier: 0x%.4x\n", *dest); return; } d += 2 + d[1]; } - printf("demux_ts: found no format id\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: found no format id\n"); *dest = 0; } @@ -957,7 +962,7 @@ static void demux_ts_parse_pmt (demux_ts_t *this, /* sections start with a pointer. Skip it! */ pkt += pkt[4]; if (pkt - originalPkt > PKT_SIZE) { - printf ("demux error! PMT with invalid pointer\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux error! PMT with invalid pointer\n"); return; } @@ -1009,8 +1014,8 @@ static void demux_ts_parse_pmt (demux_ts_t *this, } if ((section_number != 0) || (last_section_number != 0)) { - printf ("demux_ts: FIXME (unsupported) PMT consists of multiple (%d)" - "sections\n", last_section_number); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_ts: FIXME (unsupported) PMT consists of multiple (%d) sections\n", last_section_number); return; } } @@ -1061,9 +1066,9 @@ static void demux_ts_parse_pmt (demux_ts_t *this, this->pmt[program_count], section_length+3-4, 0xffffffff); if (crc32 != calc_crc32) { - printf ("demux_ts: demux error! PMT with invalid CRC32: " - "packet_crc32: %#.8x calc_crc32: %#.8x\n", - crc32,calc_crc32); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_ts: demux error! PMT with invalid CRC32: packet_crc32: %#.8x calc_crc32: %#.8x\n", + crc32,calc_crc32); return; } #ifdef TS_PMT_LOG @@ -1088,8 +1093,8 @@ static void demux_ts_parse_pmt (demux_ts_t *this, stream = &this->pmt[program_count][12] + program_info_length; coded_length = 13 + program_info_length; if (coded_length > section_length) { - printf ("demux error! PMT with inconsistent " - "progInfo length\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux error! PMT with inconsistent progInfo length\n"); return; } section_length -= coded_length; @@ -1105,8 +1110,8 @@ static void demux_ts_parse_pmt (demux_ts_t *this, stream_info_length = ((stream[3] << 8) | stream[4]) & 0x0fff; coded_length = 5 + stream_info_length; if (coded_length > section_length) { - printf ("demux error! PMT with inconsistent " - "streamInfo length\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux error! PMT with inconsistent streamInfo length\n"); return; } @@ -1267,7 +1272,7 @@ static int sync_correct(demux_ts_t*this, uint8_t *buf, int32_t npkt_read) { int sync_ok = 0; int read_length; - printf ("demux_ts: about to resync!\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: about to resync!\n"); for (p=0; p < npkt_read; p++) { for(n=0; n < PKT_SIZE; n++) { @@ -1292,14 +1297,15 @@ static int sync_correct(demux_ts_t*this, uint8_t *buf, int32_t npkt_read) { n + p * PKT_SIZE); /* FIXME: when read_length is not as required... we now stop demuxing */ if (read_length != (n + p * PKT_SIZE)) { - printf ("demux_ts_tsync_correct: sync found, but read failed\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_ts_tsync_correct: sync found, but read failed\n"); return 0; } } else { - printf ("demux_ts_tsync_correct: sync not found! Stop demuxing\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts_tsync_correct: sync not found! Stop demuxing\n"); return 0; } - printf ("demux_ts: resync successful!\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: resync successful!\n"); return 1; } @@ -1340,8 +1346,9 @@ static unsigned char * demux_synchronise(demux_ts_t* this) { read_length = this->input->read(this->input, buf, PKT_SIZE * NPKT_PER_READ); if (read_length % PKT_SIZE) { - printf ("demux_ts: read returned %d bytes (not a multiple of %d!)\n", - read_length, PKT_SIZE); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_ts: read returned %d bytes (not a multiple of %d!)\n", + read_length, PKT_SIZE); this->status = DEMUX_FINISHED; return NULL; } @@ -1362,7 +1369,7 @@ static unsigned char * demux_synchronise(demux_ts_t* this) { } else read_zero = 0; if (read_zero > 200) { - printf ("demux_ts: read 0 packets too many times!\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: read 0 packets too many times!\n"); this->status = DEMUX_FINISHED; return NULL; } @@ -1372,7 +1379,7 @@ static unsigned char * demux_synchronise(demux_ts_t* this) { packet_number = 0; if (!sync_detect(this, &buf[0], npkt_read)) { - printf ("demux_ts: sync error.\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: sync error.\n"); this->status = DEMUX_FINISHED; return NULL; } @@ -1516,12 +1523,12 @@ static void demux_ts_parse_packet (demux_ts_t*this) { * Discard packets that are obviously bad. */ if (sync_byte != 0x47) { - printf ("demux error! invalid ts sync byte %.2x\n", - sync_byte); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux error! invalid ts sync byte %.2x\n", sync_byte); return; } if (transport_error_indicator) { - printf ("demux error! transport error\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux error! transport error\n"); return; } if (pid == 0x1ffb) { @@ -1531,7 +1538,8 @@ static void demux_ts_parse_packet (demux_ts_t*this) { if (transport_scrambling_control) { if (this->videoPid == pid) { - printf ("demux_ts: selected videoPid is scrambled; skipping...\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_ts: selected videoPid is scrambled; skipping...\n"); } for (i=0; i < this->scrambled_npids; i++) { if (this->scrambled_pids[i] == pid) return; @@ -1539,7 +1547,7 @@ static void demux_ts_parse_packet (demux_ts_t*this) { this->scrambled_pids[this->scrambled_npids] = pid; this->scrambled_npids++; - printf ("demux_ts: PID 0x%.4x is scrambled!\n", pid); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: PID 0x%.4x is scrambled!\n", pid); return; } @@ -1579,8 +1587,8 @@ static void demux_ts_parse_packet (demux_ts_t*this) { if ( (pes_stream_id >= VIDEO_STREAM_S) && (pes_stream_id <= VIDEO_STREAM_E) ) { if ( this->videoPid == INVALID_PID) { - printf ("demux_ts: auto-detected video pid 0x%.4x\n", - pid); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_ts: auto-detected video pid 0x%.4x\n", pid); this->videoPid = pid; this->videoMedia = this->media_num; @@ -1589,8 +1597,8 @@ static void demux_ts_parse_packet (demux_ts_t*this) { } else if ( (pes_stream_id >= AUDIO_STREAM_S) && (pes_stream_id <= AUDIO_STREAM_E) ) { if ( this->audioPid == INVALID_PID) { - printf ("demux_ts: auto-detected audio pid 0x%.4x\n", - pid); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_ts: auto-detected audio pid 0x%.4x\n", pid); this->audioPid = pid; this->audioMedia = this->media_num; @@ -1601,8 +1609,8 @@ static void demux_ts_parse_packet (demux_ts_t*this) { if (data_len > PKT_SIZE) { - printf ("demux_ts: demux error! invalid payload size %d\n", - data_len); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_ts: demux error! invalid payload size %d\n", data_len); } else { diff --git a/src/demuxers/demux_voc.c b/src/demuxers/demux_voc.c index 6aea2940e..4d909eeb8 100644 --- a/src/demuxers/demux_voc.c +++ b/src/demuxers/demux_voc.c @@ -25,7 +25,7 @@ * It will only play that block if it is PCM data. More variations will be * supported as they are encountered. * - * $Id: demux_voc.c,v 1.36 2003/11/16 23:33:44 f1rmb Exp $ + * $Id: demux_voc.c,v 1.37 2003/12/05 15:54:57 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -102,7 +102,7 @@ static int open_voc_file(demux_voc_t *this) { /* so far, this demuxer only cares about type 1 blocks */ if (preamble[0] != 1) { xine_log(this->stream->xine, XINE_LOG_MSG, - _("unknown VOC block type (0x%02X); please report to xine developers\n"), + _("unknown VOC block type (0x%02X); please report to xine developers\n"), preamble[0]); return 0; } @@ -117,7 +117,7 @@ static int open_voc_file(demux_voc_t *this) { /* this app only knows how to deal with format 0 data (raw PCM) */ if (preamble[1] != 0) { xine_log(this->stream->xine, XINE_LOG_MSG, - _("unknown VOC compression type (0x%02X); please report to xine developers\n"), + _("unknown VOC compression type (0x%02X); please report to xine developers\n"), preamble[1]); return 0; } diff --git a/src/demuxers/demux_wc3movie.c b/src/demuxers/demux_wc3movie.c index e90466b21..ea97b97e9 100644 --- a/src/demuxers/demux_wc3movie.c +++ b/src/demuxers/demux_wc3movie.c @@ -24,7 +24,7 @@ * For more information on the MVE file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_wc3movie.c,v 1.48 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: demux_wc3movie.c,v 1.49 2003/12/05 15:54:57 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -187,7 +187,7 @@ static int demux_mve_send_chunk(demux_plugin_t *this_gen) { if (palette_number >= this->number_of_shots) { xine_log(this->stream->xine, XINE_LOG_MSG, - _("demux_wc3movie: SHOT chunk referenced invalid palette (%d >= %d)\n"), + _("demux_wc3movie: SHOT chunk referenced invalid palette (%d >= %d)\n"), palette_number, this->number_of_shots); this->status = DEMUX_FINISHED; return this->status; @@ -401,7 +401,7 @@ static int open_mve_file(demux_mve_t *this) { if ((BE_32(&preamble[0]) != PALT_TAG) || (BE_32(&preamble[4]) != PALETTE_CHUNK_SIZE)) { xine_log(this->stream->xine, XINE_LOG_MSG, - _("demux_wc3movie: There was a problem while loading palette chunks\n")); + _("demux_wc3movie: There was a problem while loading palette chunks\n")); free (this->palettes); free (this->shot_offsets); return 0; diff --git a/src/dxr3/dxr3_decode_spu.c b/src/dxr3/dxr3_decode_spu.c index 8721f43c2..27e696ecb 100644 --- a/src/dxr3/dxr3_decode_spu.c +++ b/src/dxr3/dxr3_decode_spu.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: dxr3_decode_spu.c,v 1.40 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: dxr3_decode_spu.c,v 1.41 2003/12/05 15:54:57 f1rmb Exp $ */ /* dxr3 spu decoder plugin. @@ -146,7 +146,7 @@ static void *dxr3_spudec_init_plugin(xine_t *xine, void* data) { dxr3_spudec_class_t *this; - this = (dxr3_spudec_class_t *)malloc(sizeof(dxr3_spudec_class_t)); + this = (dxr3_spudec_class_t *)xine_xmalloc(sizeof(dxr3_spudec_class_t)); if (!this) return NULL; this->spu_decoder_class.open_plugin = dxr3_spudec_open_plugin; @@ -172,7 +172,7 @@ static spu_decoder_t *dxr3_spudec_open_plugin(spu_decoder_class_t *class_gen, xi if (class->instance) return NULL; if (!dxr3_present(stream)) return NULL; - this = (dxr3_spudec_t *)malloc(sizeof(dxr3_spudec_t)); + this = (dxr3_spudec_t *)xine_xmalloc(sizeof(dxr3_spudec_t)); if (!this) return NULL; this->spu_decoder.decode_data = dxr3_spudec_decode_data; @@ -210,8 +210,8 @@ static spu_decoder_t *dxr3_spudec_open_plugin(spu_decoder_class_t *class_gen, xi /* open dxr3 spu device */ snprintf(tmpstr, sizeof(tmpstr), "%s_sp%s", this->devname, this->devnum); if ((this->fd_spu = open(tmpstr, O_WRONLY)) < 0) { - printf("dxr3_decode_spu: Failed to open spu device %s (%s)\n", - tmpstr, strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("dxr3_decode_spu: Failed to open spu device %s (%s)\n"), tmpstr, strerror(errno)); pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock); free(this); return NULL; @@ -279,7 +279,8 @@ static void dxr3_spudec_decode_data(spu_decoder_t *this_gen, buf_element_t *buf) dxr3_swab_clut((int *)buf->content); pthread_mutex_lock(&this->dxr3_vo->spu_device_lock); if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_SETPALETTE, buf->content)) - printf("dxr3_decode_spu: failed to set CLUT (%s)\n", strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_decode_spu: failed to set CLUT (%s)\n", strerror(errno)); /* remember clut, when video out places some overlay we may need to restore it */ memcpy(this->clut, buf->content, 16 * sizeof(uint32_t)); this->dxr3_vo->clut_cluttered = 0; @@ -328,14 +329,14 @@ static void dxr3_spudec_decode_data(spu_decoder_t *this_gen, buf_element_t *buf) if ((dxr3_spudec_copy_nav_to_btn(this, 0, &btn ) > 0)) { pthread_mutex_lock(&this->dxr3_vo->spu_device_lock); if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_BUTTON, &btn)) - printf("dxr3_decode_spu: failed to set spu button (%s)\n", - strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_decode_spu: failed to set spu button (%s)\n", strerror(errno)); pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock); } else { /* current button does not exist -> use another one */ xine_event_t event; - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "requested button not available\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("requested button not available\n")); if (this->buttonN > this->pci.hli.hl_gi.btn_ns) this->buttonN = this->pci.hli.hl_gi.btn_ns; @@ -350,8 +351,8 @@ static void dxr3_spudec_decode_data(spu_decoder_t *this_gen, buf_element_t *buf) if ((dxr3_spudec_copy_nav_to_btn(this, 0, &btn ) > 0)) { pthread_mutex_lock(&this->dxr3_vo->spu_device_lock); if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_BUTTON, &btn)) - printf("dxr3_decode_spu: failed to set spu button (%s)\n", - strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_decode_spu: failed to set spu button (%s)\n", strerror(errno)); pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock); } else XINE_ASSERT(0, "no working menu button found"); @@ -454,13 +455,15 @@ static void dxr3_spudec_decode_data(spu_decoder_t *this_gen, buf_element_t *buf) llprintf(LOG_PTS, "pts = %lld vpts = %lld\n", buf->pts, vpts); vpts32 = vpts; if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_SETPTS, &vpts32)) - printf("dxr3_decode_spu: spu setpts failed (%s)\n", strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_decode_spu: spu setpts failed (%s)\n", strerror(errno)); } /* has video out tampered with our palette */ if (this->dxr3_vo->clut_cluttered) { if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_SETPALETTE, this->clut)) - printf("dxr3_decode_spu: failed to set CLUT (%s)\n", strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_decode_spu: failed to set CLUT (%s)\n", strerror(errno)); this->dxr3_vo->clut_cluttered = 0; } @@ -468,14 +471,14 @@ static void dxr3_spudec_decode_data(spu_decoder_t *this_gen, buf_element_t *buf) llprintf(LOG_SPU, "write: SPU_FD = %i\n",this->fd_spu); written = write(this->fd_spu, buf->content, buf->size); if (written < 0) { - printf("dxr3_decode_spu: spu device write failed (%s)\n", - strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_decode_spu: spu device write failed (%s)\n", strerror(errno)); pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock); return; } if (written != buf->size) - printf("dxr3_decode_spu: Could only write %d of %d spu bytes.\n", - written, buf->size); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_decode_spu: Could only write %d of %d spu bytes.\n", written, buf->size); pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock); } @@ -541,8 +544,8 @@ static void dxr3_spudec_set_button(spu_decoder_t *this_gen, int32_t button, int3 (dxr3_spudec_copy_nav_to_btn(this, mode - 1, &btn ) > 0)) { pthread_mutex_lock(&this->dxr3_vo->spu_device_lock); if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_BUTTON, &btn)) - printf("dxr3_decode_spu: failed to set spu button (%s)\n", - strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_decode_spu: failed to set spu button (%s)\n", strerror(errno)); pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock); } pthread_mutex_unlock(&this->pci_lock); @@ -628,7 +631,8 @@ static int dxr3_spudec_copy_nav_to_btn(dxr3_spudec_t *this, int32_t mode, em8300 } if (!button_ptr) { - printf("dxr3_decode_spu: No suitable menu button group found, using group 1.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_decode_spu: No suitable menu button group found, using group 1.\n"); button_ptr = &this->pci.hli.btnit[this->buttonN - 1]; } diff --git a/src/dxr3/dxr3_decode_video.c b/src/dxr3/dxr3_decode_video.c index f27c58146..99d42b195 100644 --- a/src/dxr3/dxr3_decode_video.c +++ b/src/dxr3/dxr3_decode_video.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: dxr3_decode_video.c,v 1.47 2003/11/29 19:35:39 mroi Exp $ + * $Id: dxr3_decode_video.c,v 1.48 2003/12/05 15:54:57 f1rmb Exp $ */ /* dxr3 video decoder plugin. @@ -151,7 +151,7 @@ static void *dxr3_init_plugin(xine_t *xine, void *data) { dxr3_decoder_class_t *this; - this = (dxr3_decoder_class_t *)malloc(sizeof (dxr3_decoder_class_t)); + this = (dxr3_decoder_class_t *)xine_xmalloc(sizeof (dxr3_decoder_class_t)); if (!this) return NULL; this->video_decoder_class.open_plugin = dxr3_open_plugin; @@ -179,7 +179,7 @@ static video_decoder_t *dxr3_open_plugin(video_decoder_class_t *class_gen, xine_ if (class->instance) return NULL; if (!dxr3_present(stream)) return NULL; - this = (dxr3_decoder_t *)malloc(sizeof (dxr3_decoder_t)); + this = (dxr3_decoder_t *)xine_xmalloc(sizeof (dxr3_decoder_t)); if (!this) return NULL; cfg = stream->xine->config; @@ -217,8 +217,8 @@ static video_decoder_t *dxr3_open_plugin(video_decoder_class_t *class_gen, xine_ this->fd_video = -1; if ((this->fd_control = open(tmpstr, O_WRONLY)) < 0) { - printf("dxr3_decode_video: Failed to open control device %s (%s)\n", - tmpstr, strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("dxr3_decode_video: Failed to open control device %s (%s)\n"), tmpstr, strerror(errno)); free(this); return NULL; } @@ -495,8 +495,8 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) /* open the device for the decoder */ snprintf (tmpstr, sizeof(tmpstr), "%s_mv%s", this->devname, this->devnum); if ((this->fd_video = open(tmpstr, O_WRONLY)) < 0) { - printf("dxr3_decode_video: Failed to open video device %s (%s)\n", - tmpstr, strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("dxr3_decode_video: Failed to open video device %s (%s)\n"), tmpstr, strerror(errno)); return; } @@ -553,8 +553,8 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) uint32_t vpts32 = vpts; /* update the dxr3's current pts value */ if (ioctl(this->fd_video, EM8300_IOCTL_VIDEO_SETPTS, &vpts32)) - printf("dxr3_decode_video: set video pts failed (%s)\n", - strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_decode_video: set video pts failed (%s)\n", strerror(errno)); } if (delay >= 90000) /* frame more than 1 sec ahead */ @@ -576,17 +576,18 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) written = write(this->fd_video, buf->content, buf->size); if (written < 0) { if (errno == EAGAIN) { - printf("dxr3_decode_video: write to device would block. flushing\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("dxr3_decode_video: write to device would block. flushing\n")); dxr3_flush(this_gen); } else { - printf("dxr3_decode_video: video device write failed (%s)\n", - strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("dxr3_decode_video: video device write failed (%s)\n"), strerror(errno)); } return; } if (written != buf->size) - printf("dxr3_decode_video: Could only write %d of %d video bytes.\n", - written, buf->size); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_decode_video: Could only write %d of %d video bytes.\n", written, buf->size); } static void dxr3_reset(video_decoder_t *this_gen) @@ -613,7 +614,7 @@ static void dxr3_flush(video_decoder_t *this_gen) static uint8_t end_buffer[4] = { 0x00, 0x00, 0x01, 0xb7 }; write(this->fd_video, &end_buffer, 4); this->sequence_open = 0; - printf("dxr3_decode_video: WARNING: added missing end sequence\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "dxr3_decode_video: WARNING: added missing end sequence\n"); } } @@ -756,8 +757,8 @@ static int get_duration(dxr3_decoder_t *this) duration = 1500; break; default: - printf("dxr3_decode_video: WARNING: unknown frame rate code %d\n", - this->frame_rate_code); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("dxr3_decode_video: WARNING: unknown frame rate code %d\n"), this->frame_rate_code); duration = 0; break; } @@ -784,7 +785,8 @@ static int get_duration(dxr3_decoder_t *this) /* we just entered a force_duration window, so we start the correction */ metronom_t *metronom = this->stream->metronom; int64_t cur_offset; - printf("dxr3_decode_video: WARNING: correcting frame rate code from PAL to NTSC\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("dxr3_decode_video: WARNING: correcting frame rate code from PAL to NTSC\n")); /* those weird streams need an offset, too */ cur_offset = metronom->get_option(metronom, METRONOM_AV_OFFSET); metronom->set_option(metronom, METRONOM_AV_OFFSET, cur_offset - 28800); @@ -811,21 +813,27 @@ static int get_duration(dxr3_decoder_t *this) static void dxr3_update_sync_mode(void *this_gen, xine_cfg_entry_t *entry) { - ((dxr3_decoder_t *)this_gen)->sync_every_frame = entry->num_value; - printf("dxr3_decode_video: setting sync_every_frame to %s\n", - (entry->num_value ? "on" : "off")); + dxr3_decoder_t *this = (dxr3_decoder_t *)this_gen; + + this->sync_every_frame = entry->num_value; + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_decode_video: setting sync_every_frame to %s\n", (entry->num_value ? "on" : "off")); } static void dxr3_update_enhanced_mode(void *this_gen, xine_cfg_entry_t *entry) { - ((dxr3_decoder_t *)this_gen)->enhanced_mode = entry->num_value; - printf("dxr3_decode_video: setting enhanced mode to %s\n", - (entry->num_value ? "on" : "off")); + dxr3_decoder_t *this = (dxr3_decoder_t *)this_gen; + + this->enhanced_mode = entry->num_value; + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_decode_video: setting enhanced mode to %s\n", (entry->num_value ? "on" : "off")); } static void dxr3_update_correct_durations(void *this_gen, xine_cfg_entry_t *entry) { - ((dxr3_decoder_t *)this_gen)->correct_durations = entry->num_value; - printf("dxr3_decode_video: setting correct_durations mode to %s\n", - (entry->num_value ? "on" : "off")); + dxr3_decoder_t *this = (dxr3_decoder_t *)this_gen; + + this->correct_durations = entry->num_value; + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_decode_video: setting correct_durations mode to %s\n", (entry->num_value ? "on" : "off")); } diff --git a/src/dxr3/dxr3_mpeg_encoders.c b/src/dxr3/dxr3_mpeg_encoders.c index 622e40128..e4ec99913 100644 --- a/src/dxr3/dxr3_mpeg_encoders.c +++ b/src/dxr3/dxr3_mpeg_encoders.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: dxr3_mpeg_encoders.c,v 1.14 2003/11/05 21:58:22 mroi Exp $ + * $Id: dxr3_mpeg_encoders.c,v 1.15 2003/12/05 15:54:58 f1rmb Exp $ */ /* mpeg encoders for the dxr3 video out plugin. @@ -120,13 +120,12 @@ int dxr3_rte_init(dxr3_driver_t *drv) rte_data_t* this; if (!rte_init()) { - printf("dxr3_mpeg_encoder: failed to init librte\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("dxr3_mpeg_encoder: failed to init librte\n")); return 0; } - this = malloc(sizeof(rte_data_t)); + this = xine_xmalloc(sizeof(rte_data_t)); if (!this) return 0; - memset(this, 0, sizeof(rte_data_t)); this->encoder_data.type = ENC_RTE; this->encoder_data.on_update_format = rte_on_update_format; @@ -157,7 +156,8 @@ static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) } if ((frame->vo_frame.pitches[0] % 16 != 0) || (frame->oheight % 16 != 0)) { - printf("dxr3_mpeg_encoder: rte only handles video dimensions which are multiples of 16\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("dxr3_mpeg_encoder: rte only handles video dimensions which are multiples of 16\n")); return 0; } @@ -167,7 +167,7 @@ static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) /* create new rte context */ this->context = rte_context_new(this->width, this->height, "mp1e", drv); if (!this->context) { - printf("dxr3_mpeg_encoder: failed to get rte context.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("dxr3_mpeg_encoder: failed to get rte context.\n")); return 0; } context = this->context; /* shortcut */ @@ -178,7 +178,7 @@ static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) /* get mpeg codec handle */ codec = rte_codec_set(context, RTE_STREAM_VIDEO, 0, "mpeg1_video"); if (!codec) { - printf("dxr3_mpeg_encoder: could not create codec.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("dxr3_mpeg_encoder: could not create codec.\n")); rte_context_destroy(context); this->context = 0; return 0; @@ -210,36 +210,44 @@ static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) */ fps = 90000.0 / frame->vo_frame.duration; if (!rte_option_set(codec, "virtual_frame_rate", fps)) - printf("dxr3_mpeg_encoder: WARNING: rte_option_set failed; virtual_frame_rate = %g.\n", fps); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: WARNING: rte_option_set failed; virtual_frame_rate = %g.\n", fps); if (!rte_option_set(codec, "coded_frame_rate", fps)) - printf("dxr3_mpeg_encoder: WARNING: rte_option_set failed; coded_frame_rate = %g.\n", fps); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: WARNING: rte_option_set failed; coded_frame_rate = %g.\n", fps); if (!rte_option_set(codec, "bit_rate", (int)this->rte_bitrate)) - printf("dxr3_mpeg_encoder: WARNING: rte_option_set failed; bit_rate = %d.\n", (int)this->rte_bitrate); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: WARNING: rte_option_set failed; bit_rate = %d.\n", (int)this->rte_bitrate); if (!rte_option_set(codec, "gop_sequence", "I")) - printf("dxr3_mpeg_encoder: WARNING: rte_option_set failed; gop_sequence = \"I\".\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: WARNING: rte_option_set failed; gop_sequence = \"I\".\n"); /* just to be sure, disable motion comp (not needed in I frames) */ if (!rte_option_set(codec, "motion_compensation", 0)) - printf("dxr3_mpeg_encoder: WARNING: rte_option_set failed; motion_compensation = 0.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: WARNING: rte_option_set failed; motion_compensation = 0.\n"); rte_set_input(context, RTE_VIDEO, RTE_PUSH, FALSE, NULL, NULL, NULL); rte_set_output(context, mp1e_callback, NULL, NULL); if (!rte_init_context(context)) { - printf("dxr3_mpeg_encoder: cannot init the context: %s\n", context->error); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("dxr3_mpeg_encoder: cannot init the context: %s\n"), context->error); rte_context_destroy(context); this->context = 0; return 0; } /* do the sync'ing and start encoding */ if (!rte_start_encoding(context)) { - printf("dxr3_mpeg_encoder: cannot start encoding: %s\n", context->error); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("dxr3_mpeg_encoder: cannot start encoding: %s\n"), context->error); rte_context_destroy(context); this->context = 0; return 0; } this->rte_ptr = rte_push_video_data(context, NULL, 0); if (!this->rte_ptr) { - printf("dxr3_mpeg_encoder: failed to get encoder buffer pointer.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: failed to get encoder buffer pointer.\n"); return 0; } @@ -303,13 +311,13 @@ static void mp1e_callback(rte_context *context, void *data, ssize_t size, void * written = write(drv->fd_video, data, size); if (written < 0) { - printf("dxr3_mpeg_encoder: video device write failed (%s)\n", - strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: video device write failed (%s)\n", strerror(errno)); return; } if (written != size) - printf("dxr3_mpeg_encoder: Could only write %d of %d mpeg bytes.\n", - written, size); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: Could only write %d of %d mpeg bytes.\n", written, size); } #endif @@ -319,9 +327,8 @@ int dxr3_fame_init(dxr3_driver_t *drv) { fame_data_t *this; - this = malloc(sizeof(fame_data_t)); + this = xine_xmalloc(sizeof(fame_data_t)); if (!this) return 0; - memset(this, 0, sizeof(fame_data_t)); this->encoder_data.type = ENC_FAME; this->encoder_data.on_update_format = fame_on_update_format; @@ -374,14 +381,16 @@ static int fame_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) this->context = fame_open(); if (!this->context) { - printf("dxr3_mpeg_encoder: Couldn't start the FAME library\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("dxr3_mpeg_encoder: Couldn't start the FAME library\n")); return 0; } if (!this->buffer) this->buffer = (unsigned char *)malloc(DEFAULT_BUFFER_SIZE); if (!this->buffer) { - printf("dxr3_mpeg_encoder: Couldn't allocate temp buffer for mpeg data\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: Couldn't allocate temp buffer for mpeg data\n"); return 0; } @@ -476,12 +485,14 @@ static int fame_on_display_frame(dxr3_driver_t *drv, dxr3_frame_t *frame) written = write(drv->fd_video, this->buffer, size); if (written < 0) { - printf("dxr3_mpeg_encoder: video device write failed (%s)\n", + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: video device write failed (%s)\n", strerror(errno)); return 0; } if (written != size) - printf("dxr3_mpeg_encoder: Could only write %d of %d mpeg bytes.\n", + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: Could only write %d of %d mpeg bytes.\n", written, size); return 1; } @@ -516,7 +527,8 @@ static int fame_prepare_frame(fame_data_t *this, dxr3_driver_t *drv, dxr3_frame_ if (frame->vo_frame.format == XINE_IMGFMT_YUY2) { /* need YUY2->YV12 conversion */ if (!(this->out[0] && this->out[1] && this->out[2]) ) { - printf("dxr3_mpeg_encoder: Internal YV12 buffer not created.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: Internal YV12 buffer not created.\n"); return 0; } y = this->out[0] + frame->vo_frame.width * drv->top_bar; diff --git a/src/dxr3/dxr3_scr.c b/src/dxr3/dxr3_scr.c index ffa289f1f..76e0d3ee4 100644 --- a/src/dxr3/dxr3_scr.c +++ b/src/dxr3/dxr3_scr.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: dxr3_scr.c,v 1.10 2003/09/11 10:01:03 mroi Exp $ + * $Id: dxr3_scr.c,v 1.11 2003/12/05 15:54:58 f1rmb Exp $ */ /* dxr3 scr plugin. @@ -60,13 +60,14 @@ dxr3_scr_t *dxr3_scr_init(xine_t *xine) dxr3_scr_t *this; const char *confstr; - this = (dxr3_scr_t *)malloc(sizeof(dxr3_scr_t)); + this = (dxr3_scr_t *)xine_xmalloc(sizeof(dxr3_scr_t)); + this->xine = xine; confstr = xine->config->register_string(xine->config, CONF_LOOKUP, CONF_DEFAULT, CONF_NAME, CONF_HELP, 0, NULL, NULL); if ((this->fd_control = open(confstr, O_WRONLY)) < 0) { - printf("dxr3_scr: Failed to open control device %s (%s)\n", - confstr, strerror(errno)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "dxr3_scr: Failed to open control device %s (%s)\n", confstr, strerror(errno)); free(this); return NULL; } @@ -111,7 +112,7 @@ static void dxr3_scr_start(scr_plugin_t *scr, int64_t vpts) this->last_pts = vpts32; this->offset = vpts - ((int64_t)vpts32 << 1); if (ioctl(this->fd_control, EM8300_IOCTL_SCR_SET, &vpts32)) - printf("dxr3_scr: start failed (%s)\n", strerror(errno)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: start failed (%s)\n", strerror(errno)); #if LOG_SCR printf("dxr3_scr: started with vpts %lld\n", vpts); #endif @@ -130,12 +131,12 @@ static int64_t dxr3_scr_get_current(scr_plugin_t *scr) pthread_mutex_lock(&this->mutex); if (ioctl(this->fd_control, EM8300_IOCTL_SCR_GET, &pts)) - printf("dxr3_scr: get current failed (%s)\n", strerror(errno)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: get current failed (%s)\n", strerror(errno)); if (this->last_pts > 0xF0000000 && pts < 0x10000000) /* wrap around detected, compensate with offset */ this->offset += (int64_t)1 << 33; if (pts == 0) - printf("dxr3_scr: WARNING: pts dropped to zero.\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: WARNING: pts dropped to zero.\n"); this->last_pts = pts; current = ((int64_t)pts << 1) + this->offset; pthread_mutex_unlock(&this->mutex); @@ -151,7 +152,7 @@ static void dxr3_scr_adjust(scr_plugin_t *scr, int64_t vpts) pthread_mutex_lock(&this->mutex); if (ioctl(this->fd_control, EM8300_IOCTL_SCR_GET, ¤t_pts32)) - printf("dxr3_scr: adjust get failed (%s)\n", strerror(errno)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: adjust get failed (%s)\n", strerror(errno)); this->last_pts = current_pts32; this->offset = vpts - ((int64_t)current_pts32 << 1); offset32 = this->offset / 4; @@ -159,7 +160,7 @@ static void dxr3_scr_adjust(scr_plugin_t *scr, int64_t vpts) if (offset32 < -7200/4 || offset32 > 7200/4) { uint32_t vpts32 = vpts >> 1; if (ioctl(this->fd_control, EM8300_IOCTL_SCR_SET, &vpts32)) - printf("dxr3_scr: adjust set failed (%s)\n", strerror(errno)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: adjust set failed (%s)\n", strerror(errno)); this->last_pts = vpts32; this->offset = vpts - ((int64_t)vpts32 << 1); } @@ -206,7 +207,7 @@ static int dxr3_scr_set_speed(scr_plugin_t *scr, int speed) } if (dxr3_mvcommand(this->fd_control, playmode)) - printf("dxr3_scr: failed to playmode (%s)\n", strerror(errno)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: failed to playmode (%s)\n", strerror(errno)); if(em_speed > 0x900) this->scanning = 1; @@ -214,7 +215,7 @@ static int dxr3_scr_set_speed(scr_plugin_t *scr, int speed) this->scanning = 0; if (ioctl(this->fd_control, EM8300_IOCTL_SCR_SETSPEED, &em_speed)) - printf("dxr3_scr: failed to set speed (%s)\n", strerror(errno)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: failed to set speed (%s)\n", strerror(errno)); #if LOG_SCR printf("dxr3_scr: speed set to mode %d\n", speed); @@ -245,7 +246,9 @@ static int dxr3_mvcommand(int fd_control, int command) static void dxr3_scr_update_priority(void *this_gen, xine_cfg_entry_t *entry) { - ((dxr3_scr_t *)this_gen)->priority = entry->num_value; - printf("dxr3_scr: setting scr priority to %d\n", - entry->num_value); + dxr3_scr_t *this = (dxr3_scr_t *)this_gen; + + this->priority = entry->num_value; + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "dxr3_scr: setting scr priority to %d\n", entry->num_value); } diff --git a/src/dxr3/dxr3_scr.h b/src/dxr3/dxr3_scr.h index ce7416627..80cc35bc7 100644 --- a/src/dxr3/dxr3_scr.h +++ b/src/dxr3/dxr3_scr.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: dxr3_scr.h,v 1.4 2003/09/11 10:01:03 mroi Exp $ + * $Id: dxr3_scr.h,v 1.5 2003/12/05 15:54:58 f1rmb Exp $ */ #include "xine_internal.h" @@ -34,6 +34,7 @@ typedef struct dxr3_scr_s { int64_t offset; /* difference between real scr and internal dxr3 clock */ uint32_t last_pts; /* last known value of internal dxr3 clock to detect wrap around */ int scanning; /* are we in a scanning mode */ + xine_t *xine; } dxr3_scr_t; /* plugin initialization function */ diff --git a/src/dxr3/dxr3_spu_encoder.c b/src/dxr3/dxr3_spu_encoder.c index 8892db59f..7b662efbe 100644 --- a/src/dxr3/dxr3_spu_encoder.c +++ b/src/dxr3/dxr3_spu_encoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: dxr3_spu_encoder.c,v 1.2 2003/03/02 07:58:18 mroi Exp $ + * $Id: dxr3_spu_encoder.c,v 1.3 2003/12/05 15:54:58 f1rmb Exp $ */ #include <stdio.h> @@ -173,7 +173,7 @@ static void create_histogram(spu_encoder_t *this) for (i = 0; i < OVL_PALETTE_SIZE; i++) if (this->map[i]) printf("dxr3_spu_encoder: histogram: color #%d 0x%.8x appears %d times\n", - i, this->overlay->color[i], this->map[i]); + i, this->overlay->color[i], this->map[i]); for (i = 0; i < OVL_PALETTE_SIZE; i++) if (this->clip_map[i]) printf("dxr3_spu_encoder: histogram: clip color #%d 0x%.8x appears %d times\n", diff --git a/src/dxr3/video_out_dxr3.c b/src/dxr3/video_out_dxr3.c index d62f07d38..0e4b5de98 100644 --- a/src/dxr3/video_out_dxr3.c +++ b/src/dxr3/video_out_dxr3.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_dxr3.c,v 1.94 2003/11/29 19:35:39 mroi Exp $ + * $Id: video_out_dxr3.c,v 1.95 2003/12/05 15:54:58 f1rmb Exp $ */ /* mpeg1 encoding video out plugin for the dxr3. @@ -170,7 +170,7 @@ static dxr3_driver_class_t *dxr3_vo_init_plugin(xine_t *xine, void *visual_gen) const char *confstr; int dashpos; - this = (dxr3_driver_class_t *)malloc(sizeof(dxr3_driver_class_t)); + this = (dxr3_driver_class_t *)xine_xmalloc(sizeof(dxr3_driver_class_t)); if (!this) return NULL; confstr = xine->config->register_string(xine->config, @@ -242,9 +242,8 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v if (class->instance) return NULL; - this = (dxr3_driver_t *)malloc(sizeof(dxr3_driver_t)); + this = (dxr3_driver_t *)xine_xmalloc(sizeof(dxr3_driver_t)); if (!this) return NULL; - memset(this, 0, sizeof(dxr3_driver_t)); this->vo_driver.get_capabilities = dxr3_get_capabilities; this->vo_driver.alloc_frame = dxr3_alloc_frame; @@ -285,16 +284,16 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v #endif if ((this->fd_control = open(tmpstr, O_WRONLY)) < 0) { - xprintf(class->xine, XINE_VERBOSITY_LOG, - "video_out_dxr3: Failed to open control device %s (%s)\n", tmpstr, strerror(errno)); + xprintf(this->class->xine, XINE_VERBOSITY_LOG, + _("video_out_dxr3: Failed to open control device %s (%s)\n"), tmpstr, strerror(errno)); return 0; } snprintf (tmpstr, sizeof(tmpstr), "%s_mv%s", class->devname, class->devnum); if ((this->fd_video = open (tmpstr, O_WRONLY | O_FSYNC )) < 0) { - printf("video_out_dxr3: Failed to open video device %s (%s)\n", - tmpstr, strerror(errno)); + xprintf(this->class->xine, XINE_VERBOSITY_LOG, + _("video_out_dxr3: Failed to open video device %s (%s)\n"), tmpstr, strerror(errno)); return 0; } /* close now and and let the decoder/encoder reopen if they want */ @@ -340,31 +339,36 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v _("Content other than mpeg has to pass an additional reencoding stage, " "because the dxr3 handles mpeg only."), 10, NULL, NULL); if ((strcmp(available_encoders[encoder], "libavcodec") == 0) && !dxr3_lavc_init(this, node)) { - printf("video_out_dxr3: Mpeg encoder libavcodec failed to init.\n"); + xprintf(this->class->xine, XINE_VERBOSITY_LOG, + _("video_out_dxr3: Mpeg encoder libavcodec failed to init.\n")); return 0; } #ifdef HAVE_LIBRTE if ((strcmp(available_encoders[encoder], "rte") == 0) && !dxr3_rte_init(this)) { - printf("video_out_dxr3: Mpeg encoder rte failed to init.\n"); + xprintf(this->class->xine, XINE_VERBOSITY_LOG, + _("video_out_dxr3: Mpeg encoder rte failed to init.\n")); return 0; } #endif #ifdef HAVE_LIBFAME if ((strcmp(available_encoders[encoder], "fame") == 0) && !dxr3_fame_init(this)) { - printf("video_out_dxr3: Mpeg encoder fame failed to init.\n"); + xprintf(this->class->xine, XINE_VERBOSITY_LOG, + _("video_out_dxr3: Mpeg encoder fame failed to init.\n")); return 0; } #endif if (strcmp(available_encoders[encoder], "none") == 0) - printf("video_out_dxr3: Mpeg encoding disabled.\n" - "video_out_dxr3: that's ok, you don't need it for mpeg video like DVDs, but\n" - "video_out_dxr3: you will not be able to play non-mpeg content using this video out\n" - "video_out_dxr3: driver. See the README.dxr3 for details on configuring an encoder.\n"); + xprintf(this->class->xine, XINE_VERBOSITY_LOG, + _("video_out_dxr3: Mpeg encoding disabled.\n" + "video_out_dxr3: that's ok, you don't need it for mpeg video like DVDs, but\n" + "video_out_dxr3: you will not be able to play non-mpeg content using this video out\n" + "video_out_dxr3: driver. See the README.dxr3 for details on configuring an encoder.\n")); } else - printf("video_out_dxr3: No mpeg encoder compiled in.\n" - "video_out_dxr3: that's ok, you don't need it for mpeg video like DVDs, but\n" - "video_out_dxr3: you will not be able to play non-mpeg content using this video out\n" - "video_out_dxr3: driver. See the README.dxr3 for details on configuring an encoder.\n"); + xprintf(this->class->xine, XINE_VERBOSITY_LOG, + _("video_out_dxr3: No mpeg encoder compiled in.\n" + "video_out_dxr3: that's ok, you don't need it for mpeg video like DVDs, but\n" + "video_out_dxr3: you will not be able to play non-mpeg content using this video out\n" + "video_out_dxr3: driver. See the README.dxr3 for details on configuring an encoder.\n")); /* init aspect */ this->aspect = dxr3_set_property(&this->vo_driver, VO_PROP_ASPECT_RATIO, XINE_VO_ASPECT_4_3); @@ -401,6 +405,7 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v printf("video_out_dxr3: setting up overlay mode\n"); #endif gather_screen_vars(this, visual_gen); + this->overlay.xine = this->class->xine; if (dxr3_overlay_read_state(&this->overlay) == 0) { this->overlay_enabled = 1; this->tv_switchable = 1; @@ -416,7 +421,8 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v _("Crops the overlay area from top and bottom to avoid green lines"), NULL, 20, NULL, NULL); } else { - printf("video_out_dxr3: please run autocal, overlay disabled\n"); + xprintf(this->class->xine, XINE_VERBOSITY_LOG, + _("video_out_dxr3: please run autocal, overlay disabled\n")); this->overlay_enabled = 0; this->tv_switchable = 0; this->widescreen_enabled = 0; @@ -451,7 +457,8 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v } if (this->tv_mode != EM8300_VIDEOMODE_DEFAULT) if (ioctl(this->fd_control, EM8300_IOCTL_SET_VIDEOMODE, &this->tv_mode)) - printf("video_out_dxr3: setting video mode failed.\n"); + xprintf(this->class->xine, XINE_VERBOSITY_LOG, + _("video_out_dxr3: setting video mode failed.\n")); #ifdef HAVE_X11 /* initialize overlay */ @@ -476,17 +483,21 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v scr.xsize = this->overlay.screen_xres; scr.ysize = this->overlay.screen_yres; if (ioctl(this->fd_control, EM8300_IOCTL_OVERLAY_SETSCREEN, &scr)) - printf("video_out_dxr3: setting the overlay screen failed.\n"); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: setting the overlay screen failed.\n"); if (dxr3_overlay_set_keycolor(&this->overlay) != 0) - printf("video_out_dxr3: setting the overlay keycolor failed.\n"); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: setting the overlay keycolor failed.\n"); if (dxr3_overlay_set_attributes(&this->overlay) != 0) - printf("video_out_dxr3: setting an overlay attribute failed.\n"); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: setting an overlay attribute failed.\n"); /* finally switch to overlay mode */ value = EM8300_OVERLAY_MODE_OVERLAY; if (ioctl(this->fd_control, EM8300_IOCTL_OVERLAY_SETMODE, &value) != 0) - printf("video_out_dxr3: switching to overlay mode failed.\n"); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: switching to overlay mode failed.\n"); } #endif @@ -504,8 +515,7 @@ static vo_frame_t *dxr3_alloc_frame(vo_driver_t *this_gen) dxr3_frame_t *frame; dxr3_driver_t *this = (dxr3_driver_t *)this_gen; - frame = (dxr3_frame_t *)malloc(sizeof(dxr3_frame_t)); - memset(frame, 0, sizeof(dxr3_frame_t)); + frame = (dxr3_frame_t *)xine_xmalloc(sizeof(dxr3_frame_t)); pthread_mutex_init(&frame->vo_frame.mutex, NULL); @@ -626,8 +636,8 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge /* open the device for the encoder */ snprintf(tmpstr, sizeof(tmpstr), "%s_mv%s", this->class->devname, this->class->devnum); if ((this->fd_video = open(tmpstr, O_WRONLY)) < 0) - printf("video_out_dxr3: Failed to open video device %s (%s)\n", - tmpstr, strerror(errno)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: Failed to open video device %s (%s)\n", tmpstr, strerror(errno)); /* start the scr plugin */ time = clock->get_current_time(clock); @@ -659,8 +669,9 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge /* Tell the viewers about the aspect ratio stuff. */ if (oheight - height > 0) - printf("video_out_dxr3: adding %d black lines to get %s aspect ratio.\n", - oheight - height, frame->aspect == XINE_VO_ASPECT_4_3 ? "4:3" : "16:9"); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: adding %d black lines to get %s aspect ratio.\n", + oheight - height, frame->aspect == XINE_VO_ASPECT_4_3 ? "4:3" : "16:9"); /* make top black bar multiple of 16, * so old and new macroblocks overlap */ @@ -676,8 +687,9 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge if (!this->enc) { /* no encoder plugin! Let's bug the user! */ - printf("video_out_dxr3: Need an mpeg encoder to play non-mpeg videos on dxr3\n" - "video_out_dxr3: Read the README.dxr3 for details.\n"); + xprintf(this->class->xine, XINE_VERBOSITY_LOG, + _("video_out_dxr3: Need an mpeg encoder to play non-mpeg videos on dxr3\n" + "video_out_dxr3: Read the README.dxr3 for details.\n")); } } @@ -817,9 +829,9 @@ static void dxr3_overlay_end(vo_driver_t *this_gen, vo_frame_t *frame_gen) if (!this->fd_spu) { snprintf (tmpstr, sizeof(tmpstr), "%s_sp%s", this->class->devname, this->class->devnum); if ((this->fd_spu = open (tmpstr, O_WRONLY)) < 0) { - printf("video_out_dxr3: Failed to open spu device %s (%s)\n", - tmpstr, strerror(errno)); - printf("video_out_dxr3: Overlays are not available\n"); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: Failed to open spu device %s (%s)\n" + "video_out_dxr3: Overlays are not available\n", tmpstr, strerror(errno)); pthread_mutex_unlock(&this->spu_device_lock); return; } @@ -846,16 +858,17 @@ static void dxr3_overlay_end(vo_driver_t *this_gen, vo_frame_t *frame_gen) this->spu_enc->color[7] = this->spu_enc->clip_color[3]; /* set palette */ if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_SETPALETTE, this->spu_enc->color)) - printf("video_out_dxr3: failed to set CLUT (%s)\n", strerror(errno)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: failed to set CLUT (%s)\n", strerror(errno)); this->clut_cluttered = 1; /* write spu */ written = write(this->fd_spu, this->spu_enc->target, this->spu_enc->size); if (written < 0) - printf("video_out_dxr3: spu device write failed (%s)\n", - strerror(errno)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: spu device write failed (%s)\n", strerror(errno)); else if (written != this->spu_enc->size) - printf("video_out_dxr3: Could only write %d of %d spu bytes.\n", - written, this->spu_enc->size); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: Could only write %d of %d spu bytes.\n", written, this->spu_enc->size); /* set clipping */ btn.color = 0x7654; btn.contrast = @@ -868,8 +881,8 @@ static void dxr3_overlay_end(vo_driver_t *this_gen, vo_frame_t *frame_gen) btn.top = this->spu_enc->overlay->y + this->spu_enc->overlay->clip_top; btn.bottom = this->spu_enc->overlay->y + this->spu_enc->overlay->clip_bottom - 2; if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_BUTTON, &btn)) - printf("dxr3_decode_spu: failed to set spu button (%s)\n", - strerror(errno)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "dxr3_decode_spu: failed to set spu button (%s)\n", strerror(errno)); pthread_mutex_unlock(&this->spu_device_lock); } @@ -931,8 +944,8 @@ static void dxr3_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) /* inform the card on the timing */ if (ioctl(this->fd_video, EM8300_IOCTL_VIDEO_SETPTS, &vpts32)) - printf("video_out_dxr3: set video pts failed (%s)\n", - strerror(errno)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: set video pts failed (%s)\n", strerror(errno)); /* for non-mpeg, the encoder plugin is responsible for calling * frame_gen->free(frame_gen) ! */ this->enc->on_display_frame(this, frame); @@ -988,7 +1001,8 @@ static int dxr3_get_property(vo_driver_t *this_gen, int property) case VO_PROP_WINDOW_HEIGHT: return this->scale.gui_height; } - printf("video_out_dxr3: property %d not implemented.\n", property); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: property %d not implemented.\n", property); return 0; } @@ -1039,12 +1053,14 @@ static int dxr3_set_property(vo_driver_t *this_gen, int property, int value) } if (ioctl(this->fd_control, EM8300_IOCTL_SET_ASPECTRATIO, &val)) - printf("video_out_dxr3: failed to set aspect ratio (%s)\n", strerror(errno)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: failed to set aspect ratio (%s)\n", strerror(errno)); this->scale.force_redraw = 1; break; case VO_PROP_COLORKEY: - printf("video_out_dxr3: VO_PROP_COLORKEY not implemented!"); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: VO_PROP_COLORKEY not implemented!"); this->overlay.colorkey = value; break; case VO_PROP_ZOOM_X: @@ -1056,7 +1072,8 @@ static int dxr3_set_property(vo_driver_t *this_gen, int property, int value) if (!this->widescreen_enabled) { val = EM8300_ASPECTRATIO_4_3; if (ioctl(this->fd_control, EM8300_IOCTL_SET_ASPECTRATIO, &val)) - printf("video_out_dxr3: failed to set aspect ratio (%s)\n", strerror(errno)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: failed to set aspect ratio (%s)\n", strerror(errno)); dxr3_zoomTV(this); } else { /* FIXME: We should send an anamorphic hint to widescreen tvs, so they @@ -1075,17 +1092,19 @@ static int dxr3_set_property(vo_driver_t *this_gen, int property, int value) #if LOG_VID printf("video_out_dxr3: Changing TVMode to "); #endif - if (this->tv_mode == EM8300_VIDEOMODE_PAL) printf("PAL\n"); - if (this->tv_mode == EM8300_VIDEOMODE_PAL60) printf("PAL60\n"); - if (this->tv_mode == EM8300_VIDEOMODE_NTSC) printf("NTSC\n"); + if (this->tv_mode == EM8300_VIDEOMODE_PAL) xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "PAL\n"); + if (this->tv_mode == EM8300_VIDEOMODE_PAL60) xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "PAL60\n"); + if (this->tv_mode == EM8300_VIDEOMODE_NTSC) xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "NTSC\n"); if (ioctl(this->fd_control, EM8300_IOCTL_SET_VIDEOMODE, &this->tv_mode)) - printf("video_out_dxr3: setting video mode failed (%s)\n", strerror(errno)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: setting video mode failed (%s)\n", strerror(errno)); break; } if (bcs_changed) if (ioctl(this->fd_control, EM8300_IOCTL_SETBCS, &this->bcs)) - printf("video_out_dxr3: bcs set failed (%s)\n", strerror(errno)); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: bcs set failed (%s)\n", strerror(errno)); return value; } @@ -1306,7 +1325,8 @@ static int dxr3_overlay_read_state(dxr3_overlay_t *this) printf("video_out_dxr3: attempting to open %s\n", fname); #endif if (!(fp = fopen(fname, "r"))) { - printf("video_out_dxr3: ERROR Reading overlay init file. Run autocal!\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_dxr3: ERROR Reading overlay init file. Run autocal!\n")); return -1; } @@ -1395,7 +1415,8 @@ static int dxr3_overlay_set_keycolor(dxr3_overlay_t *this) attr.attribute = EM9010_ATTRIBUTE_KEYCOLOR_LOWER; attr.value = overlay_limit; if ((ret = ioctl(this->fd_control, EM8300_IOCTL_OVERLAY_SET_ATTRIBUTE, &attr)) < 0) { - printf("video_out_dxr3: WARNING: error setting overlay lower limit attribute\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: WARNING: error setting overlay lower limit attribute\n"); return ret; } @@ -1409,7 +1430,8 @@ static int dxr3_overlay_set_keycolor(dxr3_overlay_t *this) attr.attribute = EM9010_ATTRIBUTE_KEYCOLOR_UPPER; attr.value = overlay_limit; if ((ret = ioctl(this->fd_control, EM8300_IOCTL_OVERLAY_SET_ATTRIBUTE, &attr)) < 0) - printf("video_out_dxr3: WARNING: error setting overlay upper limit attribute\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: WARNING: error setting overlay upper limit attribute\n"); return ret; } @@ -1519,22 +1541,22 @@ static void dxr3_update_add_bars(void *data, xine_cfg_entry_t *entry) { dxr3_driver_t *this = (dxr3_driver_t *)data; this->add_bars = entry->num_value; - printf("video_out_dxr3: setting add_bars to correct aspect ratio to %s\n", - (this->add_bars ? "on" : "off")); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: setting add_bars to correct aspect ratio to %s\n", (this->add_bars ? "on" : "off")); } static void dxr3_update_swap_fields(void *data, xine_cfg_entry_t *entry) { dxr3_driver_t *this = (dxr3_driver_t *)data; this->swap_fields = entry->num_value; - printf("video_out_dxr3: setting swap fields to %s\n", - (this->swap_fields ? "on" : "off")); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: setting swap fields to %s\n", (this->swap_fields ? "on" : "off")); } static void dxr3_update_enhanced_mode(void *data, xine_cfg_entry_t *entry) { dxr3_driver_t *this = (dxr3_driver_t *)data; this->enhanced_mode = entry->num_value; - printf("video_out_dxr3: setting enhanced encoding playback to %s\n", - (this->enhanced_mode ? "on" : "off")); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_dxr3: setting enhanced encoding playback to %s\n", (this->enhanced_mode ? "on" : "off")); } diff --git a/src/dxr3/video_out_dxr3.h b/src/dxr3/video_out_dxr3.h index 09af98652..e9481851f 100644 --- a/src/dxr3/video_out_dxr3.h +++ b/src/dxr3/video_out_dxr3.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_dxr3.h,v 1.19 2003/09/11 10:01:04 mroi Exp $ + * $Id: video_out_dxr3.h,v 1.20 2003/12/05 15:54:58 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -65,6 +65,7 @@ typedef struct dxr3_overlay_s { struct coeff colcal_upper[3]; struct coeff colcal_lower[3]; + xine_t *xine; } dxr3_overlay_t; typedef struct dxr3_driver_class_s { diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index 4759f553a..4436edb22 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -20,7 +20,7 @@ * Compact Disc Digital Audio (CDDA) Input Plugin * by Mike Melanson (melanson@pcisys.net) * - * $Id: input_cdda.c,v 1.39 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: input_cdda.c,v 1.40 2003/12/05 15:54:58 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -409,7 +409,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) { toc->ignore_last_track = 0; } toc->total_tracks = toc->last_track - toc->first_track + 1; - + /* allocate space for the toc entries */ toc->toc_entries = (cdrom_toc_entry *)malloc(toc->total_tracks * sizeof(cdrom_toc_entry)); @@ -840,7 +840,7 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f #define _BUFSIZ 300 -static int host_connect_attempt (struct in_addr ia, int port) +static int host_connect_attempt (xine_t *xine, struct in_addr ia, int port) { int s; struct sockaddr_in sin; @@ -848,7 +848,7 @@ static int host_connect_attempt (struct in_addr ia, int port) s=socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); if (s==-1) { - printf("input_cdda: failed to open socket.\n"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "input_cdda: failed to open socket.\n"); return -1; } @@ -862,7 +862,7 @@ static int host_connect_attempt (struct in_addr ia, int port) if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && WSAGetLastError() != WSAEINPROGRESS) #endif /* WIN32 */ { - printf("input_cdda: cannot connect to host.\n"); + xprintf(xine, XINE_VERBOSITY_LOG, _("input_cdda: cannot connect to host.\n")); close(s); return -1; } @@ -870,7 +870,7 @@ static int host_connect_attempt (struct in_addr ia, int port) return s; } -static int host_connect (const char *host, int port) +static int host_connect (xine_t *xine, const char *host, int port) { struct hostent *h; int i; @@ -878,21 +878,22 @@ static int host_connect (const char *host, int port) h=gethostbyname(host); if (h==NULL) { - printf("input_cdda: unable to resolve '%s'.\n", host); + xprintf(xine, XINE_VERBOSITY_LOG, _("input_cdda: unable to resolve '%s'.\n"), host); return -1; } for(i=0; h->h_addr_list[i]; i++) { struct in_addr ia; memcpy(&ia, h->h_addr_list[i], 4); - s=host_connect_attempt(ia, port); + s=host_connect_attempt(xine, ia, port); if(s != -1) { signal( SIGPIPE, SIG_IGN ); return s; } } - printf("input_cdda: unable to connect to '%s'.\n", host); + xprintf(xine, XINE_VERBOSITY_LOG, _("input_cdda: unable to connect to '%s'.\n"), host); + return -1; } @@ -961,7 +962,7 @@ static int sock_check_opened(int socket) { /* * read binary data from socket */ -static int sock_data_read (int socket, char *buf, int nlen) { +static int sock_data_read (xine_t *xine, int socket, char *buf, int nlen) { int n, num_bytes; if((socket < 0) || (buf == NULL)) @@ -989,12 +990,12 @@ static int sock_data_read (int socket, char *buf, int nlen) { timeout.tv_usec = 0; if (select (socket+1, &rset, NULL, NULL, &timeout) <= 0) { - printf ("input_cdda: timeout on read.\n"); + xprintf (xine, XINE_VERBOSITY_DEBUG, "input_cdda: timeout on read.\n"); return 0; } continue; } - printf ("input_cdda: read error %d.\n", errno); + xprintf (xine, XINE_VERBOSITY_DEBUG, "input_cdda: read error %d.\n", errno); return 0; } @@ -1076,7 +1077,7 @@ static int sock_data_write(int socket, char *buf, int len) { return wlen; } -static int network_command( int socket, char *data_buf, char *msg, ...) +static int network_command( xine_t *xine, int socket, char *data_buf, char *msg, ...) { char buf[_BUFSIZ]; va_list args; @@ -1092,13 +1093,13 @@ static int network_command( int socket, char *data_buf, char *msg, ...) if( sock_data_write(socket, buf, strlen(buf)) < (int)strlen(buf) ) { - printf("input_cdda: error writing to socket.\n"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "input_cdda: error writing to socket.\n"); return -1; } if( sock_string_read(socket, buf, _BUFSIZ) <= 0 ) { - printf("input_cdda: error reading from socket.\n"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "input_cdda: error reading from socket.\n"); return -1; } @@ -1106,10 +1107,11 @@ static int network_command( int socket, char *data_buf, char *msg, ...) if( n ) { if( !data_buf ) { - printf("input_cdda: protocol error, data returned but no buffer provided.\n"); + xprintf(xine, XINE_VERBOSITY_DEBUG, + "input_cdda: protocol error, data returned but no buffer provided.\n"); return -1; } - if( sock_data_read(socket, data_buf, n) < n ) + if( sock_data_read(xine, socket, data_buf, n) < n ) return -1; } else if ( data_buf ) { @@ -1120,7 +1122,7 @@ static int network_command( int socket, char *data_buf, char *msg, ...) } -static int network_connect( char *url ) +static int network_connect(xine_t *xine, char *url ) { char *host; int port; @@ -1135,12 +1137,12 @@ static int network_connect( char *url ) return -1; } - fd = host_connect( host, port ); + fd = host_connect(xine, host, port ); free(url); if( fd != -1 ) { - if( network_command(fd, NULL, "cdda_open") < 0 ) { - printf("input_cdda: error opening remote drive.\n"); + if( network_command(xine, fd, NULL, "cdda_open") < 0 ) { + xprintf(xine, XINE_VERBOSITY_DEBUG, "input_cdda: error opening remote drive.\n"); close(fd); return -1; } @@ -1148,14 +1150,14 @@ static int network_connect( char *url ) return fd; } -static int network_read_cdrom_toc(int fd, cdrom_toc *toc) { +static int network_read_cdrom_toc(xine_t *xine, int fd, cdrom_toc *toc) { char buf[_BUFSIZ]; int i; /* fetch the table of contents */ - if( network_command( fd, buf, "cdda_tochdr" ) == -1) { - printf("input_cdda: network CDROMREADTOCHDR error.\n"); + if( network_command(xine, fd, buf, "cdda_tochdr" ) == -1) { + xprintf(xine, XINE_VERBOSITY_DEBUG, "input_cdda: network CDROMREADTOCHDR error.\n"); return -1; } @@ -1174,8 +1176,8 @@ static int network_read_cdrom_toc(int fd, cdrom_toc *toc) { for (i = toc->first_track; i <= toc->last_track; i++) { /* fetch the table of contents */ - if( network_command( fd, buf, "cdda_tocentry %d", i ) == -1) { - printf("input_cdda: network CDROMREADTOCENTRY error.\n"); + if( network_command( xine, fd, buf, "cdda_tocentry %d", i ) == -1) { + xprintf(xine, XINE_VERBOSITY_DEBUG, "input_cdda: network CDROMREADTOCENTRY error.\n"); return -1; } @@ -1191,8 +1193,8 @@ static int network_read_cdrom_toc(int fd, cdrom_toc *toc) { } /* fetch the leadout as well */ - if( network_command( fd, buf, "cdda_tocentry %d", CD_LEADOUT_TRACK ) == -1) { - printf("input_cdda: network CDROMREADTOCENTRY error.\n"); + if( network_command( xine, fd, buf, "cdda_tocentry %d", CD_LEADOUT_TRACK ) == -1) { + xprintf(xine, XINE_VERBOSITY_DEBUG, "input_cdda: network CDROMREADTOCENTRY error.\n"); return -1; } @@ -1208,10 +1210,10 @@ static int network_read_cdrom_toc(int fd, cdrom_toc *toc) { return 0; } -static int network_read_cdrom_frames(int fd, int first_frame, int num_frames, +static int network_read_cdrom_frames(xine_t *xine, int fd, int first_frame, int num_frames, unsigned char data[CD_RAW_FRAME_SIZE]) { - return network_command( fd, data, "cdda_read %d %d", first_frame, num_frames ); + return network_command( xine, fd, data, "cdda_read %d %d", first_frame, num_frames ); } @@ -1274,7 +1276,8 @@ static int _cdda_is_cd_changed(cdda_input_plugin_t *this) { return -1; if((err = ioctl(this->fd, CDROM_MEDIA_CHANGED, cd_changed)) < 0) { - printf("input_cdda: ioctl(CDROM_MEDIA_CHANGED) failed: %s.\n", strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: ioctl(CDROM_MEDIA_CHANGED) failed: %s.\n", strerror(errno)); return -1; } @@ -1301,49 +1304,50 @@ static int _cdda_is_cd_changed(cdda_input_plugin_t *this) { /* * create a directory, in safe mode */ -static void _cdda_mkdir_safe(char *path) { +static void _cdda_mkdir_safe(xine_t *xine, char *path) { if(path == NULL) return; - + #ifndef WIN32 { - struct stat pstat; - - if((lstat(path, &pstat)) < 0) { - /* file or directory no exist, create it */ - if(mkdir(path, 0755) < 0) { - fprintf(stderr, "input_cdda: mkdir(%s) failed: %s.\n", path, strerror(errno)); - return; - } - } - else { - /* Check of found file is a directory file */ - if(!S_ISDIR(pstat.st_mode)) { - fprintf(stderr, "input_cdda: %s is not a directory.\n", path); - } - } + struct stat pstat; + + if((lstat(path, &pstat)) < 0) { + /* file or directory no exist, create it */ + if(mkdir(path, 0755) < 0) { + xprintf(xine, XINE_VERBOSITY_DEBUG, + "input_cdda: mkdir(%s) failed: %s.\n", path, strerror(errno)); + return; + } + } + else { + /* Check of found file is a directory file */ + if(!S_ISDIR(pstat.st_mode)) { + xprintf(xine, XINE_VERBOSITY_DEBUG, "input_cdda: %s is not a directory.\n", path); + } + } } #else { - HANDLE hList; - TCHAR szDir[MAX_PATH+1]; - WIN32_FIND_DATA FileData; - - // Get the proper directory path - sprintf(szDir, "%s\\*", path); - - // Get the first file - hList = FindFirstFile(szDir, &FileData); - if (hList == INVALID_HANDLE_VALUE) - { - if(_mkdir(path) != 0) { - fprintf(stderr, "input_cdda: mkdir(%s) failed.\n", path); - return; - } - } - - FindClose(hList); + HANDLE hList; + TCHAR szDir[MAX_PATH+1]; + WIN32_FIND_DATA FileData; + + // Get the proper directory path + sprintf(szDir, "%s\\*", path); + + // Get the first file + hList = FindFirstFile(szDir, &FileData); + if (hList == INVALID_HANDLE_VALUE) + { + if(_mkdir(path) != 0) { + xprintf(xine, XINE_VERBOSITY_DEBUG, "input_cdda: mkdir(%s) failed.\n", path); + return; + } + } + + FindClose(hList); } #endif /* WIN32 */ } @@ -1351,7 +1355,7 @@ static void _cdda_mkdir_safe(char *path) { /* * Make recursive directory creation */ -static void _cdda_mkdir_recursive_safe(char *path) { +static void _cdda_mkdir_recursive_safe(xine_t *xine, char *path) { char *p, *pp; char buf[XINE_PATH_MAX + XINE_NAME_MAX + 1]; char buf2[XINE_PATH_MAX + XINE_NAME_MAX + 1]; @@ -1381,7 +1385,7 @@ static void _cdda_mkdir_recursive_safe(char *path) { #endif /* WIN32 */ - _cdda_mkdir_safe(buf2); + _cdda_mkdir_safe(xine, buf2); } } } @@ -1543,7 +1547,8 @@ static int _cdda_load_cached_cddb_infos(cdda_input_plugin_t *this) { sprintf(cdir, "%s/%s", cdir, discid); if((fd = fopen(cdir, "r")) == NULL) { - printf("input_cdda: fopen(%s) failed: %s.\n", cdir, strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: fopen(%s) failed: %s.\n", cdir, strerror(errno)); closedir(dir); return 0; } @@ -1629,12 +1634,13 @@ static void _cdda_save_cached_cddb_infos(cdda_input_plugin_t *this, char *fileco /* Ensure "~/.xine/cddbcache" exist */ sprintf(cfile, "%s", this->cddb.cache_dir); - _cdda_mkdir_recursive_safe(cfile); + _cdda_mkdir_recursive_safe(this->stream->xine, cfile); sprintf(cfile, "%s/%08lx", this->cddb.cache_dir, this->cddb.disc_id); if((fd = fopen(cfile, "w")) == NULL) { - printf("input_cdda: fopen(%s) failed: %s.\n", cfile, strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: fopen(%s) failed: %s.\n", cfile, strerror(errno)); return; } else { @@ -1715,10 +1721,14 @@ static void _cdda_cddb_retrieve(cdda_input_plugin_t *this) { else { this->cddb.fd = _cdda_cddb_socket_open(this); if(this->cddb.fd >= 0) { - printf("input_cdda: successfuly connected to cddb server '%s:%d'.\n", this->cddb.server, this->cddb.port); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_cdda: successfuly connected to cddb server '%s:%d'.\n"), + this->cddb.server, this->cddb.port); } else { - printf("input_cdda: failed to connect to cddb server '%s:%d' (%s).\n", this->cddb.server, this->cddb.port, strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_cdda: failed to connect to cddb server '%s:%d' (%s).\n"), + this->cddb.server, this->cddb.port, strerror(errno)); this->cddb.have_cddb_info = 0; return; } @@ -1727,7 +1737,8 @@ static void _cdda_cddb_retrieve(cdda_input_plugin_t *this) { memset(&buffer, 0, sizeof(buffer)); _cdda_cddb_socket_read(&buffer[0], 2047, this->cddb.fd); if ((err = _cdda_cddb_handle_code(buffer)) < 0) { - printf("input_cdda: error while reading cddb welcome message.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: error while reading cddb welcome message.\n"); _cdda_cddb_socket_close(this); return; } @@ -1740,7 +1751,8 @@ static void _cdda_cddb_retrieve(cdda_input_plugin_t *this) { memset(&buffer, 0, sizeof(buffer)); sprintf(buffer, "cddb hello unknown localhost xine %s\n", VERSION); if ((err = _cdda_cddb_send_command(this, buffer)) <= 0) { - printf("input_cdda: error while sending cddb hello command.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: error while sending cddb hello command.\n"); _cdda_cddb_socket_close(this); return; } @@ -1748,7 +1760,8 @@ static void _cdda_cddb_retrieve(cdda_input_plugin_t *this) { memset(&buffer, 0, sizeof(buffer)); _cdda_cddb_socket_read(&buffer[0], 2047, this->cddb.fd); if ((err = _cdda_cddb_handle_code(buffer)) < 0) { - printf("input_cdda: cddb hello command returned error code '%03d'.\n", err); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: cddb hello command returned error code '%03d'.\n", err); _cdda_cddb_socket_close(this); return; } @@ -1761,7 +1774,8 @@ static void _cdda_cddb_retrieve(cdda_input_plugin_t *this) { } sprintf(buffer, "%s%d\n", buffer, this->cddb.disc_length); if ((err = _cdda_cddb_send_command(this, buffer)) <= 0) { - printf("input_cdda: error while sending cddb query command.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: error while sending cddb query command.\n"); _cdda_cddb_socket_close(this); return; } @@ -1769,7 +1783,8 @@ static void _cdda_cddb_retrieve(cdda_input_plugin_t *this) { memset(&buffer, 0, sizeof(buffer)); _cdda_cddb_socket_read(&buffer[0], 2047, this->cddb.fd); if ((err = _cdda_cddb_handle_code(buffer)) != 200) { - printf("input_cdda: cddb query command returned error code '%03d'.\n", err); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: cddb query command returned error code '%03d'.\n", err); _cdda_cddb_socket_close(this); return; } @@ -1790,7 +1805,8 @@ static void _cdda_cddb_retrieve(cdda_input_plugin_t *this) { memset(&buffer, 0, sizeof(buffer)); sprintf(buffer, "cddb read %s %s\n", this->cddb.disc_category, this->cddb.cdiscid); if ((err = _cdda_cddb_send_command(this, buffer)) <= 0) { - printf("input_cdda: error while sending cddb read command.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: error while sending cddb read command.\n"); _cdda_cddb_socket_close(this); return; } @@ -1798,7 +1814,8 @@ static void _cdda_cddb_retrieve(cdda_input_plugin_t *this) { memset(&buffer, 0, sizeof(buffer)); _cdda_cddb_socket_read(&buffer[0], 2047, this->cddb.fd); if ((err = _cdda_cddb_handle_code(buffer)) != 210) { - printf("input_cdda: cddb read command returned error code '%03d'.\n", err); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: cddb read command returned error code '%03d'.\n", err); _cdda_cddb_socket_close(this); return; } @@ -2195,7 +2212,7 @@ static buf_element_t *cdda_plugin_read_block (input_plugin_t *this_gen, fifo_buf this->cache_last - this->cache_first + 1, this->cache[0]); else if ( this->net_fd != -1 ) - err = network_read_cdrom_frames(this->net_fd, this->cache_first, + err = network_read_cdrom_frames(this->stream->xine, this->net_fd, this->cache_first, this->cache_last - this->cache_first + 1, this->cache[0]); } @@ -2302,11 +2319,11 @@ static int cdda_plugin_open (input_plugin_t *this_gen ) { #ifndef WIN32 if( strchr(cdda_device,':') ) { - fd = network_connect(cdda_device); + fd = network_connect(this->stream->xine, cdda_device); if( fd != -1 ) { this->net_fd = fd; - err = network_read_cdrom_toc(this->net_fd, toc); + err = network_read_cdrom_toc(this->stream->xine, this->net_fd, toc); } } #endif @@ -2447,9 +2464,9 @@ static char ** cdda_class_get_autoplay_list (input_class_t *this_gen, #ifndef WIN32 if( strchr(this->cdda_device,':') ) { - fd = network_connect(this->cdda_device); + fd = network_connect(ip->stream->xine, this->cdda_device); if( fd != -1 ) { - err = network_read_cdrom_toc(fd, toc); + err = network_read_cdrom_toc(ip->stream->xine, fd, toc); } } #endif @@ -2601,7 +2618,7 @@ static void cdda_class_dispose (input_class_t *this_gen) { static int cdda_class_eject_media (input_class_t *this_gen) { cdda_input_class_t *this = (cdda_input_class_t *) this_gen; - return media_eject_media (this->cdda_device); + return media_eject_media (this->xine, this->cdda_device); } diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 4f2850dc0..e4e2a5a80 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -77,17 +77,18 @@ typedef struct { struct dmx_pes_filter_params pesFilterParamsV; struct dmx_pes_filter_params pesFilterParamsA; + xine_t *xine; } tuner_t; typedef struct { - char *name; - struct dvb_frontend_parameters front_param; - int vpid; - int apid; - int sat_no; - int tone; - int pol; + char *name; + struct dvb_frontend_parameters front_param; + int vpid; + int apid; + int sat_no; + int tone; + int pol; } channel_t; typedef struct { @@ -103,7 +104,7 @@ typedef struct { typedef struct { input_plugin_t input_plugin; - dvb_input_class_t *cls; + dvb_input_class_t *class; xine_stream_t *stream; @@ -209,38 +210,39 @@ static void tuner_dispose (tuner_t *this) { free (this); } -static tuner_t *tuner_init () { +static tuner_t *tuner_init (xine_t *xine) { tuner_t *this; - this = malloc (sizeof (tuner_t)); + this = (tuner_t *) xine_xmalloc(sizeof(tuner_t)); this->fd_frontend = -1; - this->fd_demuxa = -1; - this->fd_demuxv = -1; + this->fd_demuxa = -1; + this->fd_demuxv = -1; + this->xine = xine; if ((this->fd_frontend = open(FRONTEND_DEVICE, O_RDWR)) < 0){ - perror("FRONTEND DEVICE"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "FRONTEND DEVICE: %s\n", strerror(errno)); tuner_dispose(this); return NULL; } if ((ioctl (this->fd_frontend, FE_GET_INFO, &this->feinfo)) < 0) { - perror("FE_GET_INFO"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "FE_GET_INFO: %s\n", strerror(errno)); tuner_dispose(this); return NULL; } this->fd_demuxa = open (DEMUX_DEVICE, O_RDWR); if (this->fd_demuxa < 0) { - perror ("DEMUX DEVICE audio"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "DEMUX DEVICE audio: %s\n", strerror(errno)); tuner_dispose(this); return NULL; } this->fd_demuxv=open (DEMUX_DEVICE, O_RDWR); if (this->fd_demuxv < 0) { - perror ("DEMUX DEVICE video"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "DEMUX DEVICE video: %s\n", strerror(errno)); tuner_dispose(this); return NULL; } @@ -263,7 +265,7 @@ static void tuner_set_vpid (tuner_t *this, ushort vpid) { this->pesFilterParamsV.flags = DMX_IMMEDIATE_START; if (ioctl(this->fd_demuxv, DMX_SET_PES_FILTER, &this->pesFilterParamsV) < 0) - perror("set_vpid"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "set_vpid: %s\n", strerror(errno)); } static void tuner_set_apid (tuner_t *this, ushort apid) { @@ -279,7 +281,7 @@ static void tuner_set_apid (tuner_t *this, ushort apid) { this->pesFilterParamsA.flags = DMX_IMMEDIATE_START; if (ioctl (this->fd_demuxa, DMX_SET_PES_FILTER, &this->pesFilterParamsA) < 0) - perror("set_apid"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "set_apid: %s\n", strerror(errno)); } static int tuner_set_diseqc(tuner_t *this, channel_t *c) @@ -315,17 +317,19 @@ static int tuner_tune_it (tuner_t *this, struct dvb_frontend_parameters fe_status_t status; if (ioctl(this->fd_frontend, FE_SET_FRONTEND, front_param) <0) { - perror("setfront front"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "setfront front: %s\n", strerror(errno)); } do { if (ioctl(this->fd_frontend, FE_READ_STATUS, &status) < 0) { - perror("fe get event"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "fe get event: %s\n", strerror(errno)); return 0; - } - printf("input_dvb: status: %x\n", status); - if (status & FE_HAS_LOCK) { - return 1; + } + + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "input_dvb: status: %x\n", status); + + if (status & FE_HAS_LOCK) { + return 1; } usleep(500000); } @@ -334,19 +338,20 @@ static int tuner_tune_it (tuner_t *this, struct dvb_frontend_parameters return 0; } -static void print_channel (channel_t *channel) { - printf ("input_dvb: channel '%s' freq %d vpid %d apid %d\n", - channel->name, - channel->front_param.frequency, - channel->vpid, - channel->apid); +static void print_channel (xine_t *xine, channel_t *channel) { + xprintf (xine, XINE_VERBOSITY_DEBUG, + "input_dvb: channel '%s' freq %d vpid %d apid %d\n", + channel->name, + channel->front_param.frequency, + channel->vpid, + channel->apid); } static int tuner_set_channel (tuner_t *this, channel_t *c) { - print_channel (c); + print_channel (this->xine, c); tuner_set_vpid (this, 0); tuner_set_apid (this, 0); @@ -402,18 +407,18 @@ static void switch_channel (dvb_input_plugin_t *this) { close (this->fd); if (!tuner_set_channel (this->tuner, &this->channels[this->channel])) { - printf ("input_dvb: tuner_set_channel failed\n"); + xprintf (this->class->xine, XINE_VERBOSITY_LOG, _("input_dvb: tuner_set_channel failed\n")); pthread_mutex_unlock (&this->mutex); return; } - event.type = XINE_EVENT_PIDS_CHANGE; + event.type = XINE_EVENT_PIDS_CHANGE; data.vpid = this->channels[this->channel].vpid; data.apid = this->channels[this->channel].apid; event.data = &data; event.data_length = sizeof (xine_pids_data_t); - printf ("input_dvb: sending event\n"); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "input_dvb: sending event\n"); xine_event_send (this->stream, &event); @@ -429,7 +434,7 @@ static void switch_channel (dvb_input_plugin_t *this) { event.data_length = sizeof(ui_data); xine_event_send(this->stream, &event); - printf ("input_dvb: ui title event sent\n"); + lprintf ("input_dvb: ui title event sent\n"); this->fd = open (DVR_DEVICE, O_RDONLY); @@ -673,7 +678,7 @@ static int find_param(const Param *list, const char *name) return list->value;; } -static channel_t *load_channels (int *num_ch, fe_type_t fe_type) { +static channel_t *load_channels (xine_t *xine, int *num_ch, fe_type_t fe_type) { FILE *f; char str[BUFSIZE]; @@ -685,7 +690,7 @@ static channel_t *load_channels (int *num_ch, fe_type_t fe_type) { f = fopen (filename, "rb"); if (!f) { - printf ("input_dvb: failed to open dvb channel file '%s'\n", filename); + xprintf (xine, XINE_VERBOSITY_LOG, _("input_dvb: failed to open dvb channel file '%s'\n"), filename); return NULL; } @@ -697,7 +702,8 @@ static channel_t *load_channels (int *num_ch, fe_type_t fe_type) { num_channels++; } fclose (f); - printf ("input_dvb: %d channels found.\n", num_channels); + + xprintf (xine, XINE_VERBOSITY_DEBUG, "input_dvb: %d channels found.\n", num_channels); channels = malloc (sizeof (channel_t) * num_channels); @@ -875,12 +881,12 @@ static int dvb_plugin_open (input_plugin_t *this_gen) { int num_channels; char str[256]; - if ( !(tuner = tuner_init()) ) { - printf ("input_dvb: cannot open dvb device\n"); + if ( !(tuner = tuner_init(this->class->xine)) ) { + xprintf (this->class->xine, XINE_VERBOSITY_LOG, _("input_dvb: cannot open dvb device\n")); return 0; } - if ( !(channels = load_channels(&num_channels, tuner->feinfo.type)) ) { + if ( !(channels = load_channels(this->class->xine, &num_channels, tuner->feinfo.type)) ) { tuner_dispose (tuner); return 0; } @@ -893,14 +899,14 @@ static int dvb_plugin_open (input_plugin_t *this_gen) { this->channel = 0; if (!tuner_set_channel (this->tuner, &this->channels[this->channel])) { - printf ("input_dvb: tuner_set_channel failed\n"); + xprintf (this->class->xine, XINE_VERBOSITY_LOG, _("input_dvb: tuner_set_channel failed\n")); tuner_dispose(this->tuner); free(this->channels); return 0; } if ((this->fd = open (DVR_DEVICE, O_RDONLY)) < 0){ - printf ("input_dvb: cannot open dvr device '%s'\n", DVR_DEVICE); + xprintf (this->class->xine, XINE_VERBOSITY_LOG, _("input_dvb: cannot open dvr device '%s'\n"), DVR_DEVICE); tuner_dispose(this->tuner); free(this->channels); return 0; @@ -950,11 +956,11 @@ static int dvb_plugin_open (input_plugin_t *this_gen) { return 1; } -static input_plugin_t *dvb_class_get_instance (input_class_t *cls_gen, +static input_plugin_t *dvb_class_get_instance (input_class_t *class_gen, xine_stream_t *stream, const char *data) { - dvb_input_class_t *cls = (dvb_input_class_t *) cls_gen; + dvb_input_class_t *class = (dvb_input_class_t *) class_gen; dvb_input_plugin_t *this; char *mrl = (char *) data; @@ -965,7 +971,7 @@ static input_plugin_t *dvb_class_get_instance (input_class_t *cls_gen, this->stream = stream; this->mrl = strdup(mrl); - this->cls = cls; + this->class = class; this->tuner = NULL; this->channels = NULL; this->fd = -1; @@ -985,7 +991,7 @@ static input_plugin_t *dvb_class_get_instance (input_class_t *cls_gen, this->input_plugin.get_mrl = dvb_plugin_get_mrl; this->input_plugin.get_optional_data = dvb_plugin_get_optional_data; this->input_plugin.dispose = dvb_plugin_dispose; - this->input_plugin.input_class = cls_gen; + this->input_plugin.input_class = class_gen; return &this->input_plugin; } @@ -1003,8 +1009,8 @@ static char *dvb_class_get_identifier (input_class_t *this_gen) { } static void dvb_class_dispose (input_class_t *this_gen) { - dvb_input_class_t *cls = (dvb_input_class_t *) this_gen; - free (cls); + dvb_input_class_t *class = (dvb_input_class_t *) this_gen; + free (class); } static int dvb_class_eject_media (input_class_t *this_gen) { @@ -1013,10 +1019,10 @@ static int dvb_class_eject_media (input_class_t *this_gen) { static char ** dvb_class_get_autoplay_list (input_class_t *this_gen, int *num_files) { - dvb_input_class_t *cls = (dvb_input_class_t *) this_gen; + dvb_input_class_t *class = (dvb_input_class_t *) this_gen; *num_files = 1; - return cls->mrls; + return class->mrls; } static void *init_class (xine_t *xine, void *data) { diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index 291ae37ea..4003021d8 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_dvd.c,v 1.174 2003/11/26 23:44:09 f1rmb Exp $ + * $Id: input_dvd.c,v 1.175 2003/12/05 15:54:58 f1rmb Exp $ * */ @@ -538,7 +538,8 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, unsigned char *block; if(fifo == NULL) { - printf("input_dvd: values of \\beta will give rise to dom!\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_dvd: values of \\beta will give rise to dom!\n")); return NULL; } @@ -556,8 +557,8 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, } result = dvdnav_get_next_cache_block (this->dvdnav, &block, &event, &len); if(result == DVDNAV_STATUS_ERR) { - printf("input_dvd: Error getting next block from DVD (%s)\n", - dvdnav_err_to_string(this->dvdnav)); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_dvd: Error getting next block from DVD (%s)\n"), dvdnav_err_to_string(this->dvdnav)); _x_message(this->stream, XINE_MSG_READ_ERROR, dvdnav_err_to_string(this->dvdnav), NULL); if (block != buf->mem) dvdnav_free_cache_block(this->dvdnav, block); @@ -741,7 +742,7 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, } break; default: - printf("input_dvd: FIXME: Unknown event (%i)\n", event); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_dvd: FIXME: Unknown event (%i)\n", event); break; } } @@ -762,7 +763,8 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, /* the stack for storing the memory chunks from xine is full, we cannot * modify the buffer, because we would not be able to reconstruct it. * Therefore we copy the data and give the buffer back. */ - printf("input_dvd: too many buffers issued, memory stack exceeded\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_dvd: too many buffers issued, memory stack exceeded\n"); memcpy(buf->mem, block, DVD_BLOCK_SIZE); dvdnav_free_cache_block(this->dvdnav, block); buf->content = buf->mem; @@ -909,31 +911,31 @@ static void dvd_handle_events(dvd_input_plugin_t *this) { switch(event->type) { case XINE_EVENT_INPUT_MENU1: - printf("input_dvd: MENU1 key hit.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_dvd: MENU1 key hit.\n"); dvdnav_menu_call(this->dvdnav, DVD_MENU_Escape); break; case XINE_EVENT_INPUT_MENU2: - printf("input_dvd: MENU2 key hit.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_dvd: MENU2 key hit.\n"); dvdnav_menu_call(this->dvdnav, DVD_MENU_Title); break; case XINE_EVENT_INPUT_MENU3: - printf("input_dvd: MENU3 key hit.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_dvd: MENU3 key hit.\n"); dvdnav_menu_call(this->dvdnav, DVD_MENU_Root); break; case XINE_EVENT_INPUT_MENU4: - printf("input_dvd: MENU4 key hit.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_dvd: MENU4 key hit.\n"); dvdnav_menu_call(this->dvdnav, DVD_MENU_Subpicture); break; case XINE_EVENT_INPUT_MENU5: - printf("input_dvd: MENU5 key hit.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_dvd: MENU5 key hit.\n"); dvdnav_menu_call(this->dvdnav, DVD_MENU_Audio); break; case XINE_EVENT_INPUT_MENU6: - printf("input_dvd: MENU6 key hit.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_dvd: MENU6 key hit.\n"); dvdnav_menu_call(this->dvdnav, DVD_MENU_Angle); break; case XINE_EVENT_INPUT_MENU7: - printf("input_dvd: MENU7 key hit.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_dvd: MENU7 key hit.\n"); dvdnav_menu_call(this->dvdnav, DVD_MENU_Part); break; case XINE_EVENT_INPUT_NEXT: @@ -1376,7 +1378,7 @@ static int dvd_plugin_open (input_plugin_t *this_gen) { this->opened = 0; ret = dvdnav_open(&this->dvdnav, intended_dvd_device); if(ret == DVDNAV_STATUS_ERR) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_dvd: Error opening DVD device\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("input_dvd: Error opening DVD device\n")); _x_message (this->stream, XINE_MSG_READ_ERROR, intended_dvd_device, NULL); return 0; @@ -1387,7 +1389,7 @@ static int dvd_plugin_open (input_plugin_t *this_gen) { } else { ret = dvdnav_open(&this->dvdnav, intended_dvd_device); if(ret == DVDNAV_STATUS_ERR) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_dvd: Error opening DVD device\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("input_dvd: Error opening DVD device\n")); _x_message (this->stream, XINE_MSG_READ_ERROR, intended_dvd_device, NULL); return 0; @@ -1436,8 +1438,8 @@ static int dvd_plugin_open (input_plugin_t *this_gen) { tt = strtol(locator, NULL,10); dvdnav_get_number_of_titles(this->dvdnav, &titles); if((tt <= 0) || (tt > titles)) { - printf("input_dvd: Title %i is out of range (1 to %i).\n", tt, - titles); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_dvd: Title %i is out of range (1 to %i).\n", tt, titles); dvdnav_close(this->dvdnav); this->dvdnav = NULL; return 0; @@ -1450,8 +1452,8 @@ static int dvd_plugin_open (input_plugin_t *this_gen) { } dvdnav_get_number_of_parts(this->dvdnav, tt, &parts); if ((pr == 0) || (pr > parts)) { - printf("input_dvd: Part %i is out of range (1 to %i).\n", pr, - parts); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_dvd: Part %i is out of range (1 to %i).\n", pr, parts); dvdnav_close(this->dvdnav); this->dvdnav = NULL; return 0; @@ -1610,7 +1612,7 @@ static void dvd_class_dispose(input_class_t *this_gen) { static int dvd_class_eject_media (input_class_t *this_gen) { dvd_input_class_t *this = (dvd_input_class_t*)this_gen; - return media_eject_media (this->dvd_device); + return media_eject_media (this->xine, this->dvd_device); } static void *init_class (xine_t *xine, void *data) { @@ -1626,7 +1628,7 @@ static void *init_class (xine_t *xine, void *data) { printf("input_dvd.c: config = %p\n", config); #endif - this = (dvd_input_class_t *) malloc (sizeof (dvd_input_class_t)); + this = (dvd_input_class_t *) xine_xmalloc (sizeof (dvd_input_class_t)); this->input_class.get_instance = dvd_class_get_instance; this->input_class.get_identifier = dvd_class_get_identifier; @@ -1725,6 +1727,9 @@ static void *init_class (xine_t *xine, void *data) { /* * $Log: input_dvd.c,v $ + * Revision 1.175 2003/12/05 15:54:58 f1rmb + * cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's relevant too. Small other little fix (can't remember). Change few internal function prototype because it xine_t pointer need to be used if some xine's internal sections. NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, without invasive changes. To be continued... + * * Revision 1.174 2003/11/26 23:44:09 f1rmb * xprintf clean pass. xprintf now log into new XINE_LOG_TRACE log buffer. scratch buffer enhancement (thanks Thibaut for the malloc tips), enlarge log buffer from 25 lines (very useless), to 150 (better). * diff --git a/src/input/input_file.c b/src/input/input_file.c index d05a9ba83..964c79488 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_file.c,v 1.87 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: input_file.c,v 1.88 2003/12/05 15:54:58 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -588,7 +588,8 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, linksize = readlink(fullfilename, linkbuf, XINE_PATH_MAX + XINE_NAME_MAX); if(linksize < 0) - printf ("input_file: readlink() failed: %s\n", strerror(errno)); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "input_file: readlink() failed: %s\n", strerror(errno)); else { dir_files[num_dir_files].link = (char *) xine_xmalloc(linksize + 1); strncpy(dir_files[num_dir_files].link, linkbuf, linksize); @@ -625,7 +626,8 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, linksize = readlink(fullfilename, linkbuf, XINE_PATH_MAX + XINE_NAME_MAX); if(linksize < 0) { - printf ("input_file: readlink() failed: %s\n", strerror(errno)); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "input_file: readlink() failed: %s\n", strerror(errno)); } else { hide_files[num_hide_files].link = (char *) @@ -660,7 +662,8 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, linksize = readlink(fullfilename, linkbuf, XINE_PATH_MAX + XINE_NAME_MAX); if(linksize < 0) { - printf ("input_file: readlink() failed: %s\n", strerror(errno)); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "input_file: readlink() failed: %s\n", strerror(errno)); } else { norm_files[num_norm_files].link = (char *) diff --git a/src/input/input_mms.c b/src/input/input_mms.c index 76ada3774..b6cdf2daf 100644 --- a/src/input/input_mms.c +++ b/src/input/input_mms.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_mms.c,v 1.43 2003/11/26 23:44:09 f1rmb Exp $ + * $Id: input_mms.c,v 1.44 2003/12/05 15:54:58 f1rmb Exp $ * * mms input plugin based on work from major mms */ @@ -365,7 +365,7 @@ static input_plugin_t *mms_class_get_instance (input_class_t *cls_gen, xine_stre return NULL; } - this = (mms_input_plugin_t *) malloc (sizeof (mms_input_plugin_t)); + this = (mms_input_plugin_t *) xine_xmalloc (sizeof (mms_input_plugin_t)); cls->ip = this; this->stream = stream; this->mms = NULL; diff --git a/src/input/input_net.c b/src/input/input_net.c index 666a33a1a..16640ce35 100644 --- a/src/input/input_net.c +++ b/src/input/input_net.c @@ -20,7 +20,7 @@ * Read from a tcp network stream over a lan (put a tweaked mp1e encoder the * other end and you can watch tv anywhere in the house ..) * - * $Id: input_net.c,v 1.55 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: input_net.c,v 1.56 2003/12/05 15:54:58 f1rmb Exp $ * * how to set up mp1e for use with this plugin: * @@ -272,7 +272,8 @@ static off_t net_plugin_read (input_plugin_t *this_gen, if( (len-total) > 0 ) { n = _x_read_abort (this->stream, this->fh, &buf[total], len-total); - printf ("input_net: got %lld bytes (%lld/%lld bytes read)\n", n,total,len); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_net: got %lld bytes (%lld/%lld bytes read)\n", n,total,len); if (n < 0) { _x_message(this->stream, XINE_MSG_READ_ERROR, this->host_port, NULL); @@ -348,7 +349,8 @@ static off_t net_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin if( this->curpos <= this->preview_size ) this->curpos = offset; else - printf ("input_net: cannot seek back! (%lld > %lld)\n", this->curpos, offset); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_net: cannot seek back! (%lld > %lld)\n", this->curpos, offset); } else { offset -= this->curpos; diff --git a/src/input/input_pnm.c b/src/input/input_pnm.c index efa9bee59..879295ab2 100644 --- a/src/input/input_pnm.c +++ b/src/input/input_pnm.c @@ -120,8 +120,8 @@ static buf_element_t *pnm_plugin_read_block (input_plugin_t *this_gen, static off_t pnm_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin) { pnm_input_plugin_t *this = (pnm_input_plugin_t *) this_gen; - printf ("input_pnm: seek %lld bytes, origin %d\n", - offset, origin); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pnm: seek %lld bytes, origin %d\n", offset, origin); /* only realtive forward-seeking is implemented */ diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c index 8c6d8527c..d2c064142 100644 --- a/src/input/input_pvr.c +++ b/src/input/input_pvr.c @@ -38,7 +38,7 @@ * usage: * xine pvr:/<prefix_to_tmp_files>\!<prefix_to_saved_files>\!<max_page_age> * - * $Id: input_pvr.c,v 1.37 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: input_pvr.c,v 1.38 2003/12/05 15:54:58 f1rmb Exp $ */ /************************************************************************** @@ -396,9 +396,8 @@ static void pvrscr_exit (scr_plugin_t *scr) { static pvrscr_t* pvrscr_init (void) { pvrscr_t *this; - this = malloc(sizeof(*this)); - memset(this, 0, sizeof(*this)); - + this = (pvrscr_t *) xine_xmalloc(sizeof(pvrscr_t)); + this->scr.interface_version = 2; this->scr.get_priority = pvrscr_get_priority; this->scr.set_speed = pvrscr_set_speed; @@ -614,7 +613,8 @@ static int pvr_break_rec_page (pvr_input_plugin_t *this) { this->rec_fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0666 ); if( this->rec_fd == -1 ) { - printf("input_pvr: error creating pvr file (%s)\n", filename); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_pvr: error creating pvr file (%s)\n"), filename); free(filename); return 0; } @@ -659,12 +659,14 @@ static int pvr_rec_file(pvr_input_plugin_t *this) { } pos = (off_t)(this->rec_blk - this->page_block[this->rec_page]) * PVR_BLOCK_SIZE; if( lseek (this->rec_fd, pos, SEEK_SET) != pos ) { - printf("input_pvr: error setting position for writing %lld\n", pos); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: error setting position for writing %lld\n", pos); return 0; } if( this->rec_fd != -1 ) { if( write(this->rec_fd, this->data, PVR_BLOCK_SIZE) < PVR_BLOCK_SIZE ) { - printf("input_pvr: short write to pvr file (out of disk space?)\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: short write to pvr file (out of disk space?)\n"); return 0; } this->rec_blk++; @@ -766,7 +768,8 @@ static int pvr_play_file(pvr_input_plugin_t *this, fifo_buffer_t *fifo, uint8_t this->play_fd = open(filename, O_RDONLY ); if( this->play_fd == -1 ) { - printf("input_pvr: error opening pvr file (%s)\n", filename); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_pvr: error opening pvr file (%s)\n"), filename); free(filename); return 0; } @@ -780,11 +783,13 @@ static int pvr_play_file(pvr_input_plugin_t *this, fifo_buffer_t *fifo, uint8_t pos = (off_t)(this->play_blk - this->page_block[this->play_page]) * PVR_BLOCK_SIZE; if( lseek (this->play_fd, pos, SEEK_SET) != pos ) { - printf("input_pvr: error setting position for reading %lld\n", pos); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: error setting position for reading %lld\n", pos); return 0; } if( read(this->play_fd, buffer, PVR_BLOCK_SIZE) < PVR_BLOCK_SIZE ) { - printf("input_pvr: short read from pvr file\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: short read from pvr file\n"); return 0; } this->play_blk++; @@ -839,7 +844,8 @@ static void *pvr_loop (void *this_gen) { num_bytes = read (this->dev_fd, this->data + total_bytes, PVR_BLOCK_SIZE-total_bytes); if (num_bytes <= 0) { if (num_bytes < 0) - printf ("input_pvr: read error (%s)\n", strerror(errno)); + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + _("input_pvr: read error (%s)\n"), strerror(errno)); this->pvr_running = 0; break; } @@ -847,7 +853,7 @@ static void *pvr_loop (void *this_gen) { } if( this->data[0] || this->data[1] || this->data[2] != 1 || this->data[3] != 0xba ) { - lprintf("resyncing mpeg stream\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "resyncing mpeg stream\n"); if( !pvr_mpeg_resync(this->dev_fd) ) { this->pvr_running = 0; @@ -1040,12 +1046,14 @@ static void pvr_event_handler (pvr_input_plugin_t *this) { pthread_mutex_lock(&this->dev_lock); #ifdef USE_V4L2 if( ioctl(this->dev_fd, VIDIOC_S_INPUT, &this->input) ) - printf("input_pvr: error setting v4l2 input\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: error setting v4l2 input\n"); vf.frequency = this->frequency; vf.tuner = 0; if( ioctl(this->dev_fd, VIDIOC_S_FREQUENCY, &vf) ) - printf("input_pvr: error setting v4l2 frequency\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: error setting v4l2 frequency\n"); /* workaround an ivtv bug where stream gets bad mpeg2 artifacts * after changing inputs. reopening the device fixes it. @@ -1053,16 +1061,19 @@ static void pvr_event_handler (pvr_input_plugin_t *this) { close(this->dev_fd); this->dev_fd = open (PVR_DEVICE, O_RDWR); if (this->dev_fd == -1) { - printf("input_pvr: error opening device %s\n", PVR_DEVICE ); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: error opening device %s\n", PVR_DEVICE ); return; } #else v.norm = VIDEO_MODE_NTSC; v.channel = this->input; if( ioctl(this->dev_fd, VIDIOCSCHAN, &v) ) - printf("input_pvr: error setting v4l input\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: error setting v4l input\n"); if( ioctl(this->dev_fd, VIDIOCSFREQ, &this->frequency) ) - printf("input_pvr: error setting v4l frequency\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: error setting v4l frequency\n"); #endif pthread_mutex_unlock(&this->dev_lock); @@ -1164,24 +1175,28 @@ static void pvr_event_handler (pvr_input_plugin_t *this) { close(this->dev_fd); this->dev_fd = open (PVR_DEVICE, O_RDWR); if (this->dev_fd == -1) { - printf("input_pvr: error opening device %s\n", PVR_DEVICE ); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_pvr: error opening device %s\n"), PVR_DEVICE ); return; } if (ioctl(this->dev_fd, IVTV_IOC_G_CODEC, &codec) < 0) { - printf("input_pvr: IVTV_IOC_G_CODEC failed, maybe API changed?\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_pvr: IVTV_IOC_G_CODEC failed, maybe API changed?\n")); } else { codec.bitrate = mpeg_data->bitrate_mean; codec.bitrate_peak = mpeg_data->bitrate_peak; codec.stream_type = IVTV_STREAM_DVD; if (ioctl(this->dev_fd, IVTV_IOC_S_CODEC, &codec) < 0) { - printf("input_pvr: IVTV_IOC_S_CODEC failed, maybe API changed?\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_pvr: IVTV_IOC_S_CODEC failed, maybe API changed?\n")); } } pthread_mutex_unlock(&this->dev_lock); #else - printf("input_pvr: mpeg2 settings not supported with old api\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_pvr: mpeg2 settings not supported with old api\n")); #endif } break; @@ -1210,7 +1225,7 @@ static buf_element_t *pvr_plugin_read_block (input_plugin_t *this_gen, fifo_buff int speed = this->stream->xine->clock->speed; if( !this->pvr_running ) { - printf("input_pvr: thread died, aborting\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_pvr: thread died, aborting\n"); return NULL; } @@ -1417,13 +1432,15 @@ static int pvr_plugin_open (input_plugin_t *this_gen ) { this->dev_fd = open (PVR_DEVICE, O_RDWR); if (this->dev_fd == -1) { - printf("input_pvr: error opening device %s\n", PVR_DEVICE ); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_pvr: error opening device %s\n"), PVR_DEVICE ); return 0; } #ifdef USE_V4L2 if (ioctl(this->dev_fd, IVTV_IOC_G_CODEC, &codec) < 0) { - printf("input_pvr: IVTV_IOC_G_CODEC failed, maybe API changed?\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_pvr: IVTV_IOC_G_CODEC failed, maybe API changed?\n")); } else { codec.bitrate_mode = 0; codec.bitrate = 6000000; @@ -1431,7 +1448,8 @@ static int pvr_plugin_open (input_plugin_t *this_gen ) { codec.stream_type = IVTV_STREAM_DVD; if (ioctl(this->dev_fd, IVTV_IOC_S_CODEC, &codec) < 0) { - printf("input_pvr: IVTV_IOC_S_CODEC failed, maybe API changed?\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_pvr: IVTV_IOC_S_CODEC failed, maybe API changed?\n")); } } #endif @@ -1452,8 +1470,8 @@ static int pvr_plugin_open (input_plugin_t *this_gen ) { if ((err = pthread_create (&this->pvr_thread, NULL, pvr_loop, this)) != 0) { - fprintf (stderr, "input_pvr: can't create new thread (%s)\n", - strerror(err)); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: can't create new thread (%s)\n", strerror(err)); abort(); } @@ -1557,13 +1575,11 @@ static void pvr_class_dispose (input_class_t *this_gen) { static void *init_plugin (xine_t *xine, void *data) { pvr_input_class_t *this; - config_values_t *config; this = (pvr_input_class_t *) xine_xmalloc (sizeof (pvr_input_class_t)); this->xine = xine; this->config = xine->config; - config = xine->config; this->input_class.get_instance = pvr_class_get_instance; this->input_class.get_identifier = pvr_class_get_identifier; diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c index ddd8456c4..02b410471 100644 --- a/src/input/input_stdin_fifo.c +++ b/src/input/input_stdin_fifo.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_stdin_fifo.c,v 1.54 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: input_stdin_fifo.c,v 1.55 2003/12/05 15:54:58 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -61,6 +61,7 @@ typedef struct { char seek_buf[BUFSIZE]; + xine_t *xine; } stdin_input_plugin_t; typedef struct { @@ -70,6 +71,8 @@ typedef struct { xine_t *xine; } stdin_input_class_t; +static off_t stdin_plugin_get_current_pos (input_plugin_t *this_gen); + static off_t stdin_plugin_read (input_plugin_t *this_gen, @@ -131,8 +134,6 @@ static buf_element_t *stdin_plugin_read_block (input_plugin_t *this_gen, fifo_bu } /* forward reference */ -static off_t stdin_plugin_get_current_pos (input_plugin_t *this_gen); - static off_t stdin_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin) { stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen; @@ -156,7 +157,8 @@ static off_t stdin_plugin_seek (input_plugin_t *this_gen, off_t offset, int orig if( this->curpos <= this->preview_size ) this->curpos = offset; else - printf ("stdin: cannot seek back! (%lld > %lld)\n", this->curpos, offset); + xprintf (this->xine, XINE_VERBOSITY_LOG, + _("stdin: cannot seek back! (%lld > %lld)\n"), this->curpos, offset); } else { offset -= this->curpos; @@ -243,8 +245,7 @@ static int stdin_plugin_open (input_plugin_t *this_gen ) { lprintf("filename '%s'\n", filename); if (this->fh == -1) { - printf ("stdin: failed to open '%s'\n", - filename); + xprintf (this->xine, XINE_VERBOSITY_LOG, _("stdin: failed to open '%s'\n"), filename); return 0; } } @@ -268,10 +269,10 @@ static int stdin_plugin_open (input_plugin_t *this_gen ) { } -static input_plugin_t *stdin_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, - const char *data) { +static input_plugin_t *stdin_class_get_instance (input_class_t *class_gen, + xine_stream_t *stream, const char *data) { - /* stdin_input_class_t *cls = (stdin_input_class_t *) cls_gen; */ + stdin_input_class_t *class = (stdin_input_class_t *) class_gen; stdin_input_plugin_t *this; char *mrl = strdup(data); int fh; @@ -308,6 +309,7 @@ static input_plugin_t *stdin_class_get_instance (input_class_t *cls_gen, xine_st this->curpos = 0; this->mrl = mrl; this->fh = fh; + this->xine = class->xine; this->input_plugin.open = stdin_plugin_open; this->input_plugin.get_capabilities = stdin_plugin_get_capabilities; @@ -320,7 +322,7 @@ static input_plugin_t *stdin_class_get_instance (input_class_t *cls_gen, xine_st this->input_plugin.get_mrl = stdin_plugin_get_mrl; this->input_plugin.dispose = stdin_plugin_dispose; this->input_plugin.get_optional_data = stdin_plugin_get_optional_data; - this->input_plugin.input_class = cls_gen; + this->input_plugin.input_class = class_gen; /* * buffering control diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c index 2ccfc397a..9eacc3652 100644 --- a/src/input/input_v4l.c +++ b/src/input/input_v4l.c @@ -56,6 +56,8 @@ /* Used to capture the audio data */ +#define ALSA_PCM_NEW_HW_PARAMS_API +#define ALSA_PCM_NEW_SW_PARAMS_API #ifdef HAVE_ALSA #include <alsa/asoundlib.h> #endif @@ -88,15 +90,14 @@ static struct { /* #define LOG */ -#define PLUGIN "input_v4l" #ifdef LOG -#define DBGPRINT(args...) do { printf(PLUGIN ": " args); fflush(stdout); } while(0) +#define DBGPRINT(args...) do { printf("input_v4l: " args); fflush(stdout); } while(0) #else -#define DBGPRINT(args...) {} +#define DBGPRINT(args...) do {} while(0) #endif -#define PRINT(args...) printf(PLUGIN ": " args) +#define PRINT(args...) printf("input_v4l: " args) #if !defined(NDELAY) && defined(O_NDELAY) #define FNDELAY O_NDELAY @@ -341,8 +342,7 @@ static pvrscr_t* pvrscr_init (void) { pvrscr_t *this; - this = malloc(sizeof(*this)); - memset(this, 0, sizeof(*this)); + this = (pvrscr_t *) xine_xmalloc(sizeof(pvrscr_t)); this->scr.interface_version = 2; this->scr.get_priority = pvrscr_get_priority; @@ -665,7 +665,7 @@ static int search_by_channel(v4l_input_plugin_t *this, char *input_source) } if (strstr(this->video_channel.name, input_source) == NULL) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "Tuner name not found\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("Tuner name not found\n")); return -1; } @@ -1117,7 +1117,7 @@ static int open_audio_capture_device(v4l_input_plugin_t *this) /* Set sample rate */ if (this->audio_capture) { this->exact_rate = snd_pcm_hw_params_set_rate_near(this->pcm_handle, - this->pcm_hwparams, rate, &this->dir); + this->pcm_hwparams, &rate, &this->dir); if (this->dir != 0) { PRINT("Audio :s The rate %d Hz is not supported by your hardware.\n", rate); @@ -1188,7 +1188,7 @@ static int v4l_adjust_realtime_speed(v4l_input_plugin_t *this, fifo_buffer_t *fi /* Buffer is empty, and we did not pause playback */ report_progress(this->stream, SCR_PAUSED); - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "Buffer is empty, pausing playback (used: %d, num_free: %d)\r\n", num_used, num_free); @@ -1210,7 +1210,7 @@ static int v4l_adjust_realtime_speed(v4l_input_plugin_t *this, fifo_buffer_t *fi if (scr_tunning == SCR_PAUSED) { if (2 * num_used > num_free) { /* Playback was paused, but we have normal buffer usage again */ - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "Resuming playback (used: %d, free: %d)\r\n", num_used, num_free); this->scr_tunning = 0; @@ -1249,7 +1249,7 @@ static int v4l_adjust_realtime_speed(v4l_input_plugin_t *this, fifo_buffer_t *fi /* Check if speed adjustment should be changed */ if (scr_tunning != this->scr_tunning) { this->scr_tunning = scr_tunning; - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "scr tunning = %d (used: %d, free: %d)\r\n", scr_tunning, num_used, num_free); pvrscr_speed_tunning(this->scr, 1.0 + (0.01 * scr_tunning)); } @@ -1261,7 +1261,7 @@ static int v4l_adjust_realtime_speed(v4l_input_plugin_t *this, fifo_buffer_t *fi */ this->scr_tunning = 0; - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "scr tunning resetting (used: %d, free: %d\r\n", num_used, num_free); pvrscr_speed_tunning(this->scr, 1.0); @@ -1832,7 +1832,7 @@ static input_plugin_t *v4l_class_get_video_instance (input_class_t *cls_gen, DBGPRINT("(%d) Cannot open v4l device: %s\n", this->video_fd, strerror(errno)); xine_log(this->stream->xine, XINE_LOG_MSG, - PLUGIN ": Sorry, could not open %s\n", entry->str_value); + _("input_v4l: Sorry, could not open %s\n"), entry->str_value); is_ok = 0; } else DBGPRINT("Device opened, tv %d\n", this->video_fd); @@ -1840,8 +1840,7 @@ static input_plugin_t *v4l_class_get_video_instance (input_class_t *cls_gen, /* Get capabilities */ if (is_ok && ioctl(this->video_fd,VIDIOCGCAP,&this->video_cap) < 0) { xine_log(this->stream->xine, XINE_LOG_MSG, - PLUGIN ": Sorry your v4l card doesn't support some features" - " needed by xine\n"); + _("input_v4l: Sorry your v4l card doesn't support some features needed by xine\n")); DBGPRINT ("VIDIOCGCAP ioctl went wrong\n"); is_ok = 0;; } @@ -1849,8 +1848,8 @@ static input_plugin_t *v4l_class_get_video_instance (input_class_t *cls_gen, if (is_ok && !(this->video_cap.type & VID_TYPE_CAPTURE)) { /* Capture is not supported by the device. This is a must though! */ xine_log(this->stream->xine, XINE_LOG_MSG, - PLUGIN ": Sorry, your v4l card doesn't support frame grabbing." - " This is needed by xine though\n"); + _("input_v4l: Sorry, your v4l card doesn't support frame grabbing." + " This is needed by xine though\n")); DBGPRINT("Grab device does not handle capture\n"); is_ok = 0; @@ -1858,8 +1857,8 @@ static input_plugin_t *v4l_class_get_video_instance (input_class_t *cls_gen, if (is_ok && set_input_source(this, this->tuner_name) <= 0) {\ xine_log(this->stream->xine, XINE_LOG_MSG, - PLUGIN ": Could not locate the tuner name [%s] on your v4l card\n", - this->tuner_name); + _("input_v4l: Could not locate the tuner name [%s] on your v4l card\n"), + this->tuner_name); is_ok = 0; } @@ -1904,16 +1903,16 @@ static input_plugin_t *v4l_class_get_radio_instance (input_class_t *cls_gen, if (this->radio_fd < 0) { xine_log(this->stream->xine, XINE_LOG_MSG, - PLUGIN ": Allthough normally we would be able to handle this MRL,\n" - PLUGIN ": I am unable to open the radio device.[%s]\n", - entry->str_value); + _("input_v4l: Allthough normally we would be able to handle this MRL,\n" + "input_v4l: I am unable to open the radio device.[%s]\n"), + entry->str_value); is_ok = 0; } else DBGPRINT("Device opened, radio %d\n", this->radio_fd); if (is_ok && set_input_source(this, this->tuner_name) <= 0) { xine_log(this->stream->xine, XINE_LOG_MSG, - PLUGIN ": Sorry, you Radio device doesn't support this tunername\n"); + _("input_v4l: Sorry, you Radio device doesn't support this tunername\n")); is_ok = 0; } diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c index f63c5ba09..523af25f7 100644 --- a/src/input/input_vcd.c +++ b/src/input/input_vcd.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_vcd.c,v 1.69 2003/10/19 23:48:47 rockyb Exp $ + * $Id: input_vcd.c,v 1.70 2003/12/05 15:54:58 f1rmb Exp $ * */ @@ -78,9 +78,9 @@ typedef struct { typedef struct { - input_class_t input_class; + input_class_t input_class; - xine_t *xine; + xine_t *xine; /* FIXME: add thread/mutex stuff to protect against multiple instantiation */ @@ -148,7 +148,8 @@ static int input_vcd_read_toc (vcd_input_class_t *this, int fd) { /* read TOC header */ if ( ioctl(fd, CDROMREADTOCHDR, &this->tochdr) == -1 ) { - printf ("input_vcd : error in ioctl CDROMREADTOCHDR\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "input_vcd : error in ioctl CDROMREADTOCHDR\n"); return -1; } @@ -157,7 +158,8 @@ static int input_vcd_read_toc (vcd_input_class_t *this, int fd) { this->tocent[i-1].cdte_track = i; this->tocent[i-1].cdte_format = CDROM_MSF; if ( ioctl(fd, CDROMREADTOCENTRY, &this->tocent[i-1]) == -1 ) { - printf ("input_vcd: error in ioctl CDROMREADTOCENTRY for track %d\n", i); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "input_vcd: error in ioctl CDROMREADTOCENTRY for track %d\n", i); return -1; } } @@ -168,7 +170,8 @@ static int input_vcd_read_toc (vcd_input_class_t *this, int fd) { if (ioctl(fd, CDROMREADTOCENTRY, &this->tocent[this->tochdr.cdth_trk1]) == -1 ) { - printf ("input_vcd: error in ioctl CDROMREADTOCENTRY for lead-out\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "input_vcd: error in ioctl CDROMREADTOCENTRY for lead-out\n"); return -1; } @@ -184,7 +187,8 @@ static int input_vcd_read_toc (vcd_input_class_t *this, int fd) { /* read TOC header */ if ( ioctl(fd, CDIOREADTOCHEADER, &this->tochdr) == -1 ) { - printf ("input_vcd : error in ioctl CDROMREADTOCHDR\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "input_vcd : error in ioctl CDROMREADTOCHDR\n"); return -1; } @@ -199,7 +203,8 @@ static int input_vcd_read_toc (vcd_input_class_t *this, int fd) { te.data = this->tocent; if ( ioctl(fd, CDIOREADTOCENTRYS, &te) == -1 ){ - printf ("input_vcd: error in ioctl CDROMREADTOCENTRY\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "input_vcd: error in ioctl CDROMREADTOCENTRY\n"); return -1; } @@ -246,8 +251,8 @@ static int sun_vcd_read(vcd_input_plugin_t *this, long lba, cdsector_t *data) cdxa.cdxa_format = CDROM_XA_SECTOR_DATA; if(ioctl(this->fd,CDROMCDXA,&cdxa)==-1) { - perror("CDROMCDXA"); - return -1; + xprintf(this->cls->xine, XINE_VERBOSITY_DEBUG, "CDROMCDXA: %s\n", strerror(errno)); + return -1; } } #else @@ -258,8 +263,8 @@ static int sun_vcd_read(vcd_input_plugin_t *this, long lba, cdsector_t *data) cdread.cdread_buflen = 2336; if(ioctl(this->fd,CDROMREADMODE2,&cdread)==-1) { - perror("CDROMREADMODE2"); - return -1; + xprintf(this->cls->xine, XINE_VERBOSITY_DEBUG, "CDROMREADMODE2: %s\n", strerror(errno)); + return -1; } } #endif @@ -314,11 +319,12 @@ static int sun_vcd_read(vcd_input_plugin_t *this, long lba, cdsector_t *data) sc.uscsi_flags = USCSI_ISOLATE | USCSI_READ; sc.uscsi_timeout = 20; if (ioctl(this->fd, USCSICMD, &sc)) { - perror("USCSICMD: READ CD"); + xprintf(this->cls->xine, XINE_VERBOSITY_DEBUG, "USCSICMD: READ CD: %s\n", strerror(errno)); return -1; } if (sc.uscsi_status) { - printf ("scsi command failed with status %d\n", sc.uscsi_status); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, + "scsi command failed with status %d\n", sc.uscsi_status); return -1; } } @@ -365,7 +371,8 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen, memcpy (&data, &msf, sizeof (msf)); if (ioctl (this->fd, CDROMREADRAW, &data) == -1) { - printf ("input_vcd: error in CDROMREADRAW\n"); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, + "input_vcd: error in CDROMREADRAW\n"); return 0; } @@ -400,11 +407,11 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen, do { if (lseek (this->fd, this->cur_sec * bsize, SEEK_SET) == -1) { - printf ("input_vcd: seek error %d\n", errno); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: seek error %d\n", errno); return 0; } if (read (this->fd, &data, bsize) == -1) { - printf ("input_vcd: read error %d\n", errno); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: read error %d\n", errno); return 0; } this->cur_sec++; @@ -442,7 +449,7 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen, lba = (this->cur_min * 60 + this->cur_sec) * 75L + this->cur_frame; if (sun_vcd_read(this, lba, &data) < 0) { - printf ("input_vcd: read data failed\n"); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: read data failed\n"); return 0; } @@ -500,7 +507,7 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen, memcpy (&data, &msf, sizeof (msf)); if (ioctl (this->fd, CDROMREADRAW, &data) == -1) { - printf ("input_vcd: error in CDROMREADRAW\n"); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: error in CDROMREADRAW\n"); return NULL; } @@ -540,11 +547,11 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen, do { if (lseek (this->fd, this->cur_sec * bsize, SEEK_SET) == -1) { - printf ("input_vcd: seek error %d\n", errno); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: seek error %d\n", errno); return NULL; } if (read (this->fd, &data, bsize) == -1) { - printf ("input_vcd: read error %d\n", errno); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: read error %d\n", errno); return NULL; } this->cur_sec++; @@ -587,7 +594,7 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen, lba = (this->cur_min * 60 + this->cur_sec) * 75L + this->cur_frame; if (sun_vcd_read (this, lba, &data) < 0) { - printf ("input_vcd: read data failed\n"); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: read data failed\n"); return NULL; } @@ -659,7 +666,8 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen, break; case SEEK_CUR: if (offset) - printf ("input_vcd: SEEK_CUR not implemented for offset != 0\n"); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, + "input_vcd: SEEK_CUR not implemented for offset != 0\n"); /* printf ("input_vcd: current pos: %02d:%02d:%02d\n", @@ -677,8 +685,8 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen, break; default: - printf ("input_vcd: error seek to origin %d not implemented!\n", - origin); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, + "input_vcd: error seek to origin %d not implemented!\n", origin); return 0; } @@ -710,7 +718,7 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen, case SEEK_CUR: if (offset) - printf ("input_vcd: SEEK_CUR not implemented for offset != 0\n"); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: SEEK_CUR not implemented for offset != 0\n"); sector_pos = this->cur_sec; @@ -718,8 +726,8 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen, break; default: - printf ("input_vcd: error seek to origin %d not implemented!\n", - origin); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, + "input_vcd: error seek to origin %d not implemented!\n", origin); return 0; } @@ -837,13 +845,15 @@ static int vcd_plugin_open (input_plugin_t *this_gen) { while (*filename == '/') filename++; if (sscanf (filename, "%d", &this->cur_track) != 1) { - printf ("input_vcd: malformed MRL. Use vcdo:/<track #>\n"); + xprintf (cls->xine, XINE_VERBOSITY_LOG, + _("input_vcd: malformed MRL. Use vcdo:/<track #>\n")); return 0; } if (this->cur_track>=this->cls->total_tracks) { - printf ("input_vcd: invalid track %d (valid range: 0 .. %d)\n", - this->cur_track, this->cls->total_tracks-1); + xprintf (cls->xine, XINE_VERBOSITY_LOG, + _("input_vcd: invalid track %d (valid range: 0 .. %d)\n"), + this->cur_track, this->cls->total_tracks-1); return 0; } @@ -855,7 +865,7 @@ static int vcd_plugin_open (input_plugin_t *this_gen) { { int bsize = 2352; if (ioctl (this->fd, CDRIOCSETBLOCKSIZE, &bsize) == -1) { - printf ("input_vcd: error in CDRIOCSETBLOCKSIZE %d\n", errno); + xprintf (cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: error in CDRIOCSETBLOCKSIZE %d\n", errno); return 0; } @@ -932,7 +942,7 @@ static int vcd_class_eject_media (input_class_t *this_gen) { vcd_input_class_t *this = (vcd_input_class_t *) this_gen; - return media_eject_media (this->device); + return media_eject_media (this->xine, this->device); } static xine_mrl_t **vcd_class_get_dir (input_class_t *this_gen, const char *filename, @@ -950,7 +960,8 @@ static xine_mrl_t **vcd_class_get_dir (input_class_t *this_gen, const char *file fd = open (this->device, O_RDONLY); if (fd == -1) { - printf ("unable to open %s: %s.\n", this->device, strerror(errno)); + xprintf (this->xine, XINE_VERBOSITY_LOG, + _("unable to open %s: %s.\n"), this->device, strerror(errno)); return NULL; } @@ -958,7 +969,7 @@ static xine_mrl_t **vcd_class_get_dir (input_class_t *this_gen, const char *file close (fd); fd = -1; - printf ("vcd_read_toc failed\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "vcd_read_toc failed\n"); return NULL; } @@ -1025,7 +1036,8 @@ static char ** vcd_class_get_autoplay_list (input_class_t *this_gen, int *num_fi fd = open (this->device, O_RDONLY); if (fd == -1) { - printf ("input_vcd: unable to open %s: %s.\n", this->device, strerror(errno)); + xprintf (this->xine, XINE_VERBOSITY_LOG, + _("input_vcd: unable to open %s: %s.\n"), this->device, strerror(errno)); return NULL; } @@ -1033,7 +1045,7 @@ static char ** vcd_class_get_autoplay_list (input_class_t *this_gen, int *num_fi close (fd); fd = -1; - printf ("input_vcd: vcd_read_toc failed\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "input_vcd: vcd_read_toc failed\n"); return NULL; } diff --git a/src/input/libreal/asmrp.c b/src/input/libreal/asmrp.c index 928e137fb..c426acbba 100644 --- a/src/input/libreal/asmrp.c +++ b/src/input/libreal/asmrp.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: asmrp.c,v 1.4 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: asmrp.c,v 1.5 2003/12/05 15:54:58 f1rmb Exp $ * * a parser for real's asm rules * @@ -417,7 +417,7 @@ static int asmrp_operand (asmrp_t *p) { i = asmrp_find_id (p, p->str); if (i<0) { - printf ("error: unknown identifier %s\n", p->str); + lprintf ("error: unknown identifier %s\n", p->str); } ret = p->sym_tab[i].v; @@ -444,7 +444,7 @@ static int asmrp_operand (asmrp_t *p) { break; default: - printf ("syntax error, $ number or ( expected\n"); + lprintf ("syntax error, $ number or ( expected\n"); abort(); } diff --git a/src/input/libreal/real.c b/src/input/libreal/real.c index c0a292ef9..c7f4c9793 100644 --- a/src/input/libreal/real.c +++ b/src/input/libreal/real.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real.c,v 1.11 2003/12/04 22:14:53 jstembridge Exp $ + * $Id: real.c,v 1.12 2003/12/05 15:54:58 f1rmb Exp $ * * special functions for real streams. * adopted from joschkas real tools. @@ -36,6 +36,7 @@ #include "real.h" #include "asmrp.h" #include "sdpplin.h" +#include "xine_internal.h" #include "xineutils.h" const unsigned char xor_table[] = { @@ -418,7 +419,7 @@ static int select_mlti_data(const char *mlti_chunk, int mlti_size, int selection numrules=BE_16(mlti_chunk); if (codec >= numrules) { - printf("codec index >= number of codecs. %i %i\n", codec, numrules); + lprintf("codec index >= number of codecs. %i %i\n", codec, numrules); return 0; } @@ -462,7 +463,7 @@ rmff_header_t *real_parse_sdp(char *data, char *stream_rules, uint32_t bandwidth if (!desc) return NULL; - header=xine_xmalloc(sizeof(rmff_header_t)); + header = xine_xmalloc(sizeof(rmff_header_t)); header->fileheader=rmff_new_fileheader(4+desc->stream_count); header->cont=rmff_new_cont( @@ -471,7 +472,7 @@ rmff_header_t *real_parse_sdp(char *data, char *stream_rules, uint32_t bandwidth desc->copyright, desc->abstract); header->data=rmff_new_dataheader(0,0); - header->streams=xine_xmalloc(sizeof(rmff_mdpr_t*)*(desc->stream_count+1)); + header->streams = xine_xmalloc(sizeof(rmff_mdpr_t*)*(desc->stream_count+1)); lprintf("number of streams: %u\n", desc->stream_count); for (i=0; i<desc->stream_count; i++) { @@ -553,7 +554,7 @@ int real_get_rdt_chunk(rtsp_t *rtsp_session, char *buffer) { if (n<8) return 0; if (header[0] != 0x24) { - printf("rdt chunk not recognized: got 0x%02x\n", header[0]); + lprintf("rdt chunk not recognized: got 0x%02x\n", header[0]); return 0; } size=(header[1]<<12)+(header[2]<<8)+(header[3]); @@ -637,7 +638,7 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid { char *alert=rtsp_search_answers(rtsp_session,"Alert"); if (alert) { - printf("real: got message from server:\n%s\n", alert); + lprintf("real: got message from server:\n%s\n", alert); } rtsp_send_ok(rtsp_session); return NULL; @@ -646,18 +647,18 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid /* receive description */ size=0; if (!rtsp_search_answers(rtsp_session,"Content-length")) - printf("real: got no Content-length!\n"); + lprintf("real: got no Content-length!\n"); else size=atoi(rtsp_search_answers(rtsp_session,"Content-length")); if (!rtsp_search_answers(rtsp_session,"ETag")) - printf("real: got no ETag!\n"); + lprintf("real: got no ETag!\n"); else session_id=strdup(rtsp_search_answers(rtsp_session,"ETag")); lprintf("Stream description size: %i\n", size); - description=malloc(sizeof(char)*(size+1)); + description = malloc(sizeof(char)*(size+1)); rtsp_read_data(rtsp_session, description, size); description[size]=0; diff --git a/src/input/libreal/rmff.c b/src/input/libreal/rmff.c index 6a57255b9..4bddd6987 100644 --- a/src/input/libreal/rmff.c +++ b/src/input/libreal/rmff.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: rmff.c,v 1.6 2003/12/04 22:11:25 jstembridge Exp $ + * $Id: rmff.c,v 1.7 2003/12/05 15:54:58 f1rmb Exp $ * * functions for real media file format * adopted from joschkas real tools @@ -38,7 +38,6 @@ (((uint8_t*)(x))[2] << 8) | \ ((uint8_t*)(x))[3]) - /* * writes header data to a buffer */ @@ -256,15 +255,14 @@ void rmff_dump_pheader(rmff_pheader_t *h, char *data) { static rmff_fileheader_t *rmff_scan_fileheader(const char *data) { - rmff_fileheader_t *fileheader=malloc(sizeof(rmff_fileheader_t)); + rmff_fileheader_t *fileheader = malloc(sizeof(rmff_fileheader_t)); fileheader->object_id=BE_32(data); fileheader->size=BE_32(&data[4]); fileheader->object_version=BE_16(&data[8]); if (fileheader->object_version != 0) { - printf("warning: unknown object version in .RMF: 0x%04x\n", - fileheader->object_version); + lprintf("warning: unknown object version in .RMF: 0x%04x\n", fileheader->object_version); } fileheader->file_version=BE_32(&data[10]); fileheader->num_headers=BE_32(&data[14]); @@ -274,15 +272,14 @@ static rmff_fileheader_t *rmff_scan_fileheader(const char *data) { static rmff_prop_t *rmff_scan_prop(const char *data) { - rmff_prop_t *prop=malloc(sizeof(rmff_prop_t)); + rmff_prop_t *prop = malloc(sizeof(rmff_prop_t)); prop->object_id=BE_32(data); prop->size=BE_32(&data[4]); prop->object_version=BE_16(&data[8]); if (prop->object_version != 0) { - printf("warning: unknown object version in PROP: 0x%04x\n", - prop->object_version); + lprintf("warning: unknown object version in PROP: 0x%04x\n", prop->object_version); } prop->max_bit_rate=BE_32(&data[10]); prop->avg_bit_rate=BE_32(&data[14]); @@ -301,15 +298,14 @@ static rmff_prop_t *rmff_scan_prop(const char *data) { static rmff_mdpr_t *rmff_scan_mdpr(const char *data) { - rmff_mdpr_t *mdpr=malloc(sizeof(rmff_mdpr_t)); + rmff_mdpr_t *mdpr = malloc(sizeof(rmff_mdpr_t)); mdpr->object_id=BE_32(data); mdpr->size=BE_32(&data[4]); mdpr->object_version=BE_16(&data[8]); if (mdpr->object_version != 0) { - printf("warning: unknown object version in MDPR: 0x%04x\n", - mdpr->object_version); + lprintf("warning: unknown object version in MDPR: 0x%04x\n", mdpr->object_version); } mdpr->stream_number=BE_16(&data[10]); mdpr->max_bit_rate=BE_32(&data[12]); @@ -321,17 +317,17 @@ static rmff_mdpr_t *rmff_scan_mdpr(const char *data) { mdpr->duration=BE_32(&data[36]); mdpr->stream_name_size=data[40]; - mdpr->stream_name=malloc(sizeof(char)*(mdpr->stream_name_size+1)); + mdpr->stream_name = malloc(sizeof(char)*(mdpr->stream_name_size+1)); memcpy(mdpr->stream_name, &data[41], mdpr->stream_name_size); mdpr->stream_name[mdpr->stream_name_size]=0; mdpr->mime_type_size=data[41+mdpr->stream_name_size]; - mdpr->mime_type=malloc(sizeof(char)*(mdpr->mime_type_size+1)); + mdpr->mime_type = malloc(sizeof(char)*(mdpr->mime_type_size+1)); memcpy(mdpr->mime_type, &data[42+mdpr->stream_name_size], mdpr->mime_type_size); mdpr->mime_type[mdpr->mime_type_size]=0; mdpr->type_specific_len=BE_32(&data[42+mdpr->stream_name_size+mdpr->mime_type_size]); - mdpr->type_specific_data=malloc(sizeof(char)*(mdpr->type_specific_len)); + mdpr->type_specific_data = malloc(sizeof(char)*(mdpr->type_specific_len)); memcpy(mdpr->type_specific_data, &data[46+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len); @@ -340,7 +336,7 @@ static rmff_mdpr_t *rmff_scan_mdpr(const char *data) { static rmff_cont_t *rmff_scan_cont(const char *data) { - rmff_cont_t *cont=malloc(sizeof(rmff_cont_t)); + rmff_cont_t *cont = malloc(sizeof(rmff_cont_t)); int pos; cont->object_id=BE_32(data); @@ -348,26 +344,25 @@ static rmff_cont_t *rmff_scan_cont(const char *data) { cont->object_version=BE_16(&data[8]); if (cont->object_version != 0) { - printf("warning: unknown object version in CONT: 0x%04x\n", - cont->object_version); + lprintf("warning: unknown object version in CONT: 0x%04x\n", cont->object_version); } cont->title_len=BE_16(&data[10]); - cont->title=malloc(sizeof(char)*(cont->title_len+1)); + cont->title = malloc(sizeof(char)*(cont->title_len+1)); memcpy(cont->title, &data[12], cont->title_len); cont->title[cont->title_len]=0; pos=cont->title_len+12; cont->author_len=BE_16(&data[pos]); - cont->author=malloc(sizeof(char)*(cont->author_len+1)); + cont->author = malloc(sizeof(char)*(cont->author_len+1)); memcpy(cont->author, &data[pos+2], cont->author_len); cont->author[cont->author_len]=0; pos=pos+2+cont->author_len; cont->copyright_len=BE_16(&data[pos]); - cont->copyright=malloc(sizeof(char)*(cont->copyright_len+1)); + cont->copyright = malloc(sizeof(char)*(cont->copyright_len+1)); memcpy(cont->copyright, &data[pos+2], cont->copyright_len); cont->copyright[cont->copyright_len]=0; pos=pos+2+cont->copyright_len; cont->comment_len=BE_16(&data[pos]); - cont->comment=malloc(sizeof(char)*(cont->comment_len+1)); + cont->comment = malloc(sizeof(char)*(cont->comment_len+1)); memcpy(cont->comment, &data[pos+2], cont->comment_len); cont->comment[cont->comment_len]=0; @@ -376,15 +371,14 @@ static rmff_cont_t *rmff_scan_cont(const char *data) { static rmff_data_t *rmff_scan_dataheader(const char *data) { - rmff_data_t *dh=malloc(sizeof(rmff_data_t)); + rmff_data_t *dh = malloc(sizeof(rmff_data_t)); dh->object_id=BE_32(data); dh->size=BE_32(&data[4]); dh->object_version=BE_16(&data[8]); if (dh->object_version != 0) { - printf("warning: unknown object version in DATA: 0x%04x\n", - dh->object_version); + lprintf("warning: unknown object version in DATA: 0x%04x\n", dh->object_version); } dh->num_packets=BE_32(&data[10]); dh->next_data_header=BE_32(&data[14]); @@ -394,7 +388,7 @@ static rmff_data_t *rmff_scan_dataheader(const char *data) { rmff_header_t *rmff_scan_header(const char *data) { - rmff_header_t *header=malloc(sizeof(rmff_header_t)); + rmff_header_t *header = malloc(sizeof(rmff_header_t)); rmff_mdpr_t *mdpr=NULL; int chunk_size; uint32_t chunk_type; @@ -409,14 +403,14 @@ rmff_header_t *rmff_scan_header(const char *data) { chunk_type = BE_32(ptr); if (chunk_type != RMF_TAG) { - printf("rmff: not an real media file header (.RMF tag not found).\n"); + lprintf("rmff: not an real media file header (.RMF tag not found).\n"); free(header); return NULL; } header->fileheader=rmff_scan_fileheader(ptr); ptr += header->fileheader->size; - header->streams=malloc(sizeof(rmff_mdpr_t*)*(header->fileheader->num_headers)); + header->streams = malloc(sizeof(rmff_mdpr_t*)*(header->fileheader->num_headers)); for (i=0; i<header->fileheader->num_headers; i++) { header->streams[i]=NULL; } @@ -426,7 +420,7 @@ rmff_header_t *rmff_scan_header(const char *data) { if (ptr[0] == 0) { - printf("rmff: warning: only %d of %d header found.\n", i, header->fileheader->num_headers); + lprintf("rmff: warning: only %d of %d header found.\n", i, header->fileheader->num_headers); break; } @@ -450,8 +444,10 @@ rmff_header_t *rmff_scan_header(const char *data) { chunk_size=34; /* hard coded header size */ break; default: - printf("unknown chunk\n"); + lprintf("unknown chunk\n"); +#ifdef LOG xine_hexdump(ptr,10); +#endif chunk_size=1; break; } @@ -487,8 +483,10 @@ rmff_header_t *rmff_scan_header_stream(int fd) { index+=(chunk_size-8); break; default: - printf("rmff_scan_header_stream: unknown chunk"); + lprintf("rmff_scan_header_stream: unknown chunk"); +#ifdef LOG xine_hexdump(buf+index-8, 8); +#endif chunk_type=DATA_TAG; } } while (chunk_type != DATA_TAG); @@ -512,7 +510,7 @@ void rmff_scan_pheader(rmff_pheader_t *h, char *data) { rmff_fileheader_t *rmff_new_fileheader(uint32_t num_headers) { - rmff_fileheader_t *fileheader=malloc(sizeof(rmff_fileheader_t)); + rmff_fileheader_t *fileheader = malloc(sizeof(rmff_fileheader_t)); fileheader->object_id=RMF_TAG; fileheader->size=18; @@ -536,7 +534,7 @@ rmff_prop_t *rmff_new_prop ( uint16_t num_streams, uint16_t flags ) { - rmff_prop_t *prop=malloc(sizeof(rmff_prop_t)); + rmff_prop_t *prop = malloc(sizeof(rmff_prop_t)); prop->object_id=PROP_TAG; prop->size=50; @@ -571,7 +569,7 @@ rmff_mdpr_t *rmff_new_mdpr( uint32_t type_specific_len, const char *type_specific_data ) { - rmff_mdpr_t *mdpr=malloc(sizeof(rmff_mdpr_t)); + rmff_mdpr_t *mdpr = malloc(sizeof(rmff_mdpr_t)); mdpr->object_id=MDPR_TAG; mdpr->object_version=0; @@ -595,7 +593,7 @@ rmff_mdpr_t *rmff_new_mdpr( mdpr->mime_type_size=strlen(mime_type); } mdpr->type_specific_len=type_specific_len; - mdpr->type_specific_data=malloc(sizeof(char)*type_specific_len); + mdpr->type_specific_data = malloc(sizeof(char)*type_specific_len); memcpy(mdpr->type_specific_data,type_specific_data,type_specific_len); mdpr->mlti_data=NULL; @@ -606,7 +604,7 @@ rmff_mdpr_t *rmff_new_mdpr( rmff_cont_t *rmff_new_cont(const char *title, const char *author, const char *copyright, const char *comment) { - rmff_cont_t *cont=malloc(sizeof(rmff_cont_t)); + rmff_cont_t *cont = malloc(sizeof(rmff_cont_t)); cont->object_id=CONT_TAG; cont->object_version=0; @@ -644,7 +642,7 @@ rmff_cont_t *rmff_new_cont(const char *title, const char *author, const char *co rmff_data_t *rmff_new_dataheader(uint32_t num_packets, uint32_t next_data_header) { - rmff_data_t *data=malloc(sizeof(rmff_data_t)); + rmff_data_t *data = malloc(sizeof(rmff_data_t)); data->object_id=DATA_TAG; data->size=18; @@ -707,7 +705,9 @@ void rmff_print_header(rmff_header_t *h) { printf("pre-buffer : %i ms\n", (*stream)->preroll); printf("duration : %i ms\n", (*stream)->duration); printf("type specific data:\n"); +#ifdef LOG xine_hexdump((*stream)->type_specific_data, (*stream)->type_specific_len); +#endif stream++; } } @@ -728,12 +728,12 @@ void rmff_fix_header(rmff_header_t *h) { int num_streams=0; if (!h) { - printf("rmff_fix_header: fatal: no header given.\n"); + lprintf("rmff_fix_header: fatal: no header given.\n"); return; } if (!h->streams) { - printf("rmff_fix_header: warning: no MDPR chunks\n"); + lprintf("rmff_fix_header: warning: no MDPR chunks\n"); } else { streams=h->streams; @@ -762,18 +762,18 @@ void rmff_fix_header(rmff_header_t *h) { num_headers++; header_size+=50; } else - printf("rmff_fix_header: warning: no PROP chunk.\n"); + lprintf("rmff_fix_header: warning: no PROP chunk.\n"); if (h->cont) { num_headers++; header_size+=h->cont->size; } else - printf("rmff_fix_header: warning: no CONT chunk.\n"); + lprintf("rmff_fix_header: warning: no CONT chunk.\n"); if (!h->data) { lprintf("rmff_fix_header: no DATA chunk, creating one\n"); - h->data=malloc(sizeof(rmff_data_t)); + h->data = malloc(sizeof(rmff_data_t)); h->data->object_id=DATA_TAG; h->data->object_version=0; h->data->size=34; @@ -786,7 +786,7 @@ void rmff_fix_header(rmff_header_t *h) { if (!h->fileheader) { lprintf("rmff_fix_header: no fileheader, creating one"); - h->fileheader=malloc(sizeof(rmff_fileheader_t)); + h->fileheader = malloc(sizeof(rmff_fileheader_t)); h->fileheader->object_id=RMF_TAG; h->fileheader->size=34; h->fileheader->object_version=0; diff --git a/src/input/libreal/sdpplin.c b/src/input/libreal/sdpplin.c index fb803dd91..10a8436ac 100644 --- a/src/input/libreal/sdpplin.c +++ b/src/input/libreal/sdpplin.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: sdpplin.c,v 1.2 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: sdpplin.c,v 1.3 2003/12/05 15:54:58 f1rmb Exp $ * * sdp/sdpplin parser. * @@ -117,7 +117,7 @@ static int filter(const char *in, const char *filter, char **out) { } static sdpplin_stream_t *sdpplin_parse_stream(char **data) { - sdpplin_stream_t *desc=xine_xmalloc(sizeof(sdpplin_stream_t)); + sdpplin_stream_t *desc = xine_xmalloc(sizeof(sdpplin_stream_t)); char *buf=xine_buffer_init(32); char *decoded=xine_buffer_init(32); int handled; @@ -126,7 +126,7 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) { desc->id = strdup(buf); } else { - printf("sdpplin: no m= found.\n"); + lprintf("sdpplin: no m= found.\n"); free(desc); xine_buffer_free(buf); return NULL; @@ -193,7 +193,7 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) { if(filter(*data,"a=OpaqueData:buffer;",&buf)) { decoded = b64_decode(buf, decoded, &(desc->mlti_data_size)); - desc->mlti_data=malloc(sizeof(char)*desc->mlti_data_size); + desc->mlti_data = malloc(sizeof(char)*desc->mlti_data_size); memcpy(desc->mlti_data, decoded, desc->mlti_data_size); handled=1; *data=nl(*data); @@ -225,7 +225,7 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) { sdpplin_t *sdpplin_parse(char *data) { - sdpplin_t *desc=xine_xmalloc(sizeof(sdpplin_t)); + sdpplin_t *desc = xine_xmalloc(sizeof(sdpplin_t)); sdpplin_stream_t *stream; char *buf=xine_buffer_init(32); char *decoded=xine_buffer_init(32); @@ -273,7 +273,7 @@ sdpplin_t *sdpplin_parse(char *data) { if(filter(data,"a=StreamCount:integer;",&buf)) { desc->stream_count=atoi(buf); - desc->stream=malloc(sizeof(sdpplin_stream_t*)*desc->stream_count); + desc->stream = malloc(sizeof(sdpplin_stream_t*)*desc->stream_count); handled=1; data=nl(data); } diff --git a/src/input/librtsp/rtsp.c b/src/input/librtsp/rtsp.c index dbf4d1487..02337cec3 100644 --- a/src/input/librtsp/rtsp.c +++ b/src/input/librtsp/rtsp.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: rtsp.c,v 1.14 2003/12/04 22:38:29 jstembridge Exp $ + * $Id: rtsp.c,v 1.15 2003/12/05 15:54:58 f1rmb Exp $ * * a minimalistic implementation of rtsp protocol, * *not* RFC 2326 compilant yet. @@ -118,10 +118,10 @@ static char *rtsp_get(rtsp_t *s) { } if (n>=BUF_SIZE) { - printf("librtsp: buffer overflow in rtsp_get\n"); + xprintf(s->stream->xine, XINE_VERBOSITY_DEBUG, "librtsp: buffer overflow in rtsp_get\n"); exit(1); } - string=malloc(sizeof(char)*n); + string = malloc(sizeof(char)*n); memcpy(string,s->buffer,n-1); string[n-1]=0; @@ -137,7 +137,7 @@ static char *rtsp_get(rtsp_t *s) { static void rtsp_put(rtsp_t *s, const char *string) { int len=strlen(string); - char *buf=malloc(sizeof(char)*len+2); + char *buf = malloc(sizeof(char)*len+2); lprintf(">> '%s'", string); @@ -156,7 +156,7 @@ static void rtsp_put(rtsp_t *s, const char *string) { * extract server status code */ -static int rtsp_get_code(const char *string) { +static int rtsp_get_code(rtsp_t *s, const char *string) { char buf[4]; int code=0; @@ -171,7 +171,8 @@ static int rtsp_get_code(const char *string) { return RTSP_STATUS_SET_PARAMETER; } - if(code != 200) printf("librtsp: server responds: '%s'\n",string); + if(code != 200) + xprintf(s->stream->xine, XINE_VERBOSITY_DEBUG, "librtsp: server responds: '%s'\n", string); return code; } @@ -219,7 +220,7 @@ static int rtsp_get_answers(rtsp_t *s) { int code; answer=rtsp_get(s); - code=rtsp_get_code(answer); + code=rtsp_get_code(s, answer); free(answer); rtsp_free_answers(s); @@ -246,7 +247,8 @@ static int rtsp_get_answers(rtsp_t *s) { sscanf(answer,"Session: %s",s->buffer); if (s->session) { if (strcmp(s->buffer, s->session)) { - printf("rtsp: warning: setting NEW session: %s\n", s->buffer); + xprintf(s->stream->xine, XINE_VERBOSITY_DEBUG, + "rtsp: warning: setting NEW session: %s\n", s->buffer); free(s->session); s->session=strdup(s->buffer); } @@ -296,7 +298,7 @@ int rtsp_request_options(rtsp_t *s, const char *what) { buf=strdup(what); } else { - buf=malloc(sizeof(char)*(strlen(s->host)+16)); + buf = malloc(sizeof(char)*(strlen(s->host)+16)); sprintf(buf,"rtsp://%s:%i", s->host, s->port); } rtsp_send_request(s,"OPTIONS",buf); @@ -313,7 +315,7 @@ int rtsp_request_describe(rtsp_t *s, const char *what) { buf=strdup(what); } else { - buf=malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); + buf = malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); sprintf(buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); } rtsp_send_request(s,"DESCRIBE",buf); @@ -337,7 +339,7 @@ int rtsp_request_setparameter(rtsp_t *s, const char *what) { buf=strdup(what); } else { - buf=malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); + buf = malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); sprintf(buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); } rtsp_send_request(s,"SET_PARAMETER",buf); @@ -354,7 +356,7 @@ int rtsp_request_play(rtsp_t *s, const char *what) { buf=strdup(what); } else { - buf=malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); + buf = malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); sprintf(buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); } rtsp_send_request(s,"PLAY",buf); @@ -402,7 +404,7 @@ int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size) { } /* lets make the server happy */ rtsp_put(s, "RTSP/1.0 451 Parameter Not Understood"); - rest=malloc(sizeof(char)*16); + rest = malloc(sizeof(char)*16); sprintf(rest,"CSeq: %u", seq); rtsp_put(s, rest); rtsp_put(s, ""); @@ -426,14 +428,14 @@ int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size) { rtsp_t *rtsp_connect(xine_stream_t *stream, const char *mrl, const char *user_agent) { - rtsp_t *s=malloc(sizeof(rtsp_t)); + rtsp_t *s = malloc(sizeof(rtsp_t)); char *mrl_ptr=strdup(mrl); char *slash, *colon; int hostend, pathbegin, i; if (strncmp(mrl,"rtsp://",7)) { - printf("rtsp: bad mrl: %s\n", mrl); + xprintf(stream->xine, XINE_VERBOSITY_LOG, _("rtsp: bad mrl: %s\n"), mrl); free(s); return NULL; } @@ -474,7 +476,7 @@ rtsp_t *rtsp_connect(xine_stream_t *stream, const char *mrl, const char *user_ag pathbegin=slash-mrl_ptr; hostend=colon-mrl_ptr; - s->host=malloc(sizeof(char)*hostend+1); + s->host = malloc(sizeof(char)*hostend+1); strncpy(s->host, mrl_ptr, hostend); s->host[hostend]=0; @@ -490,7 +492,7 @@ rtsp_t *rtsp_connect(xine_stream_t *stream, const char *mrl, const char *user_ag s->s = _x_io_tcp_connect (stream, s->host, s->port); if (s->s < 0) { - printf ("rtsp: failed to connect to '%s'\n", s->host); + xprintf (stream->xine, XINE_VERBOSITY_LOG, _("rtsp: failed to connect to '%s'\n"), s->host); rtsp_close(s); return NULL; } diff --git a/src/input/librtsp/rtsp_session.c b/src/input/librtsp/rtsp_session.c index e49a06b08..af11174d7 100644 --- a/src/input/librtsp/rtsp_session.c +++ b/src/input/librtsp/rtsp_session.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: rtsp_session.c,v 1.12 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: rtsp_session.c,v 1.13 2003/12/05 15:54:58 f1rmb Exp $ * * high level interface to rtsp servers. */ @@ -66,7 +66,7 @@ struct rtsp_session_s { rtsp_session_t *rtsp_session_start(xine_stream_t *stream, char *mrl) { - rtsp_session_t *rtsp_session=malloc(sizeof(rtsp_session_t)); + rtsp_session_t *rtsp_session = malloc(sizeof(rtsp_session_t)); char *server; char *mrl_line=strdup(mrl); rmff_header_t *h; @@ -75,10 +75,11 @@ rtsp_session_t *rtsp_session_start(xine_stream_t *stream, char *mrl) { connect: /* connect to server */ - rtsp_session->s=rtsp_connect(stream, mrl_line,NULL); + rtsp_session->s=rtsp_connect(stream, mrl_line, NULL); if (!rtsp_session->s) { - printf("rtsp_session: failed to connect to server %s\n", mrl_line); + xprintf(stream->xine, XINE_VERBOSITY_LOG, + _("rtsp_session: failed to connect to server %s\n"), mrl_line); free(rtsp_session); return NULL; } @@ -104,13 +105,14 @@ connect: { free(mrl_line); mrl_line=strdup(rtsp_search_answers(rtsp_session->s, "Location")); - printf("rtsp_session: redirected to %s\n", mrl_line); + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "rtsp_session: redirected to %s\n", mrl_line); rtsp_close(rtsp_session->s); free(server); goto connect; /* *shudder* i made a design mistake somewhere */ } else { - printf("rtsp_session: session can not be established.\n"); + xprintf(stream->xine, XINE_VERBOSITY_LOG, + _("rtsp_session: session can not be established.\n")); rtsp_close(rtsp_session->s); free(rtsp_session); return NULL; @@ -125,7 +127,8 @@ connect: } else { - printf("rtsp_session: rtsp server type '%s' not supported yet. sorry.\n",server); + xprintf(stream->xine, XINE_VERBOSITY_LOG, + _("rtsp_session: rtsp server type '%s' not supported yet. sorry.\n"), server); rtsp_close(rtsp_session->s); free(server); free(rtsp_session); diff --git a/src/input/media_helper.c b/src/input/media_helper.c index ce8f0d701..86a456b3a 100644 --- a/src/input/media_helper.c +++ b/src/input/media_helper.c @@ -79,7 +79,7 @@ static int media_umount_media(const char *device) #endif /* WIN32 */ } -int media_eject_media (const char *device) { +int media_eject_media (xine_t *xine, const char *device) { #ifndef WIN32 int ret, status; @@ -127,10 +127,10 @@ int media_eject_media (const char *device) { #elif defined (__NetBSD__) || defined (__OpenBSD__) || defined (__FreeBSD__) if (ioctl(fd, CDIOCALLOW) == -1) { - perror("ioctl(cdromallow)"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "ioctl(cdromallow): %s\n", strerror(errno)); } else { if (ioctl(fd, CDIOCEJECT) == -1) { - perror("ioctl(cdromeject)"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "ioctl(cdromeject): %s\n", strerror(errno)); } } @@ -138,7 +138,8 @@ int media_eject_media (const char *device) { close(fd); } else { - printf("input_dvd: Device %s failed to open during eject calls\n",device); + xprintf(xine, XINE_VERBOSITY_LOG, + _("input_dvd: Device %s failed to open during eject calls\n"), device); } return 1; #else diff --git a/src/input/media_helper.h b/src/input/media_helper.h index 48ef7b383..2f6aaee60 100644 --- a/src/input/media_helper.h +++ b/src/input/media_helper.h @@ -19,5 +19,11 @@ * */ -int media_eject_media (const char *device); +#ifndef HAVE_MEDIA_HELPER_H +#define HAVE_MEDIA_HELPER_H +#include "xine_internal.h" + +int media_eject_media (xine_t *xine, const char *device); + +#endif diff --git a/src/input/mmsh.c b/src/input/mmsh.c index 3f3c012d7..f1c06da2e 100644 --- a/src/input/mmsh.c +++ b/src/input/mmsh.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: mmsh.c,v 1.23 2003/12/04 22:07:05 tmattern Exp $ + * $Id: mmsh.c,v 1.24 2003/12/05 15:54:58 f1rmb Exp $ * * MMS over HTTP protocol * written by Thibaut Mattern @@ -226,8 +226,7 @@ static int send_command (mmsh_t *this, char *cmd) { length = strlen(cmd); if (_x_io_tcp_write(this->stream, this->s, cmd, length) != length) { - xprintf (this->stream->xine, XINE_LOG_MSG, - "libmmsh: send error\n"); + xprintf (this->stream->xine, XINE_LOG_MSG, _("libmmsh: send error\n")); return 0; } return 1; @@ -272,28 +271,28 @@ static int get_answer (mmsh_t *this) { if (sscanf(this->buf, "HTTP/%d.%d %d", &httpver, &httpsub, &httpcode) != 3) { xine_log (this->stream->xine, XINE_LOG_MSG, - _("libmmsh: bad response format\n")); + _("libmmsh: bad response format\n")); return 0; } if (httpcode >= 300 && httpcode < 400) { xine_log (this->stream->xine, XINE_LOG_MSG, - _("libmmsh: 3xx redirection not implemented: >%d %s<\n"), - httpcode, httpstatus); + _("libmmsh: 3xx redirection not implemented: >%d %s<\n"), + httpcode, httpstatus); return 0; } if (httpcode < 200 || httpcode >= 300) { xine_log (this->stream->xine, XINE_LOG_MSG, - _("libmmsh: http status not 2xx: >%d %s<\n"), - httpcode, httpstatus); + _("libmmsh: http status not 2xx: >%d %s<\n"), + httpcode, httpstatus); return 0; } } else { if (!strncasecmp(this->buf, "Location: ", 10)) { xine_log (this->stream->xine, XINE_LOG_MSG, - _("libmmsh: Location redirection not implemented\n")); + _("libmmsh: Location redirection not implemented\n")); return 0; } @@ -623,14 +622,12 @@ mmsh_t *mmsh_connect (xine_stream_t *stream, const char *url, int bandwidth) { if (!_x_parse_url (this->url, &this->proto, &this->host, &this->port, &this->user, &this->password, &this->uri)) { - xine_log (this->stream->xine, XINE_LOG_MSG, - "invalid url\n"); + xine_log (this->stream->xine, XINE_LOG_MSG, _("invalid url\n")); goto fail; } if (!mmsh_valid_proto(this->proto)) { - xine_log (this->stream->xine, XINE_LOG_MSG, - "unsupported protocol\n"); + xine_log (this->stream->xine, XINE_LOG_MSG, _("unsupported protocol\n")); goto fail; } diff --git a/src/input/net_buf_ctrl.c b/src/input/net_buf_ctrl.c index bb8970e81..0a328d367 100644 --- a/src/input/net_buf_ctrl.c +++ b/src/input/net_buf_ctrl.c @@ -98,9 +98,7 @@ static void report_progress (xine_stream_t *stream, int p) { } static void nbc_set_speed_pause (xine_stream_t *stream) { -#ifdef LOG - printf("\nnet_buf_ctrl: nbc_put_cb: set_speed_pause\n"); -#endif + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "\nnet_buf_ctrl: nbc_put_cb: set_speed_pause\n"); stream->xine->clock->set_speed (stream->xine->clock, XINE_SPEED_PAUSE); stream->xine->clock->set_option (stream->xine->clock, CLOCK_SCR_ADJUSTABLE, 0); if (stream->audio_out) @@ -108,9 +106,7 @@ static void nbc_set_speed_pause (xine_stream_t *stream) { } static void nbc_set_speed_normal (xine_stream_t *stream) { -#ifdef LOG - printf("\nnet_buf_ctrl: nbc_put_cb: set_speed_normal\n"); -#endif + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "\nnet_buf_ctrl: nbc_put_cb: set_speed_normal\n"); stream->xine->clock->set_speed (stream->xine->clock, XINE_SPEED_NORMAL); stream->xine->clock->set_option (stream->xine->clock, CLOCK_SCR_ADJUSTABLE, 1); if (stream->audio_out) @@ -125,22 +121,19 @@ static void display_stats (nbc_t *this) { char *buffering[2] = {" ", "buf"}; char *enabled[2] = {"off", "on "}; - if (this->stream->xine->verbosity >= 2) { - printf("net_buf_ctrl: vid %3d%% %4.1fs %4lldkbps %1d, "\ - "aud %3d%% %4.1fs %4lldkbps %1d, %s %s\r", - this->video_fifo_fill, - (float)(this->video_fifo_length / 1000), - this->video_br / 1000, - this->video_in_disc, - this->audio_fifo_fill, - (float)(this->audio_fifo_length / 1000), - this->audio_br / 1000, - this->audio_in_disc, - buffering[this->buffering], - enabled[this->enabled] - ); - fflush(stdout); - } + printf("net_buf_ctrl: vid %3d%% %4.1fs %4lldkbps %1d, "\ + "aud %3d%% %4.1fs %4lldkbps %1d, %s %s\r", + this->video_fifo_fill, + (float)(this->video_fifo_length / 1000), + this->video_br / 1000, + this->video_in_disc, + this->audio_fifo_fill, + (float)(this->audio_fifo_length / 1000), + this->audio_br / 1000, + this->audio_in_disc, + buffering[this->buffering], + enabled[this->enabled]); + fflush(stdout); } /* Try to compute the length of the fifo in 1/1000 s @@ -361,14 +354,12 @@ static void nbc_put_cb (fifo_buffer_t *fifo, /* discontinuity management */ if (fifo == this->video_fifo) { this->video_in_disc++; -#ifdef LOG - printf("\nnet_buf_ctrl: nbc_put_cb video disc %d\n", this->video_in_disc); -#endif + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "\nnet_buf_ctrl: nbc_put_cb video disc %d\n", this->video_in_disc); } else { this->audio_in_disc++; -#ifdef LOG - printf("\nnet_buf_ctrl: nbc_put_cb audio disc %d\n", this->audio_in_disc); -#endif + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "\nnet_buf_ctrl: nbc_put_cb audio disc %d\n", this->audio_in_disc); } break; } @@ -383,7 +374,9 @@ static void nbc_put_cb (fifo_buffer_t *fifo, } - display_stats(this); + if(this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + display_stats(this); + pthread_mutex_unlock(&this->mutex); } @@ -438,14 +431,12 @@ static void nbc_get_cb (fifo_buffer_t *fifo, if (buf->type == BUF_CONTROL_NEWPTS) { if (fifo == this->video_fifo) { this->video_in_disc--; -#ifdef LOG - printf("\nnet_buf_ctrl: nbc_get_cb video disc %d\n", this->video_in_disc); -#endif + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "\nnet_buf_ctrl: nbc_get_cb video disc %d\n", this->video_in_disc); } else { this->audio_in_disc--; -#ifdef LOG - printf("\nnet_buf_ctrl: nbc_get_cb audio disc %d\n", this->audio_in_disc); -#endif + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "\nnet_buf_ctrl: nbc_get_cb audio disc %d\n", this->audio_in_disc); } } @@ -457,12 +448,15 @@ static void nbc_get_cb (fifo_buffer_t *fifo, this->audio_fifo_size = fifo->fifo_data_size; } } - display_stats(this); + + if(this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + display_stats(this); + pthread_mutex_unlock(&this->mutex); } nbc_t *nbc_init (xine_stream_t *stream) { - + nbc_t *this = (nbc_t *) malloc (sizeof (nbc_t)); fifo_buffer_t *video_fifo = stream->video_fifo; fifo_buffer_t *audio_fifo = stream->audio_fifo; @@ -511,10 +505,9 @@ nbc_t *nbc_init (xine_stream_t *stream) { void nbc_close (nbc_t *this) { fifo_buffer_t *video_fifo = this->stream->video_fifo; fifo_buffer_t *audio_fifo = this->stream->audio_fifo; + xine_t *xine = this->stream->xine; -#ifdef LOG - printf("\nnet_buf_ctrl: nbc_close\n"); -#endif + xprintf(xine, XINE_VERBOSITY_DEBUG, "\nnet_buf_ctrl: nbc_close\n"); video_fifo->unregister_alloc_cb(video_fifo, nbc_alloc_cb); video_fifo->unregister_put_cb(video_fifo, nbc_put_cb); @@ -535,11 +528,9 @@ void nbc_close (nbc_t *this) { } pthread_mutex_unlock(&this->mutex); - + free (this); -#ifdef LOG - printf("\nnet_buf_ctrl: nbc_close: done\n"); -#endif + xprintf(xine, XINE_VERBOSITY_DEBUG, "\nnet_buf_ctrl: nbc_close: done\n"); } @@ -548,7 +539,8 @@ void nbc_set_high_water_mark(nbc_t *this, int value) { Deprecated this->high_water_mark = value; */ - printf("\nnet_buf_ctrl: this method is deprecated, please fix the input plugin\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "\nnet_buf_ctrl: this method is deprecated, please fix the input plugin\n"); } void nbc_set_low_water_mark(nbc_t *this, int value) { @@ -556,5 +548,6 @@ void nbc_set_low_water_mark(nbc_t *this, int value) { Deprecated this->low_water_mark = value; */ - printf("\nnet_buf_ctrl: this method is deprecated, please fix the input plugin\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "\nnet_buf_ctrl: this method is deprecated, please fix the input plugin\n"); } diff --git a/src/input/pnm.c b/src/input/pnm.c index aa814236a..5c66329e0 100644 --- a/src/input/pnm.c +++ b/src/input/pnm.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: pnm.c,v 1.17 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: pnm.c,v 1.18 2003/12/05 15:54:58 f1rmb Exp $ * * pnm protocol implementation * based upon code from joschka @@ -183,7 +183,9 @@ unsigned char after_chunks[]={ +#ifdef LOG static void hexdump (char *buf, int length); +#endif /* * network utilities @@ -191,14 +193,14 @@ static void hexdump (char *buf, int length); * to connect to a host, send and receive data over this connection */ -static int host_connect_attempt(struct in_addr ia, int port) { +static int host_connect_attempt(xine_t *xine, struct in_addr ia, int port) { int s; struct sockaddr_in sin; s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); if (s == -1) { - printf ("input_pnm: socket(): %s\n", strerror(errno)); + xprintf (xine, XINE_VERBOSITY_DEBUG, "input_pnm: socket(): %s\n", strerror(errno)); return -1; } @@ -208,7 +210,7 @@ static int host_connect_attempt(struct in_addr ia, int port) { if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && errno != EINPROGRESS) { - printf ("input_pnm: connect(): %s\n", strerror(errno)); + xprintf (xine, XINE_VERBOSITY_DEBUG, "input_pnm: connect(): %s\n", strerror(errno)); close(s); return -1; } @@ -216,14 +218,14 @@ static int host_connect_attempt(struct in_addr ia, int port) { return s; } -static int host_connect(const char *host, int port) { +static int host_connect(xine_t *xine, const char *host, int port) { struct hostent *h; int i, s; h = gethostbyname(host); if (h == NULL) { - printf ("input_pnm: unable to resolve '%s'.\n", host); + xprintf (xine, XINE_VERBOSITY_LOG, _("input_pnm: unable to resolve '%s'.\n"), host); return -1; } @@ -231,11 +233,12 @@ static int host_connect(const char *host, int port) { struct in_addr ia; memcpy (&ia, h->h_addr_list[i], 4); - s = host_connect_attempt(ia, port); + s = host_connect_attempt(xine, ia, port); if(s != -1) return s; } - printf ("input_pnm: unable to connect to '%s'.\n", host); + xprintf (xine, XINE_VERBOSITY_LOG, _("input_pnm: unable to connect to '%s'.\n"), host); + return -1; } @@ -309,7 +312,7 @@ static ssize_t rm_read(pnm_t *p, void *buf, size_t count) { /* * a simple hexdump tool for debugging purposes */ - +#ifdef LOG static void hexdump (char *buf, int length) { int i; @@ -340,6 +343,7 @@ static void hexdump (char *buf, int length) { } printf ("\n"); } +#endif /* * pnm_get_chunk gets a chunk from stream @@ -395,7 +399,7 @@ static unsigned int pnm_get_chunk(pnm_t *p, rm_read (p, ptr, 2); if (*ptr == 'X') /* checking for server message */ { - printf("input_pnm: got a message from server:\n"); + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "input_pnm: got a message from server:\n"); rm_read (p, ptr+2, 1); /* two bytes of message length*/ @@ -404,14 +408,14 @@ static unsigned int pnm_get_chunk(pnm_t *p, /* message itself */ rm_read (p, ptr+3, n); ptr[3+n]=0; - printf("%s\n",ptr+3); + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "%s\n", ptr+3); return -1; } if (*ptr == 'F') /* checking for server error */ { /* some error codes after 'F' were ignored */ - printf("input_pnm: server error.\n"); + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "input_pnm: server error.\n"); return -1; } if (*ptr == 'i') /* the server want a response from us. it will be sent after these headers */ @@ -436,10 +440,12 @@ static unsigned int pnm_get_chunk(pnm_t *p, case MDPR_TAG: case CONT_TAG: if (chunk_size > max) { - printf("error: max chunk size exeeded (max was 0x%04x)\n", max); + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "error: max chunk size exeeded (max was 0x%04x)\n", max); /* reading some bytes for debugging */ n=rm_read (p, &data[PREAMBLE_SIZE], 0x100 - PREAMBLE_SIZE); +#ifdef LOG hexdump(data,n+PREAMBLE_SIZE); +#endif return -1; } rm_read (p, &data[PREAMBLE_SIZE], chunk_size-PREAMBLE_SIZE); @@ -577,7 +583,7 @@ static int pnm_get_headers(pnm_t *p, int *need_response) { while(1) { if (HEADER_SIZE-size<=0) { - printf("input_pnm: header buffer overflow. exiting\n"); + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "input_pnm: header buffer overflow. exiting\n"); return 0; } chunk_size=pnm_get_chunk(p,HEADER_SIZE-size,&chunk_type,ptr,&nr); @@ -600,7 +606,7 @@ static int pnm_get_headers(pnm_t *p, int *need_response) { } if (!prop_hdr) { - printf("input_pnm: error while parsing headers.\n"); + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "input_pnm: error while parsing headers.\n"); return 0; } @@ -696,7 +702,8 @@ static int pnm_calc_stream(pnm_t *p) { return 0; break; } - printf("input_pnm: wow, something very nasty happened in pnm_calc_stream\n"); + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pnm: wow, something very nasty happened in pnm_calc_stream\n"); return 2; } @@ -741,12 +748,13 @@ static int pnm_get_stream_chunk(pnm_t *p) { rm_read (p, &p->buffer[8], size-5); p->buffer[size+3]=0; - printf("input_pnm: got message from server while reading stream:\n%s\n", &p->buffer[3]); + xprintf(p->stream->xine, XINE_VERBOSITY_LOG, + _("input_pnm: got message from server while reading stream:\n%s\n"), &p->buffer[3]); return 0; } if (p->buffer[0] == 'F') { - printf("input_pnm: server error.\n"); + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "input_pnm: server error.\n"); return 0; } @@ -771,8 +779,10 @@ static int pnm_get_stream_chunk(pnm_t *p) { /* check for 'Z's */ if ((p->buffer[0] != 0x5a)||(p->buffer[7] != 0x5a)) { - printf("input_pnm: bad boundaries\n"); + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "input_pnm: bad boundaries\n"); +#ifdef LOG hexdump(p->buffer, 8); +#endif return 0; } @@ -781,7 +791,8 @@ static int pnm_get_stream_chunk(pnm_t *p) { fof2=be2me_16(*(uint16_t*)(&p->buffer[3])); if (fof1 != fof2) { - printf("input_pnm: frame offsets are different: 0x%04x 0x%04x\n",fof1,fof2); + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pnm: frame offsets are different: 0x%04x 0x%04x\n", fof1, fof2); return 0; } @@ -842,7 +853,7 @@ pnm_t *pnm_connect(xine_stream_t *stream, const char *mrl) { mrl_ptr+=6; - p=xine_xmalloc(sizeof(pnm_t)); + p = xine_xmalloc(sizeof(pnm_t)); p->stream = stream; p->port=7070; p->url=strdup(mrl); @@ -858,7 +869,7 @@ pnm_t *pnm_connect(xine_stream_t *stream, const char *mrl) { pathbegin=slash-mrl_ptr; hostend=colon-mrl_ptr; - p->host=malloc(sizeof(char)*hostend+1); + p->host = malloc(sizeof(char)*hostend+1); strncpy(p->host, mrl_ptr, hostend); p->host[hostend]=0; @@ -873,10 +884,10 @@ pnm_t *pnm_connect(xine_stream_t *stream, const char *mrl) { lprintf("got mrl: %s %i %s\n",p->host,p->port,p->path); - fd = host_connect (p->host, p->port); + fd = host_connect (stream->xine, p->host, p->port); if (fd == -1) { - printf ("input_pnm: failed to connect '%s'\n", p->host); + xprintf (p->stream->xine, XINE_VERBOSITY_LOG, _("input_pnm: failed to connect '%s'\n"), p->host); free(p->path); free(p->host); free(p->url); @@ -887,7 +898,7 @@ pnm_t *pnm_connect(xine_stream_t *stream, const char *mrl) { pnm_send_request(p,pnm_available_bandwidths[10]); if (!pnm_get_headers(p, &need_response)) { - printf ("input_pnm: failed to set up stream\n"); + xprintf (p->stream->xine, XINE_VERBOSITY_LOG, _("input_pnm: failed to set up stream\n")); free(p->path); free(p->host); free(p->url); diff --git a/src/input/vcd/vcdplayer.c b/src/input/vcd/vcdplayer.c index c3f9069da..56640d7fa 100644 --- a/src/input/vcd/vcdplayer.c +++ b/src/input/vcd/vcdplayer.c @@ -1,5 +1,5 @@ /* - $Id: vcdplayer.c,v 1.1 2003/10/13 11:47:11 f1rmb Exp $ + $Id: vcdplayer.c,v 1.2 2003/12/05 15:54:58 f1rmb Exp $ Copyright (C) 2002,2003 Rocky Bernstein <rocky@panix.com> @@ -850,7 +850,7 @@ vcdplayer_non_pbc_nav (vcdplayer_input_t *this, uint8_t *buf) return READ_END; break; case VCDINFO_ITEM_TYPE_SPAREID2: - printf("SPAREID2\n"); + /* printf("SPAREID2\n"); */ if (this->in_still) { RETURN_NULL_STILL ; /* Hack: Just go back and do still again */ diff --git a/src/liba52/xine_decoder.c b/src/liba52/xine_decoder.c index d2151c8fc..90deb8437 100644 --- a/src/liba52/xine_decoder.c +++ b/src/liba52/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.64 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: xine_decoder.c,v 1.65 2003/12/05 15:54:58 f1rmb Exp $ * * stuff needed to turn liba52 into a xine decoder plugin */ @@ -222,7 +222,7 @@ static void a52dec_decode_frame (a52dec_decoder_t *this, int64_t pts, int previe this->frame_buffer, &a52_output_flags, &level, 384)) { - printf ("liba52: a52_frame error\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "liba52: a52_frame error\n"); return; } @@ -236,7 +236,7 @@ static void a52dec_decode_frame (a52dec_decoder_t *this, int64_t pts, int previe } else if (this->audio_caps & AO_CAP_MODE_4_1CHANNEL) { output_mode = AO_CAP_MODE_4_1CHANNEL; } else { - printf("liba52: WHAT DO I DO!!!\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "liba52: WHAT DO I DO!!!\n"); output_mode = this->ao_flags_map[a52_output_flags]; } else @@ -276,7 +276,7 @@ static void a52dec_decode_frame (a52dec_decoder_t *this, int64_t pts, int previe for (i = 0; i < 6; i++) { if (a52_block (this->a52_state)) { - printf ("liba52: a52_block error on audio channel %d\n", i); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "liba52: a52_block error on audio channel %d\n", i); #if 0 for(n=0;n<2000;n++) { printf("%02x ",this->frame_buffer[n]); @@ -327,7 +327,7 @@ static void a52dec_decode_frame (a52dec_decoder_t *this, int64_t pts, int previe float_to_int (&samples[5*256], int_samples+(i*256*6)+3, 6); /* RR */ break; default: - printf ("liba52: help - unsupported mode %08x\n", output_mode); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "liba52: help - unsupported mode %08x\n", output_mode); } } @@ -561,7 +561,7 @@ static void a52dec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { crc16 = (uint16_t) ((this->frame_buffer[2] << 8) | this->frame_buffer[3]) ; crc16_result = crc16_block(&this->frame_buffer[2], this->frame_length - 2) ; /* frame_length */ if (crc16_result != 0) { /* CRC16 failed */ - printf("liba52:a52 frame failed crc16 checksum.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "liba52:a52 frame failed crc16 checksum.\n"); current = sync_start; this->pts = 0; this->syncword = 0; @@ -624,8 +624,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre lprintf ("open_plugin called\n"); - this = (a52dec_decoder_t *) malloc (sizeof (a52dec_decoder_t)); - memset(this, 0, sizeof (a52dec_decoder_t)); + this = (a52dec_decoder_t *) xine_xmalloc (sizeof (a52dec_decoder_t)); this->audio_decoder.decode_data = a52dec_decode_data; this->audio_decoder.reset = a52dec_reset; @@ -708,7 +707,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre /* else if (this->audio_caps & AO_CAP_MODE_STEREO) defaults are ok */ } else if (!(this->audio_caps & AO_CAP_MODE_STEREO)) { - printf ("HELP! a mono-only audio driver?!\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("HELP! a mono-only audio driver?!\n")); this->a52_flags_map[A52_MONO] = A52_MONO; this->a52_flags_map[A52_STEREO] = A52_MONO; @@ -760,7 +759,7 @@ static void *init_plugin (xine_t *xine, void *data) { a52dec_class_t *this; config_values_t *cfg; - this = (a52dec_class_t *) malloc (sizeof (a52dec_class_t)); + this = (a52dec_class_t *) xine_xmalloc (sizeof (a52dec_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libdivx4/xine_decoder.c b/src/libdivx4/xine_decoder.c index 89d8c7315..f1d284724 100644 --- a/src/libdivx4/xine_decoder.c +++ b/src/libdivx4/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.46 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: xine_decoder.c,v 1.47 2003/12/05 15:54:58 f1rmb Exp $ * * xine decoder plugin using divx4 * @@ -535,7 +535,7 @@ static void *init_video_decoder_plugin (xine_t *xine, void *data) { return NULL; } - this = (divx4_decoder_t *) malloc (sizeof (divx4_decoder_t)); + this = (divx4_decoder_t *) xine_xmalloc (sizeof (divx4_decoder_t)); this->decoder_ok = 0; diff --git a/src/libdts/xine_decoder.c b/src/libdts/xine_decoder.c index 38ef68088..053e73ba5 100644 --- a/src/libdts/xine_decoder.c +++ b/src/libdts/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.44 2003/08/05 11:30:56 jcdutton Exp $ + * $Id: xine_decoder.c,v 1.45 2003/12/05 15:54:59 f1rmb Exp $ * * 04-09-2001 DTS passtrough (C) Joachim Koenig * 09-12-2001 DTS passthrough inprovements (C) James Courtier-Dutton @@ -106,7 +106,7 @@ static void dts_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { for(n=1;n<=number_of_frames;n++) { data_in += ac5_length; if(data_in >= (buf->content+buf->size)) { - printf("libdts: DTS length error\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "libdts: DTS length error\n"); return; } @@ -114,7 +114,7 @@ static void dts_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { (data_in[1] != 0xfe) || (data_in[2] != 0x80) || (data_in[3] != 0x01)) { - printf("libdts: DTS Sync bad\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "libdts: DTS Sync bad\n"); return; } @@ -142,7 +142,7 @@ static void dts_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { ac5_length++; if (ac5_length > 8191) { - printf("libdts: ac5_length too long\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "libdts: ac5_length too long\n"); ac5_pcm_length = 0; } else { ac5_pcm_length = (ac5_pcm_samples + 1) * 32; @@ -159,7 +159,8 @@ static void dts_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { ac5_spdif_type = 0x0d; /* DTS-1 (2048-sample bursts) */ break; default: - printf("libdts: DTS %i-sample bursts not supported\n", ac5_pcm_length); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "libdts: DTS %i-sample bursts not supported\n", ac5_pcm_length); return; } @@ -221,7 +222,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre printf("libdts: DTS open_plugin called.\n"); #endif - this = (dts_decoder_t *) malloc (sizeof (dts_decoder_t)); + this = (dts_decoder_t *) xine_xmalloc (sizeof (dts_decoder_t)); this->audio_decoder.decode_data = dts_decode_data; this->audio_decoder.reset = dts_reset; @@ -258,7 +259,7 @@ static void *init_plugin (xine_t *xine, void *data) { #ifdef LOG_DEBUG printf("DTS class init_plugin called.\n"); #endif - this = (dts_class_t *) malloc (sizeof (dts_class_t)); + this = (dts_class_t *) xine_xmalloc (sizeof (dts_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libfaad/xine_decoder.c b/src/libfaad/xine_decoder.c index 5534ea7dd..b5981c2ca 100644 --- a/src/libfaad/xine_decoder.c +++ b/src/libfaad/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.19 2003/11/26 19:43:32 f1rmb Exp $ + * $Id: xine_decoder.c,v 1.20 2003/12/05 15:54:59 f1rmb Exp $ * */ @@ -82,7 +82,7 @@ static int faad_open_dec( faad_decoder_t *this ) { this->faac_dec = faacDecOpen(); if( !this->faac_dec ) { xine_log (this->stream->xine, XINE_LOG_MSG, - "libfaad: libfaad faacDecOpen() failed.\n" ); + _("libfaad: libfaad faacDecOpen() failed.\n")); this->faac_failed++; _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_HANDLED, 0); return 1; @@ -128,7 +128,8 @@ static void faad_decode_audio ( faad_decoder_t *this, int end_frame ) { used, this->size, this->faac_finfo.samples ); if (sample_buffer == NULL) { - printf("libfaad: %s\n", faacDecGetErrorMessage(this->faac_finfo.error)); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "libfaad: %s\n", faacDecGetErrorMessage(this->faac_finfo.error)); used = 1; } else { @@ -193,7 +194,7 @@ static void faad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { if( used < 0 ) { xine_log (this->stream->xine, XINE_LOG_MSG, - "libfaad: libfaad faacDecInit2() failed.\n" ); + _("libfaad: libfaad faacDecInit2() failed.\n")); this->faac_failed++; this->faac_dec = NULL; _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_HANDLED, 0); @@ -255,7 +256,7 @@ static void faad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { &this->rate, &this->num_channels); if( used < 0 ) { xine_log (this->stream->xine, XINE_LOG_MSG, - "libfaad: libfaad faacDecInit() failed.\n" ); + _("libfaad: libfaad faacDecInit() failed.\n")); this->faac_failed++; faacDecClose(this->faac_dec); this->faac_dec = NULL; @@ -325,7 +326,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre faad_decoder_t *this ; - this = (faad_decoder_t *) malloc (sizeof (faad_decoder_t)); + this = (faad_decoder_t *) xine_xmalloc (sizeof (faad_decoder_t)); this->audio_decoder.decode_data = faad_decode_data; this->audio_decoder.reset = faad_reset; @@ -359,7 +360,7 @@ static void *init_plugin (xine_t *xine, void *data) { faad_class_t *this ; - this = (faad_class_t *) malloc (sizeof (faad_class_t)); + this = (faad_class_t *) xine_xmalloc (sizeof (faad_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libffmpeg/libavcodec/h263.c b/src/libffmpeg/libavcodec/h263.c index 1c18ea743..2d53547ac 100644 --- a/src/libffmpeg/libavcodec/h263.c +++ b/src/libffmpeg/libavcodec/h263.c @@ -5097,7 +5097,7 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){ /* detect buggy encoders which dont set the low_delay flag (divx4/xvid/opendivx)*/ // note we cannot detect divx5 without b-frames easyly (allthough its buggy too) if(s->vo_type==0 && s->vol_control_parameters==0 && s->divx_version==0 && s->picture_number==0){ - printf("looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag\n"); + //printf("looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag\n"); s->low_delay=1; } diff --git a/src/libffmpeg/xine_decoder.c b/src/libffmpeg/xine_decoder.c index 99333bd85..3d0b7d98e 100644 --- a/src/libffmpeg/xine_decoder.c +++ b/src/libffmpeg/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.143 2003/11/29 13:47:26 miguelfreitas Exp $ + * $Id: xine_decoder.c,v 1.144 2003/12/05 15:54:59 f1rmb Exp $ * * xine decoder plugin using ffmpeg * @@ -157,7 +157,7 @@ static int get_buffer(AVCodecContext *context, AVFrame *av_frame){ if( (this->context->pix_fmt != PIX_FMT_YUV420P) || (width != context->width) || (height != context->height) ) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "ffmpeg: unsupported frame format, DR1 disabled.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg: unsupported frame format, DR1 disabled.\n")); this->context->get_buffer = avcodec_default_get_buffer; this->context->release_buffer = avcodec_default_release_buffer; @@ -250,7 +250,7 @@ static void init_video_codec (ff_video_decoder_t *this, xine_bmiheader *bih) { this->context->flags |= CODEC_FLAG_EMU_EDGE; if (avcodec_open (this->context, this->codec) < 0) { - printf ("ffmpeg: couldn't open decoder\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg: couldn't open decoder\n")); free(this->context); this->context = NULL; _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HANDLED, 0); @@ -286,7 +286,7 @@ static void init_video_codec (ff_video_decoder_t *this, xine_bmiheader *bih) { this->codec->capabilities & CODEC_CAP_DR1 ) { this->context->get_buffer = get_buffer; this->context->release_buffer = release_buffer; - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "ffmpeg: direct rendering enabled\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg: direct rendering enabled\n")); } #endif } @@ -474,7 +474,7 @@ static void find_sequence_header (ff_video_decoder_t *this, this->video_step = 1500; break; default: - printf ("ffmpeg: invalid/unknown frame rate code : %d \n", + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg: invalid/unknown frame rate code : %d \n"), frame_rate_code); this->video_step = 0; } @@ -488,7 +488,7 @@ static void find_sequence_header (ff_video_decoder_t *this, this->codec = avcodec_find_decoder (CODEC_ID_MPEG1VIDEO); if (!this->codec) { - printf ("avcodec_find_decoder (CODEC_ID_MPEG1VIDEO) failed.\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("avcodec_find_decoder (CODEC_ID_MPEG1VIDEO) failed.\n")); abort(); } @@ -906,14 +906,14 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { "Interplay MVE (ffmpeg)"); break; default: - printf ("ffmpeg: unknown video format (buftype: 0x%08X)\n", - buf->type & 0xFFFF0000); + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg: unknown video format (buftype: 0x%08X)\n"), + buf->type & 0xFFFF0000); _x_meta_info_set(this->stream, XINE_META_INFO_VIDEOCODEC, - "unknown (ffmpeg)"); + "unknown (ffmpeg)"); } if (!this->codec) { - printf ("ffmpeg: couldn't find decoder\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg: couldn't find decoder\n")); return; } @@ -954,8 +954,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if( this->size + buf->size > this->bufsize ) { this->bufsize = this->size + 2 * buf->size; xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - "ffmpeg: increasing source buffer to %d to avoid overflow.\n", - this->bufsize); + _("ffmpeg: increasing source buffer to %d to avoid overflow.\n"), this->bufsize); this->buf = realloc( this->buf, this->bufsize ); } @@ -1018,7 +1017,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { &got_picture, &this->buf[offset], this->size); if (len<0) { - printf ("ffmpeg: error decompressing frame\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "ffmpeg: error decompressing frame\n"); this->size=0; return; } @@ -1027,7 +1026,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { offset += len; if (!got_picture || !this->av_frame->data[0]) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "ffmpeg: didn't get a picture, got %d bytes left\n", this->size); if (this->size>0) @@ -1056,7 +1055,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if (len<0 || this->skipframes) { if( !this->skipframes ) - printf ("ffmpeg: error decompressing frame\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "ffmpeg: error decompressing frame\n"); img->bad_frame = 1; } else { img->bad_frame = 0; @@ -1308,7 +1307,7 @@ static void *init_video_plugin (xine_t *xine, void *data) { ff_video_class_t *this; config_values_t *config; - this = (ff_video_class_t *) malloc (sizeof (ff_video_class_t)); + this = (ff_video_class_t *) xine_xmalloc (sizeof (ff_video_class_t)); this->decoder_class.open_plugin = ff_video_open_plugin; this->decoder_class.get_identifier = ff_video_get_identifier; @@ -1443,7 +1442,7 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) } if (!this->codec) { - printf (" could not open ffmpeg decoder for buf type 0x%X\n", + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "could not open ffmpeg decoder for buf type 0x%X\n", codec_type); return; } @@ -1472,7 +1471,7 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) this->decode_buffer = xine_xmalloc(AVCODEC_MAX_AUDIO_FRAME_SIZE); if (avcodec_open (this->context, this->codec) < 0) { - printf ("ffmpeg: couldn't open decoder\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg: couldn't open decoder\n")); _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_HANDLED, 0); return; } @@ -1507,7 +1506,7 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) if( this->size + buf->size > this->bufsize ) { this->bufsize = this->size + 2 * buf->size; xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - "ffmpeg: increasing source buffer to %d to avoid overflow.\n", this->bufsize); + _("ffmpeg: increasing source buffer to %d to avoid overflow.\n"), this->bufsize); this->buf = realloc( this->buf, this->bufsize ); } @@ -1525,7 +1524,7 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) this->size); if (bytes_consumed<0) { - printf ("ffmpeg: error decompressing audio frame\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "ffmpeg: error decompressing audio frame\n"); this->size=0; return; } @@ -1536,7 +1535,8 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); if (audio_buffer->mem_size == 0) { - printf ("ffmpeg: Help! Allocated audio buffer with nothing in it!\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "ffmpeg: Help! Allocated audio buffer with nothing in it!\n"); return; } @@ -1563,8 +1563,8 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) offset += bytes_consumed; if (!decode_buffer_size) { - printf ("ffmpeg: didn't get an audio frame, got %d bytes left\n", - this->size); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "ffmpeg: didn't get an audio frame, got %d bytes left\n", this->size); if (this->size>0) memmove (this->buf, &this->buf[offset], this->size); @@ -1655,7 +1655,7 @@ static void *init_audio_plugin (xine_t *xine, void *data) { ff_audio_class_t *this ; - this = (ff_audio_class_t *) malloc (sizeof (ff_audio_class_t)); + this = (ff_audio_class_t *) xine_xmalloc (sizeof (ff_audio_class_t)); this->decoder_class.open_plugin = ff_audio_open_plugin; this->decoder_class.get_identifier = ff_audio_get_identifier; diff --git a/src/libffmpeg/xine_encoder.c b/src/libffmpeg/xine_encoder.c index da8dde351..7c92223e4 100644 --- a/src/libffmpeg/xine_encoder.c +++ b/src/libffmpeg/xine_encoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_encoder.c,v 1.8 2003/11/04 20:49:45 mroi Exp $ + * $Id: xine_encoder.c,v 1.9 2003/12/05 15:54:59 f1rmb Exp $ */ /* mpeg encoders for the dxr3 video out plugin. */ @@ -68,9 +68,8 @@ int dxr3_encoder_init(dxr3_driver_t *drv) #if LOG_ENC printf("dxr3_mpeg_encoder: lavc init , version %x\n", avcodec_version()); #endif - this = malloc(sizeof(lavc_data_t)); + this = xine_xmalloc(sizeof(lavc_data_t)); if (!this) return 0; - memset(this, 0, sizeof(lavc_data_t)); this->encoder_data.type = ENC_LAVC; this->encoder_data.on_update_format = lavc_on_update_format; diff --git a/src/libflac/decoder_flac.c b/src/libflac/decoder_flac.c index 8c7d39ad0..620c20455 100644 --- a/src/libflac/decoder_flac.c +++ b/src/libflac/decoder_flac.c @@ -337,7 +337,7 @@ static audio_decoder_t * open_plugin (audio_decoder_class_t *class_gen, xine_stream_t *stream) { flac_decoder_t *this ; - this = (flac_decoder_t *) malloc (sizeof (flac_decoder_t)); + this = (flac_decoder_t *) xine_xmalloc (sizeof (flac_decoder_t)); this->audio_decoder.decode_data = flac_decode_data; this->audio_decoder.reset = flac_reset; @@ -389,7 +389,7 @@ static void * init_plugin (xine_t *xine, void *data) { flac_class_t *this; - this = (flac_class_t *) malloc (sizeof (flac_class_t)); + this = (flac_class_t *) xine_xmalloc (sizeof (flac_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libflac/demux_flac.c b/src/libflac/demux_flac.c index 086f20fa9..4573b06b3 100644 --- a/src/libflac/demux_flac.c +++ b/src/libflac/demux_flac.c @@ -244,23 +244,27 @@ flac_error_callback (const FLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) { + demux_flac_t *this = (demux_flac_t *)client_data; /* This will be called if there is an error when flac is seeking * in the stream. */ - demux_flac_t *this = (demux_flac_t *)client_data; - printf("demux_flac: flac_error_callback\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_flac: flac_error_callback\n"); + if (status == FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC) - printf("demux_flac: Decoder lost synchronization.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_flac: Decoder lost synchronization.\n"); else if (status == FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER) - printf("demux_flac: Decoder encounted a corrupted frame header.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_flac: Decoder encounted a corrupted frame header.\n"); else if (status == FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH) - printf("demux_flac: Frame's data did not match the CRC in the footer.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_flac: Frame's data did not match the CRC in the footer.\n"); else - printf("demux_flac: unknown error.\n"); - + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_flac: unknown error.\n"); + this->status = DEMUX_FINISHED; - + return; } diff --git a/src/liblpcm/xine_decoder.c b/src/liblpcm/xine_decoder.c index fc8edaea9..7c4e30f56 100644 --- a/src/liblpcm/xine_decoder.c +++ b/src/liblpcm/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.46 2003/11/16 23:33:45 f1rmb Exp $ + * $Id: xine_decoder.c,v 1.47 2003/12/05 15:54:59 f1rmb Exp $ * * 31-8-2001 Added LPCM rate sensing. * (c) 2001 James Courtier-Dutton James@superbug.demon.co.uk @@ -197,7 +197,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre lpcm_decoder_t *this ; - this = (lpcm_decoder_t *) malloc (sizeof (lpcm_decoder_t)); + this = (lpcm_decoder_t *) xine_xmalloc (sizeof (lpcm_decoder_t)); this->audio_decoder.decode_data = lpcm_decode_data; this->audio_decoder.reset = lpcm_reset; @@ -232,7 +232,7 @@ static void *init_plugin (xine_t *xine, void *data) { lpcm_class_t *this ; - this = (lpcm_class_t *) malloc (sizeof (lpcm_class_t)); + this = (lpcm_class_t *) xine_xmalloc (sizeof (lpcm_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libmad/xine_decoder.c b/src/libmad/xine_decoder.c index fe6607b44..01c5a7edc 100644 --- a/src/libmad/xine_decoder.c +++ b/src/libmad/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.44 2003/11/26 19:43:32 f1rmb Exp $ + * $Id: xine_decoder.c,v 1.45 2003/12/05 15:54:59 f1rmb Exp $ * * stuff needed to turn libmad into a xine decoder plugin */ @@ -130,8 +130,9 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { lprintf ("decode data, decoder_flags: %d\n", buf->decoder_flags); if (buf->size>(INPUT_BUF_SIZE-this->bytes_in_buffer)) { - printf ("libmad: ALERT input buffer too small (%d bytes, %d avail)!\n", - buf->size, INPUT_BUF_SIZE-this->bytes_in_buffer); + xprintf (this->xstream->xine, XINE_VERBOSITY_DEBUG, + "libmad: ALERT input buffer too small (%d bytes, %d avail)!\n", + buf->size, INPUT_BUF_SIZE-this->bytes_in_buffer); buf->size = INPUT_BUF_SIZE-this->bytes_in_buffer; } @@ -290,7 +291,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre mad_decoder_t *this ; - this = (mad_decoder_t *) malloc (sizeof (mad_decoder_t)); + this = (mad_decoder_t *) xine_xmalloc (sizeof (mad_decoder_t)); this->audio_decoder.decode_data = mad_decode_data; this->audio_decoder.reset = mad_reset; @@ -332,7 +333,7 @@ static void *init_plugin (xine_t *xine, void *data) { mad_class_t *this; - this = (mad_class_t *) malloc (sizeof (mad_class_t)); + this = (mad_class_t *) xine_xmalloc (sizeof (mad_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libmpeg2/xine_decoder.c b/src/libmpeg2/xine_decoder.c index 0f2efb057..2fe0f5938 100644 --- a/src/libmpeg2/xine_decoder.c +++ b/src/libmpeg2/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.52 2003/11/26 19:43:34 f1rmb Exp $ + * $Id: xine_decoder.c,v 1.53 2003/12/05 15:54:59 f1rmb Exp $ * * stuff needed to turn libmpeg2 into a xine decoder plugin */ @@ -119,8 +119,7 @@ static void mpeg2dec_dispose (video_decoder_t *this_gen) { static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stream_t *stream) { mpeg2dec_decoder_t *this ; - this = (mpeg2dec_decoder_t *) malloc (sizeof (mpeg2dec_decoder_t)); - memset(this, 0, sizeof (mpeg2dec_decoder_t)); + this = (mpeg2dec_decoder_t *) xine_xmalloc (sizeof (mpeg2dec_decoder_t)); this->video_decoder.decode_data = mpeg2dec_decode_data; this->video_decoder.flush = mpeg2dec_flush; @@ -158,7 +157,7 @@ static void *init_plugin (xine_t *xine, void *data) { mpeg2_class_t *this; - this = (mpeg2_class_t *) malloc (sizeof (mpeg2_class_t)); + this = (mpeg2_class_t *) xine_xmalloc (sizeof (mpeg2_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libmpeg2new/xine_decoder.c b/src/libmpeg2new/xine_decoder.c index 7a9bfd77c..1f41f68b4 100644 --- a/src/libmpeg2new/xine_decoder.c +++ b/src/libmpeg2new/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.15 2003/11/16 23:33:45 f1rmb Exp $ + * $Id: xine_decoder.c,v 1.16 2003/12/05 15:54:59 f1rmb Exp $ * * stuff needed to turn libmpeg2 into a xine decoder plugin */ @@ -426,8 +426,7 @@ static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stre mpeg2_video_decoder_t *this ; int32_t n; - this = (mpeg2_video_decoder_t *) malloc (sizeof (mpeg2_video_decoder_t)); - memset(this, 0, sizeof (mpeg2_video_decoder_t)); + this = (mpeg2_video_decoder_t *) xine_xmalloc (sizeof (mpeg2_video_decoder_t)); this->video_decoder.decode_data = mpeg2_video_decode_data; this->video_decoder.flush = mpeg2_video_flush; @@ -468,7 +467,7 @@ static void *init_plugin (xine_t *xine, void *data) { mpeg2_class_t *this; - this = (mpeg2_class_t *) malloc (sizeof (mpeg2_class_t)); + this = (mpeg2_class_t *) xine_xmalloc (sizeof (mpeg2_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libmpg123/xine_decoder.c b/src/libmpg123/xine_decoder.c index a8b1ba7c0..8805c1014 100644 --- a/src/libmpg123/xine_decoder.c +++ b/src/libmpg123/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.10 2002/09/05 22:18:57 mroi Exp $ + * $Id: xine_decoder.c,v 1.11 2003/12/05 15:54:59 f1rmb Exp $ * * stuff needed to turn libmpg123 into a xine decoder plugin */ @@ -101,7 +101,7 @@ static void *init_audio_decoder_plugin (xine_t *xine, void *data) { mpgdec_decoder_t *this ; - this = (mpgdec_decoder_t *) malloc (sizeof (mpgdec_decoder_t)); + this = (mpgdec_decoder_t *) xine_xmalloc (sizeof (mpgdec_decoder_t)); this->audio_decoder.init = mpgdec_init; this->audio_decoder.reset = mpgdec_reset; diff --git a/src/libreal/audio_decoder.c b/src/libreal/audio_decoder.c index a1de359d0..5ef5ef738 100644 --- a/src/libreal/audio_decoder.c +++ b/src/libreal/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.32 2003/11/26 19:43:35 f1rmb Exp $ + * $Id: audio_decoder.c,v 1.33 2003/12/05 15:54:59 f1rmb Exp $ * * thin layer to use real binary-only codecs in xine * @@ -131,7 +131,7 @@ static int load_syms_linux (realdec_decoder_t *this, char *codec_name) { this->ra_handle = dlopen (path, RTLD_LAZY); if (!this->ra_handle) { - printf ("libareal: error: %s\n", dlerror()); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libareal: error: %s\n", dlerror()); _x_message(this->stream, XINE_MSG_LIBRARY_LOAD_ERROR, codec_name, NULL); return 0; @@ -151,8 +151,8 @@ static int load_syms_linux (realdec_decoder_t *this, char *codec_name) { if (!this->raCloseCodec || !this->raDecode || !this->raFlush || !this->raFreeDecoder || !this->raGetFlavorProperty || !this->raOpenCodec2 || !this->raSetFlavor || /*!raSetDLLAccessPath ||*/ !this->raInitDecoder){ - printf ("libareal: (audio) Cannot resolve symbols - incompatible dll: %s\n", - path); + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + _("libareal: (audio) Cannot resolve symbols - incompatible dll: %s\n"), path); return 0; } @@ -213,7 +213,8 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { /* FIXME: */ if (buf->type==BUF_AUDIO_COOK) { - printf ("libareal: audio header version 4 for COOK audio not supported.\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "libareal: audio header version 4 for COOK audio not supported.\n"); abort(); } data_len = 0; /* FIXME: COOK audio needs this */ @@ -272,8 +273,8 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { break; default: - printf ("libareal: error, i don't handle buf type 0x%08x\n", - buf->type); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "libareal: error, i don't handle buf type 0x%08x\n", buf->type); abort(); } @@ -283,7 +284,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { result = this->raOpenCodec2 (&this->context); if (result) { - printf ("libareal: error in raOpenCodec2: %d\n", result); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libareal: error in raOpenCodec2: %d\n", result); return 0; } @@ -308,8 +309,8 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { result = this->raInitDecoder (this->context, &init_data); if(result){ - printf ("libareal: decoder init failed, error code: 0x%x\n", - result); + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + _("libareal: decoder init failed, error code: 0x%x\n"), result); return 0; } } @@ -322,8 +323,8 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { result = this->raSetFlavor (this->context, flavor); if (result){ - printf ("libareal: decoder flavor setup failed, error code: 0x%x\n", - result); + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + _("libareal: decoder flavor setup failed, error code: 0x%x\n"), result); return 0; } @@ -359,7 +360,8 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { mode = AO_CAP_MODE_STEREO; break; default: - printf ("libareal: oups, real can do more than 2 channels ?\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + _("libareal: oups, real can do more than 2 channels ?\n")); abort(); } @@ -591,8 +593,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, real_class_t *cls = (real_class_t *) class_gen; realdec_decoder_t *this ; - this = (realdec_decoder_t *) malloc (sizeof (realdec_decoder_t)); - memset(this, 0, sizeof (realdec_decoder_t)); + this = (realdec_decoder_t *) xine_xmalloc (sizeof (realdec_decoder_t)); this->audio_decoder.decode_data = realdec_decode_data; this->audio_decoder.reset = realdec_reset; @@ -632,7 +633,7 @@ void __builtin_vec_delete(void *mem) { free(mem); } void __pure_virtual(void) { - printf("libareal: FATAL: __pure_virtual() called!\n"); + lprintf("libareal: FATAL: __pure_virtual() called!\n"); /* exit(1); */ } diff --git a/src/libreal/xine_decoder.c b/src/libreal/xine_decoder.c index 9f595f880..133df236b 100644 --- a/src/libreal/xine_decoder.c +++ b/src/libreal/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.55 2003/11/26 19:43:36 f1rmb Exp $ + * $Id: xine_decoder.c,v 1.56 2003/12/05 15:55:00 f1rmb Exp $ * * thin layer to use real binary-only codecs in xine * @@ -130,7 +130,7 @@ static int load_syms_linux (realdec_decoder_t *this, char *codec_name) { this->rv_handle = dlopen (path, RTLD_LAZY); if (!this->rv_handle) { - printf ("libreal: error: %s\n", dlerror()); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libreal: error: %s\n", dlerror()); _x_message(this->stream, XINE_MSG_LIBRARY_LOAD_ERROR, codec_name, NULL); return 0; @@ -149,7 +149,8 @@ static int load_syms_linux (realdec_decoder_t *this, char *codec_name) { this->rvyuv_transform) return 1; - printf ("libreal: Error resolving symbols! (version incompatibility?)\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + _("libreal: Error resolving symbols! (version incompatibility?)\n")); return 0; } @@ -178,8 +179,8 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { _x_meta_info_set(this->stream, XINE_META_INFO_VIDEOCODEC, "Real Video 4.0"); break; default: - printf ("libreal: error, i don't handle buf type 0x%08x\n", - buf->type); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "libreal: error, i don't handle buf type 0x%08x\n", buf->type); abort(); } @@ -514,7 +515,6 @@ static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, realdec_decoder_t *this ; this = (realdec_decoder_t *) xine_xmalloc (sizeof (realdec_decoder_t)); - memset(this, 0, sizeof (realdec_decoder_t)); this->video_decoder.decode_data = realdec_decode_data; this->video_decoder.flush = realdec_flush; @@ -560,7 +560,7 @@ void __builtin_vec_delete(void *mem) { free(mem); } void __pure_virtual(void) { - printf("libreal: FATAL: __pure_virtual() called!\n"); + lprintf("libreal: FATAL: __pure_virtual() called!\n"); /* exit(1); */ } diff --git a/src/libspeex/xine_decoder.c b/src/libspeex/xine_decoder.c index 17a9fc9f3..12c46c0e9 100644 --- a/src/libspeex/xine_decoder.c +++ b/src/libspeex/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.6 2003/11/26 19:43:36 f1rmb Exp $ + * $Id: xine_decoder.c,v 1.7 2003/12/05 15:55:00 f1rmb Exp $ * * (ogg/)speex audio decoder plugin (libspeex wrapper) for xine */ @@ -122,7 +122,7 @@ void read_metadata (speex_decoder_t *this, char * comments, int length) _x_meta_info_set(this->stream, XINE_META_INFO_AUDIOCODEC, "speex"); if (length < 8) { - printf ("libspeex: invalid/corrupted comments\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libspeex: invalid/corrupted comments\n"); return; } @@ -131,7 +131,7 @@ void read_metadata (speex_decoder_t *this, char * comments, int length) c += 4; if (c+len > end) { - printf ("libspeex: invalid/corrupted comments\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libspeex: invalid/corrupted comments\n"); return; } @@ -145,7 +145,7 @@ void read_metadata (speex_decoder_t *this, char * comments, int length) c += len; if (c+4 > end) { - printf ("libspeex: invalid/corrupted comments\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libspeex: invalid/corrupted comments\n"); return; } @@ -154,14 +154,14 @@ void read_metadata (speex_decoder_t *this, char * comments, int length) for (i = 0; i < nb_fields; i++) { if (c+4 > end) { - printf ("libspeex: invalid/corrupted comments\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libspeex: invalid/corrupted comments\n"); return; } len = readint (c, 0); c += 4; if (c+len > end) { - printf ("libspeex: invalid/corrupted comments\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libspeex: invalid/corrupted comments\n"); return; } @@ -213,7 +213,7 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { spx_header = speex_packet_to_header (buf->content, buf->size); if (!spx_header) { - printf ("libspeex: could not read Speex header\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libspeex: could not read Speex header\n"); return; } @@ -221,13 +221,13 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { spx_mode = speex_mode_list[modeID]; if (spx_mode->bitstream_version != spx_header->mode_bitstream_version) { - printf ("libspeex: incompatible Speex mode bitstream version\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libspeex: incompatible Speex mode bitstream version\n"); return; } this->st = speex_decoder_init (spx_mode); if (!this->st) { - printf ("libspeex: decoder initialization failed\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libspeex: decoder initialization failed\n"); return; } @@ -285,8 +285,8 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { mode = AO_CAP_MODE_5_1CHANNEL; break; default: - printf ("libspeex: help, %d channels ?!\n", - this->channels); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "libspeex: help, %d channels ?!\n", this->channels); /* FIXME: handle error */ } @@ -321,11 +321,11 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { if (ret==-1) break; if (ret==-2) { - printf ("libspeex: Decoding error, corrupted stream?\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libspeex: Decoding error, corrupted stream?\n"); break; } if (speex_bits_remaining(&this->bits)<0) { - printf ("libspeex: Decoding overflow, corrupted stream?\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libspeex: Decoding overflow, corrupted stream?\n"); break; } @@ -387,7 +387,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, speex_decoder_t *this ; static SpeexStereoState init_stereo = SPEEX_STEREO_STATE_INIT; - this = (speex_decoder_t *) malloc (sizeof (speex_decoder_t)); + this = (speex_decoder_t *) xine_xmalloc (sizeof (speex_decoder_t)); this->audio_decoder.decode_data = speex_decode_data; this->audio_decoder.reset = speex_reset; @@ -428,7 +428,7 @@ static void *init_plugin (xine_t *xine, void *data) { speex_class_t *this; - this = (speex_class_t *) malloc (sizeof (speex_class_t)); + this = (speex_class_t *) xine_xmalloc (sizeof (speex_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libspudec/spu.c b/src/libspudec/spu.c index cd4219781..d363cfabd 100644 --- a/src/libspudec/spu.c +++ b/src/libspudec/spu.c @@ -35,7 +35,7 @@ * along with this program; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: spu.c,v 1.72 2003/11/26 01:03:31 miguelfreitas Exp $ + * $Id: spu.c,v 1.73 2003/12/05 15:55:00 f1rmb Exp $ * */ @@ -70,9 +70,9 @@ #define LOG_NAV 1 */ -static void spudec_do_commands (spudec_state_t *state, spudec_seq_t* seq, vo_overlay_t *ovl); -static void spudec_draw_picture (spudec_state_t *state, spudec_seq_t* seq, vo_overlay_t *ovl); -static void spudec_discover_clut (spudec_state_t *state, vo_overlay_t *ovl); +static void spudec_do_commands (xine_t *xine, spudec_state_t *state, spudec_seq_t* seq, vo_overlay_t *ovl); +static void spudec_draw_picture (xine_t *xine, spudec_state_t *state, spudec_seq_t* seq, vo_overlay_t *ovl); +static void spudec_discover_clut (xine_t *xine, spudec_state_t *state, vo_overlay_t *ovl); #ifdef LOG_DEBUG static void spudec_print_overlay( vo_overlay_t *overlay ); #endif @@ -88,7 +88,8 @@ void spudec_decode_nav(spudec_decoder_t *this, buf_element_t *buf) { p = buf->content; if (p[0] || p[1] || (p[2] != 1)) { - printf("libspudec:spudec_decode_nav:nav demux error! %02x %02x %02x (should be 0x000001) \n",p[0],p[1],p[2]); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "libspudec:spudec_decode_nav:nav demux error! %02x %02x %02x (should be 0x000001) \n",p[0],p[1],p[2]); return; } @@ -168,7 +169,7 @@ void spudec_decode_nav(spudec_decoder_t *this, buf_element_t *buf) { this->event.vpts = 0; ovl_manager->add_event(ovl_manager, (void *)&this->event); } else { - printf("libspudec: No video_overlay handles left for menu\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "libspudec: No video_overlay handles left for menu\n"); } } xine_fast_memcpy(&this->pci, &pci, sizeof(pci_t)); @@ -229,14 +230,15 @@ void spudec_decode_nav(spudec_decoder_t *this, buf_element_t *buf) { /* FIXME: Add command copying here */ break; default: - printf("libspudec: unknown pci.hli.hl_gi.hli_ss = %d\n", pci.hli.hl_gi.hli_ss ); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "libspudec: unknown pci.hli.hl_gi.hli_ss = %d\n", pci.hli.hl_gi.hli_ss ); break; } pthread_mutex_unlock(&this->nav_pci_lock); return; } -void spudec_reassembly (spudec_seq_t *seq, uint8_t *pkt_data, u_int pkt_len) +void spudec_reassembly (xine_t *xine, spudec_seq_t *seq, uint8_t *pkt_data, u_int pkt_len) { #ifdef LOG_DEBUG printf ("libspudec: seq->complete = %d\n", seq->complete); @@ -250,7 +252,7 @@ void spudec_reassembly (spudec_seq_t *seq, uint8_t *pkt_data, u_int pkt_len) seq->seq_len = (((uint32_t)pkt_data[0])<<8) | pkt_data[1]; seq->cmd_offs = (((uint32_t)pkt_data[2])<<8) | pkt_data[3]; if (seq->cmd_offs >= seq->seq_len) { - printf("libspudec:faulty stream\n"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "libspudec:faulty stream\n"); seq->broken = 1; } if (seq->buf_len < seq->seq_len) { @@ -289,7 +291,7 @@ void spudec_reassembly (spudec_seq_t *seq, uint8_t *pkt_data, u_int pkt_len) memcpy (seq->buf + seq->ra_offs, pkt_data, pkt_len); seq->ra_offs += pkt_len; } else { - printf("libspudec:faulty stream\n"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "libspudec:faulty stream\n"); seq->broken = 1; } @@ -333,13 +335,13 @@ void spudec_process (spudec_decoder_t *this, int stream_id) { } /* parse SPU command sequence, this will update forced_display, so it must come * before the check for it */ - spudec_do_commands(&this->state, cur_seq, &this->overlay); + spudec_do_commands(this->stream->xine, &this->state, cur_seq, &this->overlay); /* FIXME: Check for Forced-display or subtitle stream * For subtitles, open event. * For menus, store it for later. */ if (cur_seq->broken) { - printf("libspudec: dropping broken SPU\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "libspudec: dropping broken SPU\n"); cur_seq->broken = 0; return; } @@ -377,8 +379,9 @@ void spudec_process (spudec_decoder_t *this, int stream_id) { #ifdef LOG_BUTTON fprintf(stderr, "libspudec:Full Overlay\n"); #endif - if (!spudec_copy_nav_to_overlay(&this->pci, this->state.clut, this->buttonN, 0, - &this->overlay, &this->overlay)) { + if (!spudec_copy_nav_to_overlay(this->stream->xine, + &this->pci, this->state.clut, + this->buttonN, 0, &this->overlay, &this->overlay)) { /* current button does not exist -> use another one */ xine_event_t event; @@ -391,8 +394,9 @@ void spudec_process (spudec_decoder_t *this, int stream_id) { event.data = &this->buttonN; event.data_length = sizeof(this->buttonN); xine_event_send(this->stream, &event); - spudec_copy_nav_to_overlay(&this->pci, this->state.clut, this->buttonN, 0, - &this->overlay, &this->overlay); + spudec_copy_nav_to_overlay(this->stream->xine, + &this->pci, this->state.clut, + this->buttonN, 0, &this->overlay, &this->overlay); } } else { /* Subtitle and not a menu button */ @@ -405,11 +409,11 @@ void spudec_process (spudec_decoder_t *this, int stream_id) { pthread_mutex_unlock(&this->nav_pci_lock); if ((this->state.modified) ) { - spudec_draw_picture(&this->state, cur_seq, &this->overlay); + spudec_draw_picture(this->stream->xine, &this->state, cur_seq, &this->overlay); } if (this->state.need_clut) { - spudec_discover_clut(&this->state, &this->overlay); + spudec_discover_clut(this->stream->xine, &this->state, &this->overlay); } /* Subtitle */ @@ -418,7 +422,8 @@ void spudec_process (spudec_decoder_t *this, int stream_id) { } if( this->menu_handle < 0 ) { - printf("libspudec: No video_overlay handles left for menu\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "libspudec: No video_overlay handles left for menu\n"); return; } this->event.object.handle = this->menu_handle; @@ -472,7 +477,7 @@ void spudec_process (spudec_decoder_t *this, int stream_id) { #define CMD_SPU_WIPE 0x07 /* Not currently implemented */ #define CMD_SPU_EOF 0xff -static void spudec_do_commands(spudec_state_t *state, spudec_seq_t* seq, vo_overlay_t *ovl) +static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t* seq, vo_overlay_t *ovl) { uint8_t *buf = state->cmd_ptr; uint8_t *next_seq; @@ -594,7 +599,7 @@ static void spudec_do_commands(spudec_state_t *state, spudec_seq_t* seq, vo_over if ((state->field_offs[0] >= seq->seq_len) || (state->field_offs[1] >= seq->seq_len)) { - printf("libspudec:faulty stream\n"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "libspudec:faulty stream\n"); seq->broken = 1; } state->modified = 1; @@ -618,7 +623,7 @@ static void spudec_do_commands(spudec_state_t *state, spudec_seq_t* seq, vo_over break; default: - printf("libspudec: unknown seqence command (%02x)\n", buf[0]); + xprintf(xine, XINE_VERBOSITY_DEBUG, "libspudec: unknown seqence command (%02x)\n", buf[0]); /* FIXME: SPU should be dropped, and buffers resynced */ buf = next_seq; seq->broken = 1; @@ -682,7 +687,7 @@ static int spudec_next_line (vo_overlay_t *spu) return 0; } -static void spudec_draw_picture (spudec_state_t *state, spudec_seq_t* seq, vo_overlay_t *ovl) +static void spudec_draw_picture (xine_t *xine, spudec_state_t *state, spudec_seq_t* seq, vo_overlay_t *ovl) { rle_elem_t *rle; field = 0; @@ -706,7 +711,9 @@ static void spudec_draw_picture (spudec_state_t *state, spudec_seq_t* seq, vo_ov ovl->data_size = seq->cmd_offs * 2 * sizeof(rle_elem_t); if (ovl->rle) { - printf ("libspudec: spudec_draw_picture: ovl->rle is not empty!!!! It should be!!! You should never see this message.\n"); + xprintf (xine, XINE_VERBOSITY_DEBUG, + "libspudec: spudec_draw_picture: ovl->rle is not empty!!!! It should be!!! " + "You should never see this message.\n"); free(ovl->rle); ovl->rle=NULL; } @@ -767,7 +774,7 @@ static void spudec_draw_picture (spudec_state_t *state, spudec_seq_t* seq, vo_ov MINFOUND is the number of ocurrences threshold. */ #define MINFOUND 20 -static void spudec_discover_clut(spudec_state_t *state, vo_overlay_t *ovl) +static void spudec_discover_clut(xine_t *xine, spudec_state_t *state, vo_overlay_t *ovl) { int bg,c; int seqcolor[10]; @@ -867,8 +874,8 @@ static void spudec_print_overlay( vo_overlay_t *ovl ) { } #endif -int spudec_copy_nav_to_overlay(pci_t* nav_pci, uint32_t* clut, int32_t button, int32_t mode, - vo_overlay_t * overlay, vo_overlay_t * base ) { +int spudec_copy_nav_to_overlay(xine_t *xine, pci_t* nav_pci, uint32_t* clut, + int32_t button, int32_t mode, vo_overlay_t * overlay, vo_overlay_t * base ) { btni_t *button_ptr = NULL; unsigned int btns_per_group; int i; @@ -887,7 +894,8 @@ int spudec_copy_nav_to_overlay(pci_t* nav_pci, uint32_t* clut, int32_t button, i if (!button_ptr && nav_pci->hli.hl_gi.btngr_ns >= 3 && !(nav_pci->hli.hl_gi.btngr3_dsp_ty & 6)) button_ptr = &nav_pci->hli.btnit[2 * btns_per_group + button - 1]; if (!button_ptr) { - printf("libspudec: No suitable menu button group found, using group 1.\n"); + xprintf(xine, XINE_VERBOSITY_DEBUG, + "libspudec: No suitable menu button group found, using group 1.\n"); button_ptr = &nav_pci->hli.btnit[button - 1]; } diff --git a/src/libspudec/spu.h b/src/libspudec/spu.h index 71ecd99c9..3aa55ba0a 100644 --- a/src/libspudec/spu.h +++ b/src/libspudec/spu.h @@ -19,7 +19,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: spu.h,v 1.23 2003/11/09 21:49:36 mroi Exp $ + * $Id: spu.h,v 1.24 2003/12/05 15:55:00 f1rmb Exp $ * * This file was originally part of the OMS program. * @@ -125,10 +125,10 @@ typedef struct spudec_decoder_s { int64_t last_event_vpts; } spudec_decoder_t; -void spudec_reassembly (spudec_seq_t *seq, uint8_t *pkt_data, u_int pkt_len); +void spudec_reassembly (xine_t *xine, spudec_seq_t *seq, uint8_t *pkt_data, u_int pkt_len); void spudec_process( spudec_decoder_t *this, int stream_id); void spudec_decode_nav( spudec_decoder_t *this, buf_element_t *buf); -int spudec_copy_nav_to_overlay(pci_t* nav_pci, uint32_t* clut, int32_t button, int32_t mode, +int spudec_copy_nav_to_overlay(xine_t *xine, pci_t* nav_pci, uint32_t* clut, int32_t button, int32_t mode, vo_overlay_t * overlay, vo_overlay_t * base ); #endif diff --git a/src/libspudec/xine_decoder.c b/src/libspudec/xine_decoder.c index 3207f78dc..09b4c5795 100644 --- a/src/libspudec/xine_decoder.c +++ b/src/libspudec/xine_decoder.c @@ -19,7 +19,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.101 2003/11/26 01:03:32 miguelfreitas Exp $ + * $Id: xine_decoder.c,v 1.102 2003/12/05 15:55:00 f1rmb Exp $ * * stuff needed to turn libspu into a xine decoder plugin */ @@ -135,12 +135,11 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { this->spudec_stream_state[stream_id].pts = buf->pts; /* Required to match up with NAV packets */ } - spudec_reassembly(&this->spudec_stream_state[stream_id].ra_seq, - buf->content, - buf->size); + spudec_reassembly(this->stream->xine, + &this->spudec_stream_state[stream_id].ra_seq, buf->content, buf->size); if(this->spudec_stream_state[stream_id].ra_seq.complete == 1) { if(this->spudec_stream_state[stream_id].ra_seq.broken) { - printf("libspudec: dropping broken SPU\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "libspudec: dropping broken SPU\n"); this->spudec_stream_state[stream_id].ra_seq.broken = 0; } else spudec_process(this,stream_id); @@ -266,14 +265,15 @@ static void spudec_set_button (spu_decoder_t *this_gen, int32_t button, int32_t #ifdef LOG_BUTTON fprintf(stderr, "libspudec:Button Overlay\n"); #endif - spudec_copy_nav_to_overlay(&this->pci, this->state.clut, this->buttonN, show-1, - overlay, &this->overlay ); + spudec_copy_nav_to_overlay(this->stream->xine, &this->pci, this->state.clut, + this->buttonN, show-1, overlay, &this->overlay ); pthread_mutex_unlock(&this->nav_pci_lock); } else { - fprintf (stderr,"libspudec:xine_decoder.c:spudec_event_listener:HIDE ????\n"); - XINE_ASSERT(0, "We dropped out here for some reason"); - overlay_event->object.handle = this->menu_handle; - overlay_event->event_type = OVERLAY_EVENT_HIDE; + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "libspudec:xine_decoder.c:spudec_event_listener:HIDE ????\n"); + XINE_ASSERT(0, "We dropped out here for some reason"); + overlay_event->object.handle = this->menu_handle; + overlay_event->event_type = OVERLAY_EVENT_HIDE; } overlay_event->vpts = 0; if (this->stream->video_out) { @@ -358,14 +358,14 @@ static void *init_plugin (xine_t *xine, void *data) { spudec_class_t *this; - this = (spudec_class_t *) malloc (sizeof (spudec_class_t)); + this = (spudec_class_t *) xine_xmalloc (sizeof (spudec_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; this->decoder_class.get_description = get_description; this->decoder_class.dispose = dispose_class; - printf ("libspudec:init_plugin called\n"); + lprintf ("libspudec:init_plugin called\n"); return this; } diff --git a/src/libsputext/xine_decoder.c b/src/libsputext/xine_decoder.c index 1c6ca679d..89bf1dc1c 100644 --- a/src/libsputext/xine_decoder.c +++ b/src/libsputext/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.69 2003/12/04 03:23:28 miguelfreitas Exp $ + * $Id: xine_decoder.c,v 1.70 2003/12/05 15:55:00 f1rmb Exp $ * */ @@ -564,7 +564,7 @@ static void update_osd_font(void *class_gen, xine_cfg_entry_t *entry) strcpy(class->font, entry->str_value); - printf("libsputext: spu_font = %s\n", class->font ); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "libsputext: spu_font = %s\n", class->font ); } static void update_subtitle_size(void *class_gen, xine_cfg_entry_t *entry) @@ -618,7 +618,7 @@ static void update_src_encoding(void *class_gen, xine_cfg_entry_t *entry) sputext_class_t *class = (sputext_class_t *)class_gen; class->src_encoding = entry->str_value; - printf("libsputext: spu_src_encoding = %s\n", class->src_encoding ); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "libsputext: spu_src_encoding = %s\n", class->src_encoding ); } static void *init_spu_decoder_plugin (xine_t *xine, void *data) { diff --git a/src/libsputext/xine_decoder_ogm.c b/src/libsputext/xine_decoder_ogm.c index 21ad356b6..133abfcf8 100644 --- a/src/libsputext/xine_decoder_ogm.c +++ b/src/libsputext/xine_decoder_ogm.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder_ogm.c,v 1.8 2003/11/26 19:43:36 f1rmb Exp $ + * $Id: xine_decoder_ogm.c,v 1.9 2003/12/05 15:55:00 f1rmb Exp $ * */ @@ -68,7 +68,7 @@ typedef struct spuogm_class_s { typedef struct spuogm_decoder_s { spu_decoder_t spu_decoder; - spuogm_class_t *class; + spuogm_class_t *class; xine_stream_t *stream; int lines; @@ -446,7 +446,7 @@ static void update_osd_font(void *this_gen, xine_cfg_entry_t *entry) if( this->renderer ) this->renderer->set_font (this->osd, this->font, this->font_size); - printf("libspuogm: spu_font = %s\n", this->font ); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "libspuogm: spu_font = %s\n", this->font ); } static void update_subtitle_size(void *this_gen, xine_cfg_entry_t *entry) @@ -514,10 +514,10 @@ static char *spuogm_class_get_description (spu_decoder_class_t *this) { static void update_src_encoding(void *this_gen, xine_cfg_entry_t *entry) { - spuogm_class_t *this = (spuogm_class_t *)this_gen; + spuogm_class_t *class = (spuogm_class_t *)this_gen; - this->src_encoding = entry->str_value; - printf("libspuogm: spu_src_encoding = %s\n", this->src_encoding ); + class->src_encoding = entry->str_value; + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "libspuogm: spu_src_encoding = %s\n", class->src_encoding ); } static void *init_spu_decoder_plugin (xine_t *xine, void *data) { diff --git a/src/libtheora/xine_decoder.c b/src/libtheora/xine_decoder.c index 03bd6bd44..b332af849 100644 --- a/src/libtheora/xine_decoder.c +++ b/src/libtheora/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.17 2003/11/29 11:08:31 f1rmb Exp $ + * $Id: xine_decoder.c,v 1.18 2003/12/05 15:55:00 f1rmb Exp $ * * xine decoder plugin using libtheora * @@ -310,8 +310,7 @@ static video_decoder_t *theora_open_plugin (video_decoder_class_t *class_gen, xi printf ("This release will play back streams which have been encoded with\n"); printf ("libtheora-alpha2.\n"); - this = (theora_decoder_t *) malloc (sizeof (theora_decoder_t)); - memset(this, 0, sizeof (theora_decoder_t)); + this = (theora_decoder_t *) xine_xmalloc (sizeof (theora_decoder_t)); this->theora_decoder.decode_data = theora_decode_data; this->theora_decoder.flush = theora_flush; @@ -369,7 +368,7 @@ static void *init_plugin (xine_t *xine, void *data) { /*initialize our plugin*/ theora_class_t *this; - this = (theora_class_t *) malloc (sizeof (theora_class_t)); + this = (theora_class_t *) xine_xmalloc (sizeof (theora_class_t)); this->decoder_class.open_plugin = theora_open_plugin; this->decoder_class.get_identifier = theora_get_identifier; diff --git a/src/libvorbis/xine_decoder.c b/src/libvorbis/xine_decoder.c index 0c2e7afd2..57e8b06f0 100644 --- a/src/libvorbis/xine_decoder.c +++ b/src/libvorbis/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.34 2003/12/03 03:07:08 miguelfreitas Exp $ + * $Id: xine_decoder.c,v 1.35 2003/12/05 15:55:00 f1rmb Exp $ * * (ogg/)vorbis audio decoder plugin (libvorbis wrapper) for xine */ @@ -303,7 +303,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, vorbis_decoder_t *this ; - this = (vorbis_decoder_t *) malloc (sizeof (vorbis_decoder_t)); + this = (vorbis_decoder_t *) xine_xmalloc (sizeof (vorbis_decoder_t)); this->audio_decoder.decode_data = vorbis_decode_data; this->audio_decoder.reset = vorbis_reset; @@ -343,7 +343,7 @@ static void *init_plugin (xine_t *xine, void *data) { vorbis_class_t *this; - this = (vorbis_class_t *) malloc (sizeof (vorbis_class_t)); + this = (vorbis_class_t *) xine_xmalloc (sizeof (vorbis_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libw32dll/qt_decoder.c b/src/libw32dll/qt_decoder.c index 0513e236a..241af1814 100644 --- a/src/libw32dll/qt_decoder.c +++ b/src/libw32dll/qt_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: qt_decoder.c,v 1.27 2003/11/26 19:43:37 f1rmb Exp $ + * $Id: qt_decoder.c,v 1.28 2003/12/05 15:55:00 f1rmb Exp $ * * quicktime video/audio decoder plugin, using win32 dlls * most of this code comes directly from MPlayer @@ -231,7 +231,7 @@ static void qta_init_driver (qta_decoder_t *this, buf_element_t *buf) { this->qtml_dll = LoadLibraryA("qtmlClient.dll"); if (this->qtml_dll == NULL ) { - printf ("qt_audio: failed to load dll\n" ); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "qt_audio: failed to load dll\n" ); pthread_mutex_unlock(&win32_codec_mutex); _x_message(this->stream, XINE_MSG_LIBRARY_LOAD_ERROR, "qtmlClient.dll", NULL); @@ -240,55 +240,64 @@ static void qta_init_driver (qta_decoder_t *this, buf_element_t *buf) { this->InitializeQTML = (LPFUNC1)GetProcAddress (this->qtml_dll, "InitializeQTML"); if ( this->InitializeQTML == NULL ) { - printf ("qt_audio: failed geting proc address InitializeQTML\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "qt_audio: failed geting proc address InitializeQTML\n"); pthread_mutex_unlock(&win32_codec_mutex); return; } this->SoundConverterOpen = (LPFUNC2)GetProcAddress (this->qtml_dll, "SoundConverterOpen"); if ( this->SoundConverterOpen == NULL ) { - printf ("qt_audio: failed getting proc address SoundConverterOpen\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "qt_audio: failed getting proc address SoundConverterOpen\n"); pthread_mutex_unlock(&win32_codec_mutex); return; } this->SoundConverterClose = (LPFUNC3)GetProcAddress (this->qtml_dll, "SoundConverterClose"); if ( this->SoundConverterClose == NULL ) { - printf ("qt_audio: failed getting proc address SoundConverterClose\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "qt_audio: failed getting proc address SoundConverterClose\n"); pthread_mutex_unlock(&win32_codec_mutex); return; } this->TerminateQTML = (LPFUNC4)GetProcAddress (this->qtml_dll, "TerminateQTML"); if ( this->TerminateQTML == NULL ) { - printf ("qt_audio: failed getting proc address TerminateQTML\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "qt_audio: failed getting proc address TerminateQTML\n"); pthread_mutex_unlock(&win32_codec_mutex); return; } this->SoundConverterSetInfo = (LPFUNC5)GetProcAddress (this->qtml_dll, "SoundConverterSetInfo"); if ( this->SoundConverterSetInfo == NULL ) { - printf ("qt_audio: failed getting proc address SoundConverterSetInfo\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "qt_audio: failed getting proc address SoundConverterSetInfo\n"); pthread_mutex_unlock(&win32_codec_mutex); return; } this->SoundConverterGetBufferSizes = (LPFUNC6)GetProcAddress (this->qtml_dll, "SoundConverterGetBufferSizes"); if ( this->SoundConverterGetBufferSizes == NULL ) { - printf ("qt_audio: failed getting proc address SoundConverterGetBufferSizes\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "qt_audio: failed getting proc address SoundConverterGetBufferSizes\n"); pthread_mutex_unlock(&win32_codec_mutex); return; } this->SoundConverterConvertBuffer = (LPFUNC7)GetProcAddress (this->qtml_dll, "SoundConverterConvertBuffer"); if ( this->SoundConverterConvertBuffer == NULL ) { - printf ("qt_audio: failed getting proc address SoundConverterConvertBuffer1\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "qt_audio: failed getting proc address SoundConverterConvertBuffer1\n"); pthread_mutex_unlock(&win32_codec_mutex); return; } this->SoundConverterEndConversion = (LPFUNC8)GetProcAddress (this->qtml_dll, "SoundConverterEndConversion"); if ( this->SoundConverterEndConversion == NULL ) { - printf ("qt_audio: failed getting proc address SoundConverterEndConversion\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "qt_audio: failed getting proc address SoundConverterEndConversion\n"); pthread_mutex_unlock(&win32_codec_mutex); return; } this->SoundConverterBeginConversion = (LPFUNC9)GetProcAddress (this->qtml_dll, "SoundConverterBeginConversion"); if ( this->SoundConverterBeginConversion == NULL ) { - printf ("qt_audio: failed getting proc address SoundConverterBeginConversion\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "qt_audio: failed getting proc address SoundConverterBeginConversion\n"); pthread_mutex_unlock(&win32_codec_mutex); return; } @@ -328,7 +337,7 @@ static void qta_init_driver (qta_decoder_t *this, buf_element_t *buf) { "Qualcomm Purevoice Codec (QT DLL)"); break; default: - printf ("qt_audio: fourcc for buftype %08x ?\n", buf->type); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "qt_audio: fourcc for buftype %08x ?\n", buf->type); abort (); } @@ -407,8 +416,8 @@ static void qta_init_driver (qta_decoder_t *this, buf_element_t *buf) { mode = AO_CAP_MODE_5_1CHANNEL; break; default: - printf ("qt_audio: help, %d channels ?!\n", - this->wave.nChannels); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "qt_audio: help, %d channels ?!\n", this->wave.nChannels); abort (); } @@ -596,7 +605,7 @@ static void *qta_init_class (xine_t *xine, void *data) { pthread_once (&once_control, init_routine); - this = (qta_class_t *) malloc (sizeof (qta_class_t)); + this = (qta_class_t *) xine_xmalloc (sizeof (qta_class_t)); this->decoder_class.open_plugin = qta_open_plugin; this->decoder_class.get_identifier = qta_get_identifier; @@ -773,7 +782,7 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) { this->qtml_dll = LoadLibraryA("qtmlClient.dll"); if (this->qtml_dll == NULL ) { - printf ("qt_video: failed to load dll\n" ); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "qt_video: failed to load dll\n" ); pthread_mutex_unlock(&win32_codec_mutex); _x_message(this->stream, XINE_MSG_LIBRARY_LOAD_ERROR, "qtmlClient.dll", NULL); @@ -797,7 +806,7 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) { if (!this->InitializeQTML || !this->EnterMovies || !this->FindNextComponent || !this->ImageCodecBandDecompress){ - printf ("qt_video: invalid qt DLL!\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "qt_video: invalid qt DLL!\n"); pthread_mutex_unlock(&win32_codec_mutex); return; } @@ -823,7 +832,7 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) { prev = this->FindNextComponent(NULL,&desc); if(!prev){ - printf("Cannot find requested component\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "Cannot find requested component\n"); pthread_mutex_unlock(&win32_codec_mutex); return; } @@ -1005,8 +1014,8 @@ static void qtv_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { pthread_mutex_unlock(&win32_codec_mutex); if (cres&0xFFFF){ - printf("qt_video: ImageCodecBandDecompress cres=0x%X (-0x%X) %d :(\n", - cres,-cres,cres); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "qt_video: ImageCodecBandDecompress cres=0x%X (-0x%X) %d :(\n", cres,-cres,cres); } img = this->stream->video_out->get_frame (this->stream->video_out, diff --git a/src/libw32dll/w32codec.c b/src/libw32dll/w32codec.c index 6ab0f955d..d3571d8b1 100644 --- a/src/libw32dll/w32codec.c +++ b/src/libw32dll/w32codec.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: w32codec.c,v 1.132 2003/11/26 19:43:37 f1rmb Exp $ + * $Id: w32codec.c,v 1.133 2003/12/05 15:55:00 f1rmb Exp $ * * routines for using w32 codecs * DirectShow support by Miguel Freitas (Nov/2001) @@ -474,8 +474,8 @@ static char* get_vids_codec_name(w32v_decoder_t *this, } - printf ("w32codec: this didn't happen: unknown video buf type %08x\n", - buf_type); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "w32codec: this didn't happen: unknown video buf type %08x\n", buf_type); return NULL; @@ -516,7 +516,7 @@ static void w32v_init_codec (w32v_decoder_t *this, int buf_type) { if(!this->hic){ xine_log (this->stream->xine, XINE_LOG_MSG, - "w32codec: ICOpen failed! unknown codec %08lx / wrong parameters?\n", + _("w32codec: ICOpen failed! unknown codec %08lx / wrong parameters?\n"), this->bih->biCompression); this->decoder_ok = 0; return; @@ -525,16 +525,16 @@ static void w32v_init_codec (w32v_decoder_t *this, int buf_type) { ret = ICDecompressGetFormat(this->hic, this->bih, &this->o_bih); if(ret){ xine_log (this->stream->xine, XINE_LOG_MSG, - "w32codec: ICDecompressGetFormat (%.4s %08lx/%d) failed: Error %ld\n", + _("w32codec: ICDecompressGetFormat (%.4s %08lx/%d) failed: Error %ld\n"), (char*)&this->o_bih.biCompression, this->bih->biCompression, this->bih->biBitCount, (long)ret); this->decoder_ok = 0; return; } - printf ("w32codec: video output format: %.4s %08lx\n", - (char*)&this->o_bih.biCompression, - this->o_bih.biCompression); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "w32codec: video output format: %.4s %08lx\n", + (char*)&this->o_bih.biCompression, this->o_bih.biCompression); if(outfmt==IMGFMT_YUY2 || outfmt==IMGFMT_15RGB) this->o_bih.biBitCount=16; @@ -558,7 +558,7 @@ static void w32v_init_codec (w32v_decoder_t *this, int buf_type) { if(ret){ xine_log (this->stream->xine, XINE_LOG_MSG, - "w32codec: ICDecompressQuery failed: Error %ld\n", (long)ret); + _("w32codec: ICDecompressQuery failed: Error %ld\n"), (long)ret); this->decoder_ok = 0; return; } @@ -569,7 +569,7 @@ static void w32v_init_codec (w32v_decoder_t *this, int buf_type) { if(ret){ xine_log (this->stream->xine, XINE_LOG_MSG, - "w32codec: ICDecompressBegin failed: Error %ld\n", (long)ret); + _("w32codec: ICDecompressBegin failed: Error %ld\n"), (long)ret); this->decoder_ok = 0; return; } @@ -598,7 +598,7 @@ static void w32v_init_ds_dmo_codec (w32v_decoder_t *this, int buf_type) { uint32_t vo_cap; int outfmt; - printf ("w32codec: init DirectShow/DMO video codec...\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "w32codec: init DirectShow/DMO video codec...\n"); memset(&this->o_bih, 0, sizeof(BITMAPINFOHEADER)); this->o_bih.biSize = sizeof(BITMAPINFOHEADER); @@ -615,7 +615,7 @@ static void w32v_init_ds_dmo_codec (w32v_decoder_t *this, int buf_type) { if(!this->ds_dec){ xine_log (this->stream->xine, XINE_LOG_MSG, - "w32codec: DS_VideoDecoder failed! unknown codec %08lx / wrong parameters?\n", + _("w32codec: DS_VideoDecoder failed! unknown codec %08lx / wrong parameters?\n"), this->bih->biCompression); this->decoder_ok = 0; return; @@ -626,7 +626,7 @@ static void w32v_init_ds_dmo_codec (w32v_decoder_t *this, int buf_type) { if(!this->dmo_dec){ xine_log (this->stream->xine, XINE_LOG_MSG, - "w32codec: DMO_VideoDecoder failed! unknown codec %08lx / wrong parameters?\n", + _("w32codec: DMO_VideoDecoder failed! unknown codec %08lx / wrong parameters?\n"), this->bih->biCompression); this->decoder_ok = 0; return; @@ -730,7 +730,7 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if( !this->decoder_ok ) { xine_log (this->stream->xine, XINE_LOG_MSG, - "w32codec: decoder failed to start. Is '%s' installed?\n", + _("w32codec: decoder failed to start. Is '%s' installed?\n"), win32_codec_name ); _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HANDLED, 0); _x_message(this->stream, XINE_MSG_LIBRARY_LOAD_ERROR, @@ -757,8 +757,8 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if( this->size + buf->size > this->bufsize ) { this->bufsize = this->size + 2 * buf->size; - printf("w32codec: increasing source buffer to %d to avoid overflow.\n", - this->bufsize); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "w32codec: increasing source buffer to %d to avoid overflow.\n", this->bufsize); this->buf = realloc( this->buf, this->bufsize ); } @@ -887,7 +887,8 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { img->pts = buf->pts; if (ret || this->skipframes) { if (!this->skipframes) - printf("w32codec: Error decompressing frame, err=%ld\n", (long)ret); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "w32codec: Error decompressing frame, err=%ld\n", (long)ret); img->bad_frame = 1; lprintf ("BAD FRAME, duration is %d\n", img->duration); } else { @@ -1051,8 +1052,9 @@ static char* get_auds_codec_name(w32a_decoder_t *this, int buf_type) { "Vivo G.723/Siren Audio Codec (win32)"); return "vivog723.acm"; } - printf ("w32codec: this didn't happen: unknown audio buf type %08x\n", - buf_type); + + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "w32codec: this didn't happen: unknown audio buf type %08x\n", buf_type); return NULL; } @@ -1095,7 +1097,8 @@ static int w32a_init_audio (w32a_decoder_t *this, buf_element_t *buf ) { 16, in_fmt->nSamplesPerSec, (in_fmt->nChannels >= 2) ? AO_CAP_MODE_STEREO : AO_CAP_MODE_MONO); if (!this->output_open) { - printf("w32codec: (ACM_Decoder) Cannot open audio output device\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "w32codec: (ACM_Decoder) Cannot open audio output device\n"); free(in_fmt); return 0; } @@ -1128,10 +1131,10 @@ static int w32a_init_audio (w32a_decoder_t *this, buf_element_t *buf ) { if(ret){ if(ret==ACMERR_NOTPOSSIBLE) xine_log (this->stream->xine, XINE_LOG_MSG, - "w32codec: (ACM_Decoder) Unappropriate audio format\n"); + _("w32codec: (ACM_Decoder) Unappropriate audio format\n")); else xine_log (this->stream->xine, XINE_LOG_MSG, - "w32codec: (ACM_Decoder) acmStreamOpen error %d\n", (int) ret); + _("w32codec: (ACM_Decoder) acmStreamOpen error %d\n"), (int) ret); this->srcstream = 0; free(in_fmt); return 0; @@ -1141,7 +1144,9 @@ static int w32a_init_audio (w32a_decoder_t *this, buf_element_t *buf ) { out_size*=2; if(out_size < audio_buffer_mem_size) out_size=audio_buffer_mem_size; - printf("w32codec: Audio buffer min. size: %d\n",(int)out_size); + + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "w32codec: Audio buffer min. size: %d\n",(int)out_size); acmStreamSize(this->srcstream, out_size, (LPDWORD) &this->rec_audio_src_size, ACM_STREAMSIZEF_DESTINATION); @@ -1149,14 +1154,15 @@ static int w32a_init_audio (w32a_decoder_t *this, buf_element_t *buf ) { this->ds_dec=DS_AudioDecoder_Open(win32_codec_name,this->guid, in_fmt); if( this->ds_dec == NULL ) { - xine_log (this->stream->xine, XINE_LOG_MSG, "w32codec: Error initializing DirectShow Audio\n"); + xine_log (this->stream->xine, XINE_LOG_MSG, _("w32codec: Error initializing DirectShow Audio\n")); this->srcstream = 0; free(in_fmt); return 0; } out_size = audio_buffer_mem_size; - printf("w32codec: output buffer size: %d\n",(int)out_size); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "w32codec: output buffer size: %d\n",(int)out_size); this->rec_audio_src_size=DS_AudioDecoder_GetSrcSize(this->ds_dec,out_size); /* somehow DS_Filters seems to eat more than rec_audio_src_size if the output @@ -1167,20 +1173,23 @@ static int w32a_init_audio (w32a_decoder_t *this, buf_element_t *buf ) { this->dmo_dec=DMO_AudioDecoder_Open(win32_codec_name,this->guid, in_fmt, wf.nChannels); if( this->dmo_dec == NULL ) { - xine_log (this->stream->xine, XINE_LOG_MSG, "w32codec: Error initializing DMO Audio\n"); + xine_log (this->stream->xine, XINE_LOG_MSG, _("w32codec: Error initializing DMO Audio\n")); this->srcstream = 0; free(in_fmt); return 0; } out_size = audio_buffer_mem_size; - printf("w32codec: output buffer size: %d\n",(int)out_size); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "w32codec: output buffer size: %d\n",(int)out_size); this->rec_audio_src_size=DMO_AudioDecoder_GetSrcSize(this->dmo_dec,out_size); /* i don't know if DMO has the same problem as above. so, just in case... */ this->rec_audio_src_size*=2; } - printf("w32codec: Recommended source buffer size: %d\n", this->rec_audio_src_size); + + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "w32codec: Recommended source buffer size: %d\n", this->rec_audio_src_size); if( this->buf ) free(this->buf); @@ -1190,7 +1199,8 @@ static int w32a_init_audio (w32a_decoder_t *this, buf_element_t *buf ) { if( this->rec_audio_src_size < in_fmt->nBlockAlign ) { this->rec_audio_src_size = in_fmt->nBlockAlign; - printf("w32codec: adjusting source buffer size to %d\n", this->rec_audio_src_size); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "w32codec: adjusting source buffer size to %d\n", this->rec_audio_src_size); } this->max_audio_src_size = 2 * this->rec_audio_src_size; @@ -1251,7 +1261,8 @@ static void w32a_decode_audio (w32a_decoder_t *this, if( this->size + size > this->max_audio_src_size ) { this->max_audio_src_size = this->size + 2 * size; - printf("w32codec: increasing source buffer to %d to avoid overflow.\n", + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "w32codec: increasing source buffer to %d to avoid overflow.\n", this->max_audio_src_size); this->buf = realloc( this->buf, this->max_audio_src_size ); } @@ -1282,7 +1293,8 @@ static void w32a_decode_audio (w32a_decoder_t *this, if( this->driver_type == DRIVER_STD ) { hr=acmStreamPrepareHeader(this->srcstream,&ash,0); if(hr){ - printf("w32codec: (ACM_Decoder) acmStreamPrepareHeader error %d\n",(int)hr); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "w32codec: (ACM_Decoder) acmStreamPrepareHeader error %d\n",(int)hr); pthread_mutex_unlock(&win32_codec_mutex); return; } @@ -1304,8 +1316,8 @@ static void w32a_decode_audio (w32a_decoder_t *this, pthread_mutex_unlock(&win32_codec_mutex); if(hr){ - printf ("w32codec: stream convert error %d, used %d bytes\n", - (int)hr,(int)ash.cbSrcLengthUsed); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "w32codec: stream convert error %d, used %d bytes\n", (int)hr,(int)ash.cbSrcLengthUsed); this->size-=ash.cbSrcLength; } else { int DstLengthUsed, bufsize; @@ -1355,7 +1367,8 @@ static void w32a_decode_audio (w32a_decoder_t *this, if( this->driver_type == DRIVER_STD ) { hr=acmStreamUnprepareHeader(this->srcstream,&ash,0); if(hr){ - printf("w32codec: (ACM_Decoder) acmStreamUnprepareHeader error %d\n",(int)hr); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "w32codec: (ACM_Decoder) acmStreamUnprepareHeader error %d\n",(int)hr); } } pthread_mutex_unlock(&win32_codec_mutex); @@ -1379,8 +1392,7 @@ static void w32a_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { if( !this->decoder_ok ) { xine_log (this->stream->xine, XINE_LOG_MSG, - "w32codec: decoder failed to start. Is '%s' installed?\n", - win32_codec_name ); + _("w32codec: decoder failed to start. Is '%s' installed?\n"), win32_codec_name ); _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_HANDLED, 0); } pthread_mutex_unlock(&win32_codec_mutex); @@ -1493,7 +1505,7 @@ static void *init_video_decoder_class (xine_t *xine, void *data) { _("path to win32 codec dlls"), NULL, 0, NULL, NULL); - this = (w32v_class_t *) malloc (sizeof (w32v_class_t)); + this = (w32v_class_t *) xine_xmalloc (sizeof (w32v_class_t)); this->decoder_class.open_plugin = open_video_decoder_plugin; this->decoder_class.get_identifier = get_video_identifier; @@ -1552,7 +1564,7 @@ static void *init_audio_decoder_class (xine_t *xine, void *data) { w32a_class_t *this; config_values_t *cfg; - this = (w32a_class_t *) malloc (sizeof (w32a_class_t)); + this = (w32a_class_t *) xine_xmalloc (sizeof (w32a_class_t)); this->decoder_class.open_plugin = open_audio_decoder_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libxineadec/28k8.c b/src/libxineadec/28k8.c index e8ae06f81..9b520391e 100644 --- a/src/libxineadec/28k8.c +++ b/src/libxineadec/28k8.c @@ -22,7 +22,7 @@ * Based on public domain source code from: * http://www.honeypot.net/audio/ * - * $Id: 28k8.c,v 1.4 2003/11/16 23:33:47 f1rmb Exp $ + * $Id: 28k8.c,v 1.5 2003/12/05 15:55:00 f1rmb Exp $ */ #include <stdio.h> @@ -529,7 +529,7 @@ static void *init_plugin (xine_t *xine, void *data) { ra28k8_class_t *this ; - this = (ra28k8_class_t *) malloc (sizeof (ra28k8_class_t)); + this = (ra28k8_class_t *) xine_xmalloc (sizeof (ra28k8_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libxineadec/adpcm.c b/src/libxineadec/adpcm.c index 9c22eabd5..3b8240142 100644 --- a/src/libxineadec/adpcm.c +++ b/src/libxineadec/adpcm.c @@ -31,7 +31,7 @@ * this is also useful for extracting streams from Playstation discs * * - * $Id: adpcm.c,v 1.34 2003/11/26 19:43:37 f1rmb Exp $ + * $Id: adpcm.c,v 1.35 2003/12/05 15:55:00 f1rmb Exp $ */ #include <stdio.h> @@ -1622,7 +1622,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre adpcm_decoder_t *this ; - this = (adpcm_decoder_t *) malloc (sizeof (adpcm_decoder_t)); + this = (adpcm_decoder_t *) xine_xmalloc (sizeof (adpcm_decoder_t)); this->audio_decoder.decode_data = adpcm_decode_data; this->audio_decoder.reset = adpcm_reset; @@ -1656,7 +1656,7 @@ static void *init_plugin (xine_t *xine, void *data) { adpcm_class_t *this ; - this = (adpcm_class_t *) malloc (sizeof (adpcm_class_t)); + this = (adpcm_class_t *) xine_xmalloc (sizeof (adpcm_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libxineadec/fooaudio.c b/src/libxineadec/fooaudio.c index 40b143004..b2c9351f5 100644 --- a/src/libxineadec/fooaudio.c +++ b/src/libxineadec/fooaudio.c @@ -21,7 +21,7 @@ * player. It really works too! It will output a continuous sine wave in * place of the data it should actually send. * - * $Id: fooaudio.c,v 1.8 2003/11/16 23:33:47 f1rmb Exp $ + * $Id: fooaudio.c,v 1.9 2003/12/05 15:55:00 f1rmb Exp $ */ #include <stdio.h> @@ -128,8 +128,8 @@ static void fooaudio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) * the accumulator buffer size as necessary */ if( this->size + buf->size > this->bufsize ) { this->bufsize = this->size + 2 * buf->size; - printf("fooaudio: increasing source buffer to %d to avoid overflow.\n", - this->bufsize); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "fooaudio: increasing source buffer to %d to avoid overflow.\n", this->bufsize); this->buf = realloc( this->buf, this->bufsize ); } xine_fast_memcpy (&this->buf[this->size], buf->content, buf->size); @@ -179,7 +179,8 @@ static void fooaudio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) /* get an audio buffer */ audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); if (audio_buffer->mem_size == 0) { - printf ("fooaudio: Help! Allocated audio buffer with nothing in it!\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "fooaudio: Help! Allocated audio buffer with nothing in it!\n"); return; } @@ -256,7 +257,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre fooaudio_decoder_t *this ; - this = (fooaudio_decoder_t *) malloc (sizeof (fooaudio_decoder_t)); + this = (fooaudio_decoder_t *) xine_xmalloc (sizeof (fooaudio_decoder_t)); /* connect the member functions */ this->audio_decoder.decode_data = fooaudio_decode_data; @@ -311,7 +312,7 @@ static void *init_plugin (xine_t *xine, void *data) { fooaudio_class_t *this ; - this = (fooaudio_class_t *) malloc (sizeof (fooaudio_class_t)); + this = (fooaudio_class_t *) xine_malloc (sizeof (fooaudio_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libxineadec/gsm610.c b/src/libxineadec/gsm610.c index ac03d940c..c193b83ca 100644 --- a/src/libxineadec/gsm610.c +++ b/src/libxineadec/gsm610.c @@ -44,7 +44,7 @@ * Carsten Bormann * -------------------------------------------------------------------- * - * $Id: gsm610.c,v 1.10 2003/11/16 23:33:47 f1rmb Exp $ + * $Id: gsm610.c,v 1.11 2003/12/05 15:55:00 f1rmb Exp $ * */ @@ -129,8 +129,8 @@ static void gsm610_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { if( this->size + buf->size > this->bufsize ) { this->bufsize = this->size + 2 * buf->size; - printf("gsm610: increasing source buffer to %d to avoid overflow.\n", - this->bufsize); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "gsm610: increasing source buffer to %d to avoid overflow.\n", this->bufsize); this->buf = realloc( this->buf, this->bufsize ); } @@ -146,7 +146,8 @@ static void gsm610_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { /* the data should line up on a 65-byte boundary */ if ((buf->size % 65) != 0) { - printf ("gsm610: received MS GSM block that does not line up\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "gsm610: received MS GSM block that does not line up\n"); this->size = 0; return; } @@ -181,7 +182,7 @@ static void gsm610_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { /* the data should line up on a 33-byte boundary */ if ((buf->size % 33) != 0) { - printf ("gsm610: received GSM block that does not line up\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "gsm610: received GSM block that does not line up\n"); this->size = 0; return; } @@ -235,7 +236,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre gsm610_decoder_t *this ; - this = (gsm610_decoder_t *) malloc (sizeof (gsm610_decoder_t)); + this = (gsm610_decoder_t *) xine_xmalloc (sizeof (gsm610_decoder_t)); this->audio_decoder.decode_data = gsm610_decode_data; this->audio_decoder.reset = gsm610_reset; @@ -267,7 +268,7 @@ static void *init_plugin (xine_t *xine, void *data) { gsm610_class_t *this ; - this = (gsm610_class_t *) malloc (sizeof (gsm610_class_t)); + this = (gsm610_class_t *) xine_xmalloc (sizeof (gsm610_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libxineadec/interplayaudio.c b/src/libxineadec/interplayaudio.c index 41680ee98..abc9bcb53 100644 --- a/src/libxineadec/interplayaudio.c +++ b/src/libxineadec/interplayaudio.c @@ -21,7 +21,7 @@ * For more information regarding the Interplay MVE file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: interplayaudio.c,v 1.4 2003/11/16 23:33:47 f1rmb Exp $ + * $Id: interplayaudio.c,v 1.5 2003/12/05 15:55:00 f1rmb Exp $ */ #include <stdio.h> @@ -161,8 +161,8 @@ static void interplay_decode_data (audio_decoder_t *this_gen, buf_element_t *buf * the accumulator buffer size as necessary */ if( this->size + buf->size > this->bufsize ) { this->bufsize = this->size + 2 * buf->size; - printf("interplayaudio: increasing source buffer to %d to avoid overflow.\n", - this->bufsize); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "interplayaudio: increasing source buffer to %d to avoid overflow.\n", this->bufsize); this->buf = realloc( this->buf, this->bufsize ); } xine_fast_memcpy (&this->buf[this->size], buf->content, buf->size); @@ -193,7 +193,8 @@ static void interplay_decode_data (audio_decoder_t *this_gen, buf_element_t *buf audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); if (audio_buffer->mem_size == 0) { - printf ("interplayaudio: Help! Allocated audio buffer with nothing in it!\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "interplayaudio: Help! Allocated audio buffer with nothing in it!\n"); return; } @@ -263,7 +264,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre interplay_decoder_t *this ; - this = (interplay_decoder_t *) malloc (sizeof (interplay_decoder_t)); + this = (interplay_decoder_t *) xine_xmalloc (sizeof (interplay_decoder_t)); /* connect the member functions */ this->audio_decoder.decode_data = interplay_decode_data; @@ -318,7 +319,7 @@ static void *init_plugin (xine_t *xine, void *data) { interplay_class_t *this ; - this = (interplay_class_t *) malloc (sizeof (interplay_class_t)); + this = (interplay_class_t *) xine_xmalloc (sizeof (interplay_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libxineadec/logpcm.c b/src/libxineadec/logpcm.c index cc972eac6..d5a003a66 100644 --- a/src/libxineadec/logpcm.c +++ b/src/libxineadec/logpcm.c @@ -30,7 +30,7 @@ * http://sox.sourceforge.net/ * which listed the code as being lifted from Sun Microsystems. * - * $Id: logpcm.c,v 1.14 2003/11/16 23:33:47 f1rmb Exp $ + * $Id: logpcm.c,v 1.15 2003/12/05 15:55:00 f1rmb Exp $ * */ @@ -187,8 +187,8 @@ static void logpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { if( this->size + buf->size > this->bufsize ) { this->bufsize = this->size + 2 * buf->size; - printf("logpcm: increasing source buffer to %d to avoid overflow.\n", - this->bufsize); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "logpcm: increasing source buffer to %d to avoid overflow.\n", this->bufsize); this->buf = realloc( this->buf, this->bufsize ); } @@ -203,7 +203,8 @@ static void logpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); if (audio_buffer->mem_size == 0) { - printf ("logpcm: Help! Allocated audio buffer with nothing in it!\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "logpcm: Help! Allocated audio buffer with nothing in it!\n"); return; } @@ -255,7 +256,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre logpcm_decoder_t *this ; - this = (logpcm_decoder_t *) malloc (sizeof (logpcm_decoder_t)); + this = (logpcm_decoder_t *) xine_xmalloc (sizeof (logpcm_decoder_t)); this->audio_decoder.decode_data = logpcm_decode_data; this->audio_decoder.reset = logpcm_reset; @@ -287,7 +288,7 @@ static void *init_plugin (xine_t *xine, void *data) { logpcm_class_t *this ; - this = (logpcm_class_t *) malloc (sizeof (logpcm_class_t)); + this = (logpcm_class_t *) xine_xmalloc (sizeof (logpcm_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libxineadec/nosefart/dis6502.c b/src/libxineadec/nosefart/dis6502.c index 10ae2c44e..ff552d219 100644 --- a/src/libxineadec/nosefart/dis6502.c +++ b/src/libxineadec/nosefart/dis6502.c @@ -20,7 +20,7 @@ ** dis6502.c ** ** 6502 disassembler based on code from John Saeger -** $Id: dis6502.c,v 1.1 2003/01/08 07:04:35 tmmm Exp $ +** $Id: dis6502.c,v 1.2 2003/12/05 15:55:01 f1rmb Exp $ */ #include "types.h" @@ -462,10 +462,13 @@ void nes6502_disasm(uint32 PC, uint8 P, uint8 A, uint8 X, uint8 Y, uint8 S) /* ** $Log: dis6502.c,v $ +** Revision 1.2 2003/12/05 15:55:01 f1rmb +** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's relevant too. Small other little fix (can't remember). Change few internal function prototype because it xine_t pointer need to be used if some xine's internal sections. NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, without invasive changes. To be continued... +** ** Revision 1.1 2003/01/08 07:04:35 tmmm ** initial import of Nosefart sources ** ** Revision 1.4 2000/06/09 15:12:25 matt ** initial revision ** -*/
\ No newline at end of file +*/ diff --git a/src/libxineadec/nosefart/dis6502.h b/src/libxineadec/nosefart/dis6502.h index 73440c657..a02fd73ae 100644 --- a/src/libxineadec/nosefart/dis6502.h +++ b/src/libxineadec/nosefart/dis6502.h @@ -20,7 +20,7 @@ ** dis6502.h ** ** 6502 disassembler header -** $Id: dis6502.h,v 1.1 2003/01/08 07:04:35 tmmm Exp $ +** $Id: dis6502.h,v 1.2 2003/12/05 15:55:01 f1rmb Exp $ */ #ifndef _DIS6502_H_ @@ -40,10 +40,13 @@ extern void nes6502_disasm(uint32 PC, uint8 P, uint8 A, uint8 X, uint8 Y, uint8 /* ** $Log: dis6502.h,v $ +** Revision 1.2 2003/12/05 15:55:01 f1rmb +** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's relevant too. Small other little fix (can't remember). Change few internal function prototype because it xine_t pointer need to be used if some xine's internal sections. NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, without invasive changes. To be continued... +** ** Revision 1.1 2003/01/08 07:04:35 tmmm ** initial import of Nosefart sources ** ** Revision 1.4 2000/06/09 15:12:25 matt ** initial revision ** -*/
\ No newline at end of file +*/ diff --git a/src/libxineadec/nosefart/fds_snd.c b/src/libxineadec/nosefart/fds_snd.c index 3b5fc3e5e..fe2e4d624 100644 --- a/src/libxineadec/nosefart/fds_snd.c +++ b/src/libxineadec/nosefart/fds_snd.c @@ -20,7 +20,7 @@ ** fds_snd.c ** ** Famicom Disk System sound emulation -** $Id: fds_snd.c,v 1.1 2003/01/08 07:04:35 tmmm Exp $ +** $Id: fds_snd.c,v 1.2 2003/12/05 15:55:01 f1rmb Exp $ */ #include "types.h" @@ -76,6 +76,9 @@ apuext_t fds_ext = /* ** $Log: fds_snd.c,v $ +** Revision 1.2 2003/12/05 15:55:01 f1rmb +** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's relevant too. Small other little fix (can't remember). Change few internal function prototype because it xine_t pointer need to be used if some xine's internal sections. NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, without invasive changes. To be continued... +** ** Revision 1.1 2003/01/08 07:04:35 tmmm ** initial import of Nosefart sources ** @@ -88,4 +91,4 @@ apuext_t fds_ext = ** Revision 1.1 2000/06/20 00:06:47 matt ** initial revision ** -*/
\ No newline at end of file +*/ diff --git a/src/libxineadec/nosefart/fds_snd.h b/src/libxineadec/nosefart/fds_snd.h index d4621d52b..9d20b5b2a 100644 --- a/src/libxineadec/nosefart/fds_snd.h +++ b/src/libxineadec/nosefart/fds_snd.h @@ -20,7 +20,7 @@ ** fds_snd.h ** ** Famicom Disk System sound emulation -** $Id: fds_snd.h,v 1.1 2003/01/08 07:04:35 tmmm Exp $ +** $Id: fds_snd.h,v 1.2 2003/12/05 15:55:01 f1rmb Exp $ */ #ifndef _FDS_SND_H_ @@ -35,6 +35,9 @@ extern apuext_t fds_ext; /* ** $Log: fds_snd.h,v $ +** Revision 1.2 2003/12/05 15:55:01 f1rmb +** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's relevant too. Small other little fix (can't remember). Change few internal function prototype because it xine_t pointer need to be used if some xine's internal sections. NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, without invasive changes. To be continued... +** ** Revision 1.1 2003/01/08 07:04:35 tmmm ** initial import of Nosefart sources ** @@ -44,4 +47,4 @@ extern apuext_t fds_ext; ** Revision 1.1 2000/06/20 00:06:47 matt ** initial revision ** -*/
\ No newline at end of file +*/ diff --git a/src/libxineadec/nosefart/log.c b/src/libxineadec/nosefart/log.c index d865fd382..8935a596e 100644 --- a/src/libxineadec/nosefart/log.c +++ b/src/libxineadec/nosefart/log.c @@ -20,7 +20,7 @@ ** log.c ** ** Error logging functions -** $Id: log.c,v 1.1 2003/01/08 07:04:35 tmmm Exp $ +** $Id: log.c,v 1.2 2003/12/05 15:55:01 f1rmb Exp $ */ #include <stdio.h> @@ -103,6 +103,9 @@ void log_printf(const char *format, ... ) /* ** $Log: log.c,v $ +** Revision 1.2 2003/12/05 15:55:01 f1rmb +** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's relevant too. Small other little fix (can't remember). Change few internal function prototype because it xine_t pointer need to be used if some xine's internal sections. NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, without invasive changes. To be continued... +** ** Revision 1.1 2003/01/08 07:04:35 tmmm ** initial import of Nosefart sources ** @@ -112,4 +115,4 @@ void log_printf(const char *format, ... ) ** Revision 1.4 2000/06/09 15:12:25 matt ** initial revision ** -*/
\ No newline at end of file +*/ diff --git a/src/libxineadec/nosefart/log.h b/src/libxineadec/nosefart/log.h index 5ccfb1cd0..b9d282c20 100644 --- a/src/libxineadec/nosefart/log.h +++ b/src/libxineadec/nosefart/log.h @@ -20,7 +20,7 @@ ** log.h ** ** Error logging header file -** $Id: log.h,v 1.1 2003/01/08 07:04:35 tmmm Exp $ +** $Id: log.h,v 1.2 2003/12/05 15:55:01 f1rmb Exp $ */ #ifndef _LOG_H_ @@ -37,10 +37,13 @@ extern void log_printf(const char *format, ...); /* ** $Log: log.h,v $ +** Revision 1.2 2003/12/05 15:55:01 f1rmb +** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's relevant too. Small other little fix (can't remember). Change few internal function prototype because it xine_t pointer need to be used if some xine's internal sections. NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, without invasive changes. To be continued... +** ** Revision 1.1 2003/01/08 07:04:35 tmmm ** initial import of Nosefart sources ** ** Revision 1.4 2000/06/09 15:12:25 matt ** initial revision ** -*/
\ No newline at end of file +*/ diff --git a/src/libxineadec/nosefart/memguard.c b/src/libxineadec/nosefart/memguard.c index 24e7a151a..05d0cb91d 100644 --- a/src/libxineadec/nosefart/memguard.c +++ b/src/libxineadec/nosefart/memguard.c @@ -22,7 +22,7 @@ ** memory allocation wrapper routines ** ** NOTE: based on code (c) 1998 the Retrocade group -** $Id: memguard.c,v 1.1 2003/01/08 07:04:35 tmmm Exp $ +** $Id: memguard.c,v 1.2 2003/12/05 15:55:01 f1rmb Exp $ */ #include "types.h" @@ -363,6 +363,9 @@ void mem_checkblocks(void) /* ** $Log: memguard.c,v $ +** Revision 1.2 2003/12/05 15:55:01 f1rmb +** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's relevant too. Small other little fix (can't remember). Change few internal function prototype because it xine_t pointer need to be used if some xine's internal sections. NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, without invasive changes. To be continued... +** ** Revision 1.1 2003/01/08 07:04:35 tmmm ** initial import of Nosefart sources ** @@ -375,4 +378,4 @@ void mem_checkblocks(void) ** Revision 1.6 2000/06/09 15:12:25 matt ** initial revision ** -*/
\ No newline at end of file +*/ diff --git a/src/libxineadec/nosefart/mmc5_snd.c b/src/libxineadec/nosefart/mmc5_snd.c index c51f61bbf..7269fa967 100644 --- a/src/libxineadec/nosefart/mmc5_snd.c +++ b/src/libxineadec/nosefart/mmc5_snd.c @@ -20,7 +20,7 @@ ** mmc5_snd.c ** ** Nintendo MMC5 sound emulation -** $Id: mmc5_snd.c,v 1.1 2003/01/08 07:04:35 tmmm Exp $ +** $Id: mmc5_snd.c,v 1.2 2003/12/05 15:55:01 f1rmb Exp $ */ #include <string.h> @@ -333,6 +333,9 @@ apuext_t mmc5_ext = /* ** $Log: mmc5_snd.c,v $ +** Revision 1.2 2003/12/05 15:55:01 f1rmb +** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's relevant too. Small other little fix (can't remember). Change few internal function prototype because it xine_t pointer need to be used if some xine's internal sections. NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, without invasive changes. To be continued... +** ** Revision 1.1 2003/01/08 07:04:35 tmmm ** initial import of Nosefart sources ** @@ -354,4 +357,4 @@ apuext_t mmc5_ext = ** Revision 1.1 2000/06/20 00:06:47 matt ** initial revision ** -*/
\ No newline at end of file +*/ diff --git a/src/libxineadec/nosefart/mmc5_snd.h b/src/libxineadec/nosefart/mmc5_snd.h index 6166567fd..256cc2285 100644 --- a/src/libxineadec/nosefart/mmc5_snd.h +++ b/src/libxineadec/nosefart/mmc5_snd.h @@ -20,7 +20,7 @@ ** mmc5_snd.h ** ** Nintendo MMC5 sound emulation header -** $Id: mmc5_snd.h,v 1.1 2003/01/08 07:04:35 tmmm Exp $ +** $Id: mmc5_snd.h,v 1.2 2003/12/05 15:55:01 f1rmb Exp $ */ #ifndef _MMC5_SND_H_ @@ -67,6 +67,9 @@ extern apuext_t mmc5_ext; /* ** $Log: mmc5_snd.h,v $ +** Revision 1.2 2003/12/05 15:55:01 f1rmb +** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's relevant too. Small other little fix (can't remember). Change few internal function prototype because it xine_t pointer need to be used if some xine's internal sections. NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, without invasive changes. To be continued... +** ** Revision 1.1 2003/01/08 07:04:35 tmmm ** initial import of Nosefart sources ** @@ -76,4 +79,4 @@ extern apuext_t mmc5_ext; ** Revision 1.1 2000/06/20 00:06:47 matt ** initial revision ** -*/
\ No newline at end of file +*/ diff --git a/src/libxineadec/nosefart/nes6502.h b/src/libxineadec/nosefart/nes6502.h index aae2b866a..9b9be5811 100644 --- a/src/libxineadec/nosefart/nes6502.h +++ b/src/libxineadec/nosefart/nes6502.h @@ -20,7 +20,7 @@ ** nes6502.h ** ** NES custom 6502 CPU definitions / prototypes -** $Id: nes6502.h,v 1.1 2003/01/08 07:04:35 tmmm Exp $ +** $Id: nes6502.h,v 1.2 2003/12/05 15:55:01 f1rmb Exp $ */ /* NOTE: 16-bit addresses avoided like the plague: use 32-bit values @@ -122,10 +122,13 @@ extern void nes6502_getcontext(nes6502_context *cpu); /* ** $Log: nes6502.h,v $ +** Revision 1.2 2003/12/05 15:55:01 f1rmb +** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's relevant too. Small other little fix (can't remember). Change few internal function prototype because it xine_t pointer need to be used if some xine's internal sections. NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, without invasive changes. To be continued... +** ** Revision 1.1 2003/01/08 07:04:35 tmmm ** initial import of Nosefart sources ** ** Revision 1.4 2000/06/09 15:12:25 matt ** initial revision ** -*/
\ No newline at end of file +*/ diff --git a/src/libxineadec/nosefart/nsf.h b/src/libxineadec/nosefart/nsf.h index 9ca9f298c..61cc14f60 100644 --- a/src/libxineadec/nosefart/nsf.h +++ b/src/libxineadec/nosefart/nsf.h @@ -20,7 +20,7 @@ ** nsf.h ** ** NSF loading/saving related defines / prototypes -** $Id: nsf.h,v 1.1 2003/01/08 07:04:35 tmmm Exp $ +** $Id: nsf.h,v 1.2 2003/12/05 15:55:01 f1rmb Exp $ */ #ifndef _NSF_H_ @@ -114,6 +114,9 @@ extern void nsf_setfilter(nsf_t *nsf, int filter_type); /* ** $Log: nsf.h,v $ +** Revision 1.2 2003/12/05 15:55:01 f1rmb +** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's relevant too. Small other little fix (can't remember). Change few internal function prototype because it xine_t pointer need to be used if some xine's internal sections. NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, without invasive changes. To be continued... +** ** Revision 1.1 2003/01/08 07:04:35 tmmm ** initial import of Nosefart sources ** @@ -141,4 +144,4 @@ extern void nsf_setfilter(nsf_t *nsf, int filter_type); ** Revision 1.4 2000/06/09 15:12:26 matt ** initial revision ** -*/
\ No newline at end of file +*/ diff --git a/src/libxineadec/nosefart/version.h b/src/libxineadec/nosefart/version.h index 22e91ecd6..d7dcb2e5d 100644 --- a/src/libxineadec/nosefart/version.h +++ b/src/libxineadec/nosefart/version.h @@ -20,7 +20,7 @@ ** version.h ** ** Program name / version definitions -** $Id: version.h,v 1.1 2003/01/08 07:04:36 tmmm Exp $ +** $Id: version.h,v 1.2 2003/12/05 15:55:01 f1rmb Exp $ */ #ifndef _VERSION_H_ @@ -38,6 +38,9 @@ /* ** $Log: version.h,v $ +** Revision 1.2 2003/12/05 15:55:01 f1rmb +** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's relevant too. Small other little fix (can't remember). Change few internal function prototype because it xine_t pointer need to be used if some xine's internal sections. NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, without invasive changes. To be continued... +** ** Revision 1.1 2003/01/08 07:04:36 tmmm ** initial import of Nosefart sources ** @@ -53,4 +56,4 @@ ** Revision 1.4 2000/06/09 15:12:25 matt ** initial revision ** -*/
\ No newline at end of file +*/ diff --git a/src/libxineadec/nosefart/vrc7_snd.c b/src/libxineadec/nosefart/vrc7_snd.c index e71c84af5..42cff0103 100644 --- a/src/libxineadec/nosefart/vrc7_snd.c +++ b/src/libxineadec/nosefart/vrc7_snd.c @@ -21,7 +21,7 @@ ** ** VRCVII sound hardware emulation ** Thanks to Charles MacDonald (cgfm2@hooked.net) for donating code. -** $Id: vrc7_snd.c,v 1.1 2003/01/08 07:04:36 tmmm Exp $ +** $Id: vrc7_snd.c,v 1.2 2003/12/05 15:55:01 f1rmb Exp $ */ #include <stdio.h> @@ -323,6 +323,9 @@ apuext_t vrc7_ext = /* ** $Log: vrc7_snd.c,v $ +** Revision 1.2 2003/12/05 15:55:01 f1rmb +** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's relevant too. Small other little fix (can't remember). Change few internal function prototype because it xine_t pointer need to be used if some xine's internal sections. NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, without invasive changes. To be continued... +** ** Revision 1.1 2003/01/08 07:04:36 tmmm ** initial import of Nosefart sources ** @@ -341,4 +344,4 @@ apuext_t vrc7_ext = ** Revision 1.1 2000/06/20 00:06:47 matt ** initial revision ** -*/
\ No newline at end of file +*/ diff --git a/src/libxineadec/nosefart/vrcvisnd.c b/src/libxineadec/nosefart/vrcvisnd.c index a01a42a5b..b1f26fe52 100644 --- a/src/libxineadec/nosefart/vrcvisnd.c +++ b/src/libxineadec/nosefart/vrcvisnd.c @@ -20,7 +20,7 @@ ** vrcvisnd.c ** ** VRCVI sound hardware emulation -** $Id: vrcvisnd.c,v 1.1 2003/01/08 07:04:36 tmmm Exp $ +** $Id: vrcvisnd.c,v 1.2 2003/12/05 15:55:01 f1rmb Exp $ */ #include "types.h" @@ -183,6 +183,9 @@ apuext_t vrcvi_ext = /* ** $Log: vrcvisnd.c,v $ +** Revision 1.2 2003/12/05 15:55:01 f1rmb +** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's relevant too. Small other little fix (can't remember). Change few internal function prototype because it xine_t pointer need to be used if some xine's internal sections. NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, without invasive changes. To be continued... +** ** Revision 1.1 2003/01/08 07:04:36 tmmm ** initial import of Nosefart sources ** @@ -204,4 +207,4 @@ apuext_t vrcvi_ext = ** Revision 1.4 2000/06/09 15:12:28 matt ** initial revision ** -*/
\ No newline at end of file +*/ diff --git a/src/libxineadec/nosefart/vrcvisnd.h b/src/libxineadec/nosefart/vrcvisnd.h index 28608a86c..7666fec0c 100644 --- a/src/libxineadec/nosefart/vrcvisnd.h +++ b/src/libxineadec/nosefart/vrcvisnd.h @@ -20,7 +20,7 @@ ** vrcvisnd.h ** ** VRCVI (Konami MMC) sound hardware emulation header -** $Id: vrcvisnd.h,v 1.1 2003/01/08 07:04:36 tmmm Exp $ +** $Id: vrcvisnd.h,v 1.2 2003/12/05 15:55:01 f1rmb Exp $ */ #ifndef _VRCVISND_H_ @@ -64,6 +64,9 @@ extern apuext_t vrcvi_ext; /* ** $Log: vrcvisnd.h,v $ +** Revision 1.2 2003/12/05 15:55:01 f1rmb +** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's relevant too. Small other little fix (can't remember). Change few internal function prototype because it xine_t pointer need to be used if some xine's internal sections. NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, without invasive changes. To be continued... +** ** Revision 1.1 2003/01/08 07:04:36 tmmm ** initial import of Nosefart sources ** @@ -79,4 +82,4 @@ extern apuext_t vrcvi_ext; ** Revision 1.4 2000/06/09 15:12:28 matt ** initial revision ** -*/
\ No newline at end of file +*/ diff --git a/src/libxineadec/nsf.c b/src/libxineadec/nsf.c index aff552039..b57d70be5 100644 --- a/src/libxineadec/nsf.c +++ b/src/libxineadec/nsf.c @@ -20,7 +20,7 @@ * NSF Audio "Decoder" using the Nosefart NSF engine by Matt Conte * http://www.baisoku.org/ * - * $Id: nsf.c,v 1.4 2003/11/16 23:33:47 f1rmb Exp $ + * $Id: nsf.c,v 1.5 2003/12/05 15:55:01 f1rmb Exp $ */ #include <stdio.h> @@ -113,7 +113,7 @@ static void nsf_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { nsf_init(); this->nsf = nsf_load(NULL, this->nsf_file, this->nsf_size); if (!this->nsf) { - printf ("nsf: could not initialize NSF\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "nsf: could not initialize NSF\n"); /* make the decoder return on every subsequent buffer */ this->nsf_index = 0; } @@ -154,7 +154,7 @@ static void nsf_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { /* get an audio buffer */ audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); if (audio_buffer->mem_size == 0) { - printf ("nsf: Help! Allocated audio buffer with nothing in it!\n"); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "nsf: Help! Allocated audio buffer with nothing in it!\n"); return; } @@ -206,7 +206,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre nsf_decoder_t *this ; - this = (nsf_decoder_t *) malloc (sizeof (nsf_decoder_t)); + this = (nsf_decoder_t *) xine_xmalloc (sizeof (nsf_decoder_t)); /* connect the member functions */ this->audio_decoder.decode_data = nsf_decode_data; @@ -256,7 +256,7 @@ static void *init_plugin (xine_t *xine, void *data) { nsf_class_t *this ; - this = (nsf_class_t *) malloc (sizeof (nsf_class_t)); + this = (nsf_class_t *) xine_xmalloc (sizeof (nsf_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libxineadec/pcm.c b/src/libxineadec/pcm.c index cdf750f45..2ef908612 100644 --- a/src/libxineadec/pcm.c +++ b/src/libxineadec/pcm.c @@ -103,7 +103,7 @@ static void pcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {\ aud = this->stream->audio_out->get_buffer(this->stream->audio_out); if (aud->mem_size == 0) { - printf(__FILE__ ": :( Got an audio buffer with size 0!\r\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "Got an audio buffer with size 0!\n"); return; } @@ -159,8 +159,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre pcm_decoder_t *this; - this = (pcm_decoder_t *) malloc (sizeof (pcm_decoder_t)); - memset(this, 0, sizeof (pcm_decoder_t)); + this = (pcm_decoder_t *) xine_xmalloc (sizeof (pcm_decoder_t)); this->audio_decoder.decode_data = pcm_decode_data; this->audio_decoder.reset = pcm_reset; @@ -193,7 +192,7 @@ static void *init_plugin (xine_t *xine, void *data) { pcm_class_t *this ; - this = (pcm_class_t *) malloc (sizeof (pcm_class_t)); + this = (pcm_class_t *) xine_xmalloc (sizeof (pcm_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libxineadec/roqaudio.c b/src/libxineadec/roqaudio.c index e446c7051..51b6b5f0c 100644 --- a/src/libxineadec/roqaudio.c +++ b/src/libxineadec/roqaudio.c @@ -21,7 +21,7 @@ * For more information regarding the RoQ file format, visit: * http://www.csse.monash.edu.au/~timf/ * - * $Id: roqaudio.c,v 1.17 2003/11/16 23:33:47 f1rmb Exp $ + * $Id: roqaudio.c,v 1.18 2003/12/05 15:55:01 f1rmb Exp $ * */ @@ -101,8 +101,8 @@ static void roqaudio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) if( this->size + buf->size > this->bufsize ) { this->bufsize = this->size + 2 * buf->size; - printf("RoQ: increasing source buffer to %d to avoid overflow.\n", - this->bufsize); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "RoQ: increasing source buffer to %d to avoid overflow.\n", this->bufsize); this->buf = realloc( this->buf, this->bufsize ); } diff --git a/src/libxinevdec/cinepak.c b/src/libxinevdec/cinepak.c index a814dc757..45232f37b 100644 --- a/src/libxinevdec/cinepak.c +++ b/src/libxinevdec/cinepak.c @@ -22,7 +22,7 @@ * based on overview of Cinepak algorithm and example decoder * by Tim Ferguson: http://www.csse.monash.edu.au/~timf/ * - * $Id: cinepak.c,v 1.33 2003/11/16 23:33:47 f1rmb Exp $ + * $Id: cinepak.c,v 1.34 2003/12/05 15:55:01 f1rmb Exp $ */ #include <stdlib.h> @@ -534,7 +534,7 @@ static void *init_plugin (xine_t *xine, void *data) { cvid_class_t *this; - this = (cvid_class_t *) malloc (sizeof (cvid_class_t)); + this = (cvid_class_t *) xine_xmalloc (sizeof (cvid_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libxinevdec/cyuv.c b/src/libxinevdec/cyuv.c index 3e43ca579..1ca568cd1 100644 --- a/src/libxinevdec/cyuv.c +++ b/src/libxinevdec/cyuv.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: cyuv.c,v 1.21 2003/11/16 23:33:48 f1rmb Exp $ + * $Id: cyuv.c,v 1.22 2003/12/05 15:55:01 f1rmb Exp $ */ /* And this is the header that came with the CYUV decoder: */ @@ -170,8 +170,8 @@ static void cyuv_decode_data (video_decoder_t *this_gen, if( this->size + buf->size > this->bufsize ) { this->bufsize = this->size + 2 * buf->size; - printf("CYUV: increasing source buffer to %d to avoid overflow.\n", - this->bufsize); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "CYUV: increasing source buffer to %d to avoid overflow.\n", this->bufsize); this->buf = realloc( this->buf, this->bufsize ); } @@ -223,7 +223,7 @@ static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stre cyuv_decoder_t *this ; - this = (cyuv_decoder_t *) malloc (sizeof (cyuv_decoder_t)); + this = (cyuv_decoder_t *) xine_xmalloc (sizeof (cyuv_decoder_t)); this->video_decoder.decode_data = cyuv_decode_data; this->video_decoder.flush = cyuv_flush; @@ -256,7 +256,7 @@ static void *init_plugin (xine_t *xine, void *data) { cyuv_class_t *this; - this = (cyuv_class_t *) malloc (sizeof (cyuv_class_t)); + this = (cyuv_class_t *) xine_xmalloc (sizeof (cyuv_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libxinevdec/fli.c b/src/libxinevdec/fli.c index 98e03190d..8578e41c1 100644 --- a/src/libxinevdec/fli.c +++ b/src/libxinevdec/fli.c @@ -23,7 +23,7 @@ * avoid when implementing a FLI decoder, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: fli.c,v 1.23 2003/11/16 23:33:48 f1rmb Exp $ + * $Id: fli.c,v 1.24 2003/12/05 15:55:01 f1rmb Exp $ */ #include <stdio.h> @@ -338,8 +338,8 @@ static void decode_fli_frame(fli_decoder_t *this) { this->ghost_image[ghost_pixel_ptr++] = palette_idx1; pixel_countdown--; if (pixel_countdown < 0) - printf ("fli warning: pixel_countdown < 0 (%d)\n", - pixel_countdown); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "fli warning: pixel_countdown < 0 (%d)\n", pixel_countdown); } } else { /* copy bytes if byte_run < 0 */ byte_run = -byte_run; @@ -348,8 +348,8 @@ static void decode_fli_frame(fli_decoder_t *this) { this->ghost_image[ghost_pixel_ptr++] = palette_idx1; pixel_countdown--; if (pixel_countdown < 0) - printf ("fli warning: pixel_countdown < 0 (%d)\n", - pixel_countdown); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "fli warning: pixel_countdown < 0 (%d)\n", pixel_countdown); } } } @@ -362,11 +362,10 @@ static void decode_fli_frame(fli_decoder_t *this) { /* copy the chunk (uncompressed frame) to the ghost image and * schedule the whole frame to be updated */ if (chunk_size - 6 > this->width * this->height) { - printf( - _("FLI: in chunk FLI_COPY : source data (%d bytes) bigger than" \ - " image, skipping chunk\n"), - chunk_size - 6); - break; + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "FLI: in chunk FLI_COPY : source data (%d bytes) bigger than image, skipping chunk\n", + chunk_size - 6); + break; } else memcpy(this->ghost_image, &this->buf[stream_ptr], chunk_size - 6); stream_ptr += chunk_size - 6; @@ -379,7 +378,8 @@ static void decode_fli_frame(fli_decoder_t *this) { break; default: - printf (_("FLI: Unrecognized chunk type: %d\n"), chunk_type); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "FLI: Unrecognized chunk type: %d\n", chunk_type); break; } @@ -404,10 +404,9 @@ static void decode_fli_frame(fli_decoder_t *this) { /* by the end of the chunk, the stream ptr should equal the frame * size (minus 1, possibly); if it doesn't, issue a warning */ if ((stream_ptr != this->size) && (stream_ptr != this->size - 1)) - printf ( - _(" warning: processed FLI chunk where chunk size = %d\n" \ - " and final chunk ptr = %d\n"), - this->size, stream_ptr); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "warning: processed FLI chunk where chunk size = %d\nand final chunk ptr = %d\n", + this->size, stream_ptr); } /************************************************************************** diff --git a/src/libxinevdec/idcinvideo.c b/src/libxinevdec/idcinvideo.c index 7f01b73d8..d6efd0b89 100644 --- a/src/libxinevdec/idcinvideo.c +++ b/src/libxinevdec/idcinvideo.c @@ -21,7 +21,7 @@ * the Id CIN format, visit: * http://www.csse.monash.edu.au/~timf/ * - * $Id: idcinvideo.c,v 1.18 2003/11/16 23:33:48 f1rmb Exp $ + * $Id: idcinvideo.c,v 1.19 2003/12/05 15:55:01 f1rmb Exp $ */ #include <stdio.h> @@ -108,7 +108,7 @@ static void huff_decode(idcinvideo_decoder_t *this) { while(node_num >= HUF_TOKENS) { if(!bit_pos) { if(dat_pos > this->size) { - printf("Huffman decode error.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "Huffman decode error.\n"); return; } bit_pos = 8; diff --git a/src/libxinevdec/image.c b/src/libxinevdec/image.c index c700443c3..aaa955001 100644 --- a/src/libxinevdec/image.c +++ b/src/libxinevdec/image.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: image.c,v 1.10 2003/11/26 19:43:37 f1rmb Exp $ + * $Id: image.c,v 1.11 2003/12/05 15:55:01 f1rmb Exp $ * * a image video decoder */ @@ -280,7 +280,7 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if (!this->png_ptr) { if (initialize_png_reader(this) < 0) { - printf("image: failed to init png reader\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "image: failed to init png reader\n"); } } if (!this->video_open) { @@ -294,7 +294,7 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { this->pts = buf->pts; if (process_data(this, buf->content, buf->size) < 0) { - printf("image: error processing data\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "image: error processing data\n"); } } @@ -365,7 +365,7 @@ static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, */ if (initialize_png_reader(this) < 0) { - printf("image: failed to init png reader\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "image: failed to init png reader\n"); } return &this->video_decoder; diff --git a/src/libxinevdec/interplayvideo.c b/src/libxinevdec/interplayvideo.c index 261a69192..98a99c288 100644 --- a/src/libxinevdec/interplayvideo.c +++ b/src/libxinevdec/interplayvideo.c @@ -21,7 +21,7 @@ * For more information regarding the Interplay MVE format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: interplayvideo.c,v 1.7 2003/11/16 23:33:48 f1rmb Exp $ + * $Id: interplayvideo.c,v 1.8 2003/12/05 15:55:01 f1rmb Exp $ */ #include <stdio.h> @@ -1107,7 +1107,8 @@ static void interplay_decode_frame(interplay_decoder_t *this) { /* on the way out, make sure all the video data bytes were consumed */ if (stream_ptr != this->size) - printf ("Interplay video warning: Finished decode with bytes left over (%d < %d)\n", + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "Interplay video warning: Finished decode with bytes left over (%d < %d)\n", stream_ptr, this->size); debug_interplay ("code counts:\n"); diff --git a/src/libxinevdec/msrle.c b/src/libxinevdec/msrle.c index a9398c85b..10c013c02 100644 --- a/src/libxinevdec/msrle.c +++ b/src/libxinevdec/msrle.c @@ -21,7 +21,7 @@ * For more information on the MS RLE format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: msrle.c,v 1.21 2003/11/16 23:33:48 f1rmb Exp $ + * $Id: msrle.c,v 1.22 2003/12/05 15:55:01 f1rmb Exp $ */ #include <stdio.h> @@ -113,14 +113,16 @@ static void decode_msrle8(msrle_decoder_t *this) { /* copy pixels from encoded stream */ if ((row_ptr + pixel_ptr + stream_byte > frame_size) || (row_ptr < 0)) { - printf(_("MS RLE: frame ptr just went out of bounds (1)\n")); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "MS RLE: frame ptr just went out of bounds (1)\n"); return; } rle_code = stream_byte; extra_byte = stream_byte & 0x01; if (stream_ptr + rle_code + extra_byte > this->size) { - printf(_("MS RLE: stream ptr just went out of bounds (2)\n")); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "MS RLE: stream ptr just went out of bounds (2)\n"); return; } @@ -143,7 +145,8 @@ static void decode_msrle8(msrle_decoder_t *this) { /* decode a run of data */ if ((row_ptr + pixel_ptr + stream_byte > frame_size) || (row_ptr < 0)) { - printf(_("MS RLE: frame ptr just went out of bounds (2)\n")); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "MS RLE: frame ptr just went out of bounds (2)\n"); return; } @@ -164,8 +167,9 @@ static void decode_msrle8(msrle_decoder_t *this) { /* one last sanity check on the way out */ if (stream_ptr < this->size) - printf(_("MS RLE: ended frame decode with bytes left over (%d < %d)\n"), - stream_ptr, this->size); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "MS RLE: ended frame decode with bytes left over (%d < %d)\n", + stream_ptr, this->size); } /************************************************************************** diff --git a/src/libxinevdec/qtrpza.c b/src/libxinevdec/qtrpza.c index 3299d1e36..6be138f81 100644 --- a/src/libxinevdec/qtrpza.c +++ b/src/libxinevdec/qtrpza.c @@ -21,7 +21,7 @@ * For more information about the RPZA format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: qtrpza.c,v 1.19 2003/11/16 23:33:48 f1rmb Exp $ + * $Id: qtrpza.c,v 1.20 2003/12/05 15:55:01 f1rmb Exp $ */ #include <stdio.h> @@ -126,8 +126,9 @@ static void decode_qtrpza(qtrpza_decoder_t *this) { /* First byte is always 0xe1. Warn if it's different */ if ((unsigned char)this->buf[stream_ptr] != 0xe1) - printf(_("First chunk byte is 0x%02x instead of 0x1e\n"), - (unsigned char)this->buf[stream_ptr]); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "First chunk byte is 0x%02x instead of 0x1e\n", + (unsigned char)this->buf[stream_ptr]); /* Get chunk size, ingnoring first byte */ chunk_size = BE_32(&this->buf[stream_ptr]) & 0x00FFFFFF; @@ -135,7 +136,8 @@ static void decode_qtrpza(qtrpza_decoder_t *this) { /* If length mismatch use size from MOV file and try to decode anyway */ if (chunk_size != this->size) - printf(_("MOV chunk size != encoded chunk size; using MOV chunk size\n")); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "MOV chunk size != encoded chunk size; using MOV chunk size\n"); chunk_size = this->size; @@ -268,9 +270,9 @@ static void decode_qtrpza(qtrpza_decoder_t *this) { /* Unknown opcode */ default: - printf(_("Unknown opcode %d in rpza chunk." - " Skip remaining %d bytes of chunk data.\n"), opcode, - chunk_size - stream_ptr); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "Unknown opcode %d in rpza chunk.Skip remaining %d bytes of chunk data.\n", + opcode, chunk_size - stream_ptr); return; } /* Opcode switch */ diff --git a/src/libxinevdec/qtsmc.c b/src/libxinevdec/qtsmc.c index 8bdf7b7bf..b7a43d0a4 100644 --- a/src/libxinevdec/qtsmc.c +++ b/src/libxinevdec/qtsmc.c @@ -23,7 +23,7 @@ * For more information on the SMC format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: qtsmc.c,v 1.19 2003/11/16 23:33:48 f1rmb Exp $ + * $Id: qtsmc.c,v 1.20 2003/12/05 15:55:01 f1rmb Exp $ */ #include <stdio.h> @@ -136,8 +136,9 @@ static void decode_qtsmc(qtsmc_decoder_t *this) { chunk_size = BE_32(&this->buf[stream_ptr]) & 0x00FFFFFF; stream_ptr += 4; if (chunk_size != this->size) - printf(_("warning: MOV chunk size != encoded chunk size (%d != %d); using MOV chunk size\n"), - chunk_size, this->size); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "warning: MOV chunk size != encoded chunk size (%d != %d); using MOV chunk size\n", + chunk_size, this->size); chunk_size = this->size; total_blocks = (this->width * this->height) / (4 * 4); @@ -147,16 +148,16 @@ static void decode_qtsmc(qtsmc_decoder_t *this) { /* sanity checks */ /* make sure stream ptr hasn't gone out of bounds */ if (stream_ptr > chunk_size) { - printf(_( - "SMC decoder just went out of bounds (stream ptr = %d, chunk size = %d)\n"), - stream_ptr, chunk_size); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "SMC decoder just went out of bounds (stream ptr = %d, chunk size = %d)\n", + stream_ptr, chunk_size); return; } /* make sure the row pointer hasn't gone wild */ if (row_ptr >= image_size) { - printf(_( - "SMC decoder just went out of bounds (row ptr = %d, height = %d)\n"), - row_ptr, image_size); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "SMC decoder just went out of bounds (row ptr = %d, height = %d)\n", + row_ptr, image_size); return; } @@ -177,9 +178,9 @@ static void decode_qtsmc(qtsmc_decoder_t *this) { /* sanity check */ if ((row_ptr == 0) && (pixel_ptr == 0)) { - printf(_( - "encountered repeat block opcode (%02X) but no blocks rendered yet\n"), - opcode & 0xF0); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "encountered repeat block opcode (%02X) but no blocks rendered yet\n", + opcode & 0xF0); break; } @@ -215,9 +216,9 @@ static void decode_qtsmc(qtsmc_decoder_t *this) { /* sanity check */ if ((row_ptr == 0) && (pixel_ptr < 2 * 4)) { - printf(_( - "encountered repeat block opcode (%02X) but not enough blocks rendered yet\n"), - opcode & 0xF0); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "encountered repeat block opcode (%02X) but not enough blocks rendered yet\n", + opcode & 0xF0); break; } @@ -487,7 +488,8 @@ static void decode_qtsmc(qtsmc_decoder_t *this) { break; case 0xF0: - printf(_("0xF0 opcode seen in SMC chunk (xine developers would like to know)\n")); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "0xF0 opcode seen in SMC chunk (xine developers would like to know)\n"); break; } } diff --git a/src/libxinevdec/roqvideo.c b/src/libxinevdec/roqvideo.c index 88f895df5..baf0e48b2 100644 --- a/src/libxinevdec/roqvideo.c +++ b/src/libxinevdec/roqvideo.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: roqvideo.c,v 1.23 2003/11/16 23:33:48 f1rmb Exp $ + * $Id: roqvideo.c,v 1.24 2003/12/05 15:55:01 f1rmb Exp $ */ /* And this is the header that came with the RoQ video decoder: */ @@ -363,7 +363,7 @@ static void roqvideo_decode_frame(roqvideo_decoder_t *ri) { } break; default: - printf("Unknown vq code: %d\n", vqid); + xprintf(ri->stream->xine, XINE_VERBOSITY_DEBUG, "Unknown vq code: %d\n", vqid); } } @@ -434,8 +434,8 @@ static void roqvideo_decode_data (video_decoder_t *this_gen, if( this->size + buf->size > this->bufsize ) { this->bufsize = this->size + 2 * buf->size; - printf("RoQ: increasing source buffer to %d to avoid overflow.\n", - this->bufsize); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "RoQ: increasing source buffer to %d to avoid overflow.\n", this->bufsize); this->buf = realloc( this->buf, this->bufsize ); } diff --git a/src/libxinevdec/yuv_frames.c b/src/libxinevdec/yuv_frames.c index 662f5dec9..9ff515fa6 100644 --- a/src/libxinevdec/yuv_frames.c +++ b/src/libxinevdec/yuv_frames.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: yuv_frames.c,v 1.7 2003/11/26 19:43:37 f1rmb Exp $ + * $Id: yuv_frames.c,v 1.8 2003/12/05 15:55:01 f1rmb Exp $ * * dummy video decoder for uncompressed video frames as delivered by v4l */ @@ -108,8 +108,7 @@ static void yuv_frames_dispose (video_decoder_t *this_gen) { static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stream_t *stream) { yuv_frames_decoder_t *this ; - this = (yuv_frames_decoder_t *) malloc (sizeof (yuv_frames_decoder_t)); - memset(this, 0, sizeof (yuv_frames_decoder_t)); + this = (yuv_frames_decoder_t *) xine_xmalloc (sizeof (yuv_frames_decoder_t)); this->video_decoder.decode_data = yuv_frames_decode_data; this->video_decoder.flush = yuv_frames_flush; @@ -144,7 +143,7 @@ static void *init_plugin (xine_t *xine, void *data) { mpeg2_class_t *this; - this = (mpeg2_class_t *) malloc (sizeof (mpeg2_class_t)); + this = (mpeg2_class_t *) xine_xmalloc (sizeof (mpeg2_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libxvid/xine_decoder.c b/src/libxvid/xine_decoder.c index 5daa4c269..ab18b461f 100644 --- a/src/libxvid/xine_decoder.c +++ b/src/libxvid/xine_decoder.c @@ -226,7 +226,7 @@ static void *init_video_decoder_plugin (xine_t *xine, void *data) { return NULL; } - this = (xvid_decoder_t *) malloc (sizeof (xvid_decoder_t)); + this = (xvid_decoder_t *) xine_xmalloc (sizeof (xvid_decoder_t)); this->video_decoder.init = xvid_init_plugin; this->video_decoder.decode_data = xvid_decode_data; diff --git a/src/post/deinterlace/deinterlace.c b/src/post/deinterlace/deinterlace.c index df7d0e65c..dfa398016 100644 --- a/src/post/deinterlace/deinterlace.c +++ b/src/post/deinterlace/deinterlace.c @@ -59,7 +59,7 @@ void register_deinterlace_method( deinterlace_method_t *method ) (*dest)->method = method; (*dest)->next = 0; } else { - printf( "deinterlace: Can't allocate memory.\n" ); + printf( "deinterlace: Can't allocate memory.\n" ); } } @@ -92,8 +92,7 @@ void register_deinterlace_plugin( const char *filename ) void *handle = dlopen( filename, RTLD_NOW ); if( !handle ) { - printf( "deinterlace: Can't load plugin '%s': %s\n", - filename, dlerror() ); + printf( "deinterlace: Can't load plugin '%s': %s\n", filename, dlerror() ); } else { deinterlace_plugin_init_t plugin_init; plugin_init = (deinterlace_plugin_init_t) dlsym( handle, "deinterlace_plugin_init" ); diff --git a/src/post/deinterlace/xine_plugin.c b/src/post/deinterlace/xine_plugin.c index 949be9579..c4f3066f7 100644 --- a/src/post/deinterlace/xine_plugin.c +++ b/src/post/deinterlace/xine_plugin.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_plugin.c,v 1.22 2003/11/11 18:44:56 f1rmb Exp $ + * $Id: xine_plugin.c,v 1.23 2003/12/05 15:55:02 f1rmb Exp $ * * advanced video deinterlacer plugin * Jun/2003 by Miguel Freitas @@ -328,8 +328,8 @@ static void *deinterlace_init_plugin(xine_t *xine, void *data) */ filter_deinterlace_methods( config_flags, 5 /*fieldsavailable*/ ); if( !get_num_deinterlace_methods() ) { - printf( "tvtime: No deinterlacing methods " - "available, exiting.\n" ); + xprintf(xine, XINE_VERBOSITY_LOG, + _("tvtime: No deinterlacing methods available, exiting.\n")); return NULL; } diff --git a/src/post/goom/xine_goom.c b/src/post/goom/xine_goom.c index fc2cdd8e9..c074cb8ce 100644 --- a/src/post/goom/xine_goom.c +++ b/src/post/goom/xine_goom.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_goom.c,v 1.45 2003/12/03 10:52:41 andruil Exp $ + * $Id: xine_goom.c,v 1.46 2003/12/05 15:55:02 f1rmb Exp $ * * GOOM post plugin. * @@ -191,7 +191,7 @@ static void csc_method_changed_cb(void *data, xine_cfg_entry_t *cfg) { static void *goom_init_plugin(xine_t *xine, void *data) { - post_class_goom_t *this = (post_class_goom_t *)malloc(sizeof(post_class_goom_t)); + post_class_goom_t *this = (post_class_goom_t *)xine_xmalloc(sizeof(post_class_goom_t)); config_values_t *cfg; if (!this) @@ -232,7 +232,7 @@ static post_plugin_t *goom_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target) { - post_plugin_goom_t *this = (post_plugin_goom_t *)malloc(sizeof(post_plugin_goom_t)); + post_plugin_goom_t *this = (post_plugin_goom_t *)xine_xmalloc(sizeof(post_plugin_goom_t)); post_class_goom_t *class = (post_class_goom_t*) class_gen; xine_post_in_t *input = (xine_post_in_t *)malloc(sizeof(xine_post_in_t)); post_goom_out_t *output = (post_goom_out_t *)malloc(sizeof(post_goom_out_t)); diff --git a/src/post/mosaico/mosaico.c b/src/post/mosaico/mosaico.c index 377069b03..5922296a3 100644 --- a/src/post/mosaico/mosaico.c +++ b/src/post/mosaico/mosaico.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: mosaico.c,v 1.18 2003/11/26 19:43:37 f1rmb Exp $ + * $Id: mosaico.c,v 1.19 2003/12/05 15:55:02 f1rmb Exp $ */ /* @@ -398,7 +398,7 @@ static void frame_copy_content(vo_frame_t *to, vo_frame_t *from) { } if(to->format != from->format) { - printf("frame_copy_content : buffers have different format\n"); + lprintf("frame_copy_content : buffers have different format\n"); return; } @@ -544,7 +544,8 @@ static int _mosaico_draw_2(vo_frame_t *frame, post_mosaico_out_t *output, int co break; default: - printf("Mosaico: cannot handle image format %d\n", frame->format); + xprintf(output->stream->xine, XINE_VERBOSITY_DEBUG, + "Mosaico: cannot handle image format %d\n", frame->format); /*new_frame->free(new_frame); _x_post_restore_video_frame(frame, port); return frame->draw(frame, stream);*/ diff --git a/src/post/planar/invert.c b/src/post/planar/invert.c index ba0db55c4..b5359fc2f 100644 --- a/src/post/planar/invert.c +++ b/src/post/planar/invert.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: invert.c,v 1.15 2003/11/11 18:44:59 f1rmb Exp $ + * $Id: invert.c,v 1.16 2003/12/05 15:55:02 f1rmb Exp $ */ /* @@ -251,7 +251,8 @@ static int invert_draw(vo_frame_t *frame, xine_stream_t *stream) inverted_frame->base[2][i] = 0xff - frame->base[2][i]; break; default: - printf("invert: cannot handle image format %d\n", frame->format); + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + "invert: cannot handle image format %d\n", frame->format); inverted_frame->free(inverted_frame); _x_post_restore_video_frame(frame, port); return frame->draw(frame, stream); diff --git a/src/video_out/alphablend.c b/src/video_out/alphablend.c index ecf963613..111f3fee3 100644 --- a/src/video_out/alphablend.c +++ b/src/video_out/alphablend.c @@ -767,7 +767,9 @@ void blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, #endif if ((rlelen < 0) || (rle_remainder < 0)) { +#ifdef LOG_BLEND_YUV printf("alphablend: major bug in blend_yuv < 0\n"); +#endif } if (rlelen == 0) { rle_remainder = rlelen = rle->len; @@ -971,7 +973,9 @@ void blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, uint16_t o; if ((rlelen < 0) || (rle_remainder < 0)) { +#ifdef LOG_BLEND_YUV printf("alphablend: major bug in blend_yuv < 0\n"); +#endif } if (rlelen == 0) { rle_remainder = rlelen = rle->len; diff --git a/src/video_out/deinterlace.c b/src/video_out/deinterlace.c index fe75cee5c..d08346cfc 100644 --- a/src/video_out/deinterlace.c +++ b/src/video_out/deinterlace.c @@ -811,7 +811,7 @@ void deinterlace_yuv( uint8_t *pdst, uint8_t *psrc[], xine_fast_memcpy(pdst,psrc[0],width*height); break; case DEINTERLACE_ONEFIELDXV: - printf("deinterlace: ONEFIELDXV must be handled by the video driver.\n"); + lprintf("deinterlace: ONEFIELDXV must be handled by the video driver.\n"); break; case DEINTERLACE_LINEARBLEND: if( check_for_mmx() ) @@ -820,7 +820,7 @@ void deinterlace_yuv( uint8_t *pdst, uint8_t *psrc[], deinterlace_linearblend_yuv(pdst,psrc,width,height); break; default: - printf("deinterlace: unknow method %d.\n",method); + lprintf("deinterlace: unknow method %d.\n",method); break; } } @@ -836,7 +836,7 @@ int deinterlace_yuv_supported ( int method ) case DEINTERLACE_ONEFIELD: return check_for_mmx(); case DEINTERLACE_ONEFIELDXV: - printf ("deinterlace: ONEFIELDXV must be handled by the video driver.\n"); + lprintf ("deinterlace: ONEFIELDXV must be handled by the video driver.\n"); return 0; case DEINTERLACE_LINEARBLEND: return 1; diff --git a/src/video_out/video_out_aa.c b/src/video_out/video_out_aa.c index 17a947fee..accd9c22b 100644 --- a/src/video_out/video_out_aa.c +++ b/src/video_out/video_out_aa.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_aa.c,v 1.40 2003/10/31 17:25:20 mroi Exp $ + * $Id: video_out_aa.c,v 1.41 2003/12/05 15:55:03 f1rmb Exp $ * * video_out_aa.c, ascii-art output plugin for xine * @@ -66,6 +66,7 @@ typedef struct { vo_driver_t vo_driver; config_values_t *config; + xine_t *xine; int user_ratio; aa_context *context; @@ -75,6 +76,7 @@ typedef struct { video_driver_class_t driver_class; config_values_t *config; + xine_t *xine; } aa_class_t; @@ -103,30 +105,28 @@ static void aa_frame_field (vo_frame_t *vo_img, int which_field) { } -static vo_frame_t *aa_alloc_frame(vo_driver_t *this) { - aa_frame_t *frame; +static vo_frame_t *aa_alloc_frame(vo_driver_t *this_gen) { + /* aa_driver_t *this = (aa_driver_t*) this_gen; */ + aa_frame_t *frame; - frame = (aa_frame_t *) malloc (sizeof (aa_frame_t)); - if (frame == NULL) { - printf("aa_alloc_frame: out of memory\n"); + frame = (aa_frame_t *) xine_xmalloc (sizeof (aa_frame_t)); + if (!frame) return NULL; - } - memset (frame, 0, sizeof (aa_frame_t)); frame->vo_frame.proc_slice = NULL; frame->vo_frame.proc_frame = NULL; frame->vo_frame.field = aa_frame_field; frame->vo_frame.dispose = aa_dispose_frame; - frame->vo_frame.driver = this; + frame->vo_frame.driver = this_gen; return (vo_frame_t*) frame; } -static void aa_update_frame_format (vo_driver_t *this, vo_frame_t *img, +static void aa_update_frame_format (vo_driver_t *this_gen, vo_frame_t *img, uint32_t width, uint32_t height, double ratio, int format, int flags) { - - aa_frame_t *frame = (aa_frame_t *) img; + aa_driver_t *this = (aa_driver_t*) this_gen; + aa_frame_t *frame = (aa_frame_t *) img; /* printf ("aa_update_format...\n"); */ @@ -166,7 +166,7 @@ static void aa_update_frame_format (vo_driver_t *this, vo_frame_t *img, frame->vo_frame.pitches[0] = 8*((width + 3) / 4); frame->vo_frame.base[0] = xine_xmalloc_aligned(16, frame->vo_frame.pitches[0] * height, (void**) &frame->mem[0]); } else { - printf ("alert! unsupported image format %04x\n", format); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "alert! unsupported image format %04x\n", format); abort(); } @@ -236,7 +236,8 @@ static int aa_get_property (vo_driver_t *this_gen, int property) { if ( property == VO_PROP_ASPECT_RATIO) { return this->user_ratio ; } else { - printf ("video_out_aa: tried to get unsupported property %d\n", property); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_aa: tried to get unsupported property %d\n", property); } return 0; @@ -252,7 +253,8 @@ static int aa_set_property (vo_driver_t *this_gen, this->user_ratio = value; } else { - printf ("video_out_aa: tried to set unsupported property %d\n", property); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_aa: tried to set unsupported property %d\n", property); } return value; @@ -275,11 +277,12 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi aa_class_t *class = (aa_class_t *) class_gen; aa_driver_t *this; - this = (aa_driver_t*) malloc (sizeof (aa_driver_t)); + this = (aa_driver_t*) xine_xmalloc (sizeof (aa_driver_t)); this->context = (aa_context*) visual_gen; this->config = class->config; + this->xine = class->xine; this->vo_driver.get_capabilities = aa_get_capabilities; this->vo_driver.alloc_frame = aa_alloc_frame ; @@ -314,7 +317,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { /* aa_context *context = (aa_context*) visual_gen; */ aa_class_t *this; - this = (aa_class_t *) malloc(sizeof(aa_class_t)); + this = (aa_class_t *) xine_xmalloc(sizeof(aa_class_t)); this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; @@ -322,6 +325,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { this->driver_class.dispose = dispose_class; this->config = xine->config; + this->xine = xine; return this; } diff --git a/src/video_out/video_out_directfb.c b/src/video_out/video_out_directfb.c index 14e271908..63b099200 100644 --- a/src/video_out/video_out_directfb.c +++ b/src/video_out/video_out_directfb.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_directfb.c,v 1.23 2003/10/23 15:17:07 mroi Exp $ + * $Id: video_out_directfb.c,v 1.24 2003/12/05 15:55:03 f1rmb Exp $ * * DirectFB based output plugin. * Rich Wareham <richwareham@users.sourceforge.net> @@ -70,6 +70,7 @@ typedef struct directfb_frame_s { vo_frame_t vo_frame; + xine_t *xine; int width, height; double ratio; @@ -80,9 +81,9 @@ typedef struct directfb_frame_s { } directfb_frame_t; typedef struct directfb_driver_s { - vo_driver_t vo_driver; + xine_t *xine; config_values_t *config; directfb_frame_t *cur_frame; @@ -119,7 +120,8 @@ typedef struct directfb_driver_s { } directfb_driver_t; typedef struct { - video_driver_class_t driver_class; + video_driver_class_t driver_class; + xine_t *xine; } directfb_class_t; #define CONTEXT_BAD 0 @@ -137,14 +139,13 @@ static uint32_t directfb_get_capabilities (vo_driver_t *this_gen) { } static void directfb_frame_field (vo_frame_t *vo_img, int which_field) { - - /* directfb_frame_t *frame = (directfb_frame_t *) vo_img ; */ + directfb_frame_t *frame = (directfb_frame_t *) vo_img ; switch(which_field) { case VO_BOTH_FIELDS: break; default: - fprintf(stderr, "Interlaced images not supported\n"); + xprintf(frame->xine, XINE_VERBOSITY_DEBUG, "Interlaced images not supported\n"); } #if 0 switch (which_field) { @@ -179,11 +180,12 @@ static void directfb_frame_dispose (vo_frame_t *vo_img) { static vo_frame_t *directfb_alloc_frame (vo_driver_t *this_gen) { + directfb_driver_t *this = (directfb_driver_t *) this_gen; directfb_frame_t *frame ; frame = (directfb_frame_t *) calloc (1, sizeof (directfb_frame_t)); if (frame==NULL) { - printf ("directfb_alloc_frame: out of memory\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "directfb_alloc_frame: out of memory\n"); return NULL; } @@ -201,7 +203,8 @@ static vo_frame_t *directfb_alloc_frame (vo_driver_t *this_gen) { frame->vo_frame.dispose = directfb_frame_dispose; frame->surface = NULL; - frame->locked = 0; + frame->locked = 0; + frame->xine = this->xine; return (vo_frame_t *) frame; } @@ -258,7 +261,8 @@ static void directfb_update_frame_format (vo_driver_t *this_gen, l_dsc.pixelformat = DSPF_YUY2; break; default: - fprintf(stderr,"Error unknown image format (%i), assuming YV12\n", frame->format); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "Error unknown image format (%i), assuming YV12\n", frame->format); s_dsc.pixelformat = DSPF_YV12; l_dsc.pixelformat = DSPF_YV12; } @@ -277,7 +281,7 @@ static void directfb_update_frame_format (vo_driver_t *this_gen, l_dsc.options = 0; ret = this->layer->TestConfiguration(this->layer, &l_dsc, &failed ); if (ret == DFB_UNSUPPORTED) { - fprintf(stderr, "Error: Unsupported operation\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "Error: Unsupported operation\n"); return; } DFBCHECK(this->layer->SetConfiguration(this->layer, &l_dsc)); @@ -400,8 +404,8 @@ static void directfb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen this->last_frame_height = frame->height; this->last_frame_ratio = frame->ratio; - fprintf (stderr, "video_out_directfb: frame size %d x %d\n", - this->frame_width, this->frame_height); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_directfb: frame size %d x %d\n", this->frame_width, this->frame_height); } directfb_render_image (this, frame); @@ -413,12 +417,13 @@ static void directfb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen static int directfb_get_property (vo_driver_t *this_gen, int property) { - /* directfb_driver_t *this = (directfb_driver_t *) this_gen; */ + directfb_driver_t *this = (directfb_driver_t *) this_gen; if ( property == VO_PROP_ASPECT_RATIO) { return 1; } else { - printf ("video_out_directfb: tried to get unsupported property %d\n", property); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_directfb: tried to get unsupported property %d\n", property); } return 0; @@ -446,16 +451,17 @@ static char *aspect_ratio_name(int a) static int directfb_set_property (vo_driver_t *this_gen, int property, int value) { - /* directfb_driver_t *this = (directfb_driver_t *) this_gen; */ + directfb_driver_t *this = (directfb_driver_t *) this_gen; if ( property == VO_PROP_ASPECT_RATIO) { if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; /* this->user_ratio = value; */ - printf("video_out_directfb: aspect ratio changed to %s\n", - aspect_ratio_name(value)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_directfb: aspect ratio changed to %s\n", aspect_ratio_name(value)); } else { - printf ("video_out_directfb: tried to set unsupported property %d\n", property); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_directfb: tried to set unsupported property %d\n", property); } return value; @@ -484,7 +490,7 @@ static void directfb_translate_gui2video(directfb_driver_t *this, static int directfb_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *data) { - /* directfb_driver_t *this = (directfb_driver_t *) this_gen; */ + directfb_driver_t *this = (directfb_driver_t *) this_gen; switch (data_type) { @@ -492,7 +498,7 @@ static int directfb_gui_data_exchange (vo_driver_t *this_gen, return -1; } -fprintf (stderr, "done gui_data_exchange\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "done gui_data_exchange\n"); return 0; } @@ -514,24 +520,20 @@ typedef struct { static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *visual_gen) { - /* directfb_class_t *class = (directfb_class_t *) class_gen; */ + directfb_class_t *class = (directfb_class_t *) class_gen; directfb_driver_t *this; dfb_visual_info_t *visual_info = (dfb_visual_info_t*)visual_gen; - fprintf (stderr, "EXPERIMENTAL directfb output plugin\n"); + xprintf (class->xine, XINE_VERBOSITY_DEBUG, "EXPERIMENTAL directfb output plugin\n"); /* * allocate plugin struct */ - this = malloc (sizeof (directfb_driver_t)); - - if (!this) { - printf ("video_out_directfb: malloc failed\n"); + this = xine_xmalloc (sizeof (directfb_driver_t)); + if (!this) return NULL; - } - - memset (this, 0, sizeof(directfb_driver_t)); + this->xine = class->xine; this->frame_width = 0; this->frame_height = 0; @@ -576,12 +578,14 @@ static void *init_class (xine_t *xine, void *visual_gen) { directfb_class_t *this; - this = (directfb_class_t *) malloc (sizeof (directfb_class_t)); + this = (directfb_class_t *) xine_xmalloc (sizeof (directfb_class_t)); this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; this->driver_class.get_description = get_description; this->driver_class.dispose = dispose_class; + this->xine = xine; + return this; } diff --git a/src/video_out/video_out_directx.c b/src/video_out/video_out_directx.c index 4f773d535..dec8eb50f 100755 --- a/src/video_out/video_out_directx.c +++ b/src/video_out/video_out_directx.c @@ -20,7 +20,7 @@ * video_out_directx.c, direct draw video output plugin for xine * by Matthew Grooms <elon@altavista.com> * - * $Id: video_out_directx.c,v 1.11 2003/11/26 19:43:37 f1rmb Exp $ + * $Id: video_out_directx.c,v 1.12 2003/12/05 15:55:03 f1rmb Exp $ */ typedef unsigned char boolean; @@ -76,6 +76,8 @@ typedef struct { vo_driver_t vo_driver; win32_visual_t *win32_visual; + xine_t *xine; + LPDIRECTDRAW7 ddobj; /* direct draw object */ LPDIRECTDRAWSURFACE primary; /* primary dd surface */ LPDIRECTDRAWSURFACE secondary; /* secondary dd surface */ @@ -99,6 +101,7 @@ typedef struct { video_driver_class_t driver_class; config_values_t *config; char *device_name; + xine_t *xine; } directx_class_t; /* ----------------------------------------- @@ -158,7 +161,7 @@ boolean CreatePrimary( win32_driver_t * win32_driver ) if( result != DD_OK ) { Error( 0, "DirectDrawCreate : error %i", result ); - printf( "vo_out_directx : DirectDrawCreate : error %i\n", result ); + xprintf(win32_driver->xine, XINE_VERBOSITY_DEBUG, "vo_out_directx : DirectDrawCreate : error %i\n", result ); return 0; } @@ -247,14 +250,14 @@ boolean CreateSecondary( win32_driver_t * win32_driver, int width, int height, i DDSURFACEDESC2 ddsd; if( format == XINE_IMGFMT_YV12 ) - printf( "vo_out_directx : switching to YV12 overlay type\n" ); + xprintf(win32_driver->xine, XINE_VERBOSITY_DEBUG, "vo_out_directx : switching to YV12 overlay type\n" ); if( format == XINE_IMGFMT_YUY2 ) - printf( "vo_out_directx : switching to YUY2 overlay type\n" ); + xprintf(win32_driver->xine, XINE_VERBOSITY_DEBUG, "vo_out_directx : switching to YUY2 overlay type\n" ); #if RGB_SUPPORT if( format == IMGFMT_RGB ) - printf( "vo_out_directx : switching to RGB overlay type\n" ); + xprintf(win32_driver->xine, XINE_VERBOSITY_DEBUG, "vo_out_directx : switching to RGB overlay type\n" ); #endif if( !win32_driver->ddobj ) @@ -833,14 +836,12 @@ static void win32_frame_dispose( vo_frame_t * vo_frame ) static vo_frame_t * win32_alloc_frame( vo_driver_t * vo_driver ) { - win32_frame_t * win32_frame; + win32_driver_t *win32_driver = (win32_driver_t *)vo_driver; + win32_frame_t *win32_frame; - win32_frame = ( win32_frame_t * ) malloc( sizeof( win32_frame_t ) ); - if (win32_frame == NULL) { - printf("win32_alloc_frame: out of memory\n"); + win32_frame = ( win32_frame_t * ) xine_malloc( sizeof( win32_frame_t ) ); + if (!win32_frame) return NULL; - } - memset( win32_frame, 0, sizeof( win32_frame_t ) ); win32_frame->vo_frame.proc_slice = NULL; win32_frame->vo_frame.proc_frame = NULL; @@ -901,7 +902,8 @@ static void win32_update_frame_format( vo_driver_t * vo_driver, vo_frame_t * vo_ #endif else { - printf ( "vo_out_directx : !!! unsupported image format %04x !!!\n", format ); + xprintf (win32_driver->xine, XINE_VERBOSITY_DEBUG, + "vo_out_directx : !!! unsupported image format %04x !!!\n", format ); exit (1); } @@ -1146,9 +1148,10 @@ static void win32_exit( vo_driver_t * vo_driver ) static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *win32_visual) /*vo_driver_t *init_video_out_plugin( config_values_t * config, void * win32_visual )*/ { - win32_driver_t *win32_driver = ( win32_driver_t * ) malloc ( sizeof( win32_driver_t ) ); + directx_class_t *class = (directx_class_t *)class_gen; + win32_driver_t *win32_driver = ( win32_driver_t * ) xine_xmalloc ( sizeof( win32_driver_t ) ); - memset( win32_driver, 0, sizeof( win32_driver_t ) ); + win32_driver->xine = class->xine; /* Make sure that the DirectX drivers are available and present! */ /* Not complete yet */ @@ -1215,7 +1218,8 @@ static void *init_class (xine_t *xine, void *visual_gen) { #ifdef TC /* check for directx device */ if((fd = open(device_name, O_RDWR)) < 0) { - printf("video_out_directx: aborting. (unable to open directx device \"%s\")\n", device_name); + xprintf(xine, XINE_VERBOSITY_DEBUG, + "video_out_directx: aborting. (unable to open directx device \"%s\")\n", device_name); return NULL; } close(fd); @@ -1224,14 +1228,14 @@ static void *init_class (xine_t *xine, void *visual_gen) { /* * from this point on, nothing should go wrong anymore */ - directx = (directx_class_t *) malloc (sizeof (directx_class_t)); - memset( directx, 0, sizeof( directx_class_t ) ); + directx = (directx_class_t *) xine_xmalloc (sizeof (directx_class_t)); directx->driver_class.open_plugin = open_plugin; directx->driver_class.get_identifier = get_identifier; directx->driver_class.get_description = get_description; directx->driver_class.dispose = dispose_class; + directx->xine = xine; directx->config = xine->config; directx->device_name = device_name; diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c index 3900d5b66..80d6221f8 100644 --- a/src/video_out/video_out_fb.c +++ b/src/video_out/video_out_fb.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_fb.c,v 1.33 2003/11/26 19:43:37 f1rmb Exp $ + * $Id: video_out_fb.c,v 1.34 2003/12/05 15:55:03 f1rmb Exp $ * * video_out_fb.c, frame buffer xine driver by Miguel Freitas * @@ -143,12 +143,14 @@ typedef struct fb_driver_s struct fb_fix_screeninfo fb_fix; int use_zero_copy; + xine_t *xine; } fb_driver_t; typedef struct { video_driver_class_t driver_class; config_values_t *config; + xine_t *xine; } fb_class_t; static uint32_t fb_get_capabilities(vo_driver_t *this_gen) @@ -213,14 +215,10 @@ static vo_frame_t *fb_alloc_frame(vo_driver_t *this_gen) this->total_num_native_buffers <= this->used_num_buffers) return 0; - frame = (fb_frame_t *)malloc(sizeof(fb_frame_t)); + frame = (fb_frame_t *)xine_xmalloc(sizeof(fb_frame_t)); if(!frame) - { - fprintf(stderr, "fb_alloc_frame: Out of memory.\n"); - return 0; - } + return NULL; - memset(frame, 0, sizeof(fb_frame_t)); memcpy(&frame->sc, &this->sc, sizeof(vo_scale_t)); pthread_mutex_init(&frame->vo_frame.mutex, NULL); @@ -563,7 +561,8 @@ static void fb_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) this->sc.output_width = frame->sc.output_width; this->sc.output_height = frame->sc.output_height; - printf("video_out_fb: gui size %d x %d, frame size %d x %d\n", + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_fb: gui size %d x %d, frame size %d x %d\n", this->sc.gui_width, this->sc.gui_height, frame->sc.output_width, frame->sc.output_height); @@ -586,7 +585,8 @@ static void fb_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) this->fb_var.yoffset = frame->yoffset; if(ioctl(this->fd, FBIOPAN_DISPLAY, &this->fb_var) == -1) - perror("video_out_fb: ioctl FBIOPAN_DISPLAY failed"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_fb: ioctl FBIOPAN_DISPLAY failed: %s\n", strerror(errno)); } else { @@ -625,8 +625,8 @@ static int fb_get_property(vo_driver_t *this_gen, int property) return this->sc.gui_height; default: - printf("video_out_fb: tried to get unsupported " - "property %d\n", property); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_fb: tried to get unsupported property %d\n", property); } return 0; @@ -640,22 +640,22 @@ static int fb_set_property(vo_driver_t *this_gen, int property, int value) { case VO_PROP_ASPECT_RATIO: if(value>=XINE_VO_ASPECT_NUM_RATIOS) - value = XINE_VO_ASPECT_AUTO; - this->sc.user_ratio = value; - printf("video_out_fb: aspect ratio changed to %s\n", - _x_vo_scale_aspect_ratio_name(value)); + value = XINE_VO_ASPECT_AUTO; + this->sc.user_ratio = value; + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_fb: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); break; case VO_PROP_BRIGHTNESS: - this->yuv2rgb_gamma = value; + this->yuv2rgb_gamma = value; this->yuv2rgb_factory-> set_csc_levels(this->yuv2rgb_factory, value, 128, 128); - printf("video_out_fb: gamma changed to %d\n",value); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_fb: gamma changed to %d\n", value); break; default: - printf("video_out_fb: tried to set unsupported " - "property %d\n", property); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_fb: tried to set unsupported property %d\n", property); } return value; @@ -692,13 +692,13 @@ static void fb_dispose(vo_driver_t *this_gen) close(this->fd); } -static int get_fb_var_screeninfo(int fd, struct fb_var_screeninfo *var) +static int get_fb_var_screeninfo(int fd, struct fb_var_screeninfo *var, xine_t *xine) { int i; if(ioctl(fd, FBIOGET_VSCREENINFO, var)) { - perror("video_out_fb: ioctl FBIOGET_VSCREENINFO"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "video_out_fb: ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno)); return 0; } @@ -720,18 +720,18 @@ static int get_fb_var_screeninfo(int fd, struct fb_var_screeninfo *var) /* Get proper value for maximized var->yres_virtual. */ if(ioctl(fd, FBIOGET_VSCREENINFO, var) == -1) { - perror("video_out_fb: ioctl FBIOGET_VSCREENINFO"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "video_out_fb: ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno)); return 0; } return 1; } -static int get_fb_fix_screeninfo(int fd, struct fb_fix_screeninfo *fix) +static int get_fb_fix_screeninfo(int fd, struct fb_fix_screeninfo *fix, xine_t *xine) { if(ioctl(fd, FBIOGET_FSCREENINFO, fix)) { - perror("video_out_fb: ioctl FBIOGET_FSCREENINFO"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "video_out_fb: ioctl FBIOGET_FSCREENINFO: %s\n", strerror(errno)); return 0; } @@ -739,9 +739,9 @@ static int get_fb_fix_screeninfo(int fd, struct fb_fix_screeninfo *fix) fix->visual != FB_VISUAL_DIRECTCOLOR) || fix->type != FB_TYPE_PACKED_PIXELS) { - fprintf(stderr, "video_out_fb: only packed truecolor/directcolor is supported (%d).\n" - " Check 'fbset -i' or try 'fbset -depth 16'.\n", - fix->visual); + xprintf(xine, XINE_VERBOSITY_LOG, + _("video_out_fb: only packed truecolor/directcolor is supported (%d).\n" + " Check 'fbset -i' or try 'fbset -depth 16'.\n"), fix->visual); return 0; } @@ -765,7 +765,7 @@ static void register_callbacks(fb_driver_t *this) this->vo_driver.redraw_needed = fb_redraw_needed; } -static int open_fb_device(config_values_t *config) +static int open_fb_device(config_values_t *config, xine_t *xine) { static char devkey[] = "video.fb_device"; /* Why static? */ char *device_name; @@ -792,8 +792,8 @@ static int open_fb_device(config_values_t *config) if(fd < 0) { - fprintf(stderr, "video_out_fb: Unable to open device \"%s\", aborting: %s\n", - device_name, strerror(errno)); + xprintf(xine, XINE_VERBOSITY_DEBUG, + "video_out_fb: Unable to open device \"%s\", aborting: %s\n", device_name, strerror(errno)); return -1; } @@ -841,7 +841,7 @@ static int mode_visual(fb_driver_t *this, config_values_t *config, } } - fprintf(stderr, "video_out_fb: Your video mode was not recognized, sorry.\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_fb: Your video mode was not recognized, sorry.\n")); return 0; } @@ -898,31 +898,32 @@ static void setup_buffers(fb_driver_t *this, this->cur_frame = this->old_frame = 0; - printf("video_out_fb: %d video RAM buffers are available.\n", - this->total_num_native_buffers); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_fb: %d video RAM buffers are available.\n"), this->total_num_native_buffers); if(this->total_num_native_buffers < RECOMMENDED_NUM_BUFFERS) { this->use_zero_copy = 0; - printf("WARNING: video_out_fb: Zero copy buffers are DISABLED because only %d buffers\n" - " are available which is less than the recommended %d buffers. Lowering\n" - " the frame buffer resolution might help.\n", - this->total_num_native_buffers, - RECOMMENDED_NUM_BUFFERS); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("WARNING: video_out_fb: Zero copy buffers are DISABLED because only %d buffers\n" + " are available which is less than the recommended %d buffers. Lowering\n" + " the frame buffer resolution might help.\n"), + this->total_num_native_buffers, RECOMMENDED_NUM_BUFFERS); } else { /* test if FBIOPAN_DISPLAY works */ this->fb_var.yoffset = this->fb_var.yres; if(ioctl(this->fd, FBIOPAN_DISPLAY, &this->fb_var) == -1) { - printf("WARNING: video_out_fb: Zero copy buffers are DISABLED because kernel driver\n" - " do not support screen panning (used for frame flips).\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("WARNING: video_out_fb: Zero copy buffers are DISABLED because kernel driver\n" + " do not support screen panning (used for frame flips).\n")); } else { this->fb_var.yoffset = 0; ioctl(this->fd, FBIOPAN_DISPLAY, &this->fb_var); this->use_zero_copy = 1; - printf("video_out_fb: Using zero copy buffers.\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_fb: Using zero copy buffers.\n"); } } } @@ -943,24 +944,22 @@ static vo_driver_t *fb_open_plugin(video_driver_class_t *class_gen, config = class->config; /* allocate plugin struct */ - this = malloc(sizeof(fb_driver_t)); + this = (fb_driver_t *) xine_xmalloc(sizeof(fb_driver_t)); if(!this) - { - fprintf(stderr, "video_out_fb: malloc failed\n"); - return 0; - } - memset(this, 0, sizeof(fb_driver_t)); + return NULL; register_callbacks(this); - this->fd = open_fb_device(config); + this->fd = open_fb_device(config, class->xine); if(this->fd == -1) goto error; - if(!get_fb_var_screeninfo(this->fd, &this->fb_var)) + if(!get_fb_var_screeninfo(this->fd, &this->fb_var, class->xine)) goto error; - if(!get_fb_fix_screeninfo(this->fd, &this->fb_fix)) + if(!get_fb_fix_screeninfo(this->fd, &this->fb_fix, class->xine)) goto error; + this->xine = class->xine; + if(this->fb_fix.line_length) this->fb_bytes_per_line = this->fb_fix.line_length; else @@ -986,17 +985,18 @@ static vo_driver_t *fb_open_plugin(video_driver_class_t *class_gen, setup_buffers(this, &this->fb_var); if(this->depth > 16) - printf("WARNING: video_out_fb: current display depth is %d. For better performance\n" - " a depth of 16 bpp is recommended!\n\n", - this->depth); - - printf("video_out_fb: video mode depth is %d (%d bpp),\n" - " red: %d/%d, green: %d/%d, blue: %d/%d\n", - this->depth, this->bpp, - this->fb_var.red.length, this->fb_var.red.offset, - this->fb_var.green.length, this->fb_var.green.offset, - this->fb_var.blue.length, this->fb_var.blue.offset); - + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("WARNING: video_out_fb: current display depth is %d. For better performance\n" + " a depth of 16 bpp is recommended!\n\n"), this->depth); + + xprintf(class->xine, XINE_VERBOSITY_DEBUG, + "video_out_fb: video mode depth is %d (%d bpp),\n" + " red: %d/%d, green: %d/%d, blue: %d/%d\n", + this->depth, this->bpp, + this->fb_var.red.length, this->fb_var.red.offset, + this->fb_var.green.length, this->fb_var.green.offset, + this->fb_var.blue.length, this->fb_var.blue.offset); + if(!setup_yuv2rgb(this, config, &this->fb_var, &this->fb_fix)) goto error; @@ -1028,7 +1028,7 @@ static void fb_dispose_class(video_driver_class_t *this_gen) static void *fb_init_class(xine_t *xine, void *visual_gen) { - fb_class_t *this = (fb_class_t *)malloc(sizeof(fb_class_t)); + fb_class_t *this = (fb_class_t *)xine_xmalloc(sizeof(fb_class_t)); this->driver_class.open_plugin = fb_open_plugin; this->driver_class.get_identifier = fb_get_identifier; @@ -1036,6 +1036,7 @@ static void *fb_init_class(xine_t *xine, void *visual_gen) this->driver_class.dispose = fb_dispose_class; this->config = xine->config; + this->xine = xine; return this; } @@ -1051,22 +1052,8 @@ static vo_info_t vo_info_fb = }; /* exported plugin catalog entry */ -plugin_info_t xine_plugin_info[] = -{ +plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { - PLUGIN_VIDEO_OUT, - 18, - "fb", - XINE_VERSION_CODE, - &vo_info_fb, fb_init_class - }, - { - PLUGIN_NONE, - 0, - "", - 0, - NULL, - NULL - } + { PLUGIN_VIDEO_OUT, 18, "fb", XINE_VERSION_CODE, &vo_info_fb, fb_init_class }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_none.c b/src/video_out/video_out_none.c index e54ed411a..9b5609865 100644 --- a/src/video_out/video_out_none.c +++ b/src/video_out/video_out_none.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_none.c,v 1.18 2003/10/31 17:25:20 mroi Exp $ + * $Id: video_out_none.c,v 1.19 2003/12/05 15:55:03 f1rmb Exp $ * * Was originally part of toxine frontend. * ...but has now been adapted to xine coding style standards ;) @@ -47,17 +47,20 @@ typedef struct { int height; double ratio; int format; + xine_t *xine; } none_frame_t; typedef struct { vo_driver_t vo_driver; config_values_t *config; - int ratio; + int ratio; + xine_t *xine; } none_driver_t; typedef struct { video_driver_class_t driver_class; config_values_t *config; + xine_t *xine; } none_class_t; @@ -85,15 +88,12 @@ static uint32_t none_get_capabilities(vo_driver_t *vo_driver) { } static vo_frame_t *none_alloc_frame(vo_driver_t *vo_driver) { + /* none_driver_t *this = (none_driver_t *) vo_driver; */ none_frame_t *frame; - frame = (none_frame_t *) malloc(sizeof(none_frame_t)); - - if(frame == NULL) { - printf ("video_out_none: out of memory in none_alloc_frame\n"); - abort(); - } - memset(frame, 0, sizeof(none_frame_t)); + frame = (none_frame_t *) xine_xmalloc(sizeof(none_frame_t)); + if(!frame) + return NULL; frame->vo_frame.base[0] = NULL; frame->vo_frame.base[1] = NULL; @@ -111,7 +111,8 @@ static vo_frame_t *none_alloc_frame(vo_driver_t *vo_driver) { static void none_update_frame_format(vo_driver_t *vo_driver, vo_frame_t *vo_frame, uint32_t width, uint32_t height, double ratio, int format, int flags) { - none_frame_t *frame = (none_frame_t *)vo_frame; + none_driver_t *this = (none_driver_t *) vo_driver; + none_frame_t *frame = (none_frame_t *) vo_frame; if((frame->width != width) || (frame->height != height) || (frame->format != format)) { @@ -148,7 +149,7 @@ static void none_update_frame_format(vo_driver_t *vo_driver, vo_frame_t *vo_fram break; default: - printf ("video_out_none: unknown frame format %04x)\n", format); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_none: unknown frame format %04x)\n", format); break; } @@ -158,7 +159,8 @@ static void none_update_frame_format(vo_driver_t *vo_driver, vo_frame_t *vo_fram || frame->vo_frame.base[1] == NULL || frame->vo_frame.base[2] == NULL)) || (format == XINE_IMGFMT_YUY2 && frame->vo_frame.base[0] == NULL)) { - printf ("video_out_none: error. (framedata allocation failed: out of memory)\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_none: error. (framedata allocation failed: out of memory)\n"); free_framedata(frame); } } @@ -242,9 +244,10 @@ static vo_driver_t *open_plugin(video_driver_class_t *driver_class, const void * none_class_t *class = (none_class_t *) driver_class; none_driver_t *driver; - driver = (none_driver_t *) malloc(sizeof(none_driver_t)); + driver = (none_driver_t *) xine_xmalloc(sizeof(none_driver_t)); driver->config = class->config; + driver->xine = class->xine; driver->ratio = XINE_VO_ASPECT_AUTO; driver->vo_driver.get_capabilities = none_get_capabilities; @@ -284,7 +287,7 @@ static void dispose_class (video_driver_class_t *driver_class) { static void *init_class (xine_t *xine, void *visual) { none_class_t *this; - this = (none_class_t *) malloc(sizeof(none_class_t)); + this = (none_class_t *) xine_xmalloc(sizeof(none_class_t)); this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; @@ -292,6 +295,7 @@ static void *init_class (xine_t *xine, void *visual) { this->driver_class.dispose = dispose_class; this->config = xine->config; + this->xine = xine; return this; } diff --git a/src/video_out/video_out_opengl.c b/src/video_out/video_out_opengl.c index ffe00340d..be8be58ca 100644 --- a/src/video_out/video_out_opengl.c +++ b/src/video_out/video_out_opengl.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_opengl.c,v 1.32 2003/11/26 01:03:32 miguelfreitas Exp $ + * $Id: video_out_opengl.c,v 1.33 2003/12/05 15:55:03 f1rmb Exp $ * * video_out_glut.c, glut based OpenGL rendering interface for xine * Matthias Hopf <mat@mshopf.de> @@ -172,11 +172,13 @@ typedef struct opengl_driver_s { uint8_t *yuv2rgb_cmap; yuv2rgb_factory_t *yuv2rgb_factory; + xine_t *xine; } opengl_driver_t; typedef struct { video_driver_class_t driver_class; config_values_t *config; + xine_t *xine; } opengl_class_t; @@ -271,14 +273,12 @@ static void opengl_frame_dispose (vo_frame_t *vo_img) { static vo_frame_t *opengl_alloc_frame (vo_driver_t *this_gen) { opengl_frame_t *frame ; - opengl_driver_t *this = (opengl_driver_t *) this_gen; + opengl_driver_t *this = (opengl_driver_t *) this_gen; DEBUGF ((stderr, "*** alloc_frame ***\n")); - frame = (opengl_frame_t *) calloc (1, sizeof (opengl_frame_t)); - if (frame==NULL) { - printf ("opengl_alloc_frame: out of memory\n"); - return NULL; - } + frame = (opengl_frame_t *) xine_xmalloc (sizeof (opengl_frame_t)); + if (!frame) + return NULL; pthread_mutex_init (&frame->vo_frame.mutex, NULL); @@ -355,7 +355,8 @@ static void opengl_update_frame_format (vo_driver_t *this_gen, frame->vo_frame.base[0] = xine_xmalloc_aligned(16, frame->vo_frame.pitches[0] * height, (void **) &frame->chunk[0]); break; default: - fprintf (stderr, "video_out_opengl: image format %d not supported, update video driver!\n", format); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_opengl: image format %d not supported, update video driver!\n", format); return; } @@ -503,7 +504,8 @@ static void opengl_render_image (opengl_driver_t *this, opengl_frame_t *frame, /* already initialized? */ if (! this->drawable || ! this->vinfo) { - fprintf (stderr, "video_out_opengl: early exit due to missing drawable %lx vinfo %p\n", this->drawable, this->vinfo); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_opengl: early exit due to missing drawable %lx vinfo %p\n", this->drawable, this->vinfo); return; } @@ -586,7 +588,9 @@ static void opengl_render_image (opengl_driver_t *this, opengl_frame_t *frame, * Set and initialize context */ if (! glXMakeCurrent (this->display, this->drawable, ctx)) { - fprintf (stderr, "video_out_opengl: no OpenGL support available (glXMakeCurrent)\n The drawable does not seem to be updated correctly.\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_opengl: no OpenGL support available (glXMakeCurrent)\n" + " The drawable does not seem to be updated correctly.\n"); abort(); } DEBUGF ((stderr, "set context done\n")); @@ -754,8 +758,8 @@ static int opengl_get_property (vo_driver_t *this_gen, int property) { case VO_PROP_WINDOW_HEIGHT: return this->sc.gui_height; default: - printf ("video_out_opengl: tried to get unsupported property %d\n", - property); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_opengl: tried to get unsupported property %d\n", property); } return 0; @@ -773,7 +777,7 @@ static int opengl_set_property (vo_driver_t *this_gen, if (value >= XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; - fprintf (stderr, "video_out_opengl: aspect ratio changed to %s\n", + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_opengl: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name (value)); opengl_compute_ideal_size (this); // opengl_redraw_needed ((vo_driver_t *) this); @@ -781,10 +785,11 @@ static int opengl_set_property (vo_driver_t *this_gen, case VO_PROP_BRIGHTNESS: this->yuv2rgb_gamma = value; this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, value, 128, 128); - printf("video_out_opengl: gamma changed to %d\n",value); + xrintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_opengl: gamma changed to %d\n",value); break; default: - printf ("video_out_opengl: tried to set unsupported property %d\n", property); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_opengl: tried to set unsupported property %d\n", property); } return value; @@ -823,7 +828,8 @@ static int opengl_gui_data_exchange (vo_driver_t *this_gen, this->vinfo = glXChooseVisual (this->display, this->screen, glxAttrib); XUnlockDisplay (this->display); if (this->vinfo == NULL) - fprintf (stderr, "video_out_opengl: no OpenGL support available (glXChooseVisual)\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_opengl: no OpenGL support available (glXChooseVisual)\n"); *(XVisualInfo**)data = this->vinfo; DEBUGF ((stderr, "*** visual %p depth %d\n", this->vinfo->visual, this->vinfo->depth)); break; @@ -913,7 +919,7 @@ static vo_driver_t *opengl_open_plugin (video_driver_class_t *class_gen, opengl_driver_t *this; - fprintf (stderr, "EXPERIMENTAL opengl output plugin TNG\n"); + xprintf (class->xine, XINE_VERBOSITY_DEBUG, "EXPERIMENTAL opengl output plugin TNG\n"); /* * allocate plugin struct @@ -922,6 +928,7 @@ static vo_driver_t *opengl_open_plugin (video_driver_class_t *class_gen, XINE_ASSERT (this, "OpenGL driver struct is not defined"); this->config = class->config; + this->xine = class->xine; this->display = visual->display; this->screen = visual->screen; @@ -980,7 +987,7 @@ static void opengl_dispose_class (video_driver_class_t *this) { static void *opengl_init_class (xine_t *xine, void *visual_gen) { - opengl_class_t *this = (opengl_class_t *) malloc (sizeof (opengl_class_t)); + opengl_class_t *this = (opengl_class_t *) xine_xmalloc (sizeof (opengl_class_t)); this->driver_class.open_plugin = opengl_open_plugin; this->driver_class.get_identifier = opengl_get_identifier; @@ -988,6 +995,7 @@ static void *opengl_init_class (xine_t *xine, void *visual_gen) { this->driver_class.dispose = opengl_dispose_class; this->config = xine->config; + this->xine = xine; return this; } diff --git a/src/video_out/video_out_pgx64.c b/src/video_out/video_out_pgx64.c index 6c4edaa35..94be4fdc9 100644 --- a/src/video_out/video_out_pgx64.c +++ b/src/video_out/video_out_pgx64.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_pgx64.c,v 1.45 2003/11/11 18:45:00 f1rmb Exp $ + * $Id: video_out_pgx64.c,v 1.46 2003/12/05 15:55:03 f1rmb Exp $ * * video_out_pgx64.c, Sun PGX64/PGX24 output plugin for xine * @@ -316,15 +316,12 @@ static uint32_t pgx64_get_capabilities(vo_driver_t *this_gen) static vo_frame_t* pgx64_alloc_frame(vo_driver_t *this_gen) { - /*pgx64_driver_t *this = (pgx64_driver_t *)(void *)this_gen;*/ + pgx64_driver_t *this = (pgx64_driver_t *)(void *)this_gen; pgx64_frame_t *frame; - frame = malloc(sizeof(pgx64_frame_t)); - if (!frame) { - printf("video_out_pgx64: Error: frame malloc failed\n"); + frame = (pgx64_frame_t *) xine_xmalloc(sizeof(pgx64_frame_t)); + if (!frame) return NULL; - } - memset(frame, 0, sizeof(pgx64_frame_t)); pthread_mutex_init(&frame->vo_frame.mutex, NULL); @@ -338,7 +335,7 @@ static vo_frame_t* pgx64_alloc_frame(vo_driver_t *this_gen) static void pgx64_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, double ratio, int format, int flags) { - /*pgx64_driver_t *this = (pgx64_driver_t *)(void *)this_gen;*/ + pgx64_driver_t *this = (pgx64_driver_t *)(void *)this_gen; pgx64_frame_t *frame = (pgx64_frame_t *)frame_gen; if ((width != frame->width) || @@ -388,7 +385,7 @@ static void pgx64_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_g for (i=0; i<frame->planes; i++) { if (!frame->vo_frame.base[i]) { - printf("video_out_pgx64: frame plane malloc failed\n"); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_pgx64: frame plane malloc failed\n"); abort(); } } @@ -475,7 +472,8 @@ static void pgx64_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) return; } else { - printf("video_out_pgx64: Warning: low video memory, multi-buffering disabled\n"); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_pgx64: Warning: low video memory, multi-buffering disabled\n"); vram_reset(this); this->buf_mode = BUF_MODE_NONE; break; @@ -502,7 +500,7 @@ static void pgx64_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) if (this->buf_mode == BUF_MODE_NONE) { for (i=0; i<frame->planes; i++) { if ((this->buffers[0][i] = vram_alloc(this, frame->lengths[i])) < 0) { - printf("video_out_pgx64: Error: insuffucient video memory\n"); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_pgx64: Error: insuffucient video memory\n"); return; } else { @@ -521,7 +519,8 @@ static void pgx64_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) } if (this->buf_mode == BUF_MODE_SINGLE) { - printf("video_out_pgx64: Warning: low video memory, double-buffering disabled\n"); + xprintf(this->class->xine, XINE_VERBOSITY_LOG, + _("video_out_pgx64: Warning: low video memory, double-buffering disabled\n")); for (i=0; i<frame->planes; i++) { this->buffers[1][i] = this->buffers[0][i]; this->buffer_ptrs[1][i] = this->vram + this->buffers[1][i]; @@ -639,7 +638,7 @@ static void pgx64_overlay_key_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen ovl = (pgx64_overlay_t *)malloc(sizeof(pgx64_overlay_t)); if (!ovl) { - printf("video_out_pgx64: overlay malloc failed\n"); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_pgx64: overlay malloc failed\n"); return; } ovl->x = scale_down(overlay->x * x_scale); @@ -732,7 +731,8 @@ static void pgx64_overlay_key_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen } } if (y < overlay->height) { - printf("video_out_pgx64: Notice: RLE data doesn't extend to height of overlay\n"); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_pgx64: Notice: RLE data doesn't extend to height of overlay\n"); XFillRectangle(this->display, ovl->p, this->gc, scale_down(x * x_scale), scale_down(y * y_scale), ovl->width, scale_down(overlay->height * y_scale) - scale_down(y * y_scale)); } XUnlockDisplay(this->display); @@ -937,7 +937,8 @@ static void set_overlay_mode(pgx64_driver_t* this, int ovl_mode) if ((XGetRGBColormaps(this->display, RootWindow(this->display, this->screen), &this->stdcolmap, &this->stdcolmap_size, XA_RGB_BEST_MAP) == 0) || (this->stdcolmap->red_max == 0) || (!this->stdcolmap->colormap)) { - printf("video_out_pgx64: Warning: RGB_BEST_MAP property not set or malformed. Run xstdcmap(1).\n"); + xprintf(this->class->xine, XINE_VERBOSITY_LOG, + _("video_out_pgx64: Warning: RGB_BEST_MAP property not set or malformed. Run xstdcmap(1).\n")); if (this->stdcolmap) { XFree(this->stdcolmap); this->stdcolmap = NULL; @@ -1020,34 +1021,35 @@ static vo_driver_t* pgx64_init_driver(video_driver_class_t *class_gen, const voi devname = class->config->register_string(class->config, "video.pgx64_device", "/dev/fb", "name of pgx64 device", NULL, 10, NULL, NULL); if ((fbfd = open(devname, O_RDWR)) < 0) { - printf("video_out_pgx64: Error: can't open framebuffer device '%s'\n", devname); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, + "video_out_pgx64: Error: can't open framebuffer device '%s'\n", devname); return NULL; } if (ioctl(fbfd, FBIOGATTR, &attr) < 0) { - printf("video_out_pgx64: Error: ioctl failed, unable to determine framebuffer characteristics\n"); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, + "video_out_pgx64: Error: ioctl failed, unable to determine framebuffer characteristics\n"); close(fbfd); return NULL; } if (attr.real_type != 22) { - printf("video_out_pgx64: Error: '%s' is not a mach64 framebuffer device\n", devname); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, + "video_out_pgx64: Error: '%s' is not a mach64 framebuffer device\n", devname); close(fbfd); return NULL; } if ((baseaddr = mmap(0, FB_ADDRSPACE, PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, 0)) == MAP_FAILED) { - printf("video_out_pgx64: Error: unable to memory map framebuffer\n"); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, + "video_out_pgx64: Error: unable to memory map framebuffer\n"); close(fbfd); return NULL; } - this = (pgx64_driver_t*)malloc(sizeof(pgx64_driver_t)); - if (!this) { - printf("video_out_pgx64: Error: driver malloc failed\n"); + this = (pgx64_driver_t*)xine_xmalloc(sizeof(pgx64_driver_t)); + if (!this) return NULL; - } - memset(this, 0, sizeof(pgx64_driver_t)); this->vo_driver.get_capabilities = pgx64_get_capabilities; this->vo_driver.alloc_frame = pgx64_alloc_frame; @@ -1116,12 +1118,9 @@ static void* pgx64_init_class(xine_t *xine, void *visual_gen) { pgx64_driver_class_t *class; - class = (pgx64_driver_class_t*)malloc(sizeof(pgx64_driver_class_t)); - if (!class) { - printf("video_out_pgx64: Error: driver class malloc failed\n"); + class = (pgx64_driver_class_t*)xine_xmalloc(sizeof(pgx64_driver_class_t)); + if (!class) return NULL; - } - memset(class, 0, sizeof(pgx64_driver_class_t)); class->vo_driver_class.open_plugin = pgx64_init_driver; class->vo_driver_class.get_identifier = pgx64_get_identifier; diff --git a/src/video_out/video_out_sdl.c b/src/video_out/video_out_sdl.c index 516e8af56..31ee6f512 100644 --- a/src/video_out/video_out_sdl.c +++ b/src/video_out/video_out_sdl.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_sdl.c,v 1.33 2003/11/26 19:43:37 f1rmb Exp $ + * $Id: video_out_sdl.c,v 1.34 2003/12/05 15:55:03 f1rmb Exp $ * * video_out_sdl.c, Simple DirectMedia Layer * @@ -102,12 +102,13 @@ struct sdl_driver_s { #endif vo_scale_t sc; - + xine_t *xine; }; typedef struct { video_driver_class_t driver_class; config_values_t *config; + xine_t *xine; } sdl_class_t; static uint32_t sdl_get_capabilities (vo_driver_t *this_gen) { @@ -132,17 +133,14 @@ static void sdl_frame_dispose (vo_frame_t *vo_img) { } static vo_frame_t *sdl_alloc_frame (vo_driver_t *this_gen) { - + /* sdl_driver_t *this = (sdl_driver_t *) this_gen; */ sdl_frame_t *frame ; - frame = (sdl_frame_t *) malloc (sizeof (sdl_frame_t)); + frame = (sdl_frame_t *) xine_xmalloc (sizeof (sdl_frame_t)); - if (frame==NULL) { - printf ("sdl_alloc_frame: out of memory\n"); + if (!frame) return NULL; - } - memset (frame, 0, sizeof(sdl_frame_t)); - + pthread_mutex_init (&frame->vo_frame.mutex, NULL); /* @@ -318,7 +316,7 @@ static void sdl_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { if ( (frame->width != this->sc.delivered_width) || (frame->height != this->sc.delivered_height) || (frame->ratio != this->sc.delivered_ratio) ) { - printf("video_out_sdl: change frame format\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_sdl: change frame format\n"); this->sc.delivered_width = frame->width; this->sc.delivered_height = frame->height; @@ -372,8 +370,8 @@ static int sdl_set_property (vo_driver_t *this_gen, if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; - printf("video_out_sdl: aspect ratio changed to %s\n", - _x_vo_scale_aspect_ratio_name(value)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_sdl: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); sdl_compute_ideal_size (this); this->sc.force_redraw = 1; @@ -462,20 +460,16 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi XWindowAttributes window_attributes; #endif - this = malloc (sizeof (sdl_driver_t)); - - if (!this) { - printf ("video_out_sdl: open_plugin - malloc failed\n"); + this = (sdl_driver_t *) xine_xmalloc (sizeof (sdl_driver_t)); + if (this) return NULL; - } - - memset (this, 0, sizeof(sdl_driver_t)); this->sdlflags = SDL_HWSURFACE | SDL_RESIZABLE; xine_setenv("SDL_VIDEO_YUV_HWACCEL", "1", 1); xine_setenv("SDL_VIDEO_X11_NODIRECTCOLOR", "1", 1); + this->xine = class->xine; #ifdef HAVE_X11 this->display = visual->display; this->screen = visual->screen; @@ -492,9 +486,8 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi _x_vo_scale_init( &this->sc, 0, 0, config ); #endif - if ((SDL_Init (SDL_INIT_VIDEO)) < 0) { - printf ("video_out_sdl: open_plugin - sdl video initialization failed.\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_sdl: open_plugin - sdl video initialization failed.\n"); return NULL; } @@ -502,15 +495,16 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi if (!SDL_ListModes (vidInfo->vfmt, SDL_HWSURFACE | SDL_RESIZABLE)) { this->sdlflags = SDL_RESIZABLE; if (!SDL_ListModes (vidInfo->vfmt, SDL_RESIZABLE)) { - printf ("video_out_sdl: open_plugin - sdl couldn't get any acceptable video mode\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_sdl: open_plugin - sdl couldn't get any acceptable video mode\n"); return NULL; } } this->bpp = vidInfo->vfmt->BitsPerPixel; if (this->bpp < 16) { - fprintf(stderr, "sdl has to emulate a 16 bit surfaces, " - "that will slow things down.\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("sdl has to emulate a 16 bit surfaces, that will slow things down.\n")); this->bpp = 16; } @@ -545,8 +539,8 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->vo_driver.dispose = sdl_dispose; this->vo_driver.redraw_needed = sdl_redraw_needed; - printf ("video_out_sdl: warning, xine's SDL driver is EXPERIMENTAL\n"); - printf ("video_out_sdl: fullscreen mode is NOT supported\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_sdl: warning, xine's SDL driver is EXPERIMENTAL\n"); + xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_sdl: fullscreen mode is NOT supported\n")); return &this->vo_driver; } /** @@ -571,19 +565,21 @@ static void *init_class (xine_t *xine, void *visual_gen) { /* check if we have SDL */ if ((SDL_Init (SDL_INIT_VIDEO)) < 0) { - printf ("video_out_sdl: open_plugin - sdl video initialization failed.\n"); + xprintf (xine, XINE_VERBOSITY_DEBUG, + "video_out_sdl: open_plugin - sdl video initialization failed.\n"); return NULL; } SDL_QuitSubSystem (SDL_INIT_VIDEO); - this = (sdl_class_t*) malloc (sizeof (sdl_class_t)); + this = (sdl_class_t*) xine_xmalloc (sizeof (sdl_class_t)); this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; this->driver_class.get_description = get_description; this->driver_class.dispose = dispose_class; - this->config = xine->config; + this->config = xine->config; + this->xine = xine; return this; } diff --git a/src/video_out/video_out_stk.c b/src/video_out/video_out_stk.c index 0b92b6a0d..2e04708a5 100644 --- a/src/video_out/video_out_stk.c +++ b/src/video_out/video_out_stk.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_stk.c,v 1.10 2003/11/26 19:43:37 f1rmb Exp $ + * $Id: video_out_stk.c,v 1.11 2003/12/05 15:55:03 f1rmb Exp $ * * video_out_stk.c, Libstk Surface Video Driver * more info on Libstk at http://www.libstk.org @@ -92,12 +92,14 @@ typedef struct stk_driver_s { pthread_mutex_t mutex; uint32_t capabilities; vo_scale_t sc; + xine_t *xine; } stk_driver_t; typedef struct { - video_driver_class_t driver_class; - config_values_t* config; + video_driver_class_t driver_class; + config_values_t* config; + xine_t *xine; } stk_class_t; static uint32_t stk_get_capabilities (vo_driver_t *this_gen) { @@ -127,15 +129,14 @@ static void stk_frame_dispose (vo_frame_t *vo_img) { } static vo_frame_t *stk_alloc_frame(vo_driver_t *this_gen) { + stk_driver_t* this = (stk_driver_t*)this_gen; /* allocate the frame */ stk_frame_t* frame; + //printf("video_out_stk: alloc_frame()\n"); - frame = (stk_frame_t *)malloc(sizeof(stk_frame_t)); - if (frame == NULL) { - printf("stk_alloc_frame: out of memory\n"); - return NULL; - } - memset(frame, 0, sizeof(stk_frame_t)); + frame = (stk_frame_t *) xine_xmalloc(sizeof(stk_frame_t)); + if (!frame) + return NULL; /* populate the frame members*/ pthread_mutex_init (&frame->vo_frame.mutex, NULL); @@ -275,7 +276,7 @@ static void stk_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { if ( (frame->width != this->sc.delivered_width) || (frame->height != this->sc.delivered_height) || (frame->ratio != this->sc.delivered_ratio) ) { - printf("video_out_stk: change frame format\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_stk: change frame format\n"); this->sc.delivered_width = frame->width; this->sc.delivered_height = frame->height; @@ -322,7 +323,8 @@ static int stk_set_property (vo_driver_t* this_gen, int property, int value) { if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; - printf("video_out_stk: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_stk: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); stk_compute_ideal_size (this); this->sc.force_redraw = 1; @@ -375,25 +377,24 @@ static void stk_dispose (vo_driver_t * this_gen) { } static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *visual_gen) { + stk_class_t * class = (stk_class_t *) class_gen; /* allocate the video output driver class */ stk_driver_t* this; //printf("video_out_stk: open_plugin()\n"); - this = malloc (sizeof (stk_driver_t)); - if (!this) { - printf ("video_out_stk: open_plugin - malloc failed\n"); - return NULL; - } - memset (this, 0, sizeof(stk_driver_t)); + this = (stk_driver_t *) xine_xmalloc (sizeof (stk_driver_t)); + if (!this) + return NULL; /* populate the video output driver members */ - this->config = ((stk_class_t*)class_gen)->config; + this->config = class->config; + this->xine = class->xine; this->xine_panel = (xine_panel_t*)visual_gen; - this->surface = stk_xine_panel_surface(this->xine_panel); + this->surface = stk_xine_panel_surface(this->xine_panel); /* FIXME: provide a way to get bpp from stk surfaces */ /* this->bpp = stk_surface_bpp(this->surface); */ - this->bpp = 32; + this->bpp = 32; pthread_mutex_init(&this->mutex, NULL); /* FIXME: provide a way to get YUV formats from stk surfaces */ /* this->capabilities = stk_surface_formats(this->surface); */ @@ -424,7 +425,8 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis xine_setenv("SDL_VIDEO_YUV_HWACCEL", "1", 1); xine_setenv("SDL_VIDEO_X11_NODIRECTCOLOR", "1", 1); - printf ("video_out_stk: warning, xine's STK driver is EXPERIMENTAL\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_stk: warning, xine's STK driver is EXPERIMENTAL\n"); return &this->vo_driver; } @@ -453,7 +455,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { //printf("video_out_stk: init_class()\n"); - this = (stk_class_t*)malloc(sizeof(stk_class_t)); + this = (stk_class_t *) xine_xmalloc(sizeof(stk_class_t)); this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; @@ -461,6 +463,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { this->driver_class.dispose = dispose_class; this->config = xine->config; + this->xine = xine; return this; } diff --git a/src/video_out/video_out_syncfb.c b/src/video_out/video_out_syncfb.c index 4aa89fa69..9e2c1bee6 100644 --- a/src/video_out/video_out_syncfb.c +++ b/src/video_out/video_out_syncfb.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_syncfb.c,v 1.93 2003/11/26 01:03:32 miguelfreitas Exp $ + * $Id: video_out_syncfb.c,v 1.94 2003/12/05 15:55:03 f1rmb Exp $ * * video_out_syncfb.c, SyncFB (for Matrox G200/G400 cards) interface for xine * @@ -90,7 +90,6 @@ struct syncfb_driver_s { GC gc; XColor black; - vo_scale_t sc; int virtual_screen_width; @@ -115,16 +114,17 @@ struct syncfb_driver_s { syncfb_buffer_info_t bufinfo; syncfb_param_t params; - int video_win_visibility; + int video_win_visibility; + xine_t *xine; }; typedef struct { - video_driver_class_t driver_class; - - config_values_t *config; + video_driver_class_t driver_class; - char *device_name; + config_values_t *config; + char *device_name; + xine_t *xine; } syncfb_class_t; /* @@ -135,7 +135,8 @@ typedef struct { static int syncfb_overlay_on(syncfb_driver_t* this) { if(ioctl(this->fd, SYNCFB_ON)) { - printf("video_out_syncfb: error. (on ioctl failed)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: error. (on ioctl failed)\n"); return 0; } else { this->overlay_state = 1; @@ -147,7 +148,8 @@ static int syncfb_overlay_on(syncfb_driver_t* this) static int syncfb_overlay_off(syncfb_driver_t* this) { if(ioctl(this->fd, SYNCFB_OFF)) { - printf("video_out_syncfb: error. (off ioctl failed)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: error. (off ioctl failed)\n"); return 0; } else { this->overlay_state = 0; @@ -275,7 +277,8 @@ static void write_frame_sfb(syncfb_driver_t* this, syncfb_frame_t* frame) if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV422)) write_frame_YUY2(this, frame); else - printf("video_out_syncfb: error. (YUY2 not supported by your graphic card)\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_syncfb: error. (YUY2 not supported by your graphic card)\n")); break; case XINE_IMGFMT_YV12: @@ -290,12 +293,13 @@ static void write_frame_sfb(syncfb_driver_t* this, syncfb_frame_t* frame) write_frame_YUV420P3(this, frame); break; default: - printf("video_out_syncfb: error. (YV12 not supported by your graphic card)\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_syncfb: error. (YV12 not supported by your graphic card)\n")); } break; default: - printf("video_out_syncfb: error. (unknown frame format)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (unknown frame format)\n"); break; } @@ -378,7 +382,8 @@ static void syncfb_compute_output_size(syncfb_driver_t *this) this->cur_frame->format > 0 && this->video_win_visibility) { if(ioctl(this->fd, SYNCFB_GET_CONFIG, &this->syncfb_config)) - printf("video_out_syncfb: error. (get_config ioctl failed)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: error. (get_config ioctl failed)\n"); this->syncfb_config.syncfb_mode = SYNCFB_FEATURE_SCALE | SYNCFB_FEATURE_CROP; @@ -393,7 +398,8 @@ static void syncfb_compute_output_size(syncfb_driver_t *this) this->syncfb_config.src_palette = VIDEO_PALETTE_YUV422; break; default: - printf("video_out_syncfb: error. (unknown frame format)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: error. (unknown frame format)\n"); this->syncfb_config.src_palette = 0; break; } @@ -417,7 +423,7 @@ static void syncfb_compute_output_size(syncfb_driver_t *this) if(this->capabilities.palettes & (1<<this->syncfb_config.src_palette)) { if(ioctl(this->fd,SYNCFB_SET_CONFIG,&this->syncfb_config)) - printf("video_out_syncfb: error. (set_config ioctl failed)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (set_config ioctl failed)\n"); syncfb_overlay_on(this); } @@ -470,30 +476,29 @@ static void syncfb_frame_dispose(vo_frame_t* vo_img) static vo_frame_t* syncfb_alloc_frame(vo_driver_t* this_gen) { - syncfb_frame_t* frame; + /* syncfb_driver_t *this = (syncfb_driver_t *) this_gen; */ + syncfb_frame_t *frame; frame = (syncfb_frame_t *) xine_xmalloc(sizeof(syncfb_frame_t)); - - if(frame == NULL) - printf("video_out_syncfb: error. (frame allocation failed: out of memory)\n"); - else { - pthread_mutex_init(&frame->vo_frame.mutex, NULL); - - frame->vo_frame.base[0] = NULL; - frame->vo_frame.base[1] = NULL; - frame->vo_frame.base[2] = NULL; - - /* - * supply required functions - */ - frame->vo_frame.proc_slice = NULL; - frame->vo_frame.proc_frame = NULL; - frame->vo_frame.field = syncfb_frame_field; - frame->vo_frame.dispose = syncfb_frame_dispose; - - frame->vo_frame.driver = this_gen; - } - + if(!frame) + return NULL; + + pthread_mutex_init(&frame->vo_frame.mutex, NULL); + + frame->vo_frame.base[0] = NULL; + frame->vo_frame.base[1] = NULL; + frame->vo_frame.base[2] = NULL; + + /* + * supply required functions + */ + frame->vo_frame.proc_slice = NULL; + frame->vo_frame.proc_frame = NULL; + frame->vo_frame.field = syncfb_frame_field; + frame->vo_frame.dispose = syncfb_frame_dispose; + + frame->vo_frame.driver = this_gen; + return (vo_frame_t *) frame; } @@ -502,7 +507,8 @@ static void syncfb_update_frame_format(vo_driver_t* this_gen, uint32_t width, uint32_t height, double ratio, int format, int flags) { - syncfb_frame_t* frame = (syncfb_frame_t *) frame_gen; + syncfb_driver_t *this = (syncfb_driver_t *) this_gen; + syncfb_frame_t *frame = (syncfb_frame_t *) frame_gen; /* uint32_t frame_size = width*height; */ if((frame->width != width) @@ -538,14 +544,17 @@ static void syncfb_update_frame_format(vo_driver_t* this_gen, frame->vo_frame.base[2] = NULL; break; default: - printf("video_out_syncfb: error. (unable to allocate framedata because of unknown frame format: %04x)\n", format); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: error. (unable to allocate " + "framedata because of unknown frame format: %04x)\n", format); } /* if((format == IMGFMT_YV12 && (frame->data_mem[0] == NULL || frame->data_mem[1] == NULL || frame->data_mem[2] == NULL)) || (format == IMGFMT_YUY2 && frame->data_mem[0] == NULL)) {*/ if((format == XINE_IMGFMT_YV12 && (frame->vo_frame.base[0] == NULL || frame->vo_frame.base[1] == NULL || frame->vo_frame.base[2] == NULL)) || (format == XINE_IMGFMT_YUY2 && frame->vo_frame.base[0] == NULL)) { - printf("video_out_syncfb: error. (framedata allocation failed: out of memory)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: error. (framedata allocation failed: out of memory)\n"); free_framedata(frame); } @@ -603,17 +612,19 @@ static void syncfb_display_frame(vo_driver_t* this_gen, vo_frame_t* frame_gen) /* the rest is only successful and safe, if the overlay is really on */ if(this->overlay_state) { if(this->bufinfo.id != -1) { - printf("video_out_syncfb: error. (invalid syncfb image buffer state)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: error. (invalid syncfb image buffer state)\n"); frame->vo_frame.free(&frame->vo_frame); return; } if(ioctl(this->fd, SYNCFB_REQUEST_BUFFER, &this->bufinfo)) - printf("video_out_syncfb: error. (request ioctl failed)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (request ioctl failed)\n"); if(this->bufinfo.id == -1) { - printf("video_out_syncfb: error. (syncfb module couldn't allocate image buffer)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: error. (syncfb module couldn't allocate image buffer)\n"); frame->vo_frame.free(&frame->vo_frame); /* @@ -632,7 +643,7 @@ static void syncfb_display_frame(vo_driver_t* this_gen, vo_frame_t* frame_gen) write_frame_sfb(this, frame); if(ioctl(this->fd, SYNCFB_COMMIT_BUFFER, &this->bufinfo)) - printf("video_out_syncfb: error. (commit ioctl failed)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (commit ioctl failed)\n"); } else frame->vo_frame.free(&frame->vo_frame); @@ -735,7 +746,8 @@ static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) this->params.image_yorg = this->syncfb_config.image_yorg; if(ioctl(this->fd,SYNCFB_SET_PARAMS,&this->params)) - printf("video_out_syncfb: error. (setting of contrast value failed)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: error. (setting of contrast value failed)\n"); break; @@ -755,7 +767,8 @@ static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) this->params.image_yorg = this->syncfb_config.image_yorg; if(ioctl(this->fd,SYNCFB_SET_PARAMS,&this->params)) - printf("video_out_syncfb: error. (setting of brightness value failed)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: error. (setting of brightness value failed)\n"); break; } @@ -843,21 +856,23 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi display = visual->display; - if(!(this = xine_xmalloc(sizeof (syncfb_driver_t)))) { - printf("video_out_syncfb: aborting. (allocation of syncfb_driver_t failed: out of memory)\n"); - return NULL; - } + if(!(this = xine_xmalloc(sizeof (syncfb_driver_t)))) + return NULL; /* check for syncfb device */ if((this->fd = open(class->device_name, O_RDWR)) < 0) { - printf("video_out_syncfb: aborting. (unable to open syncfb device \"%s\")\n", class->device_name); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: aborting. (unable to open syncfb device \"%s\")\n", class->device_name); free(this); return NULL; } + this->xine = class->xine; + /* get capabilities from the syncfb module */ if(ioctl(this->fd, SYNCFB_GET_CAPS, &this->capabilities)) { - printf("video_out_syncfb: aborting. (syncfb_get_caps ioctl failed)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: aborting. (syncfb_get_caps ioctl failed)\n"); close(this->fd); free(this); @@ -869,7 +884,8 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->video_mem = (uint8_t *) mmap(0, this->capabilities.memory_size, PROT_WRITE, MAP_SHARED, this->fd, 0); if(this->video_mem == MAP_FAILED) { - printf("video_out_syncfb: aborting. (mmap of video memory failed)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: aborting. (mmap of video memory failed)\n"); close(this->fd); free(this); @@ -902,30 +918,36 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV420P3)) { this->supported_capabilities |= VO_CAP_YV12; this->yuv_format = VIDEO_PALETTE_YUV420P3; - printf("video_out_syncfb: info. (SyncFB module supports YUV 4:2:0 (3 plane))\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_syncfb: info. (SyncFB module supports YUV 4:2:0 (3 plane))\n")); } else if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV420P2)) { this->supported_capabilities |= VO_CAP_YV12; this->yuv_format = VIDEO_PALETTE_YUV420P2; - printf("video_out_syncfb: info. (SyncFB module supports YUV 4:2:0 (2 plane))\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_syncfb: info. (SyncFB module supports YUV 4:2:0 (2 plane))\n")); } else if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV422)) { this->supported_capabilities |= VO_CAP_YV12; this->yuv_format = VIDEO_PALETTE_YUV422; - printf("video_out_syncfb: info. (SyncFB module supports YUV 4:2:2)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + _("video_out_syncfb: info. (SyncFB module supports YUV 4:2:2)\n")); } if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV422)) { this->supported_capabilities |= VO_CAP_YUY2; - printf("video_out_syncfb: info. (SyncFB module supports YUY2)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + _("video_out_syncfb: info. (SyncFB module supports YUY2)\n")); } if(this->capabilities.palettes & (1<<VIDEO_PALETTE_RGB565)) { /* FIXME: no RGB support yet * this->supported_capabilities |= VO_CAP_RGB; */ - printf("video_out_syncfb: info. (SyncFB module supports RGB565)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + _("video_out_syncfb: info. (SyncFB module supports RGB565)\n")); } if(!this->supported_capabilities) { - printf("video_out_syncfb: aborting. (SyncFB module does not support YV12, YUY2 nor RGB565)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + _("video_out_syncfb: aborting. (SyncFB module does not support YV12, YUY2 nor RGB565)\n")); munmap(0, this->capabilities.memory_size); close(this->fd); @@ -943,7 +965,10 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->props[VO_PROP_BRIGHTNESS].min = -128; this->props[VO_PROP_BRIGHTNESS].max = 127; } else { - printf("video_out_syncfb: info. (brightness/contrast control won\'t be available because your SyncFB kernel module seems to be outdated. Please refer to README.syncfb for informations on how to update it.)\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_syncfb: info. (brightness/contrast control won\'t be available because " + "your SyncFB kernel module seems to be outdated. Please refer to README." + "syncfb for informations on how to update it.)\n")); } /* check for virtual screen size and screen depth - this is rather important @@ -1033,7 +1058,8 @@ static void *init_class (xine_t *xine, void *visual_gen) { /* check for syncfb device */ if((fd = open(device_name, O_RDWR)) < 0) { - printf("video_out_syncfb: aborting. (unable to open syncfb device \"%s\")\n", device_name); + xprintf(xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: aborting. (unable to open syncfb device \"%s\")\n", device_name); return NULL; } close(fd); @@ -1041,7 +1067,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { /* * from this point on, nothing should go wrong anymore */ - this = (syncfb_class_t *) malloc (sizeof (syncfb_class_t)); + this = (syncfb_class_t *) xine_xmalloc (sizeof (syncfb_class_t)); this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; @@ -1049,6 +1075,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { this->driver_class.dispose = dispose_class; this->config = xine->config; + this->xine = xine; this->device_name = device_name; return this; diff --git a/src/video_out/video_out_vidix.c b/src/video_out/video_out_vidix.c index 1531dcb4d..daa51fdd7 100644 --- a/src/video_out/video_out_vidix.c +++ b/src/video_out/video_out_vidix.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_vidix.c,v 1.55 2003/11/26 23:44:10 f1rmb Exp $ + * $Id: video_out_vidix.c,v 1.56 2003/12/05 15:55:03 f1rmb Exp $ * * video_out_vidix.c * @@ -301,7 +301,8 @@ static void write_frame_sfb(vidix_driver_t* this, vidix_frame_t* frame) break; default: - printf("video_out_vidix: error. (unknown frame format %04x)\n", frame->format); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_vidix: error. (unknown frame format %04x)\n", frame->format); break; } } @@ -390,16 +391,12 @@ static void vidix_frame_dispose (vo_frame_t *vo_img) { } static vo_frame_t *vidix_alloc_frame (vo_driver_t *this_gen) { + /* vidix_driver_t *this = (vidix_driver_t *) this_gen; */ + vidix_frame_t *frame ; - vidix_frame_t *frame ; - - frame = (vidix_frame_t *) malloc (sizeof (vidix_frame_t)); - - if (frame==NULL) { - printf ("vidix_alloc_frame: out of memory\n"); + frame = (vidix_frame_t *) xine_xmalloc (sizeof (vidix_frame_t)); + if (!frame) return NULL; - } - memset (frame, 0, sizeof(vidix_frame_t)); pthread_mutex_init (&frame->vo_frame.mutex, NULL); @@ -464,7 +461,8 @@ static void vidix_config_playback (vidix_driver_t *this) { if((err=vdlConfigPlayback(this->vidix_handler,&this->vidix_play))!=0) { - printf("video_out_vidix: Can't configure playback: %s\n",strerror(err)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_vidix: Can't configure playback: %s\n",strerror(err)); this->vidix_started = -1; return; } @@ -516,8 +514,8 @@ static void vidix_config_playback (vidix_driver_t *this) { this->dstrides.y = (this->sc.delivered_width*2 + apitch) & ~apitch; break; default: - printf("video_out_vidix: error. (unknown frame format: %04x)\n", - this->delivered_format); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_vidix: error. (unknown frame format: %04x)\n", this->delivered_format); } lprintf("video_out_vidix: overlay on\n"); @@ -529,7 +527,7 @@ static void vidix_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, double ratio, int format, int flags) { - + vidix_driver_t *this = (vidix_driver_t *) this_gen; vidix_frame_t *frame = (vidix_frame_t *) frame_gen; if ((frame->width != width) @@ -562,12 +560,14 @@ static void vidix_update_frame_format (vo_driver_t *this_gen, frame->vo_frame.base[2] = NULL; break; default: - printf("video_out_vidix: error. (unknown frame format: %04x)\n", format); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_vidix: error. (unknown frame format: %04x)\n", format); } if((format == XINE_IMGFMT_YV12 && (frame->vo_frame.base[0] == NULL || frame->vo_frame.base[1] == NULL || frame->vo_frame.base[2] == NULL)) || (format == XINE_IMGFMT_YUY2 && frame->vo_frame.base[0] == NULL)) { - printf("video_out_vidix: error. (framedata allocation failed: out of memory)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_vidix: error. (framedata allocation failed: out of memory)\n"); free_framedata(frame); } @@ -755,7 +755,7 @@ static int vidix_set_property (vo_driver_t *this_gen, this->vidix_eq.hue = value; if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq)) != 0) - xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_vidix: can't set hue: %s\n", strerror(err)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set hue: %s\n", strerror(err)); } if ( property == VO_PROP_SATURATION ) { @@ -763,7 +763,7 @@ static int vidix_set_property (vo_driver_t *this_gen, this->vidix_eq.saturation = value; if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq)) != 0) - xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_vidix: can't set saturation: %s\n", strerror(err)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set saturation: %s\n", strerror(err)); } if ( property == VO_PROP_BRIGHTNESS ) { @@ -771,7 +771,7 @@ static int vidix_set_property (vo_driver_t *this_gen, this->vidix_eq.brightness = value; if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq)) != 0) - xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_vidix: can't set brightness: %s\n", strerror(err)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set brightness: %s\n", strerror(err)); } if ( property == VO_PROP_CONTRAST ) { @@ -779,7 +779,7 @@ static int vidix_set_property (vo_driver_t *this_gen, this->vidix_eq.contrast = value; if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq)) != 0) - xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_vidix: can't set contrast: %s\n", strerror(err)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set contrast: %s\n", strerror(err)); } } @@ -832,7 +832,7 @@ static void vidix_rgb_callback(vo_driver_t *this_gen, xine_cfg_entry_t *entry) { } if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq))) - xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_vidix: can't set rgb intensity: %s\n", strerror(err)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set rgb intensity: %s\n", strerror(err)); } @@ -935,13 +935,9 @@ static vidix_driver_t *open_plugin (video_driver_class_t *class_gen) { vidix_driver_t *this; int err; - this = malloc (sizeof (vidix_driver_t)); - - if (!this) { - printf ("video_out_vidix: malloc failed\n"); + this = (vidix_driver_t *) xine_xmalloc (sizeof (vidix_driver_t)); + if (!this) return NULL; - } - memset (this, 0, sizeof(vidix_driver_t)); pthread_mutex_init (&this->mutex, NULL); @@ -959,7 +955,7 @@ static vidix_driver_t *open_plugin (video_driver_class_t *class_gen) { /* Find what equalizer flags are supported */ if(this->vidix_cap.flags & FLAG_EQUALIZER) { if((err = vdlPlaybackGetEq(this->vidix_handler, &this->vidix_eq)) != 0) { - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: couldn't get equalizer capabilities: %s\n", strerror(err)); } else { if(this->vidix_eq.cap & VEQ_CAP_BRIGHTNESS) { @@ -1003,7 +999,7 @@ static vidix_driver_t *open_plugin (video_driver_class_t *class_gen) { (void*) vidix_rgb_callback, this); if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq))) - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set rgb intensity: %s\n", strerror(err)); } } @@ -1055,7 +1051,8 @@ static void query_fourccs (vidix_driver_t *this) { if((err = vdlQueryFourcc(this->vidix_handler, &vidix_fourcc)) == 0) { this->capabilities |= VO_CAP_YUY2; - xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_vidix: adaptor supports the yuy2 format\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_vidix: adaptor supports the yuy2 format\n")); } /* Detect if YV12 is supported - we always support yv12 but we need @@ -1065,7 +1062,8 @@ static void query_fourccs (vidix_driver_t *this) { if((err = vdlQueryFourcc(this->vidix_handler, &vidix_fourcc)) == 0) { this->supports_yv12 = 1; - xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_vidix: adaptor supports the yv12 format\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_vidix: adaptor supports the yv12 format\n")); } else this->supports_yv12 = 0; } @@ -1074,37 +1072,35 @@ static void *init_class (xine_t *xine, void *visual_gen) { vidix_class_t *this; int err; - this = malloc (sizeof (vidix_class_t)); - - if (!this) { - printf ("video_out_vidix: malloc failed\n"); + this = (vidix_class_t *) xine_xmalloc (sizeof (vidix_class_t)); + if (!this) return NULL; - } - memset (this, 0, sizeof(vidix_class_t)); - if(vdlGetVersion() != VIDIX_VERSION) { - printf("video_out_vidix: You have wrong version of VIDIX library\n"); + xprintf(xine, XINE_VERBOSITY_LOG, + _("video_out_vidix: You have wrong version of VIDIX library\n")); free(this); return NULL; } this->vidix_handler = vdlOpen((XINE_PLUGINDIR"/vidix/"), NULL, TYPE_OUTPUT, 0); if(this->vidix_handler == NULL) { - printf("video_out_vidix: Couldn't find working VIDIX driver\n"); + xprintf(xine, XINE_VERBOSITY_LOG, + _("video_out_vidix: Couldn't find working VIDIX driver\n")); free(this); return NULL; } if((err=vdlGetCapability(this->vidix_handler,&this->vidix_cap)) != 0) { - printf("video_out_vidix: Couldn't get capability: %s\n",strerror(err)); + xprintf(xine, XINE_VERBOSITY_DEBUG, + "video_out_vidix: Couldn't get capability: %s\n",strerror(err)); free(this); return NULL; } xprintf(xine, XINE_VERBOSITY_LOG, - "video_out_vidix: using driver: %s by %s\n",this->vidix_cap.name,this->vidix_cap.author); + _("video_out_vidix: using driver: %s by %s\n"), this->vidix_cap.name, this->vidix_cap.author); this->xine = xine; this->config = xine->config; @@ -1168,7 +1164,7 @@ static vo_driver_t *vidix_open_plugin (video_driver_class_t *class_gen, const vo query_fourccs(this); XLockDisplay (this->display); - this->xoverlay = x11osd_create (this->display, this->screen, this->drawable); + this->xoverlay = x11osd_create (this->xine, this->display, this->screen, this->drawable); XUnlockDisplay (this->display); if( this->xoverlay ) @@ -1221,14 +1217,15 @@ static vo_driver_t *vidixfb_open_plugin (video_driver_class_t *class_gen, const /* Open fb device for reading */ if((fd = open("/dev/fb0", O_RDONLY)) < 0) { - printf("video_out_vidix: unable to open frame buffer device \"%s\": %s\n", - device, strerror(errno)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_vidix: unable to open frame buffer device \"%s\": %s\n", device, strerror(errno)); return NULL; } /* Read screen info */ if(ioctl(fd, FBIOGET_VSCREENINFO, &fb_var) != 0) { - perror("video_out_vidix: error in ioctl FBIOGET_VSCREENINFO"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_vidix: error in ioctl FBIOGET_VSCREENINFO: %s", strerror(errno)); close(fd); return NULL; } diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c index 86e81593d..02b793d69 100644 --- a/src/video_out/video_out_xshm.c +++ b/src/video_out/video_out_xshm.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xshm.c,v 1.123 2003/11/26 23:44:10 f1rmb Exp $ + * $Id: video_out_xshm.c,v 1.124 2003/12/05 15:55:04 f1rmb Exp $ * * video_out_xshm.c, X11 shared memory extension interface for xine * @@ -185,8 +185,8 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, if (myimage == NULL ) { xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xshm: shared memory error when allocating image\n" - "video_out_xshm: => not using MIT Shared Memory extension.\n"); + _("video_out_xshm: shared memory error when allocating image\n" + "video_out_xshm: => not using MIT Shared Memory extension.\n")); this->use_shm = 0; goto finishShmTesting; } @@ -201,8 +201,8 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, if (shminfo->shmid < 0 ) { xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xshm: %s: allocating image\n" - "video_out_xshm: => not using MIT Shared Memory extension.\n", strerror(errno)); + _("video_out_xshm: %s: allocating image\n" + "video_out_xshm: => not using MIT Shared Memory extension.\n"), strerror(errno)); this->use_shm = 0; goto finishShmTesting; } @@ -211,8 +211,8 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, if (shminfo->shmaddr == ((char *) -1)) { xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xshm: shared memory error (address error) when allocating image \n" - "video_out_xshm: => not using MIT Shared Memory extension.\n"); + _("video_out_xshm: shared memory error (address error) when allocating image \n" + "video_out_xshm: => not using MIT Shared Memory extension.\n")); shmctl (shminfo->shmid, IPC_RMID, 0); shminfo->shmid = -1; this->use_shm = 0; @@ -228,8 +228,8 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, if (gX11Fail) { xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xshm: x11 error during shared memory XImage creation\n" - "video_out_xshm: => not using MIT Shared Memory extension.\n"); + _("video_out_xshm: x11 error during shared memory XImage creation\n" + "video_out_xshm: => not using MIT Shared Memory extension.\n")); shmdt (shminfo->shmaddr); shmctl (shminfo->shmid, IPC_RMID, 0); shminfo->shmid = -1; @@ -372,13 +372,10 @@ static vo_frame_t *xshm_alloc_frame (vo_driver_t *this_gen) { xshm_frame_t *frame; xshm_driver_t *this = (xshm_driver_t *) this_gen; - frame = (xshm_frame_t *) malloc (sizeof (xshm_frame_t)); - if (frame == NULL) { - printf ("xshm_alloc_frame: out of memory\n"); + frame = (xshm_frame_t *) xine_xmalloc (sizeof (xshm_frame_t)); + if (!frame) return NULL; - } - memset (frame, 0, sizeof(xshm_frame_t)); memcpy (&frame->sc, &this->sc, sizeof(vo_scale_t)); pthread_mutex_init (&frame->vo_frame.mutex, NULL); @@ -658,7 +655,8 @@ static void xshm_overlay_blend (vo_driver_t *this_gen, frame->sc.delivered_width, frame->sc.delivered_height); break; default: - printf("xine-lib:video_out_xshm:xshm_overlay_blend: Cannot blend bpp:%i\n", this->bpp); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:video_out_xshm:xshm_overlay_blend: Cannot blend bpp:%i\n", this->bpp); /* it should never get here, unless a user tries to play in bpp:8 */ break; } @@ -782,7 +780,7 @@ static int xshm_get_property (vo_driver_t *this_gen, int property) { case VO_PROP_WINDOW_HEIGHT: return this->sc.gui_height; default: - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xshm: tried to get unsupported property %d\n", property); } @@ -798,7 +796,7 @@ static int xshm_set_property (vo_driver_t *this_gen, if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xshm: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); } else if (property == VO_PROP_BRIGHTNESS) { @@ -832,7 +830,8 @@ static int xshm_set_property (vo_driver_t *this_gen, this->sc.force_redraw = 1; } else { - printf ("video_out_xshm: tried to set unsupported property %d\n", property); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_xshm: tried to set unsupported property %d\n", property); } return value; @@ -1034,18 +1033,15 @@ static vo_driver_t *xshm_open_plugin (video_driver_class_t *class_gen, const voi XColor dummy; if (!XInitThreads()) { - printf ("video_out_xshm: No thread-safe X libraries available.\n"); + xprintf (class->xine, XINE_VERBOSITY_LOG, + _("video_out_xshm: No thread-safe X libraries available.\n")); return NULL; } - this = malloc (sizeof (xshm_driver_t)); + this = (xshm_driver_t *) xine_xmalloc (sizeof (xshm_driver_t)); - if (!this) { - printf ("video_out_xshm: malloc failed\n"); + if (!this) return NULL; - } - - memset (this, 0, sizeof(xshm_driver_t)); this->display = visual->display; this->screen = visual->screen; @@ -1109,8 +1105,8 @@ static vo_driver_t *xshm_open_plugin (video_driver_class_t *class_gen, const voi if (this->depth>16) xprintf(this->xine, XINE_VERBOSITY_LOG, - "\n\nWARNING: current display depth is %d. For better performance\n" - "a depth of 16 bpp is recommended!\n\n", this->depth); + _("\n\nWARNING: current display depth is %d. For better performance\n" + "a depth of 16 bpp is recommended!\n\n"), this->depth); /* * check for X shared memory support @@ -1122,7 +1118,7 @@ static vo_driver_t *xshm_open_plugin (video_driver_class_t *class_gen, const voi } else { xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xshm: MIT shared memory extension not present on display.\n"); + _("video_out_xshm: MIT shared memory extension not present on display.\n")); this->use_shm = 0; } @@ -1142,7 +1138,7 @@ static vo_driver_t *xshm_open_plugin (video_driver_class_t *class_gen, const voi cpu_byte_order = htonl(1) == 1 ? MSBFirst : LSBFirst; swapped = cpu_byte_order != this->image_byte_order; - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xshm: video mode depth is %d (%d bpp), %s, %sswapped,\n" "\tred: %08lx, green: %08lx, blue: %08lx\n", this->depth, this->bpp, @@ -1203,7 +1199,8 @@ static vo_driver_t *xshm_open_plugin (video_driver_class_t *class_gen, const voi } if (!mode) { - printf ("video_out_xshm: your video mode was not recognized, sorry :-(\n"); + xprintf (this->xine, XINE_VERBOSITY_LOG, + _("video_out_xshm: your video mode was not recognized, sorry :-(\n")); return NULL; } @@ -1224,7 +1221,7 @@ static vo_driver_t *xshm_open_plugin (video_driver_class_t *class_gen, const voi this->yuv2rgb_saturation); XLockDisplay (this->display); - this->xoverlay = x11osd_create (this->display, this->screen, this->drawable); + this->xoverlay = x11osd_create (this->xine, this->display, this->screen, this->drawable); XUnlockDisplay (this->display); return &this->vo_driver; @@ -1249,7 +1246,7 @@ static void xshm_dispose_class (video_driver_class_t *this_gen) { } static void *xshm_init_class (xine_t *xine, void *visual_gen) { - xshm_class_t *this = (xshm_class_t *) malloc (sizeof (xshm_class_t)); + xshm_class_t *this = (xshm_class_t *) xine_xmalloc (sizeof (xshm_class_t)); this->driver_class.open_plugin = xshm_open_plugin; this->driver_class.get_identifier = xshm_get_identifier; diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index 1e3be022a..5d9516297 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xv.c,v 1.185 2003/11/26 23:44:10 f1rmb Exp $ + * $Id: video_out_xv.c,v 1.186 2003/12/05 15:55:04 f1rmb Exp $ * * video_out_xv.c, X11 video extension interface for xine * @@ -198,16 +198,13 @@ static void xv_frame_dispose (vo_frame_t *vo_img) { } static vo_frame_t *xv_alloc_frame (vo_driver_t *this_gen) { - xv_frame_t *frame ; + /* xv_driver_t *this = (xv_driver_t *) this_gen; */ + xv_frame_t *frame ; - frame = (xv_frame_t *) malloc (sizeof (xv_frame_t)); - - if (frame == NULL) { - printf ("xv_alloc_frame: out of memory\n"); + frame = (xv_frame_t *) xine_xmalloc (sizeof (xv_frame_t)); + if (!frame) return NULL; - } - memset (frame, 0, sizeof(xv_frame_t)); - + pthread_mutex_init (&frame->vo_frame.mutex, NULL); /* @@ -263,7 +260,7 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, xv_format = this->xv_format_yuy2; break; default: - fprintf (stderr, "create_ximage: unknown format %08x\n",format); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "create_ximage: unknown format %08x\n",format); abort(); } @@ -281,8 +278,8 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, if (image == NULL ) { xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xv: XvShmCreateImage failed\n" - "video_out_xv: => not using MIT Shared Memory extension.\n"); + _("video_out_xv: XvShmCreateImage failed\n" + "video_out_xv: => not using MIT Shared Memory extension.\n")); this->use_shm = 0; goto finishShmTesting; } @@ -291,16 +288,16 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, if (image->data_size==0) { xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xv: XvShmCreateImage returned a zero size\n" - "video_out_xv: => not using MIT Shared Memory extension.\n"); + _("video_out_xv: XvShmCreateImage returned a zero size\n" + "video_out_xv: => not using MIT Shared Memory extension.\n")); this->use_shm = 0; goto finishShmTesting; } if (shminfo->shmid < 0 ) { xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xv: shared memory error in shmget: %s" - "video_out_xv: => not using MIT Shared Memory extension.\n", strerror(errno)); + _("video_out_xv: shared memory error in shmget: %s" + "video_out_xv: => not using MIT Shared Memory extension.\n"), strerror(errno)); this->use_shm = 0; goto finishShmTesting; } @@ -308,14 +305,14 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, shminfo->shmaddr = (char *) shmat(shminfo->shmid, 0, 0); if (shminfo->shmaddr == NULL) { - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xv: shared memory error (address error NULL)\n"); this->use_shm = 0; goto finishShmTesting; } if (shminfo->shmaddr == ((char *) -1)) { - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xv: shared memory error (address error)\n"); this->use_shm = 0; goto finishShmTesting; @@ -331,8 +328,8 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, if (gX11Fail) { xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xv: x11 error during shared memory XImage creation\n" - "video_out_xv: => not using MIT Shared Memory extension.\n"); + _("video_out_xv: x11 error during shared memory XImage creation\n" + "video_out_xv: => not using MIT Shared Memory extension.\n")); shmdt (shminfo->shmaddr); shmctl (shminfo->shmid, IPC_RMID, 0); shminfo->shmid = -1; @@ -369,7 +366,7 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, data = malloc (width * height * 2); break; default: - fprintf (stderr, "create_ximage: unknown format %08x\n",format); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "create_ximage: unknown format %08x\n",format); abort(); } @@ -1015,7 +1012,7 @@ static void xv_dispose (vo_driver_t *this_gen) { XLockDisplay (this->display); if(XvUngrabPort (this->display, this->xv_port, CurrentTime) != Success) { - printf ("video_out_xv: xv_exit: XvUngrabPort() failed.\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xv: xv_exit: XvUngrabPort() failed.\n"); } XUnlockDisplay (this->display); @@ -1076,7 +1073,7 @@ static void xv_check_capability (xv_driver_t *this, XvGetPortAttribute (this->display, this->xv_port, this->props[property].atom, &int_default); - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xv: port attribute %s (%d) value is %d\n", str_prop, property, int_default); if (config_name) { @@ -1135,7 +1132,7 @@ static void xv_update_XV_FILTER(void *this_gen, xine_cfg_entry_t *entry) { XvSetPortAttribute (this->display, this->xv_port, atom, xv_filter); XUnlockDisplay(this->display); - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xv: bilinear scaling mode (XV_FILTER) = %d\n",xv_filter); } @@ -1151,7 +1148,7 @@ static void xv_update_XV_DOUBLE_BUFFER(void *this_gen, xine_cfg_entry_t *entry) XvSetPortAttribute (this->display, this->xv_port, atom, xv_double_buffer); XUnlockDisplay(this->display); - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xv: double buffering mode = %d\n", xv_double_buffer); } @@ -1176,14 +1173,9 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi XShmSegmentInfo myshminfo; XvPortID xv_port = class->xv_port; - this = malloc (sizeof (xv_driver_t)); - - if (!this) { - printf ("video_out_xv: malloc failed\n"); + this = (xv_driver_t *) xine_xmalloc (sizeof (xv_driver_t)); + if (!this) return NULL; - } - - memset (this, 0, sizeof(xv_driver_t)); this->display = visual->display; this->screen = visual->screen; @@ -1332,11 +1324,13 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi if (fo[i].id == XINE_IMGFMT_YV12) { this->xv_format_yv12 = fo[i].id; this->capabilities |= VO_CAP_YV12; - xprintf(this->xine, XINE_VERBOSITY_LOG,"video_out_xv: this adaptor supports the yv12 format.\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_xv: this adaptor supports the yv12 format.\n")); } else if (fo[i].id == XINE_IMGFMT_YUY2) { this->xv_format_yuy2 = fo[i].id; this->capabilities |= VO_CAP_YUY2; - xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_xv: this adaptor supports the yuy2 format.\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_xv: this adaptor supports the yuy2 format.\n")); } } @@ -1363,7 +1357,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->deinterlace_enabled = 0; XLockDisplay (this->display); - this->xoverlay = x11osd_create (this->display, this->screen, this->drawable); + this->xoverlay = x11osd_create (this->xine, this->display, this->screen, this->drawable); XUnlockDisplay (this->display); if( this->xoverlay ) @@ -1411,13 +1405,13 @@ static void *init_class (xine_t *xine, void *visual_gen) { */ if (!XInitThreads()) { - printf ("video_out_xv: No thread-safe X libraries available.\n"); + xprintf (xine, XINE_VERBOSITY_LOG, _("video_out_xv: No thread-safe X libraries available.\n")); return NULL; } XLockDisplay(display); if (Success != XvQueryExtension(display, &ver,&rel, &req, &ev,&err)) { - printf ("video_out_xv: Xv extension not present.\n"); + xprintf (xine, XINE_VERBOSITY_LOG, _("video_out_xv: Xv extension not present.\n")); XUnlockDisplay(display); return NULL; } @@ -1428,7 +1422,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { if (Success != XvQueryAdaptors(display,DefaultRootWindow(display), &adaptors,&adaptor_info)) { - printf("video_out_xv: XvQueryAdaptors failed.\n"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "video_out_xv: XvQueryAdaptors failed.\n"); XUnlockDisplay(display); return NULL; } @@ -1455,8 +1449,8 @@ static void *init_class (xine_t *xine, void *visual_gen) { if (!xv_port) { xprintf(xine, XINE_VERBOSITY_LOG, - "video_out_xv: Xv extension is present but I couldn't find a usable yuv12 port.\n" - " Looks like your graphics hardware driver doesn't support Xv?!\n"); + _("video_out_xv: Xv extension is present but I couldn't find a usable yuv12 port.\n" + " Looks like your graphics hardware driver doesn't support Xv?!\n")); /* XvFreeAdaptorInfo (adaptor_info); this crashed on me (gb)*/ XUnlockDisplay(display); @@ -1464,8 +1458,8 @@ static void *init_class (xine_t *xine, void *visual_gen) { } else xprintf(xine, XINE_VERBOSITY_LOG, - "video_out_xv: using Xv port %ld from adaptor %s for hardware " - "colorspace conversion and scaling.\n", xv_port, + _("video_out_xv: using Xv port %ld from adaptor %s for hardware " + "colorspace conversion and scaling.\n"), xv_port, adaptor_info[adaptor_num].name); XUnlockDisplay(display); @@ -1473,7 +1467,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { /* * from this point on, nothing should go wrong anymore */ - this = (xv_class_t *) malloc (sizeof (xv_class_t)); + this = (xv_class_t *) xine_xmalloc (sizeof (xv_class_t)); this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; diff --git a/src/video_out/video_out_xvmc.c b/src/video_out/video_out_xvmc.c index 04c94ba0b..9708c8179 100644 --- a/src/video_out/video_out_xvmc.c +++ b/src/video_out/video_out_xvmc.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xvmc.c,v 1.9 2003/11/26 19:43:38 f1rmb Exp $ + * $Id: video_out_xvmc.c,v 1.10 2003/12/05 15:55:04 f1rmb Exp $ * * video_out_xvmc.c, X11 video motion compensation extension interface for xine * @@ -217,6 +217,7 @@ struct xvmc_driver_s { uint32_t colorkey; void *user_data; + xine_t *xine; }; @@ -233,6 +234,7 @@ typedef struct { unsigned int max_surface_width; unsigned int max_surface_height; short acceleration; + xine_t *xine; } xvmc_class_t; static void xvmc_render_macro_blocks(vo_frame_t *current_image, @@ -570,13 +572,10 @@ static vo_frame_t *xvmc_alloc_frame (vo_driver_t *this_gen) { lprintf ("xvmc_alloc_frame\n"); - frame = (xvmc_frame_t *) malloc (sizeof (xvmc_frame_t)); + frame = (xvmc_frame_t *) xine_xmalloc (sizeof (xvmc_frame_t)); - if (frame == NULL) { - printf ("xvmc_alloc_frame: out of memory\n"); + if (!frame) return NULL; - } - memset (frame, 0, sizeof(xvmc_frame_t)); /* keep track of frames and how many frames alocated. */ this->frames[this->num_frame_buffers++] = frame; @@ -610,10 +609,8 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, /* initialize block & macro block pointers first time */ if(macroblocks->blocks == NULL || macroblocks->macro_blocks == NULL) { - macroblocks->blocks = malloc(sizeof(XvMCBlockArray)); - macroblocks->macro_blocks = malloc(sizeof(XvMCMacroBlockArray)); - memset (macroblocks->blocks, 0, sizeof(XvMCBlockArray)); - memset (macroblocks->macro_blocks, 0, sizeof(XvMCMacroBlockArray)); + macroblocks->blocks = xine_xmalloc(sizeof(XvMCBlockArray)); + macroblocks->macro_blocks = xine_xmalloc(sizeof(XvMCMacroBlockArray)); lprintf("macroblocks->blocks %lx ->macro_blocks %lx\n", macroblocks->blocks,macroblocks->macro_blocks); @@ -662,7 +659,7 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, width, height, XVMC_DIRECT, &this->context); if(result != Success) { - fprintf(stderr, "set_context: couldn't create XvMCContext\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "set_context: couldn't create XvMCContext\n"); macroblocks->xine_mc.xvmc_accel = 0; abort(); } @@ -674,7 +671,7 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, &this->frames[i]->surface); if(result != Success) { XvMCDestroyContext(this->display, &this->context); - printf("set_context: couldn't create XvMCSurfaces\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "set_context: couldn't create XvMCSurfaces\n"); this->context_id.xid = NULL; macroblocks->xine_mc.xvmc_accel = 0; abort(); @@ -690,14 +687,14 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, result = XvMCCreateBlocks(this->display, &this->context, slices * 6, macroblocks->blocks); if(result != Success) { - fprintf(stderr, "set_context: ERROR XvMCCreateBlocks failed\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "set_context: ERROR XvMCCreateBlocks failed\n"); macroblocks->xine_mc.xvmc_accel = 0; abort(); } result =XvMCCreateMacroBlocks(this->display, &this->context, slices, macroblocks->macro_blocks); if(result != Success) { - fprintf(stderr, "set_context: ERROR XvMCCreateMacroBlocks failed\n"); + printf(this->xine, XINE_VERBOSITY_DEBUG, "set_context: ERROR XvMCCreateMacroBlocks failed\n"); macroblocks->xine_mc.xvmc_accel = 0; abort(); } @@ -734,7 +731,7 @@ static XvImage *create_ximage (xvmc_driver_t *this, XShmSegmentInfo *shminfo, xvmc_format = this->xvmc_format_yuy2; break; default: - fprintf (stderr, "create_ximage: unknown format %08x\n",format); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "create_ximage: unknown format %08x\n",format); abort(); } @@ -754,7 +751,7 @@ static XvImage *create_ximage (xvmc_driver_t *this, XShmSegmentInfo *shminfo, data = malloc (width * height * 2); break; default: - fprintf (stderr, "create_ximage: unknown format %08x\n",format); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "create_ximage: unknown format %08x\n",format); abort(); } @@ -1101,8 +1098,8 @@ static int xvmc_set_property (vo_driver_t *this_gen, case VO_PROP_ZOOM_X: if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { this->props[property].value = value; - printf ("video_out_xv: VO_PROP_ZOOM_X = %d\n", - this->props[property].value); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_xv: VO_PROP_ZOOM_X = %d\n", this->props[property].value); this->sc.zoom_factor_x = (double)value / (double)XINE_VO_ZOOM_STEP; xvmc_compute_ideal_size (this); @@ -1113,8 +1110,8 @@ static int xvmc_set_property (vo_driver_t *this_gen, case VO_PROP_ZOOM_Y: if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { this->props[property].value = value; - printf ("video_out_xv: VO_PROP_ZOOM_Y = %d\n", - this->props[property].value); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_xv: VO_PROP_ZOOM_Y = %d\n", this->props[property].value); this->sc.zoom_factor_y = (double)value / (double)XINE_VO_ZOOM_STEP; xvmc_compute_ideal_size (this); @@ -1298,8 +1295,8 @@ static void xvmc_check_capability (xvmc_driver_t *this, XvGetPortAttribute (this->display, this->xv_port, this->props[property].atom, &int_default); - printf ("video_out_xvmc: port attribute %s (%d) value is %d\n", - str_prop, property, int_default); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_xvmc: port attribute %s (%d) value is %d\n", str_prop, property, int_default); if (config_name) { /* is this a boolean property ? */ @@ -1373,20 +1370,17 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi display = visual->display; /* TODO ??? */ - this = malloc (sizeof (xvmc_driver_t)); + this = (xvmc_driver_t *) xine_xmalloc (sizeof (xvmc_driver_t)); - if (!this) { - printf ("video_out_xvmc: malloc failed\n"); + if (!this) return NULL; - } - - memset (this, 0, sizeof(xvmc_driver_t)); this->display = visual->display; this->overlay = NULL; this->screen = visual->screen; this->xv_port = class->xv_port; this->config = config; + this->xine = class->xine; _x_vo_scale_init (&this->sc, 1, 0, config ); @@ -1506,7 +1500,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi XFree(attr); } else { - printf("video_out_xvmc: no port attributes defined.\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xvmc: no port attributes defined.\n"); } @@ -1558,25 +1552,25 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi switch(this->deinterlace_method) { case DEINTERLACE_NONE: - printf("NONE\n"); + lprintf("NONE\n"); break; case DEINTERLACE_BOB: - printf("BOB\n"); + lprintf("BOB\n"); break; case DEINTERLACE_WEAVE: - printf("WEAVE\n"); + lprintf("WEAVE\n"); break; case DEINTERLACE_GREEDY: - printf("GREEDY\n"); + lprintf("GREEDY\n"); break; case DEINTERLACE_ONEFIELD: - printf("ONEFIELD\n"); + lprintf("ONEFIELD\n"); break; case DEINTERLACE_ONEFIELDXV: - printf("ONEFIELDXV\n"); + lprintf("ONEFIELDXV\n"); break; case DEINTERLACE_LINEARBLEND: - printf("LINEARBLEND\n"); + lprintf("LINEARBLEND\n"); break; } @@ -1633,13 +1627,13 @@ static void *init_class (xine_t *xine, void *visual_gen) { XLockDisplay(display); if (Success != XvQueryExtension(display, &ver, &rel, &req, &ev, &err)) { - printf ("video_out_xvmc: Xv extension not present.\n"); + xprintf (xine, XINE_VERBOSITY_DEBUG, "video_out_xvmc: Xv extension not present.\n"); XUnlockDisplay(display); return NULL; } if(!XvMCQueryExtension(display, &ev, &err)) { - printf ("video_out_xvmc: XvMC extension not present.\n"); + xprintf (xine, XINE_VERBOSITY_LOG, _("video_out_xvmc: XvMC extension not present.\n")); XUnlockDisplay(display); return 0; } @@ -1650,7 +1644,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { if(Success != XvQueryAdaptors(display, DefaultRootWindow(display), &adaptors, &adaptor_info)) { - printf ("video_out_xvmc: XvQueryAdaptors failed.\n"); + xprintf (xine, XINE_VERBOSITY_DEBUG, "video_out_xvmc: XvQueryAdaptors failed.\n"); XUnlockDisplay(display); return 0; } @@ -1658,7 +1652,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { xv_port = 0; for ( adaptor_num = 0; (adaptor_num < adaptors) && !xv_port; adaptor_num++ ) { - printf ("video_out_xvmc: checking adaptor %d\n",adaptor_num); + xprintf (xine, XINE_VERBOSITY_DEBUG, "video_out_xvmc: checking adaptor %d\n",adaptor_num); if (adaptor_info[adaptor_num].type & XvImageMask) { surfaceInfo = XvMCListSurfaceTypes(display, adaptor_info[adaptor_num].base_id, &types); @@ -1686,13 +1680,13 @@ static void *init_class (xine_t *xine, void *visual_gen) { } if(!xv_port) { /* try for just XVMC_MOCOMP */ - lprintf ("didn't find XVMC_IDCT acceleration trying for MC\n"); + xprintf (xine, XINE_VERBOSITY_DEBUG, "didn't find XVMC_IDCT acceleration trying for MC\n"); for(surface_num = 0; surface_num < types; surface_num++) { if((surfaceInfo[surface_num].chroma_format == XVMC_CHROMA_FORMAT_420) && ((surfaceInfo[surface_num].mc_type == (XVMC_MOCOMP | XVMC_MPEG_2)))) { - lprintf ("Found XVMC_MOCOMP\n"); + xprintf (xine, XINE_VERBOSITY_DEBUG, "Found XVMC_MOCOMP\n"); max_width = surfaceInfo[surface_num].max_width; max_height = surfaceInfo[surface_num].max_height; @@ -1727,7 +1721,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { } else IDCTaccel = 0; - printf ("video_out_xvmc: IDCTaccel %02x\n",IDCTaccel); + xprintf (xine, XINE_VERBOSITY_DEBUG, "video_out_xvmc: IDCTaccel %02x\n",IDCTaccel); break; } XFree(surfaceInfo); @@ -1737,37 +1731,36 @@ static void *init_class (xine_t *xine, void *visual_gen) { if (!xv_port) { - printf ("video_out_xvmc: Xv extension is present but " - "I couldn't find a usable yuv12 port.\n"); - printf (" Looks like your graphics hardware " - "driver doesn't support Xv?!\n"); + xprintf (xine, XINE_VERBOSITY_LOG, + _("video_out_xvmc: Xv extension is present but I couldn't find a usable yuv12 port.\n")); + xprintf (xine, XINE_VERBOSITY_LOG, " Looks like your graphics hardware " + "driver doesn't support Xv?!\n"); /* XvFreeAdaptorInfo (adaptor_info); this crashed on me (gb)*/ XUnlockDisplay(display); return NULL; } else { - printf ("video_out_xvmc: using Xv port %ld from adaptor %s\n" - " for hardware colorspace conversion and scaling\n", xv_port, - adaptor_info[adaptor_num].name); + xprintf (xine, XINE_VERBOSITY_LOG, + _("video_out_xvmc: using Xv port %ld from adaptor %s\n" + " for hardware colorspace conversion and scaling\n"), + xv_port, adaptor_info[adaptor_num].name); if(IDCTaccel&XINE_VO_IDCT_ACCEL) - printf (" idct and motion compensation acceleration \n"); + xprintf (xine, XINE_VERBOSITY_LOG, _(" idct and motion compensation acceleration \n")); else if (IDCTaccel&XINE_VO_MOTION_ACCEL) - printf (" motion compensation acceleration only\n"); + xprintf (xine, XINE_VERBOSITY_LOG, _(" motion compensation acceleration only\n")); else - printf (" no XvMC support \n"); - printf (" With Overlay = %d; UnsignedIntra = %d.\n", useOverlay, - unsignedIntra); + xprintf (xine, XINE_VERBOSITY_LOG, _(" no XvMC support \n")); + xprintf (xine, XINE_VERBOSITY_LOG, _(" With Overlay = %d; UnsignedIntra = %d.\n"), + useOverlay, unsignedIntra); } XUnlockDisplay(display); this = (xvmc_class_t *) malloc (sizeof (xvmc_class_t)); - if (!this) { - printf ("video_out_xvmc: malloc failed\n"); + if (!this) return NULL; - } this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; @@ -1784,6 +1777,8 @@ static void *init_class (xine_t *xine, void *visual_gen) { this->max_surface_height = max_height; this->acceleration = IDCTaccel; + this->xine = xine; + lprintf("init_class done\n"); return this; diff --git a/src/video_out/x11osd.c b/src/video_out/x11osd.c index b268024b2..371202f9a 100644 --- a/src/video_out/x11osd.c +++ b/src/video_out/x11osd.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: x11osd.c,v 1.3 2003/11/26 18:36:34 miguelfreitas Exp $ + * $Id: x11osd.c,v 1.4 2003/12/05 15:55:04 f1rmb Exp $ * * x11osd.c, use X11 Nonrectangular Window Shape Extension to draw xine OSD * @@ -70,6 +70,7 @@ struct x11osd int y; int clean; int mapped; + xine_t *xine; }; @@ -174,23 +175,23 @@ static int x11_error_handler(Display *dpy, XErrorEvent *error) } x11osd * -x11osd_create (Display *display, int screen, Window window) +x11osd_create (xine_t *xine, Display *display, int screen, Window window) { x11osd *osd; int event_basep, error_basep; XErrorHandler old_handler = NULL; - osd = malloc (sizeof (x11osd)); - memset (osd, 0, sizeof (x11osd)); - if (osd == NULL) + osd = xine_xmalloc (sizeof (x11osd)); + if (!osd) return NULL; + osd->xine = xine; osd->display = display; osd->screen = screen; osd->parent_window = window; if (!XShapeQueryExtension (osd->display, &event_basep, &error_basep)) { - printf(_("x11osd: XShape extension not available. unscaled overlay disabled.\n")); + xprintf(osd->xine, XINE_VERBOSITY_LOG, _("x11osd: XShape extension not available. unscaled overlay disabled.\n")); goto error2; } @@ -210,7 +211,7 @@ x11osd_create (Display *display, int screen, Window window) BlackPixel (osd->display, osd->screen)); XSync(osd->display, False); if( x11_error ) { - printf(_("x11osd: error creating window. unscaled overlay disabled.\n")); + xprintf(osd->xine, XINE_VERBOSITY_LOG, _("x11osd: error creating window. unscaled overlay disabled.\n")); goto error3; } @@ -219,7 +220,7 @@ x11osd_create (Display *display, int screen, Window window) osd->height, 1); XSync(osd->display, False); if( x11_error ) { - printf(_("x11osd: error creating pixmap. unscaled overlay disabled.\n")); + xprintf(osd->xine, XINE_VERBOSITY_LOG, _("x11osd: error creating pixmap. unscaled overlay disabled.\n")); goto error4; } @@ -228,7 +229,7 @@ x11osd_create (Display *display, int screen, Window window) osd->height, osd->depth); XSync(osd->display, False); if( x11_error ) { - printf(_("x11osd: error creating pixmap. unscaled overlay disabled.\n")); + xprintf(osd->xine, XINE_VERBOSITY_LOG, _("x11osd: error creating pixmap. unscaled overlay disabled.\n")); goto error5; } diff --git a/src/video_out/x11osd.h b/src/video_out/x11osd.h index c38d6a395..23be5df11 100644 --- a/src/video_out/x11osd.h +++ b/src/video_out/x11osd.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: x11osd.h,v 1.2 2003/11/26 19:36:13 mroi Exp $ + * $Id: x11osd.h,v 1.3 2003/12/05 15:55:04 f1rmb Exp $ * * x11osd.h, use X11 Nonrectangular Window Shape Extension to draw xine OSD * @@ -30,20 +30,20 @@ #ifndef X11OSD_H #define X11OSD_H - typedef struct x11osd x11osd; +typedef struct x11osd x11osd; - x11osd *x11osd_create (Display *display, int screen, Window window); +x11osd *x11osd_create (xine_t *xine, Display *display, int screen, Window window); - void x11osd_destroy (x11osd * osd); +void x11osd_destroy (x11osd * osd); - void x11osd_expose (x11osd * osd); +void x11osd_expose (x11osd * osd); - void x11osd_resize (x11osd * osd, int width, int height); +void x11osd_resize (x11osd * osd, int width, int height); - void x11osd_drawable_changed (x11osd * osd, Window window); +void x11osd_drawable_changed (x11osd * osd, Window window); - void x11osd_clear(x11osd *osd); +void x11osd_clear(x11osd *osd); - void x11osd_blend(x11osd *osd, vo_overlay_t *overlay); +void x11osd_blend(x11osd *osd, vo_overlay_t *overlay); #endif diff --git a/src/video_out/yuv2rgb.c b/src/video_out/yuv2rgb.c index 174d1414e..57b76867c 100644 --- a/src/video_out/yuv2rgb.c +++ b/src/video_out/yuv2rgb.c @@ -23,7 +23,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: yuv2rgb.c,v 1.46 2003/11/26 19:43:38 f1rmb Exp $ + * $Id: yuv2rgb.c,v 1.47 2003/12/05 15:55:04 f1rmb Exp $ */ #include "config.h" @@ -2397,7 +2397,7 @@ static void yuv2rgb_set_csc_levels (yuv2rgb_factory_t *this, default: - printf ("yuv2rgb: mode %d not supported by yuv2rgb\n", mode); + lprintf ("yuv2rgb: mode %d not supported by yuv2rgb\n", mode); abort(); } @@ -2529,7 +2529,7 @@ static void yuv2rgb_c_init (yuv2rgb_factory_t *this) break; default: - printf ("yuv2rgb: mode %d not supported by yuv2rgb\n", this->mode); + lprintf ("yuv2rgb: mode %d not supported by yuv2rgb\n", this->mode); abort(); } @@ -2572,7 +2572,7 @@ static void yuv2rgb_single_pixel_init (yuv2rgb_factory_t *this) { break; default: - printf ("yuv2rgb: mode %d not supported by yuv2rgb\n", this->mode); + lprintf ("yuv2rgb: mode %d not supported by yuv2rgb\n", this->mode); abort(); } } @@ -3114,7 +3114,7 @@ static void yuy22rgb_c_init (yuv2rgb_factory_t *this) break; default: - printf ("yuv2rgb: mode %d not supported for yuy2\n", this->mode); + lprintf ("yuv2rgb: mode %d not supported for yuy2\n", this->mode); } } diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c index 2ae362c88..df870004d 100644 --- a/src/xine-engine/audio_decoder.c +++ b/src/xine-engine/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.116 2003/11/26 23:44:10 f1rmb Exp $ + * $Id: audio_decoder.c,v 1.117 2003/12/05 15:55:04 f1rmb Exp $ * * * functions that implement audio decoding @@ -304,9 +304,8 @@ static void *audio_decoder_loop (void *stream_gen) { if (buf->type != buftype_unknown && !_x_stream_info_get(stream, XINE_STREAM_INFO_AUDIO_HANDLED)) { - xine_log (stream->xine, XINE_LOG_MSG, - "audio_decoder: no plugin available to handle '%s'\n", - _x_buf_audio_name( buf->type ) ); + xine_log (stream->xine, XINE_LOG_MSG, + _("audio_decoder: no plugin available to handle '%s'\n"), _x_buf_audio_name( buf->type ) ); if( !_x_meta_info_get(stream, XINE_META_INFO_AUDIOCODEC) ) _x_meta_info_set(stream, XINE_META_INFO_AUDIOCODEC, _x_buf_audio_name( buf->type )); @@ -323,8 +322,7 @@ static void *audio_decoder_loop (void *stream_gen) { } } else if( buf->type != buftype_unknown ) { xine_log (stream->xine, XINE_LOG_MSG, - "audio_decoder: error, unknown buffer type: %08x\n", - buf->type ); + _("audio_decoder: error, unknown buffer type: %08x\n"), buf->type ); buftype_unknown = buf->type; } @@ -373,8 +371,8 @@ void _x_audio_decoder_init (xine_stream_t *stream) { if ((err = pthread_create (&stream->audio_thread, &pth_attrs, audio_decoder_loop, stream)) != 0) { - fprintf (stderr, "audio_decoder: can't create new thread (%s)\n", - strerror(err)); + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, + "audio_decoder: can't create new thread (%s)\n", strerror(err)); abort(); } diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index fdd3eea69..6bd3ea0eb 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -17,7 +17,7 @@ * along with self program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_out.c,v 1.154 2003/12/03 10:24:41 andruil Exp $ + * $Id: audio_out.c,v 1.155 2003/12/05 15:55:04 f1rmb Exp $ * * 22-8-2001 James imported some useful AC3 sections from the previous alsa driver. * (c) 2001 Andy Lo A Foe <andy@alsaplayer.org> @@ -276,16 +276,14 @@ struct audio_fifo_s { }; -static audio_fifo_t *fifo_new (void) { +static audio_fifo_t *fifo_new (xine_t *xine) { audio_fifo_t *fifo; fifo = (audio_fifo_t *) xine_xmalloc (sizeof (audio_fifo_t)); - if (!fifo) { - printf ("audio_out: out of memory!\n"); + if (!fifo) return NULL; - } fifo->first = NULL; fifo->last = NULL; @@ -427,9 +425,8 @@ static void ao_fill_gap (aos_t *this, int64_t pts_len) { num_frames = pts_len * this->frames_per_kpts / 1024; - xprintf (this->xine, XINE_VERBOSITY_LOG, - "inserting %d 0-frames to fill a gap of %" PRId64 " pts\n", - num_frames, pts_len); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "inserting %d 0-frames to fill a gap of %" PRId64 " pts\n", num_frames, pts_len); if ((this->output.mode == AO_CAP_MODE_A52) || (this->output.mode == AO_CAP_MODE_AC5)) { write_pause_burst(this,num_frames); @@ -1131,7 +1128,7 @@ int xine_get_next_audio_frame (xine_audio_port_t *this_gen, if (!in_buf) { pthread_mutex_unlock(&this->out_fifo->mutex); - printf ("audio_audio: EOS\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_audio: EOS\n"); return 0; } @@ -1187,7 +1184,7 @@ static int ao_change_settings(aos_t *this, uint32_t bits, uint32_t rate, int mod !(this->driver->get_capabilities(this->driver) & AO_CAP_8BITS) ) { bits = 16; xprintf (this->xine, XINE_VERBOSITY_LOG, - "8 bits not supported by driver, converting to 16 bits.\n"); + _("8 bits not supported by driver, converting to 16 bits.\n")); } /* provide mono->stereo and stereo->mono conversions */ @@ -1195,13 +1192,13 @@ static int ao_change_settings(aos_t *this, uint32_t bits, uint32_t rate, int mod !(this->driver->get_capabilities(this->driver) & AO_CAP_MODE_MONO) ) { mode = AO_CAP_MODE_STEREO; xprintf (this->xine, XINE_VERBOSITY_LOG, - "mono not supported by driver, converting to stereo.\n"); + _("mono not supported by driver, converting to stereo.\n")); } if( this->input.mode == AO_CAP_MODE_STEREO && !(this->driver->get_capabilities(this->driver) & AO_CAP_MODE_STEREO) ) { mode = AO_CAP_MODE_MONO; xprintf (this->xine, XINE_VERBOSITY_LOG, - "stereo not supported by driver, converting to mono.\n"); + _("stereo not supported by driver, converting to mono.\n")); } output_sample_rate=this->driver->open(this->driver,bits,(this->force_rate ? this->force_rate : rate),mode); @@ -1211,11 +1208,11 @@ static int ao_change_settings(aos_t *this, uint32_t bits, uint32_t rate, int mod if ( output_sample_rate == 0) { this->driver_open = 0; - xprintf (this->xine, XINE_VERBOSITY_LOG, "open failed!\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "open failed!\n"); return 0; }; - xprintf (this->xine, XINE_VERBOSITY_LOG, "output sample rate %d\n", output_sample_rate); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "output sample rate %d\n", output_sample_rate); this->last_audio_vpts = 0; this->output.mode = mode; @@ -1835,8 +1832,8 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, * pre-allocate memory for samples */ - this->free_fifo = fifo_new (); - this->out_fifo = fifo_new (); + this->free_fifo = fifo_new (this->xine); + this->out_fifo = fifo_new (this->xine); for (i=0; i<NUM_AUDIO_BUFFERS; i++) { @@ -1901,8 +1898,10 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, if ((err = pthread_create (&this->audio_thread, &pth_attrs, ao_loop, this)) != 0) { - printf ("audio_out: can't create thread (%s)\n", strerror(err)); - printf ("audio_out: sorry, this should not happen. please restart xine.\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "audio_out: can't create thread (%s)\n", strerror(err)); + xprintf (this->xine, XINE_VERBOSITY_LOG, + _("audio_out: sorry, this should not happen. please restart xine.\n")); abort(); } else diff --git a/src/xine-engine/broadcaster.c b/src/xine-engine/broadcaster.c index 41f8e24e6..4e0b4142e 100644 --- a/src/xine-engine/broadcaster.c +++ b/src/xine-engine/broadcaster.c @@ -19,7 +19,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: broadcaster.c,v 1.4 2003/11/26 23:44:10 f1rmb Exp $ + * $Id: broadcaster.c,v 1.5 2003/12/05 15:55:04 f1rmb Exp $ * * broadcaster.c - xine network broadcaster * @@ -110,7 +110,7 @@ static int sock_check_opened(int socket) { /* * Write to socket. */ -static int sock_data_write(int socket, char *buf, int len) { +static int sock_data_write(xine_t *xine, int socket, char *buf, int len) { ssize_t size; int wlen = 0; @@ -124,7 +124,7 @@ static int sock_data_write(int socket, char *buf, int len) { size = write(socket, buf, len); if(size <= 0) { - printf("broadcaster: error writing to socket %d\n",socket); + xprintf(xine, XINE_VERBOSITY_DEBUG, "broadcaster: error writing to socket %d\n",socket); return -1; } @@ -136,7 +136,7 @@ static int sock_data_write(int socket, char *buf, int len) { return wlen; } -static int sock_string_write(int socket, char *msg, ...) { +static int sock_string_write(xine_t *xine, int socket, char *msg, ...) { char buf[_BUFSIZ]; va_list args; @@ -148,7 +148,7 @@ static int sock_string_write(int socket, char *msg, ...) { if((buf[strlen(buf)] == '\0') && (buf[strlen(buf) - 1] != '\n')) sprintf(buf, "%s%c", buf, '\n'); - return sock_data_write(socket, buf, strlen(buf)); + return sock_data_write(xine, socket, buf, strlen(buf)); } /* @@ -162,9 +162,9 @@ static void broadcaster_data_write(broadcaster_t *this, char *buf, int len) { while (psock) { /* in case of failure remove from list */ - if( sock_data_write(*psock, buf, len) < 0 ) { + if( sock_data_write(this->stream->xine, *psock, buf, len) < 0 ) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "broadcaster: closing socket %d\n", *psock); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "broadcaster: closing socket %d\n", *psock); close(*psock); free(psock); if( this->connections->cur->next ) @@ -221,11 +221,11 @@ static void *manager_loop (void *this_gen) { ssock = accept(this->msock, (struct sockaddr *)&fsin, &alen); if (ssock >= 0) { /* identification string, helps demuxer probing */ - if( sock_string_write(ssock,"master xine v1") > 0 ) { + if( sock_string_write(this->stream->xine, ssock,"master xine v1") > 0 ) { int *psock = malloc(sizeof(int)); *psock = ssock; - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "broadcaster: new connection socket %d\n", *psock); xine_list_append_content(this->connections, psock); } @@ -300,7 +300,7 @@ broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port) msock = socket(PF_INET, SOCK_STREAM, 0); if( msock < 0 ) { - printf("broadcaster: error opening master socket.\n"); + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "broadcaster: error opening master socket.\n"); return NULL; } servAddr.sin_family = AF_INET; @@ -309,7 +309,7 @@ broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port) if(bind(msock, (struct sockaddr *) &servAddr, sizeof(servAddr))<0) { - printf("broadcaster: error binding to port %d\n", port); + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "broadcaster: error binding to port %d\n", port); return NULL; } @@ -333,9 +333,9 @@ broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port) this->running = 1; if ((err = pthread_create (&this->manager_thread, NULL, manager_loop, (void *)this)) != 0) { - printf ("broadcaster: can't create new thread (%s)\n", - strerror(err)); - abort(); + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, + "broadcaster: can't create new thread (%s)\n", strerror(err)); + abort(); } return this; @@ -347,7 +347,7 @@ void _x_close_broadcaster(broadcaster_t *this) psock = xine_list_first_content (this->connections); while (psock) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "broadcaster: closing socket %d\n", *psock); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "broadcaster: closing socket %d\n", *psock); close(*psock); free(psock); xine_list_delete_current (this->connections); diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c index 823e9cab9..80cd57641 100644 --- a/src/xine-engine/configfile.c +++ b/src/xine-engine/configfile.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: configfile.c,v 1.57 2003/11/26 19:43:38 f1rmb Exp $ + * $Id: configfile.c,v 1.58 2003/12/05 15:55:04 f1rmb Exp $ * * config object (was: file) management - implementation * @@ -673,7 +673,7 @@ void xine_config_load (xine_t *xine, const char *filename) { sscanf(line + 9, "%d", &this->current_version); if (this->current_version > CONFIG_FILE_VERSION) xine_log(xine, XINE_LOG_MSG, - _("The current config file has been modified by a newer version of xine.")); + _("The current config file has been modified by a newer version of xine.")); } continue; } @@ -763,8 +763,8 @@ void xine_config_save (xine_t *xine, const char *filename) { } if (!backup && (stat(filename, &config_stat) == 0)) { - printf("configfile: WARNING: backing up configfile to %s failed\n", temp); - printf("configfile: WARNING: your configuration will not be saved\n"); + xprintf(xine, XINE_VERBOSITY_LOG, _("configfile: WARNING: backing up configfile to %s failed\n"), temp); + xprintf(xine, XINE_VERBOSITY_LOG, _("configfile: WARNING: your configuration will not be saved\n")); return; } @@ -859,9 +859,9 @@ void xine_config_save (xine_t *xine, const char *filename) { pthread_mutex_unlock(&this->config_lock); if (fclose(f_config) != 0) { - printf("configfile: WARNING: writing configuration to %s failed\n", filename); - printf("configfile: WARNING: removing possibly broken config file %s\n", filename); - printf("configfile: WARNING: you should check the backup file %s\n", temp); + xprintf(xine, XINE_VERBOSITY_LOG, _("configfile: WARNING: writing configuration to %s failed\n"), filename); + xprintf(xine, XINE_VERBOSITY_LOG, _("configfile: WARNING: removing possibly broken config file %s\n"), filename); + xprintf(xine, XINE_VERBOSITY_LOG, _("configfile: WARNING: you should check the backup file %s\n"), temp); /* writing config failed -> remove file, it might be broken ... */ unlink(filename); /* ... but keep the backup */ diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index e49a93fba..2ce91fe4d 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -20,7 +20,7 @@ * Demuxer helper functions * hide some xine engine details from demuxers and reduce code duplication * - * $Id: demux.c,v 1.42 2003/11/26 19:43:38 f1rmb Exp $ + * $Id: demux.c,v 1.43 2003/12/05 15:55:04 f1rmb Exp $ */ @@ -294,8 +294,7 @@ int _x_demux_start_thread (xine_stream_t *stream) { stream->demux_thread_running = 1; if ((err = pthread_create (&stream->demux_thread, NULL, demux_loop, (void *)stream)) != 0) { - printf ("demux: can't create new thread (%s)\n", - strerror(err)); + printf ("demux: can't create new thread (%s)\n", strerror(err)); abort(); } } diff --git a/src/xine-engine/events.c b/src/xine-engine/events.c index 2f8ed16b8..998a2d159 100644 --- a/src/xine-engine/events.c +++ b/src/xine-engine/events.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: events.c,v 1.20 2003/11/16 15:41:15 mroi Exp $ + * $Id: events.c,v 1.21 2003/12/05 15:55:04 f1rmb Exp $ * * Event handling functions * @@ -138,7 +138,7 @@ void xine_event_dispose_queue (xine_event_queue_t *queue) { q = (xine_event_queue_t *) xine_list_next_content (stream->event_queues); if (!q) { - printf ("events: tried to dispose queue which is not in list\n"); + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "events: tried to dispose queue which is not in list\n"); pthread_mutex_unlock (&stream->event_queues_lock); return; @@ -218,8 +218,8 @@ void xine_event_create_listener_thread (xine_event_queue_t *queue, if ((err = pthread_create (queue->listener_thread, NULL, listener_loop, queue)) != 0) { - fprintf (stderr, "events: can't create new thread (%s)\n", - strerror(err)); + xprintf (queue->stream->xine, XINE_VERBOSITY_DEBUG, + "events: can't create new thread (%s)\n", strerror(err)); abort(); } } diff --git a/src/xine-engine/input_rip.c b/src/xine-engine/input_rip.c index b5525d384..09fadd783 100644 --- a/src/xine-engine/input_rip.c +++ b/src/xine-engine/input_rip.c @@ -29,7 +29,7 @@ * - it's possible speeder saving streams in the xine without playing: * xine stream_mrl#save:file.raw\;noaudio\;novideo * - * $Id: input_rip.c,v 1.18 2003/11/26 19:43:38 f1rmb Exp $ + * $Id: input_rip.c,v 1.19 2003/12/05 15:55:04 f1rmb Exp $ */ /* TODO: @@ -127,7 +127,7 @@ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { lprintf(" => read %lld bytes from file\n", nread_file); if (fread(&buf[npreview], nread_file, 1, this->file) != 1) { xine_log(this->stream->xine, XINE_LOG_MSG, - _("input_rip: reading of saved data failed: %s\n"), strerror(errno)); + _("input_rip: reading of saved data failed: %s\n"), strerror(errno)); return -1; } } @@ -142,7 +142,7 @@ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { if (retlen < 0) { xine_log(this->stream->xine, XINE_LOG_MSG, - _("input_rip: reading by input plugin failed\n")); + _("input_rip: reading by input plugin failed\n")); return -1; } @@ -151,7 +151,7 @@ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { nwrite = retlen - nread_orig; if (fwrite(buf + this->savepos - this->curpos, nwrite, 1, this->file) != 1) { xine_log(this->stream->xine, XINE_LOG_MSG, - _("input_rip: error writing to file %lld bytes: %s\n"), + _("input_rip: error writing to file %lld bytes: %s\n"), retlen - nread_orig, strerror(errno)); return -1; } @@ -173,7 +173,7 @@ static int rip_plugin_open(input_plugin_t *this_gen) { rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen; xine_log(this->stream->xine, XINE_LOG_MSG, - _("input_rip: open() function should never be called\n")); + _("input_rip: open() function should never be called\n")); return 0; } @@ -249,7 +249,7 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe lprintf(" => read %lld bytes from the file (block)\n", nread_file); if (fread(&buf->content[npreview], nread_file, 1, this->file) != 1) { xine_log(this->stream->xine, XINE_LOG_MSG, - _("input_rip: reading of saved data failed: %s\n"), strerror(errno)); + _("input_rip: reading of saved data failed: %s\n"), strerror(errno)); return NULL; } } @@ -280,7 +280,7 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe nwrite = retlen - nread_orig; if (fwrite(buf->content + this->savepos - this->curpos, nwrite, 1, this->file) != 1) { xine_log(this->stream->xine, XINE_LOG_MSG, - _("input_rip: error writing to file %lld bytes: %s\n"), + _("input_rip: error writing to file %lld bytes: %s\n"), retlen - nread_orig, strerror(errno)); return NULL; } @@ -303,8 +303,7 @@ static off_t rip_seek_original(rip_input_plugin_t *this, off_t reqpos) { pos = this->main_input_plugin->seek(this->main_input_plugin, reqpos, SEEK_SET); if (pos == -1) { - xine_log(this->stream->xine, XINE_LOG_MSG, - _("input_rip: seeking failed\n")); + xine_log(this->stream->xine, XINE_LOG_MSG, _("input_rip: seeking failed\n")); return -1; } #ifdef LOG @@ -361,8 +360,7 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) if (reqpos != this->savepos) { lprintf(" => seeking file to %lld\n", reqpos); if (fseeko(this->file, reqpos, SEEK_SET) != 0) { - xine_log(this->stream->xine, XINE_LOG_MSG, - _("input_rip: seeking failed: %s\n"), strerror(errno)); + xine_log(this->stream->xine, XINE_LOG_MSG, _("input_rip: seeking failed: %s\n"), strerror(errno)); return -1; } } @@ -380,17 +378,15 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) if (this->regular) { lprintf(" => seeking file to end: %lld\n", this->savepos); if (fseeko(this->file, this->savepos, SEEK_SET) != 0) { - xine_log(this->stream->xine, XINE_LOG_MSG, - _("input_rip: seeking failed: %s\n"), strerror(errno)); + xine_log(this->stream->xine, XINE_LOG_MSG, _("input_rip: seeking failed: %s\n"), strerror(errno)); return -1; } this->curpos = this->savepos; } else { if ((pos = rip_seek_original(this, this->savepos)) == -1) return -1; if (pos > this->savepos) - xine_log(this->stream->xine, XINE_LOG_MSG, - _("input_rip: %lld bytes dropped\n"), - pos - this->savepos); + xine_log(this->stream->xine, XINE_LOG_MSG, _("input_rip: %lld bytes dropped\n"), + pos - this->savepos); } } @@ -411,8 +407,7 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) toread = sizeof(buffer); if( rip_plugin_read(this_gen, buffer, toread) <= 0 ) { - xine_log(this->stream->xine, XINE_LOG_MSG, - _("input_rip: seeking failed\n")); + xine_log(this->stream->xine, XINE_LOG_MSG, _("input_rip: seeking failed\n")); break; } } @@ -540,32 +535,30 @@ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *f /* check given input plugin */ if (!stream->input_plugin) { - xine_log(stream->xine, XINE_LOG_MSG, - _("input_rip: input plugin not defined!\n")); + xine_log(stream->xine, XINE_LOG_MSG, _("input_rip: input plugin not defined!\n")); return NULL; } if (!stream->xine->save_path[0]) { xine_log(stream->xine, XINE_LOG_MSG, - _("input_rip: target directory wasn't specified, please fill out the option 'misc.save_dir'\n")); + _("input_rip: target directory wasn't specified, please fill out the option 'misc.save_dir'\n")); _x_message(stream, XINE_MSG_SECURITY, - _("The stream save feature is disabled until you set misc.save_dir in the configuration.")); + _("The stream save feature is disabled until you set misc.save_dir in the configuration.")); return NULL; } #ifndef SAVING_ALWAYS_PERMIT if ( main_plugin->get_capabilities(main_plugin) & INPUT_CAP_RIP_FORBIDDEN ) { xine_log(stream->xine, XINE_LOG_MSG, - _("input_rip: ripping/caching of this source is not permitted!\n")); + _("input_rip: ripping/caching of this source is not permitted!\n")); _x_message(stream, XINE_MSG_SECURITY, - _("xine is not allowed to save from this source. (possibly copyrighted material?)")); + _("xine is not allowed to save from this source. (possibly copyrighted material?)")); return NULL; } #endif if (!filename || !filename[0]) { - xine_log(stream->xine, XINE_LOG_MSG, - _("input_rip: file name not given!\n")); + xine_log(stream->xine, XINE_LOG_MSG, _("input_rip: file name not given!\n")); return NULL; } @@ -584,8 +577,7 @@ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *f /* find out type of target */ if (stat(target, &pstat) < 0 && errno != ENOENT) { xine_log(this->stream->xine, XINE_LOG_MSG, - _("input_rip: stat on the file %s failed: %s\n"), - target, strerror(errno)); + _("input_rip: stat on the file %s failed: %s\n"), target, strerror(errno)); free(this); return NULL; } @@ -605,8 +597,7 @@ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *f if ((this->file = fopen(target, mode)) == NULL) { xine_log(this->stream->xine, XINE_LOG_MSG, - _("input_rip: error opening file %s: %s\n"), - target, strerror(errno)); + _("input_rip: error opening file %s: %s\n"), target, strerror(errno)); free(this); return NULL; } @@ -636,8 +627,7 @@ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *f if (this->preview && this->preview_size) { if (fwrite(this->preview, this->preview_size, 1, this->file) != 1) { xine_log(this->stream->xine, XINE_LOG_MSG, - _("input_rip: error writing to file %lld bytes: %s\n"), - this->preview_size, strerror(errno)); + _("input_rip: error writing to file %lld bytes: %s\n"), this->preview_size, strerror(errno)); fclose(this->file); free(this); return NULL; diff --git a/src/xine-engine/io_helper.c b/src/xine-engine/io_helper.c index 9798c0378..f631a0736 100644 --- a/src/xine-engine/io_helper.c +++ b/src/xine-engine/io_helper.c @@ -98,7 +98,7 @@ static int _x_io_tcp_connect_ipv4(xine_stream_t *stream, const char *host, int p if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && errno != EINPROGRESS) { #else if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && WSAGetLastError() != WSAEWOULDBLOCK) { - printf("io_helper: WSAGetLastError() = %d\n", WSAGetLastError()); + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "io_helper: WSAGetLastError() = %d\n", WSAGetLastError()); #endif /* WIN32 */ _x_message(stream, XINE_MSG_CONNECTION_REFUSED, strerror(errno), NULL); @@ -128,7 +128,7 @@ int _x_io_tcp_connect(xine_stream_t *stream, const char *host, int port) { snprintf(strport, sizeof(strport), "%d", port); - printf("Resolving host '%s' at port '%s'\n", host, strport); + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "Resolving host '%s' at port '%s'\n", host, strport); error = getaddrinfo(host, strport, &hints, &res); @@ -167,7 +167,7 @@ int _x_io_tcp_connect(xine_stream_t *stream, const char *host, int port) { tmpaddr->ai_addrlen)==-1 && WSAGetLastError() != WSAEWOULDBLOCK) { - printf("io_helper: WSAGetLastError() = %d\n", WSAGetLastError()); + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "io_helper: WSAGetLastError() = %d\n", WSAGetLastError()); #endif /* WIN32 */ error = errno; @@ -286,7 +286,7 @@ static off_t xio_rw_abort(xine_stream_t *stream, int fd, int cmd, char *buf, off #else if (WSAGetLastError() == WSAEWOULDBLOCK) continue; - printf("io_helper: WSAGetLastError() = %d\n", WSAGetLastError()); + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "io_helper: WSAGetLastError() = %d\n", WSAGetLastError()); #endif return ret; diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 14751e1b1..1fbae6d69 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: load_plugins.c,v 1.167 2003/11/27 13:20:22 f1rmb Exp $ + * $Id: load_plugins.c,v 1.168 2003/12/05 15:55:04 f1rmb Exp $ * * * Load input/demux/audio_out/video_out/codec plugins @@ -306,7 +306,7 @@ static void _insert_plugin (xine_t *this, if (info->API != api_version) { xprintf(this, XINE_VERBOSITY_LOG, - "load_plugins: ignoring plugin %s, wrong iface version %d (should be %d)\n", + _("load_plugins: ignoring plugin %s, wrong iface version %d (should be %d)\n"), info->id, info->API, api_version); return; } @@ -345,8 +345,8 @@ static void _insert_plugin (xine_t *this, decoder_old = info->special_info; decoder_new = xine_xmalloc(sizeof(decoder_info_t)); if (decoder_old == NULL) { - printf ("load_plugins: plugin %s from %s is broken: special_info=NULL\n", - info->id, entry->filename); + xprintf (this, XINE_VERBOSITY_DEBUG, + "load_plugins: plugin %s from %s is broken: special_info = NULL\n", info->id, entry->filename); abort(); } for (i=0; decoder_old->supported_types[i] != 0; ++i); @@ -431,8 +431,7 @@ static void collect_plugins(xine_t *this, char *path){ sprintf (str, "%s/%s", path, pEntry->d_name); if (stat(str, &statbuffer)) { - xine_log (this, XINE_LOG_PLUGIN, - _("load_plugins: unable to stat %s\n"), str); + xine_log (this, XINE_LOG_PLUGIN, _("load_plugins: unable to stat %s\n"), str); } else { switch (statbuffer.st_mode & S_IFMT){ @@ -469,7 +468,7 @@ static void collect_plugins(xine_t *this, char *path){ /* too noisy -- but good to catch unresolved references */ xprintf(this, XINE_VERBOSITY_LOG, - "load_plugins: cannot open plugin lib %s:\n%s\n", str, dlerror()); + _("load_plugins: cannot open plugin lib %s:\n%s\n"), str, dlerror()); } else { @@ -479,7 +478,7 @@ static void collect_plugins(xine_t *this, char *path){ xine_log (this, XINE_LOG_PLUGIN, _("load_plugins: plugin %s found\n"), str); - + switch (info->type & PLUGIN_TYPE_MASK){ case PLUGIN_INPUT: _insert_plugin (this, this->plugin_catalog->input, str, @@ -602,8 +601,7 @@ static void *_load_plugin_class(xine_t *this, } else { xine_log (this, XINE_LOG_PLUGIN, - "load_plugins: Yikes! %s doesn't contain plugin info.\n", - filename); + _("load_plugins: Yikes! %s doesn't contain plugin info.\n"), filename); } } @@ -1026,15 +1024,14 @@ static demux_plugin_t *probe_demux (xine_stream_t *stream, int method1, int meth int i; int methods[3]; - xine_t *xine = stream->xine; - plugin_catalog_t *catalog = xine->plugin_catalog; + plugin_catalog_t *catalog = stream->xine->plugin_catalog; methods[0] = method1; methods[1] = method2; methods[2] = -1; if (methods[0] == -1) { - printf ("load_plugins: probe_demux method1 = %d is not allowed \n", method1); + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "load_plugins: probe_demux method1 = %d is not allowed \n", method1); abort(); } @@ -1087,8 +1084,8 @@ demux_plugin_t *_x_find_demux_plugin (xine_stream_t *stream, input_plugin_t *inp return probe_demux (stream, METHOD_BY_EXTENSION, -1, input); default: - printf ("load_plugins: unknown content detection strategy %d\n", - stream->xine->demux_strategy); + xprintf (stream->xine, XINE_VERBOSITY_LOG, + _("load_plugins: unknown content detection strategy %d\n"), stream->xine->demux_strategy); abort(); } @@ -1159,9 +1156,14 @@ demux_plugin_t *_x_find_demux_plugin_last_probe(xine_stream_t *stream, const cha if (strcasecmp(node->info->id, last_demux_name) == 0) { last_demux = node; } else { - printf("load_plugin: probing '%s' (method %d)...\n", node->info->id, stream->content_detection_method ); + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + "load_plugin: probing '%s' (method %d)...\n", node->info->id, stream->content_detection_method ); + if ((plugin = ((demux_class_t *)node->plugin_class)->open_plugin(node->plugin_class, stream, input))) { - printf ("load_plugins: using demuxer '%s' (instead of '%s')\n", node->info->id, last_demux_name); + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, + "load_plugins: using demuxer '%s' (instead of '%s')\n", node->info->id, last_demux_name); + + pthread_mutex_unlock (&catalog->lock); return plugin; } @@ -1181,7 +1183,7 @@ demux_plugin_t *_x_find_demux_plugin_last_probe(xine_stream_t *stream, const cha stream->content_detection_method = METHOD_BY_CONTENT; if ((plugin = ((demux_class_t *)last_demux->plugin_class)->open_plugin(last_demux->plugin_class, stream, input))) { - printf ("load_plugins: using demuxer '%s'\n", last_demux_name); + xprintf (stream->xine, XINE_VERBOSITY_LOG, _("load_plugins: using demuxer '%s'\n"), last_demux_name); return plugin; } @@ -1493,9 +1495,11 @@ xine_audio_port_t *xine_open_audio_driver (xine_t *this, const char *id, if (!driver) { if (id) - printf ("load_plugins: failed to load audio output plugin <%s>\n", id); + xprintf (this, XINE_VERBOSITY_LOG, + _("load_plugins: failed to load audio output plugin <%s>\n"), id); else - printf ("load_plugins: audio output auto-probing didn't find any usable audio driver.\n"); + xprintf (this, XINE_VERBOSITY_LOG, + _("load_plugins: audio output auto-probing didn't find any usable audio driver.\n")); return NULL; } @@ -1609,7 +1613,7 @@ video_decoder_t *_x_get_video_decoder (xine_stream_t *stream, uint8_t stream_typ if (!node->plugin_class) { /* remove non working plugin from catalog */ - xprintf(stream->xine, XINE_VERBOSITY_LOG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "load_plugins: plugin %s failed to init its class.\n", node->info->id); for (j = i + 1; j < PLUGINS_PER_TYPE; j++) catalog->video_decoder_map[stream_type][j - 1] = @@ -1628,7 +1632,7 @@ video_decoder_t *_x_get_video_decoder (xine_stream_t *stream, uint8_t stream_typ return vd; } else { /* remove non working plugin from catalog */ - xprintf(stream->xine, XINE_VERBOSITY_LOG, + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "load_plugins: plugin %s failed to instantiate itself.\n", node->info->id); for (j = i + 1; j < PLUGINS_PER_TYPE; j++) catalog->video_decoder_map[stream_type][j - 1] = @@ -1684,7 +1688,8 @@ audio_decoder_t *_x_get_audio_decoder (xine_stream_t *stream, uint8_t stream_typ if (!node->plugin_class) { /* remove non working plugin from catalog */ - printf("load_plugins: plugin %s failed to init its class.\n", node->info->id); + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + "load_plugins: plugin %s failed to init its class.\n", node->info->id); for (j = i + 1; j < PLUGINS_PER_TYPE; j++) catalog->audio_decoder_map[stream_type][j - 1] = catalog->audio_decoder_map[stream_type][j]; @@ -1702,7 +1707,8 @@ audio_decoder_t *_x_get_audio_decoder (xine_stream_t *stream, uint8_t stream_typ return ad; } else { /* remove non working plugin from catalog */ - printf("load_plugins: plugin %s failed to instantiate itself.\n", node->info->id); + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + "load_plugins: plugin %s failed to instantiate itself.\n", node->info->id); for (j = i + 1; j < PLUGINS_PER_TYPE; j++) catalog->audio_decoder_map[stream_type][j - 1] = catalog->audio_decoder_map[stream_type][j]; @@ -1756,7 +1762,8 @@ spu_decoder_t *_x_get_spu_decoder (xine_stream_t *stream, uint8_t stream_type) { if (!node->plugin_class) { /* remove non working plugin from catalog */ - printf("load_plugins: plugin %s failed to init its class.\n", node->info->id); + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + "load_plugins: plugin %s failed to init its class.\n", node->info->id); for (j = i + 1; j < PLUGINS_PER_TYPE; j++) catalog->spu_decoder_map[stream_type][j - 1] = catalog->spu_decoder_map[stream_type][j]; @@ -1774,7 +1781,8 @@ spu_decoder_t *_x_get_spu_decoder (xine_stream_t *stream, uint8_t stream_type) { return sd; } else { /* remove non working plugin from catalog */ - printf("load_plugins: plugin %s failed to instantiate itself.\n", node->info->id); + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + "load_plugins: plugin %s failed to instantiate itself.\n", node->info->id); for (j = i + 1; j < PLUGINS_PER_TYPE; j++) catalog->spu_decoder_map[stream_type][j - 1] = catalog->spu_decoder_map[stream_type][j]; @@ -1902,7 +1910,8 @@ xine_post_t *xine_post_init(xine_t *xine, const char *name, int inputs, node->plugin_class = _load_plugin_class(xine, node->filename, node->info, NULL); if (!node->plugin_class) { - printf("load_plugins: requested post plugin %s failed to load\n", name); + xprintf(xine, XINE_VERBOSITY_DEBUG, + "load_plugins: requested post plugin %s failed to load\n", name); pthread_mutex_unlock(&catalog->lock); return NULL; } @@ -1955,7 +1964,8 @@ xine_post_t *xine_post_init(xine_t *xine, const char *name, int inputs, return &post->xine_post; } else { - printf("load_plugins: post plugin %s failed to instantiate itself\n", name); + xprintf(xine, XINE_VERBOSITY_DEBUG, + "load_plugins: post plugin %s failed to instantiate itself\n", name); pthread_mutex_unlock(&catalog->lock); return NULL; } @@ -1966,7 +1976,7 @@ xine_post_t *xine_post_init(xine_t *xine, const char *name, int inputs, pthread_mutex_unlock(&catalog->lock); - printf("load_plugins: no post plugin named %s found\n", name); + xprintf(xine, XINE_VERBOSITY_DEBUG, "load_plugins: no post plugin named %s found\n", name); return NULL; } diff --git a/src/xine-engine/lrb.c b/src/xine-engine/lrb.c index 63072472b..c13a4dee1 100644 --- a/src/xine-engine/lrb.c +++ b/src/xine-engine/lrb.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: lrb.c,v 1.4 2003/02/28 02:51:51 storri Exp $ + * $Id: lrb.c,v 1.5 2003/12/05 15:55:04 f1rmb Exp $ * */ @@ -79,7 +79,7 @@ void lrb_add (lrb_t *this, buf_element_t *buf) { this->cur_num_entries++; } - printf ("lrb: %d elements in buffer\n", this->cur_num_entries); + lprintf ("lrb: %d elements in buffer\n", this->cur_num_entries); } @@ -106,7 +106,7 @@ void lrb_feedback (lrb_t *this, fifo_buffer_t *fifo) { this->cur_num_entries--; - printf ("lrb: feedback\n"); + lprintf ("lrb: feedback\n"); } diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c index 1f8b5eee5..5d2996fe6 100644 --- a/src/xine-engine/metronom.c +++ b/src/xine-engine/metronom.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: metronom.c,v 1.131 2003/11/26 23:44:10 f1rmb Exp $ + * $Id: metronom.c,v 1.132 2003/12/05 15:55:04 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -174,7 +174,7 @@ static void unixscr_exit (scr_plugin_t *scr) { static scr_plugin_t* unixscr_init () { unixscr_t *this; - this = malloc(sizeof(*this)); + this = (unixscr_t *) xine_xmalloc(sizeof(unixscr_t)); memset(this, 0, sizeof(*this)); this->scr.interface_version = 2; @@ -907,7 +907,7 @@ metronom_t * _x_metronom_init (int have_video, int have_audio, xine_t *xine) { metronom_clock_t *_x_metronom_clock_init(xine_t *xine) { - metronom_clock_t *this = (metronom_clock_t *)malloc(sizeof(metronom_clock_t)); + metronom_clock_t *this = (metronom_clock_t *) xine_xmalloc(sizeof(metronom_clock_t)); int err; this->set_option = metronom_clock_set_option; diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c index 478f5f772..d4fd58d94 100644 --- a/src/xine-engine/osd.c +++ b/src/xine-engine/osd.c @@ -596,8 +596,8 @@ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) { known_font->loaded = 1; known_font->fontchar = font->fontchar; } else { - printf("font '%s-%d' already loaded, weird.\n", - font->name, font->size); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("font '%s-%d' already loaded, weird.\n"), font->name, font->size); while( --i >= 0 ) { free(font->fontchar[i].bmp); } @@ -607,9 +607,9 @@ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) { } } else { - - printf("font '%s' loading failed (%d < %d)\n",font->name, - i, font->num_fontchars); + + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("font '%s' loading failed (%d < %d)\n") ,font->name, i, font->num_fontchars); while( --i >= 0 ) { free(font->fontchar[i].bmp); @@ -618,8 +618,8 @@ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) { free(font); } } else { - printf("wrong version for font '%s'. expected %d found %d.\n",font->name, - font->version, FONT_VERSION); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("wrong version for font '%s'. expected %d found %d.\n"), font->name, font->version, FONT_VERSION); free(font); } gzclose(fp); @@ -732,7 +732,8 @@ static int osd_set_font( osd_object_t *osd, const char *fontname, int size) { if (!osd->ft2) { osd->ft2 = xine_xmalloc(sizeof(osd_ft2context_t)); if(FT_Init_FreeType( &osd->ft2->library )) { - printf("osd: cannot initialize ft2 library\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("osd: cannot initialize ft2 library\n")); free(osd->ft2); osd->ft2 = NULL; } @@ -747,13 +748,15 @@ static int osd_set_font( osd_object_t *osd, const char *fontname, int size) { sprintf(pathname, "%s/%s", XINE_FONTDIR, fontname); if (FT_New_Face(osd->ft2->library, pathname, 0, &osd->ft2->face)) { error_flag = 1; - printf("osd: error loading font %s with ft2\n", fontname); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("osd: error loading font %s with ft2\n"), fontname); } } } if (!error_flag) { if (FT_Set_Pixel_Sizes(osd->ft2->face, 0, size)) { - printf("osd: error setting font size (no scalable font?)\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("osd: error setting font size (no scalable font?)\n")); } else { ret = 1; osd->ft2->useme = 1; @@ -814,7 +817,8 @@ static int osd_search(osd_fontchar_t *array, size_t n, uint16_t code) { /* * get next unicode value */ -static uint16_t osd_iconv_getunicode(iconv_t *cd, const char *encoding, char **inbuf, size_t *inbytesleft) { +static uint16_t osd_iconv_getunicode(xine_t *xine, + iconv_t *cd, const char *encoding, char **inbuf, size_t *inbytesleft) { uint16_t unicode; char *outbuf = (char*)&unicode; size_t outbytesleft = 2; @@ -825,8 +829,9 @@ static uint16_t osd_iconv_getunicode(iconv_t *cd, const char *encoding, char **i count = iconv(cd, inbuf, inbytesleft, &outbuf, &outbytesleft); if (count == (size_t)-1 && errno != E2BIG) { /* unknown character or character wider than 16 bits, try skip one byte */ - printf(_("osd: unknown sequence starting with byte 0x%02X" - " in encoding \"%s\", skipping\n"), (*inbuf)[0] & 0xFF, encoding); + xprintf(xine, XINE_VERBOSITY_LOG, + _("osd: unknown sequence starting with byte 0x%02X in encoding \"%s\", skipping\n"), + (*inbuf)[0] & 0xFF, encoding); if (*inbytesleft) { (*inbytesleft)--; (*inbuf)++; @@ -876,7 +881,8 @@ static int osd_set_encoding (osd_object_t *osd, const char *encoding) { if (!encoding[0]) { #ifdef HAVE_LANGINFO_CODESET if ((encoding = nl_langinfo(CODESET)) == NULL) { - printf(_("osd: can't find out current locale character set\n")); + xprintf(osd->renderer->stream->xine, XINE_VERBOSITY_LOG, + _("osd: can't find out current locale character set\n")); return 0; } #else @@ -886,8 +892,8 @@ static int osd_set_encoding (osd_object_t *osd, const char *encoding) { /* prepare conversion to UCS-2 */ if ((osd->cd = iconv_open("UCS-2", encoding)) == (iconv_t)-1) { - printf(_("osd: unsupported conversion %s -> UCS-2, " - "no conversion performed\n"), encoding); + xprintf(osd->renderer->stream->xine, XINE_VERBOSITY_LOG, + _("osd: unsupported conversion %s -> UCS-2, no conversion performed\n"), encoding); return 0; } @@ -935,7 +941,7 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1, #endif if (proceed == 0) { - printf(_("osd: font isn't defined\n")); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("osd: font isn't defined\n")); pthread_mutex_unlock(&this->osd_mutex); return 0; } @@ -949,7 +955,7 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1, while( inbytesleft ) { #ifndef _MSC_VER - unicode = osd_iconv_getunicode(osd->cd, osd->encoding, + unicode = osd_iconv_getunicode(this->stream->xine, osd->cd, osd->encoding, (char **)&inbuf, &inbytesleft); #else unicode = inbuf[0]; @@ -979,13 +985,13 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1, FT_GlyphSlot slot = osd->ft2->face->glyph; if (FT_Load_Glyph(osd->ft2->face, i, FT_LOAD_DEFAULT)) { - printf("osd: error loading glyph\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("osd: error loading glyph\n")); continue; } if (slot->format != ft_glyph_format_bitmap) { if (FT_Render_Glyph(osd->ft2->face->glyph, ft_render_mode_normal)) - printf("osd: error in rendering glyph\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("osd: error in rendering glyph\n")); } dst = osd->area + y1 * osd->width + x1; @@ -1078,7 +1084,7 @@ static int osd_get_text_size(osd_object_t *osd, const char *text, int *width, in #endif if (proceed == 0) { - printf(_("osd: font isn't defined\n")); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("osd: font isn't defined\n")); pthread_mutex_unlock(&this->osd_mutex); return 0; } @@ -1092,7 +1098,7 @@ static int osd_get_text_size(osd_object_t *osd, const char *text, int *width, in while( inbytesleft ) { #ifndef _MSC_VER - unicode = osd_iconv_getunicode(osd->cd, osd->encoding, + unicode = osd_iconv_getunicode(this->stream->xine, osd->cd, osd->encoding, (char **)&inbuf, &inbytesleft); #else unicode = inbuf[0]; @@ -1108,14 +1114,14 @@ static int osd_get_text_size(osd_object_t *osd, const char *text, int *width, in i = FT_Get_Char_Index( osd->ft2->face, unicode); if (FT_Load_Glyph(osd->ft2->face, i, FT_LOAD_DEFAULT)) { - printf("osd: error loading glyph %i\n", i); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("osd: error loading glyph %i\n"), i); text++; continue; } if (slot->format != ft_glyph_format_bitmap) { if (FT_Render_Glyph(osd->ft2->face->glyph, ft_render_mode_normal)) - printf("osd: error in rendering\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("osd: error in rendering\n")); } if (first) *width += slot->bitmap_left; first = 0; diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index f4226a7d5..49c115869 100644 --- a/src/xine-engine/video_decoder.c +++ b/src/xine-engine/video_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_decoder.c,v 1.141 2003/11/26 19:43:38 f1rmb Exp $ + * $Id: video_decoder.c,v 1.142 2003/12/05 15:55:05 f1rmb Exp $ * */ @@ -302,8 +302,7 @@ static void *video_decoder_loop (void *stream_gen) { if (buf->type != buftype_unknown && !_x_stream_info_get(stream, XINE_STREAM_INFO_VIDEO_HANDLED)) { xine_log (stream->xine, XINE_LOG_MSG, - "video_decoder: no plugin available to handle '%s'\n", - _x_buf_video_name( buf->type ) ); + _("video_decoder: no plugin available to handle '%s'\n"), _x_buf_video_name( buf->type ) ); if( !_x_meta_info_get(stream, XINE_META_INFO_VIDEOCODEC)) _x_meta_info_set(stream, XINE_META_INFO_VIDEOCODEC, _x_buf_video_name( buf->type )); @@ -368,8 +367,7 @@ static void *video_decoder_loop (void *stream_gen) { } else if (buf->type != buftype_unknown) { xine_log (stream->xine, XINE_LOG_MSG, - "video_decoder: error, unknown buffer type: %08x\n", - buf->type ); + _("video_decoder: error, unknown buffer type: %08x\n"), buf->type ); buftype_unknown = buf->type; } diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index 4073690cf..7c835288e 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out.c,v 1.182 2003/11/26 23:44:11 f1rmb Exp $ + * $Id: video_out.c,v 1.183 2003/12/05 15:55:05 f1rmb Exp $ * * frame allocation / queuing / scheduling / output functions */ @@ -614,8 +614,7 @@ static void expire_frames (vos_t *this, int64_t cur_vpts) { if( !this->discard_frames ) { xine_log(this->xine, XINE_LOG_MSG, - _("video_out: throwing away image with pts %lld because " - "it's too old (diff : %lld).\n"), pts, diff); + _("video_out: throwing away image with pts %lld because it's too old (diff : %lld).\n"), pts, diff); this->num_frames_discarded++; } @@ -997,8 +996,8 @@ static void *video_out_loop (void *this_gen) { lprintf ("%lld usec to sleep at master vpts %lld\n", usec_to_sleep, vpts); if ( (next_frame_vpts - vpts) > 2*90000 ) - printf("video_out: vpts/clock error, next_vpts=%lld cur_vpts=%lld\n", - next_frame_vpts,vpts); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out: vpts/clock error, next_vpts=%lld cur_vpts=%lld\n", next_frame_vpts,vpts); if (usec_to_sleep>0) xine_usec_sleep (usec_to_sleep); @@ -1070,9 +1069,9 @@ int xine_get_next_video_frame (xine_video_port_t *this_gen, pthread_mutex_lock(&this->display_img_buf_queue->mutex); img = this->display_img_buf_queue->first; - printf ("video_out: get_next_video_frame demux status = %d, fifo_size=%d\n", - stream->demux_plugin->get_status (stream->demux_plugin), - stream->video_fifo->fifo_size); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out: get_next_video_frame demux status = %d, fifo_size=%d\n", + stream->demux_plugin->get_status (stream->demux_plugin), stream->video_fifo->fifo_size); } @@ -1457,7 +1456,7 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, this->last_frame = NULL; this->img_backup = NULL; - this->overlay_source = _x_video_overlay_new_manager(); + this->overlay_source = _x_video_overlay_new_manager(xine); this->overlay_source->init (this->overlay_source); this->overlay_enabled = 1; @@ -1529,14 +1528,14 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, if ((err = pthread_create (&this->video_thread, &pth_attrs, video_out_loop, this)) != 0) { - printf (_("video_out: can't create thread (%s)\n"), - strerror(err)); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out: can't create thread (%s)\n", strerror(err)); /* FIXME: how does this happen ? */ - printf (_("video_out: sorry, this should not happen. please restart xine.\n")); + xprintf (this->xine, XINE_VERBOSITY_LOG, + _("video_out: sorry, this should not happen. please restart xine.\n")); abort(); } else - xprintf(xine, XINE_VERBOSITY_DEBUG, "video_out: thread created\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out: thread created\n"); pthread_attr_destroy(&pth_attrs); } diff --git a/src/xine-engine/video_overlay.c b/src/xine-engine/video_overlay.c index f8b05589c..9a1e2f7e7 100644 --- a/src/xine-engine/video_overlay.c +++ b/src/xine-engine/video_overlay.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_overlay.c,v 1.32 2003/11/11 18:45:01 f1rmb Exp $ + * $Id: video_overlay.c,v 1.33 2003/12/05 15:55:05 f1rmb Exp $ * */ @@ -59,6 +59,7 @@ typedef struct video_overlay_s { pthread_mutex_t showing_mutex; video_overlay_showing_t showing[MAX_SHOWING]; int showing_changed; + xine_t *xine; } video_overlay_t; @@ -80,7 +81,7 @@ static void add_showing_handle( video_overlay_t *this, int32_t handle ) if( i != MAX_SHOWING ) this->showing[i].handle = handle; else - printf("video_overlay: error: no showing slots available\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_overlay: error: no showing slots available\n"); } pthread_mutex_unlock( &this->showing_mutex ); @@ -275,7 +276,7 @@ static int32_t video_overlay_add_event(video_overlay_manager_t *this_gen, void /* memcpy everything except the actual image */ if ( this->events[new_event].event == NULL ) { - printf("video_overlay: error: event slot is NULL!\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_overlay: error: event slot is NULL!\n"); } this->events[new_event].event->event_type=event->event_type; this->events[new_event].event->vpts=event->vpts; @@ -283,7 +284,7 @@ static int32_t video_overlay_add_event(video_overlay_manager_t *this_gen, void this->events[new_event].event->object.pts=event->object.pts; if ( this->events[new_event].event->object.overlay ) { - printf("video_overlay: add_event: event->object.overlay was not freed!\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_overlay: add_event: event->object.overlay was not freed!\n"); } if( event->object.overlay ) { @@ -298,7 +299,7 @@ static int32_t video_overlay_add_event(video_overlay_manager_t *this_gen, void this->events[new_event].event->object.overlay = NULL; } } else { - printf("video_overlay:No spare subtitle event slots\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_overlay:No spare subtitle event slots\n"); new_event = -1; } @@ -370,7 +371,7 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) { this->objects[handle].handle = handle; if( this->objects[handle].overlay ) { - printf("video_overlay: error: object->overlay was not freed!\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_overlay: error: object->overlay was not freed!\n"); } this->objects[handle].overlay = this->events[this_event].event->object.overlay; @@ -423,7 +424,8 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) { * that this is not necessary and causes problems with some DVDs */ if ( (this->events[this_event].event->object.pts != this->objects[handle].pts) ) { - printf ("video_overlay:MENU BUTTON DROPPED menu pts=%lld spu pts=%lld\n", + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_overlay:MENU BUTTON DROPPED menu pts=%lld spu pts=%lld\n", this->events[this_event].event->object.pts, this->objects[handle].pts); break; @@ -456,11 +458,11 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) { #endif add_showing_handle( this, handle ); } else { - printf ("video_overlay:overlay not present\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_overlay:overlay not present\n"); } if( this->events[this_event].event->object.overlay->rle ) { - printf ("video_overlay: warning EVENT_MENU_BUTTON with rle data\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_overlay: warning EVENT_MENU_BUTTON with rle data\n"); free( this->events[this_event].event->object.overlay->rle ); this->events[this_event].event->object.overlay->rle = NULL; } @@ -472,7 +474,7 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) { break; default: - printf ("video_overlay: unhandled event type\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_overlay: unhandled event type\n"); break; } @@ -575,12 +577,13 @@ static void video_overlay_dispose(video_overlay_manager_t *this_gen) { } -video_overlay_manager_t *_x_video_overlay_new_manager (void) { +video_overlay_manager_t *_x_video_overlay_new_manager (xine_t *xine) { video_overlay_t *this; this = (video_overlay_t *) xine_xmalloc (sizeof (video_overlay_t)); + this->xine = xine; this->video_overlay.init = video_overlay_init; this->video_overlay.dispose = video_overlay_dispose; this->video_overlay.get_handle = video_overlay_get_handle; diff --git a/src/xine-engine/video_overlay.h b/src/xine-engine/video_overlay.h index fbe133c75..d6e868357 100644 --- a/src/xine-engine/video_overlay.h +++ b/src/xine-engine/video_overlay.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_overlay.h,v 1.16 2003/11/11 18:45:01 f1rmb Exp $ + * $Id: video_overlay.h,v 1.17 2003/12/05 15:55:05 f1rmb Exp $ * */ @@ -101,6 +101,6 @@ typedef struct video_overlay_event_s { video_overlay_object_t object; /* The image data. */ } video_overlay_event_t; -video_overlay_manager_t *_x_video_overlay_new_manager(void); +video_overlay_manager_t *_x_video_overlay_new_manager(xine_t *); #endif diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 73a968cb2..68e1f4c43 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine.c,v 1.273 2003/11/26 23:44:11 f1rmb Exp $ + * $Id: xine.c,v 1.274 2003/12/05 15:55:05 f1rmb Exp $ */ /* @@ -539,8 +539,7 @@ static int __open_internal (xine_stream_t *stream, const char *mrl) { */ if ((stream->input_plugin = _x_find_input_plugin (stream, input_source))) { - xine_log (stream->xine, XINE_LOG_MSG, - "xine: found input plugin : %s\n", + xine_log (stream->xine, XINE_LOG_MSG, _("xine: found input plugin : %s\n"), stream->input_plugin->input_class->get_description(stream->input_plugin->input_class)); if (stream->input_plugin->input_class->eject_media) stream->eject_class = stream->input_plugin->input_class; @@ -548,8 +547,7 @@ static int __open_internal (xine_stream_t *stream, const char *mrl) { (stream->input_plugin->input_class->get_identifier (stream->input_plugin->input_class))); if (!stream->input_plugin->open(stream->input_plugin)) { - xine_log (stream->xine, XINE_LOG_MSG, - _("xine: input plugin cannot open MRL [%s]\n"),mrl); + xine_log (stream->xine, XINE_LOG_MSG, _("xine: input plugin cannot open MRL [%s]\n"),mrl); stream->input_plugin->dispose(stream->input_plugin); stream->input_plugin = NULL; stream->err = XINE_ERROR_INPUT_FAILED; @@ -567,8 +565,7 @@ static int __open_internal (xine_stream_t *stream, const char *mrl) { } if (!stream->input_plugin) { - xine_log (stream->xine, XINE_LOG_MSG, - _("xine: cannot find input plugin for MRL [%s]\n"),mrl); + xine_log (stream->xine, XINE_LOG_MSG, _("xine: cannot find input plugin for MRL [%s]\n"),mrl); stream->err = XINE_ERROR_NO_INPUT_PLUGIN; return 0; } @@ -593,8 +590,7 @@ static int __open_internal (xine_stream_t *stream, const char *mrl) { } __mrl_unescape(demux_name); if (!(stream->demux_plugin = _x_find_demux_plugin_by_name(stream, demux_name, stream->input_plugin))) { - xine_log(stream->xine, XINE_LOG_MSG, - _("xine: specified demuxer %s failed to start\n"), demux_name); + xine_log(stream->xine, XINE_LOG_MSG, _("xine: specified demuxer %s failed to start\n"), demux_name); stream->err = XINE_ERROR_NO_DEMUX_PLUGIN; stream->status = XINE_STATUS_STOP; free(demux_name); @@ -605,7 +601,7 @@ static int __open_internal (xine_stream_t *stream, const char *mrl) { (stream->demux_plugin->demux_class->get_identifier(stream->demux_plugin->demux_class))); free(demux_name); } else { - printf("xine: error while parsing mrl\n"); + xprintf(stream->xine, XINE_VERBOSITY_LOG, _("xine: error while parsing mrl\n")); stream->err = XINE_ERROR_MALFORMED_MRL; stream->status = XINE_STATUS_STOP; return 0; @@ -630,20 +626,19 @@ static int __open_internal (xine_stream_t *stream, const char *mrl) { filename[strlen(tmp)] = '\0'; } - xine_log(stream->xine, XINE_LOG_MSG, - _("xine: join rip input plugin\n")); + xine_log(stream->xine, XINE_LOG_MSG, _("xine: join rip input plugin\n")); input_saver = _x_rip_plugin_get_instance (stream, filename); if( input_saver ) { stream->input_plugin = input_saver; } else { - printf("xine: error opening rip input plugin instance\n"); + xprintf(stream->xine, XINE_VERBOSITY_LOG, _("xine: error opening rip input plugin instance\n")); stream->err = XINE_ERROR_MALFORMED_MRL; stream->status = XINE_STATUS_STOP; return 0; } } else { - printf("xine: error while parsing mrl\n"); + xprintf(stream->xine, XINE_VERBOSITY_LOG, _("xine: error while parsing mrl\n")); stream->err = XINE_ERROR_MALFORMED_MRL; stream->status = XINE_STATUS_STOP; return 0; @@ -667,8 +662,7 @@ static int __open_internal (xine_stream_t *stream, const char *mrl) { } __mrl_unescape(demux_name); if (!(stream->demux_plugin = _x_find_demux_plugin_last_probe(stream, demux_name, stream->input_plugin))) { - xine_log(stream->xine, XINE_LOG_MSG, - _("xine: last_probed demuxer %s failed to start\n"), demux_name); + xine_log(stream->xine, XINE_LOG_MSG, _("xine: last_probed demuxer %s failed to start\n"), demux_name); stream->err = XINE_ERROR_NO_DEMUX_PLUGIN; stream->status = XINE_STATUS_STOP; free(demux_name); @@ -680,7 +674,7 @@ static int __open_internal (xine_stream_t *stream, const char *mrl) { (stream->demux_plugin->demux_class->get_identifier(stream->demux_plugin->demux_class))); free(demux_name); } else { - printf("xine: error while parsing mrl\n"); + xprintf(stream->xine, XINE_VERBOSITY_LOG, _("xine: error while parsing mrl\n")); stream->err = XINE_ERROR_MALFORMED_MRL; stream->status = XINE_STATUS_STOP; return 0; @@ -692,12 +686,12 @@ static int __open_internal (xine_stream_t *stream, const char *mrl) { if (*stream_setup == ';' || *stream_setup == '\0') { _x_stream_info_set(stream, XINE_STREAM_INFO_IGNORE_VIDEO, 1); } else { - printf("xine: error while parsing mrl\n"); + xprintf(stream->xine, XINE_VERBOSITY_LOG, _("xine: error while parsing mrl\n")); stream->err = XINE_ERROR_MALFORMED_MRL; stream->status = XINE_STATUS_STOP; return 0; } - xprintf (stream->xine, XINE_VERBOSITY_LOG, "ignoring video\n"); + xprintf (stream->xine, XINE_VERBOSITY_LOG, _("ignoring video\n")); continue; } if (strncasecmp(stream_setup, "noaudio", 7) == 0) { @@ -705,12 +699,12 @@ static int __open_internal (xine_stream_t *stream, const char *mrl) { if (*stream_setup == ';' || *stream_setup == '\0') { _x_stream_info_set(stream, XINE_STREAM_INFO_IGNORE_AUDIO, 1); } else { - printf("xine: error while parsing mrl\n"); + xprintf(stream->xine, XINE_VERBOSITY_LOG, _("xine: error while parsing mrl\n")); stream->err = XINE_ERROR_MALFORMED_MRL; stream->status = XINE_STATUS_STOP; return 0; } - xprintf (stream->xine, XINE_VERBOSITY_LOG, "ignoring audio\n"); + xprintf (stream->xine, XINE_VERBOSITY_LOG, _("ignoring audio\n")); continue; } if (strncasecmp(stream_setup, "nospu", 5) == 0) { @@ -718,12 +712,12 @@ static int __open_internal (xine_stream_t *stream, const char *mrl) { if (*stream_setup == ';' || *stream_setup == '\0') { _x_stream_info_set(stream, XINE_STREAM_INFO_IGNORE_SPU, 1); } else { - printf("xine: error while parsing mrl\n"); + xprintf(stream->xine, XINE_VERBOSITY_LOG, _("xine: error while parsing mrl\n")); stream->err = XINE_ERROR_MALFORMED_MRL; stream->status = XINE_STATUS_STOP; return 0; } - xprintf (stream->xine, XINE_VERBOSITY_LOG, "ignoring subpicture\n"); + xprintf (stream->xine, XINE_VERBOSITY_LOG, _("ignoring subpicture\n")); continue; } if (strncasecmp(stream_setup, "volume", 6) == 0) { @@ -744,7 +738,7 @@ static int __open_internal (xine_stream_t *stream, const char *mrl) { xine_set_param(stream, XINE_PARAM_AUDIO_VOLUME, atoi(volume)); free(volume); } else { - printf("xine: error while parsing mrl\n"); + xprintf(stream->xine, XINE_VERBOSITY_LOG, _("xine: error while parsing mrl\n")); stream->err = XINE_ERROR_MALFORMED_MRL; stream->status = XINE_STATUS_STOP; return 0; @@ -769,7 +763,7 @@ static int __open_internal (xine_stream_t *stream, const char *mrl) { xine_set_param(stream, XINE_PARAM_AUDIO_COMPR_LEVEL, atoi(compression)); free(compression); } else { - printf("xine: error while parsing mrl\n"); + xprintf(stream->xine, XINE_VERBOSITY_LOG, _("xine: error while parsing mrl\n")); stream->err = XINE_ERROR_MALFORMED_MRL; stream->status = XINE_STATUS_STOP; return 0; @@ -794,17 +788,17 @@ static int __open_internal (xine_stream_t *stream, const char *mrl) { stream->slave = xine_stream_new (stream->xine, NULL, stream->video_out ); stream->slave_affection = XINE_MASTER_SLAVE_PLAY | XINE_MASTER_SLAVE_STOP; if( xine_open( stream->slave, subtitle_mrl ) ) { - xprintf (stream->xine, XINE_VERBOSITY_LOG, "subtitle mrl opened '%s'\n", subtitle_mrl); + xprintf (stream->xine, XINE_VERBOSITY_LOG, _("subtitle mrl opened '%s'\n"), subtitle_mrl); stream->slave->master = stream; stream->slave_is_subtitle = 1; } else { - printf("xine: error opening subtitle mrl\n"); + xprintf(stream->xine, XINE_VERBOSITY_LOG, _("xine: error opening subtitle mrl\n")); xine_dispose( stream->slave ); stream->slave = NULL; } free(subtitle_mrl); } else { - printf("xine: error while parsing mrl\n"); + xprintf(stream->xine, XINE_VERBOSITY_LOG, _("xine: error while parsing mrl\n")); stream->err = XINE_ERROR_MALFORMED_MRL; stream->status = XINE_STATUS_STOP; return 0; @@ -830,12 +824,10 @@ static int __open_internal (xine_stream_t *stream, const char *mrl) { if (retval <= 0) { if (retval == 0) { /* the option not found */ - xine_log(stream->xine, XINE_LOG_MSG, - _("xine: error while parsing MRL\n")); + xine_log(stream->xine, XINE_LOG_MSG, _("xine: error while parsing MRL\n")); } else { /* not permitted to change from MRL */ - xine_log(stream->xine, XINE_LOG_MSG, - _("xine: changing option '%s' from MRL isn't permitted\n"), + xine_log(stream->xine, XINE_LOG_MSG, _("xine: changing option '%s' from MRL isn't permitted\n"), config_entry); } stream->err = XINE_ERROR_MALFORMED_MRL; @@ -855,8 +847,7 @@ static int __open_internal (xine_stream_t *stream, const char *mrl) { * find a demux plugin */ if (!(stream->demux_plugin = _x_find_demux_plugin (stream, stream->input_plugin))) { - xine_log (stream->xine, XINE_LOG_MSG, - _("xine: couldn't find demux for >%s<\n"), mrl); + xine_log (stream->xine, XINE_LOG_MSG, _("xine: couldn't find demux for >%s<\n"), mrl); stream->err = XINE_ERROR_NO_DEMUX_PLUGIN; stream->status = XINE_STATUS_STOP; @@ -872,8 +863,7 @@ static int __open_internal (xine_stream_t *stream, const char *mrl) { (stream->demux_plugin->demux_class->get_identifier(stream->demux_plugin->demux_class))); } - xine_log (stream->xine, XINE_LOG_MSG, - "xine: found demuxer plugin: %s\n", + xine_log (stream->xine, XINE_LOG_MSG, _("xine: found demuxer plugin: %s\n"), stream->demux_plugin->demux_class->get_description(stream->demux_plugin->demux_class)); _x_extra_info_reset( stream->current_extra_info ); @@ -893,8 +883,7 @@ static int __open_internal (xine_stream_t *stream, const char *mrl) { stream->demux_plugin->send_headers (stream->demux_plugin); if (stream->demux_plugin->get_status(stream->demux_plugin) != DEMUX_OK) { - xine_log (stream->xine, XINE_LOG_MSG, - _("xine: demuxer failed to start\n")); + xine_log (stream->xine, XINE_LOG_MSG, _("xine: demuxer failed to start\n")); stream->demux_plugin->dispose (stream->demux_plugin); stream->demux_plugin = NULL; @@ -949,8 +938,7 @@ static int __play_internal (xine_stream_t *stream, int start_pos, int start_time xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "xine_play\n"); if (!stream->demux_plugin) { - xine_log (stream->xine, XINE_LOG_MSG, - _("xine_play: no demux available\n")); + xine_log (stream->xine, XINE_LOG_MSG, _("xine_play: no demux available\n")); stream->err = XINE_ERROR_NO_DEMUX_PLUGIN; return 0; @@ -1020,8 +1008,7 @@ static int __play_internal (xine_stream_t *stream, int start_pos, int start_time pthread_mutex_unlock( &stream->demux_lock ); if (demux_status != DEMUX_OK) { - xine_log (stream->xine, XINE_LOG_MSG, - _("xine_play: demux failed to start\n")); + xine_log (stream->xine, XINE_LOG_MSG, _("xine_play: demux failed to start\n")); stream->err = XINE_ERROR_DEMUX_FAILED; stream->first_frame_flag = 0; @@ -1179,10 +1166,8 @@ xine_t *xine_new (void) { #endif /* WIN32 */ this = xine_xmalloc (sizeof (xine_t)); - if (!this) { - printf ("xine: failed to malloc xine_t\n"); + if (!this) abort(); - } #ifdef ENABLE_NLS /* @@ -1278,7 +1263,7 @@ static void __config_save_cb (void *this_gen, xine_cfg_entry_t *entry) { xine_stream_t *stream; xine_log(this, XINE_LOG_MSG, - _("xine: The specified save_dir \"%s\" might be a security risk.\n"), entry->str_value); + _("xine: The specified save_dir \"%s\" might be a security risk.\n"), entry->str_value); pthread_mutex_lock(&this->streams_lock); if ((stream = (xine_stream_t *)xine_list_first_content(this->streams))) @@ -1298,7 +1283,7 @@ void xine_init (xine_t *this) { init_yuv_conversion(); /* probe for optimized memcpy or config setting */ - xine_probe_fast_memcpy (this->config); + xine_probe_fast_memcpy (this); /* * plugins @@ -1308,7 +1293,7 @@ void xine_init (xine_t *this) { #ifdef HAVE_SETLOCALE if (!setlocale(LC_CTYPE, "")) - printf("xine: locale not supported by C library\n"); + xprintf(this, XINE_VERBOSITY_LOG, _("xine: locale not supported by C library\n")); #endif /* @@ -1519,8 +1504,8 @@ int xine_get_current_frame (xine_stream_t *stream, int *width, int *height, break; default: - printf ("xine: error, snapshot function not implemented for format 0x%x\n", - frame->format); + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, + "xine: error, snapshot function not implemented for format 0x%x\n", frame->format); abort (); } } @@ -1534,7 +1519,7 @@ int xine_get_video_frame (xine_stream_t *stream, int *duration, /* msec */ int *format, uint8_t *img) { - printf ("xine: xine_get_video_frame not implemented yet.\n"); + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "xine: xine_get_video_frame not implemented yet.\n"); abort (); return 0; } diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c index d392d668f..0003eaea8 100644 --- a/src/xine-engine/xine_interface.c +++ b/src/xine-engine/xine_interface.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_interface.c,v 1.70 2003/11/26 14:10:57 miguelfreitas Exp $ + * $Id: xine_interface.c,v 1.71 2003/12/05 15:55:05 f1rmb Exp $ * * convenience/abstraction layer, functions to implement * libxine's public interface @@ -277,8 +277,8 @@ void xine_config_update_entry (xine_t *this, const xine_cfg_entry_t *entry) { break; default: - printf ("xine_interface: error, unknown config entry type %d\n", - entry->type); + xprintf (this, XINE_VERBOSITY_DEBUG, + "xine_interface: error, unknown config entry type %d\n", entry->type); abort(); } } @@ -439,7 +439,7 @@ void xine_set_param (xine_stream_t *stream, int param, int value) { break; default: - printf ("xine_interface: unknown param %d\n", param); + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "xine_interface: unknown param %d\n", param); } } @@ -536,7 +536,7 @@ int xine_get_param (xine_stream_t *stream, int param) { break; default: - printf ("xine_interface: unknown param %d\n", param); + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, "xine_interface: unknown param %d\n", param); } return 0; @@ -587,7 +587,8 @@ uint32_t xine_get_stream_info (xine_stream_t *stream, int info) { return stream->spu_track_map_entries; default: - fprintf (stderr, "xine_interface: error, unknown stream info (%d) requested\n", info); + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, + "xine_interface: error, unknown stream info (%d) requested\n", info); } return 0; } diff --git a/src/xine-utils/memcpy.c b/src/xine-utils/memcpy.c index ca6c4444a..a75904fce 100644 --- a/src/xine-utils/memcpy.c +++ b/src/xine-utils/memcpy.c @@ -435,10 +435,10 @@ static uint64_t rdtsc(int config_flags) } #endif -static void update_fast_memcpy(void *this_gen, xine_cfg_entry_t *entry) { - static int config_flags = -1; - - int method; +static void update_fast_memcpy(void *user_data, xine_cfg_entry_t *entry) { + static int config_flags = -1; + xine_t *xine = (xine_t *) user_data; + int method; config_flags = xine_mm_accel(); @@ -451,19 +451,18 @@ static void update_fast_memcpy(void *this_gen, xine_cfg_entry_t *entry) { xine_fast_memcpy = memcpy_method[method].function; return; } else { - printf("xine: will probe memcpy on startup\n" ); + xprintf(xine, XINE_VERBOSITY_DEBUG, "xine: will probe memcpy on startup\n" ); } } #define BUFSIZE 1024*1024 -void xine_probe_fast_memcpy(config_values_t *config) +void xine_probe_fast_memcpy(xine_t *xine) { - uint64_t t; - - char *buf1, *buf2; - int i, j, best; - int config_flags = -1; - static char *memcpy_methods[] = { + uint64_t t; + char *buf1, *buf2; + int i, j, best; + int config_flags = -1; + static char *memcpy_methods[] = { "probe", "glibc", #if defined(ARCH_X86) && !defined(_MSC_VER) "kernel", "mmx", "mmxext", "sse", @@ -473,13 +472,13 @@ void xine_probe_fast_memcpy(config_values_t *config) #endif NULL }; - + config_flags = xine_mm_accel(); - best = config->register_enum (config, "misc.memcpy_method", 0, - memcpy_methods, - _("Memcopy method to use in xine for large data chunks."), - NULL, 20, update_fast_memcpy, NULL); + best = xine->config->register_enum (xine->config, "misc.memcpy_method", 0, + memcpy_methods, + _("Memcopy method to use in xine for large data chunks."), + NULL, 20, update_fast_memcpy, (void *) xine); /* check if function is configured and valid for this machine */ if( best != 0 && @@ -502,7 +501,7 @@ void xine_probe_fast_memcpy(config_values_t *config) return; } - printf("Benchmarking memcpy methods (smaller is better):\n"); + xprintf(xine, XINE_VERBOSITY_LOG, _("Benchmarking memcpy methods (smaller is better):\n")); /* make sure buffers are present on physical memory */ memset(buf1,0,BUFSIZE); memset(buf2,0,BUFSIZE); @@ -522,13 +521,13 @@ void xine_probe_fast_memcpy(config_values_t *config) t = rdtsc(config_flags) - t; memcpy_method[i].time = t; - printf("\t%s : %lld\n",memcpy_method[i].name, t); + xprintf(xine, XINE_VERBOSITY_LOG, "\t%s : %lld\n", memcpy_method[i].name, t); if( best == 0 || t < memcpy_method[best].time ) best = i; } - config->update_num (config, "misc.memcpy_method", best); + xine->config->update_num (xine->config, "misc.memcpy_method", best); free(buf1); free(buf2); diff --git a/src/xine-utils/xine_buffer.c b/src/xine-utils/xine_buffer.c index 42623895b..d99adbc49 100644 --- a/src/xine-utils/xine_buffer.c +++ b/src/xine-utils/xine_buffer.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_buffer.c,v 1.5 2003/11/26 19:43:38 f1rmb Exp $ + * $Id: xine_buffer.c,v 1.6 2003/12/05 15:55:05 f1rmb Exp $ * * * generic dynamic buffer functions. The goals @@ -211,7 +211,7 @@ void xine_buffer_copyout(void *buf, int index, void *data, int len) { if (GET_HEADER(buf)->size < index+len) { - printf("xine_buffer_copyout: warning: attempt to read over boundary!\n"); + lprintf("xine_buffer_copyout: warning: attempt to read over boundary!\n"); if (GET_HEADER(buf)->size < index) return; len = GET_HEADER(buf)->size - index; diff --git a/src/xine-utils/xine_check.c b/src/xine-utils/xine_check.c index ccd3a6424..e4ddb4622 100644 --- a/src/xine-utils/xine_check.c +++ b/src/xine-utils/xine_check.c @@ -82,10 +82,8 @@ static void set_hc_result(xine_health_check_t* hc, int state, char *format, ...) size = strlen(format) + 1; - if ((buf = malloc(size)) == NULL) { - printf ("xine_check: GASP, malloc() failed\n"); + if (!(buf = xine_xmalloc(size))) abort(); - } while(1) { va_start(args, format); diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index 313e23fc4..989a4b9cb 100644 --- a/src/xine-utils/xineutils.h +++ b/src/xine-utils/xineutils.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xineutils.h,v 1.67 2003/12/04 22:15:26 jstembridge Exp $ + * $Id: xineutils.h,v 1.68 2003/12/05 15:55:05 f1rmb Exp $ * */ #ifndef XINEUTILS_H @@ -596,7 +596,7 @@ extern void *(* xine_fast_memcpy)(void *to, const void *from, size_t len); #ifdef HAVE_XINE_INTERNAL_H /* Benchmark available memcpy methods */ -void xine_probe_fast_memcpy(config_values_t *config); +void xine_probe_fast_memcpy(xine_t *xine); #endif @@ -902,80 +902,98 @@ void xine_print_trace(void); #define LOG_MODULE_STRING printf("%s: ", LOG_MODULE ); #ifdef LOG_VERBOSE - #define LONG_LOG_MODULE_STRING \ + #define LONG_LOG_MODULE_STRING \ printf("%s: (%s:%d) ", LOG_MODULE, __XINE_FUNCTION__, __LINE__ ); #else #define LONG_LOG_MODULE_STRING LOG_MODULE_STRING #endif /* LOG_VERBOSE */ #ifdef LOG - #define lprintf \ - LONG_LOG_MODULE_STRING \ - printf -#else #ifdef __GNUC__ - #define lprintf(fmt, args...) ; + #define lprintf(fmt, args...) \ + do { \ + LONG_LOG_MODULE_STRING \ + printf(fmt, ##args); \ + } while(0) + #else /* __GNUC__ */ + #ifdef _MSC_VER + #define lprintf(fmtargs) \ + do { \ + LONG_LOG_MODULE_STRING \ + printf("%s", fmtargs); \ + } while(0) + #else /* _MSC_VER */ + #define lprintf(fmt, ...) \ + do { \ + LONG_LOG_MODULE_STRING \ + printf(__VA_ARGS__); \ + } while(0) + #endif /* _MSC_VER */ + #endif /* __GNUC__ */ +#else /* LOG */ + #ifdef __GNUC__ + #define lprintf(fmt, args...) do {} while(0) #else #ifdef _MSC_VER - #define lprintf + #define lprintf do {} while(0) #else - #define lprintf(...) ; + #define lprintf(...) do {} while(0) #endif /* _MSC_VER */ #endif /* __GNUC__ */ #endif /* LOG */ #ifdef __GNUC__ - #define llprintf(cat, fmt, args...) \ - do{ \ - if(cat){ \ - LONG_LOG_MODULE_STRING \ - printf( fmt, ##args ); \ - } \ + #define llprintf(cat, fmt, args...) \ + do{ \ + if(cat){ \ + LONG_LOG_MODULE_STRING \ + printf( fmt, ##args ); \ + } \ }while(0) #else #ifdef _MSC_VER - #define llprintf(cat, fmtargs) \ - do{ \ - if(cat){ \ - LONG_LOG_MODULE_STRING \ - printf( "%s", fmtargs ); \ - } \ + #define llprintf(cat, fmtargs) \ + do{ \ + if(cat){ \ + LONG_LOG_MODULE_STRING \ + printf( "%s", fmtargs ); \ + } \ }while(0) #else - #define llprintf(cat, ...) \ - do{ \ - if(cat){ \ - LONG_LOG_MODULE_STRING \ - printf( __VA_ARGS__ ); \ - } \ + #define llprintf(cat, ...) \ + do{ \ + if(cat){ \ + LONG_LOG_MODULE_STRING \ + printf( __VA_ARGS__ ); \ + } \ }while(0) #endif /* _MSC_VER */ #endif /* __GNUC__ */ #ifdef __GNUC__ - #define xprintf(xine, verbose, fmt, args...) \ - do { \ - if((xine)->verbosity >= verbose){ \ - LOG_MODULE_STRING \ - xine_log(xine, XINE_LOG_TRACE, fmt, ##args); \ - } \ + #define xprintf(xine, verbose, fmt, args...) \ + do { \ + if((xine)->verbosity >= verbose){ \ + LOG_MODULE_STRING \ + xine_log(xine, XINE_LOG_TRACE, fmt, ##args); \ + } \ } while(0) #else #ifdef _MSC_VER - #define xprintf(xine, verbose, fmtargs) \ - do { \ - if((xine)->verbosity >= verbose){ \ - LOG_MODULE_STRING \ - xine_log(xine, XINE_LOG_TRACE, fmtargs); \ - } \ + #define xprintf(xine, verbose, fmtargs) \ + do { \ + if((xine)->verbosity >= verbose){ \ + LOG_MODULE_STRING \ + xine_log(xine, XINE_LOG_TRACE, fmtargs); \ + } \ } while(0) #else - #define xprintf(xine, verbose, ...) \ - do { \ - if((xine)->verbosity >= verbose){ \ - LOG_MODULE_STRING \ - xine_log(xine, XINE_LOG_TRACE, __VA_ARGS__); \ - } \ + #define xprintf(xine, verbose, ...) \ + do { \ + if((xine)->verbosity >= verbose){ \ + LOG_MODULE_STRING \ + xine_log(xine, XINE_LOG_TRACE, __VA_ARGS__); \ + } \ } while(0) #endif /* _MSC_VER */ #endif /* __GNUC__ */ diff --git a/src/xine-utils/xmllexer.c b/src/xine-utils/xmllexer.c index e99ac692d..f41dbbdc6 100644 --- a/src/xine-utils/xmllexer.c +++ b/src/xine-utils/xmllexer.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xmllexer.c,v 1.4 2003/11/26 19:43:38 f1rmb Exp $ + * $Id: xmllexer.c,v 1.5 2003/12/05 15:55:05 f1rmb Exp $ * */ @@ -347,7 +347,7 @@ int lexer_get_token(char * tok, int tok_size) { } break; default: - printf("xmllexer: expected char \'%c\'\n", tok[tok_pos - 1]); /* FIX ME */ + lprintf("xmllexer: expected char \'%c\'\n", tok[tok_pos - 1]); /* FIX ME */ return T_ERROR; } } else { @@ -368,7 +368,7 @@ int lexer_get_token(char * tok, int tok_size) { /* pb */ if (tok_pos >= tok_size) { - printf("xmllexer: token buffer is too little\n"); + lprintf("xmllexer: token buffer is too little\n"); } else { if (lexbuf_pos >= lexbuf_size) { /* Terminate the current token */ @@ -398,15 +398,15 @@ int lexer_get_token(char * tok, int tok_size) { return T_DATA; break; default: - printf("xmllexer: unknown state, state=%d\n", state); + lprintf("xmllexer: unknown state, state=%d\n", state); } } else { - printf("xmllexer: abnormal end of buffer, state=%d\n", state); + lprintf("xmllexer: abnormal end of buffer, state=%d\n", state); } } return T_ERROR; } /* tok == null */ - printf("xmllexer: token buffer is null\n"); + lprintf("xmllexer: token buffer is null\n"); return T_ERROR; } diff --git a/src/xine-utils/xmlparser.c b/src/xine-utils/xmlparser.c index e7a06f65d..b232a1931 100644 --- a/src/xine-utils/xmlparser.c +++ b/src/xine-utils/xmlparser.c @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xmlparser.c,v 1.11 2003/11/26 19:43:38 f1rmb Exp $ + * $Id: xmlparser.c,v 1.12 2003/12/05 15:55:05 f1rmb Exp $ * */ @@ -209,7 +209,7 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r lprintf("info: node data : %s\n", current_node->data); break; default: - printf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state); + lprintf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state); return -1; break; } @@ -230,7 +230,7 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r lprintf("info: current node name \"%s\"\n", node_name); break; default: - printf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state); + lprintf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state); return -1; break; } @@ -296,7 +296,7 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r lprintf("info: current property name \"%s\"\n", property_name); break; default: - printf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state); + lprintf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state); return -1; break; } @@ -312,12 +312,12 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r if (strcmp(tok, root_name) == 0) { state = 4; } else { - printf("xmlparser: error: xml struct, tok=%s, waited_tok=%s\n", tok, root_name); + lprintf("xmlparser: error: xml struct, tok=%s, waited_tok=%s\n", tok, root_name); return -1; } break; default: - printf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state); + lprintf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state); return -1; break; } @@ -330,7 +330,7 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r return 0; break; default: - printf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state); + lprintf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state); return -1; break; } @@ -365,7 +365,7 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r state = 2; break; default: - printf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state); + lprintf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state); return -1; break; } @@ -394,7 +394,7 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r state = 2; break; default: - printf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state); + lprintf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state); return -1; break; } @@ -438,16 +438,16 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r default: - printf("xmlparser: error: unknown parser state, state=%d\n", state); + lprintf("xmlparser: error: unknown parser state, state=%d\n", state); return -1; } } /* lex error */ - printf("xmlparser: error: lexer error\n"); + lprintf("xmlparser: error: lexer error\n"); return -1; } else { /* max recursion */ - printf("xmlparser: error: max recursion\n"); + lprintf("xmlparser: error: max recursion\n"); return -1; } } @@ -463,7 +463,7 @@ int xml_parser_build_tree(xml_node_t **root_node) { free_xml_node(tmp_node); res = 0; } else { - printf("xmlparser: error: xml struct\n"); + lprintf("xmlparser: error: xml struct\n"); xml_parser_free_tree(tmp_node); res = -1; } @@ -573,4 +573,3 @@ static void xml_parser_dump_node (xml_node_t *node, int indent) { void xml_parser_dump_tree (xml_node_t *node) { xml_parser_dump_node (node, 0); } - |