diff options
author | Guenter Bartsch <guenter@users.sourceforge.net> | 2001-11-18 03:53:23 +0000 |
---|---|---|
committer | Guenter Bartsch <guenter@users.sourceforge.net> | 2001-11-18 03:53:23 +0000 |
commit | 4c71c84391e9a607394b7f7a23877ba15dffbf67 (patch) | |
tree | 53bf6a2b06b97cde43a11cafda54942a3a9bea45 | |
parent | 4b36ff207a52ea90bfd9b8c34c97f14963f0960d (diff) | |
download | xine-lib-4c71c84391e9a607394b7f7a23877ba15dffbf67.tar.gz xine-lib-4c71c84391e9a607394b7f7a23877ba15dffbf67.tar.bz2 |
new configfile interface, code cleanup, xprintf is gone
CVS patchset: 1064
CVS date: 2001/11/18 03:53:23
37 files changed, 1311 insertions, 774 deletions
diff --git a/include/xine.h.tmpl.in b/include/xine.h.tmpl.in index 04cd4f3c0..0e271a5fd 100644 --- a/include/xine.h.tmpl.in +++ b/include/xine.h.tmpl.in @@ -28,7 +28,7 @@ \endverbatim */ /* - * $Id: xine.h.tmpl.in,v 1.54 2001/11/10 06:26:01 mlampard Exp $ + * $Id: xine.h.tmpl.in,v 1.55 2001/11/18 03:53:23 guenter Exp $ * */ @@ -483,59 +483,146 @@ typedef void xine_t; * Opaque data type. */ typedef void ao_driver_t; -/** - * \struct cfg_data_t - * Opaque data type. - */ -typedef void cfg_data_t; -/** - * \struct config_values_t - * \brief Data type of structure config_values_s. - * \sa config_values_s. +typedef struct cfg_entry_s cfg_entry_t; +typedef void (*config_cb_t) (void *, cfg_entry_t *); + +struct cfg_entry_s { + cfg_entry_t *next; + + char *key; + int type; + + /* type unknown */ + char *unknown_value; + + /* type string */ + char *str_value; + char *str_default; + + /* common to range, enum, num, bool: */ + + int num_value; + int num_default; + + /* type range specific: */ + int range_min; + int range_max; + + /* type enum specific: */ + char **enum_values; + + /* help info for the user */ + char *description; + char *help; + + /* callback function and data for live changeable values */ + config_cb_t callback; + void *callback_data; +}; + +/* + * config entry data types */ + +#define CONFIG_TYPE_UNKNOWN 0 +#define CONFIG_TYPE_RANGE 1 +#define CONFIG_TYPE_STRING 2 +#define CONFIG_TYPE_ENUM 3 +#define CONFIG_TYPE_NUM 4 +#define CONFIG_TYPE_BOOL 5 + typedef struct config_values_s config_values_t; -/** - * \struct config_values_s - * Configuration file manipulation. - * \sa config_file_init() - */ struct config_values_s { - /** - * Lookup string values in configuration file. - */ - char* (*lookup_str) (config_values_t *self, - char *key, char *str_default); - /** - * Lookup integer values in configuration file. - */ - int (*lookup_int) (config_values_t *self, - char *key, int n_default); - /** - * Set string values in configuration file. + + /* + * register config values + * + * these functions return the current value of the + * registered item, i.e. the default value if it was + * not found in the config file or the current value + * from the config file otherwise */ - void (*set_str) (config_values_t *self, - char *key, char *value) ; - /** - * Set integer values in configuration file. + + char* (*register_string) (config_values_t *this, + char *key, + char *def_value, + char *description, + char *help, + config_cb_t changed_cb, + void *cb_data); + + int (*register_range) (config_values_t *this, + char *key, + int def_value, + int min, int max, + char *description, + char *help, + config_cb_t changed_cb, + void *cb_data); + + int (*register_enum) (config_values_t *this, + char *key, + int def_value, + char **values, + char *description, + char *help, + config_cb_t changed_cb, + void *cb_data); + + int (*register_num) (config_values_t *this, + char *key, + int def_value, + char *description, + char *help, + config_cb_t changed_cb, + void *cb_data); + + int (*register_bool) (config_values_t *this, + char *key, + int def_value, + char *description, + char *help, + config_cb_t changed_cb, + void *cb_data); + + /* convenience function to update range, enum, num and bool values */ + void (*update_num) (config_values_t *this, + char *key, int value); + + /* convenience function to update string values */ + void (*update_string) (config_values_t *this, + char *key, char *value); + + /* small utility function for enum handling */ + int (*parse_enum) (char *str, char **values); + + /* + * lookup config entries + * + * remember to call the changed_cb if it exists + * and you changed the value of this item */ - void (*set_int) (config_values_t *self, - char *key, int value) ; - /** - * Write configuration file to disk. + + cfg_entry_t* (*lookup_entry) (config_values_t *this, + char *key); + + /* + * write config file to disk */ - void (*save) (config_values_t *self); - /** - * Read configuration file from disk, overriding values in memory. - * If you also want to clear values that are not in the file, - * use config_file_init() instead! + void (*save) (config_values_t *this); + + /* + * read config file from disk, overriding values in memory */ - void (*read) (config_values_t *self, char *filename); - /** - * Contains private data of this configuration file. + void (*read) (config_values_t *this, char *filename); + + /* + * config values are stored here: */ - cfg_data_t *data; + cfg_entry_t *first, *last; }; + /** @} end of config_group */ diff --git a/src/audio_out/audio_esd_out.c b/src/audio_out/audio_esd_out.c index 8a20bdad8..353302d69 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.13 2001/11/17 14:26:37 f1rmb Exp $ + * $Id: audio_esd_out.c,v 1.14 2001/11/18 03:53:23 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -293,7 +293,10 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { this->output_sample_rate = 0; this->audio_fd = -1; this->capabilities = AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO; - this->latency = config->lookup_int (config, "esd_latency", 30000); + this->latency = config->register_range (config, "audio.esd_latency", 30000, + -30000, 90000, + "esd audio output latency (adjust a/v sync)", + NULL, NULL, NULL); this->ao_driver.get_capabilities = ao_esd_get_capabilities; this->ao_driver.get_property = ao_esd_get_property; diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c index 388adc9f5..636637ce9 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.49 2001/11/17 14:26:37 f1rmb Exp $ + * $Id: audio_oss_out.c,v 1.50 2001/11/18 03:53:23 guenter Exp $ * * 20-8-2001 First implementation of Audio sync and Audio driver separation. * Copyright (C) 2001 James Courtier-Dutton James@superbug.demon.co.uk @@ -200,8 +200,8 @@ static int ao_oss_open(ao_driver_t *this_gen, } this->output_sample_rate = tmp; this->output_sample_k_rate = this->output_sample_rate / 1000; - xprintf (VERBOSE|AUDIO, "audio_oss_out: audio rate : %d requested, %d provided by device/sec\n", - this->input_sample_rate, this->output_sample_rate); + printf ("audio_oss_out: audio rate : %d requested, %d provided by device/sec\n", + this->input_sample_rate, this->output_sample_rate); } /* * set number of channels / a52 passthrough @@ -265,7 +265,7 @@ static int ao_oss_open(ao_driver_t *this_gen, tmp = (AUDIO_NUM_FRAGMENTS << 16) | tmp ; - xprintf (VERBOSE|AUDIO, "Audio buffer fragment info : %x\n",tmp); + printf ("audio_oss_out: audio buffer fragment info : %x\n",tmp); ioctl(this->audio_fd,SNDCTL_DSP_SETFRAGMENT,&tmp); */ @@ -393,9 +393,9 @@ static void ao_oss_exit(ao_driver_t *this_gen) { oss_driver_t *this = (oss_driver_t *) this_gen; config_values_t *config = this->config; - config->set_int (config, "mixer_volume", this->mixer.volume); - config->save(config); - + + config->update_num (config, "audio.mixer_volume", this->mixer.volume); + if (this->audio_fd != -1) close(this->audio_fd); @@ -544,6 +544,7 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { int devnum; int audio_fd; int num_channels, status, arg; + static char *sync_methods[] = {"auto", "getodelay", "getoptr", "softsync", NULL}; this = (oss_driver_t *) malloc (sizeof (oss_driver_t)); @@ -552,10 +553,11 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { */ printf ("audio_oss_out: Opening audio device...\n"); - xprintf (VERBOSE|AUDIO, "audio_oss_out: Opening audio device..."); best_rate = 0; - devnum = config->lookup_int (config, "oss_device_num", -1); + devnum = config->register_num (config, "audio.oss_device_num", -1, + "/dev/dsp# device to use for oss output, -1 => auto_detect", + NULL, NULL, NULL); if (devnum >= 0) { sprintf (this->audio_dev, DSP_TEMPLATE, devnum); @@ -596,17 +598,14 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { audio_fd=open(this->audio_dev, O_WRONLY|O_NONBLOCK); - if(audio_fd < 0) - { + if(audio_fd < 0) { printf("audio_oss_out: opening audio device %s failed:\n%s\n", this->audio_dev, strerror(errno)); free (this); return NULL; - } else - xprintf (VERBOSE|AUDIO, " %s\n", this->audio_dev); - + } /* * set up driver to reasonable values for capabilities tests */ @@ -620,8 +619,10 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { * find out which sync method to use */ - this->sync_method = config->lookup_int (config, "oss_audio_sync", - OSS_SYNC_AUTO_DETECT); + this->sync_method = config->register_enum (config, "audio.oss_sync_method", OSS_SYNC_AUTO_DETECT, + sync_methods, + "A/V sync method to use by OSS, depends on driver/hardware", + NULL, NULL, NULL); if (this->sync_method == OSS_SYNC_AUTO_DETECT) { @@ -658,14 +659,11 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { gettimeofday(&this->start_time, NULL); } - this->latency = config->lookup_int (config, "oss_latency", 0); - - if( this->latency > 3000 ) { - /* this fixes the 0.9.2 default of 50000 */ - this->latency = 0; - config->set_int (config, "oss_latency", 0); - printf ("audio_oss_out: oss_latency too high -> setting to zero.\n"); - } + this->latency = config->register_range (config, "audio.oss_latency", 0, + -3000, 3000, + "Adjust a/v sync for OSS softsync", + "Use this to manually adjust a/v sync if you're using softsync", + NULL, NULL); this->capabilities = 0; @@ -685,48 +683,57 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { num_channels = 4; status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); if ( (status != -1) && (num_channels==4) ) { - if (config->lookup_int (config, "four_channel", 0)) { + if (config->register_bool (config, "audio.four_channel", 0, + "Enable 4.0 channel analog surround output", + NULL, NULL, NULL)) { this->capabilities |= AO_CAP_MODE_4CHANNEL; printf ("4-channel "); } else - printf ("(4-channel not enabled in .xinerc) " ); + printf ("(4-channel not enabled in xine config) " ); } num_channels = 5; status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); if ( (status != -1) && (num_channels==5) ) { - if (config->lookup_int (config, "five_channel", 0)) { + if (config->register_bool (config, "audio.five_channel", 0, + "Enable 5.0 channel analog surround output", + NULL, NULL, NULL)) { this->capabilities |= AO_CAP_MODE_5CHANNEL; printf ("5-channel "); } else - printf ("(5-channel not enabled in .xinerc) " ); + printf ("(5-channel not enabled in xine config) " ); } num_channels = 6; status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); if ( (status != -1) && (num_channels==6) ) { - if (config->lookup_int (config, "five_lfe_channel", 0)) { + if (config->register_bool (config, "audio.five_lfe_channel", 0, + "Enable 5.1 channel analog surround output", + NULL, NULL, NULL)) { this->capabilities |= AO_CAP_MODE_5_1CHANNEL; printf ("5.1-channel "); } else - printf ("(5.1-channel not enabled in .xinerc) " ); + printf ("(5.1-channel not enabled in xine config) " ); } ioctl(audio_fd,SNDCTL_DSP_GETFMTS,&caps); if (caps & AFMT_AC3) { - if (config->lookup_int (config, "a52_pass_through", 0)) { + if (config->register_bool (config, "audio.a52_pass_through", 0, + "Enable A52 / AC5 digital audio output via spdif", + NULL, NULL, NULL)) { this->capabilities |= AO_CAP_MODE_A52; this->capabilities |= AO_CAP_MODE_AC5; printf ("a/52-pass-through "); } else - printf ("(a/52-pass-through not enabled in .xinerc)"); + printf ("(a/52-pass-through not enabled in xine config)"); } printf ("\n"); /* - * Mixer initialisation. + * mixer initialisation. */ - __again: - this->mixer.name = config->lookup_str(config, "mixer_name", "/dev/mixer"); + + this->mixer.name = config->register_string(config, "audio.mixer_name", "/dev/mixer", + "oss mixer device", NULL, NULL, NULL); { int mixer_fd; int audio_devs; @@ -759,19 +766,14 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) { close(mixer_fd); - } else { - if(strcmp(this->mixer.name, "/dev/mixer")) { - config->set_str(config, "mixer_name", "/dev/mixer"); - config->save(config); - goto __again; - } else - printf ("audio_oss_out: open() mixer %s failed: %s\n", - this->mixer.name, strerror(errno)); - } + } else + printf ("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); - this->mixer.volume = config->lookup_int (config, "mixer_volume", 50); + this->mixer.volume = config->register_range (config, "audio.oss_mixer_volume", 50, + 0, 100, "Audio volume", NULL, NULL, NULL); (void) ao_oss_set_property(&this->ao_driver, this->mixer.prop, this->mixer.volume); diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index 20c1f58e5..380b226e2 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.13 2001/11/17 19:39:17 miguelfreitas Exp $ + * $Id: demux_asf.c,v 1.14 2001/11/18 03:53:23 guenter Exp $ * * demultiplexer for asf streams * @@ -72,8 +72,6 @@ typedef struct { uint8_t *buffer; } asf_stream_t; -static uint32_t xine_debug; - typedef struct demux_asf_s { demux_plugin_t demux_plugin; @@ -1217,7 +1215,6 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { this = xine_xmalloc (sizeof (demux_asf_t)); config = xine->config; - xine_debug = config->lookup_int (config, "xine_debug", 0); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_asf_open; diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c index 3d8dc7c0f..20d498857 100644 --- a/src/demuxers/demux_avi.c +++ b/src/demuxers/demux_avi.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_avi.c,v 1.52 2001/11/17 14:26:37 f1rmb Exp $ + * $Id: demux_avi.c,v 1.53 2001/11/18 03:53:23 guenter Exp $ * * demultiplexer for avi streams * @@ -48,8 +48,6 @@ /* The following variable indicates the kind of error */ -static uint32_t xine_debug; - typedef struct { long pos; @@ -720,7 +718,6 @@ static int demux_avi_next (demux_avi_t *this) { if (!this->no_audio && (audio_pts < video_pts)) { /* read audio */ - xprintf (VERBOSE|DEMUX|VAVI, "demux_avi: audio \n"); buf->PTS = audio_pts; buf->SCR = audio_pts; @@ -747,7 +744,6 @@ static int demux_avi_next (demux_avi_t *this) { } else { /* read video */ - xprintf (VERBOSE|DEMUX|VAVI, "demux_avi: video \n"); buf->PTS = video_pts; buf->SCR = video_pts; @@ -771,7 +767,6 @@ static int demux_avi_next (demux_avi_t *this) { this->video_fifo->put (this->video_fifo, buf); } - xprintf (VERBOSE|DEMUX|VAVI, "size : %d\n",buf->size); return (buf->size>0); } @@ -1045,8 +1040,6 @@ static int demux_avi_open(demux_plugin_t *this_gen, mrl = input->get_mrl (input); ending = strrchr(mrl, '.'); - xprintf(VERBOSE|DEMUX, "demux_avi_can_handle: ending %s of %s\n", - ending, mrl); if(ending) { if(!strcasecmp(ending, ".avi")) { @@ -1115,7 +1108,6 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { this = xine_xmalloc (sizeof (demux_avi_t)); config = xine->config; - xine_debug = config->lookup_int (config, "xine_debug", 0); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_avi_open; diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c index 19ff4a9d6..c3e11d9e9 100644 --- a/src/demuxers/demux_elem.c +++ b/src/demuxers/demux_elem.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_elem.c,v 1.28 2001/11/17 14:26:37 f1rmb Exp $ + * $Id: demux_elem.c,v 1.29 2001/11/18 03:53:23 guenter Exp $ * * demultiplexer for elementary mpeg streams * @@ -65,7 +65,6 @@ typedef struct { uint8_t scratch[4096]; } demux_mpeg_elem_t ; -static uint32_t xine_debug; /* * @@ -112,8 +111,6 @@ static void *demux_mpeg_elem_loop (void *this_gen) { } while (this->status == DEMUX_OK) ; - xprintf (VERBOSE|DEMUX, "demux loop finished (status: %d)\n", this->status); - this->status = DEMUX_FINISHED; if (this->send_end_buffers) { @@ -217,7 +214,6 @@ static void demux_mpeg_elem_start (demux_plugin_t *this_gen, /* FIXME: implement time seek */ - xprintf (VERBOSE|DEMUX, "=>seek to %Ld\n",start_pos); this->input->seek (this->input, start_pos, SEEK_SET); } @@ -284,7 +280,6 @@ static int demux_mpeg_elem_open(demux_plugin_t *this_gen, MRL = input->get_mrl (input); suffix = strrchr(MRL, '.'); - xprintf(VERBOSE|DEMUX, "%s: suffix %s of %s\n", __FUNCTION__, suffix, MRL); if(suffix) { if(!strcasecmp(suffix, ".mpv")) { @@ -341,7 +336,6 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { this = malloc (sizeof (demux_mpeg_elem_t)); config = xine->config; - xine_debug = config->lookup_int (config, "xine_debug", 0); this->demux_plugin.interface_version = DEMUX_MPEG_ELEM_IFACE_VERSION; this->demux_plugin.open = demux_mpeg_elem_open; diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c index ade2e7961..49d0e62ab 100644 --- a/src/demuxers/demux_mpeg.c +++ b/src/demuxers/demux_mpeg.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.c,v 1.44 2001/11/17 14:26:37 f1rmb Exp $ + * $Id: demux_mpeg.c,v 1.45 2001/11/18 03:53:23 guenter Exp $ * * demultiplexer for mpeg 1/2 program streams * reads streams of variable blocksizes @@ -44,8 +44,6 @@ #define NUM_PREVIEW_BUFFERS 150 -static uint32_t xine_debug; - typedef struct demux_mpeg_s { demux_plugin_t demux_plugin; @@ -84,8 +82,6 @@ static uint32_t read_bytes (demux_mpeg_t *this, int n) { if (i != n) { this->status = DEMUX_FINISHED; - - xprintf (VERBOSE|DEMUX, "Unexpected end of stream\n"); } @@ -120,14 +116,10 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, uint32_t scr) len = read_bytes(this, 2); - xprintf (VERBOSE|DEMUX|MPEG, " mpeg2 packet (len=%d",len); - if (stream_id==0xbd) { int track; - xprintf (VERBOSE|DEMUX|AC3, ",ac3"); - w = read_bytes(this, 1); flags = read_bytes(this, 1); header_len = read_bytes(this, 1); @@ -145,8 +137,6 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, uint32_t scr) w = read_bytes(this, 2); pts |= (w & 0xFFFE) >> 1; - xprintf (VERBOSE|DEMUX|VPTS, ", pts=%d",pts); - header_len -= 5 ; } @@ -155,8 +145,6 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, uint32_t scr) track = this->dummy_space[0] & 0x0F ; - xprintf (VERBOSE|DEMUX, ", track=%02x", track); - /* contents */ if(this->audio_fifo) @@ -186,8 +174,6 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, uint32_t scr) } else if ((stream_id & 0xe0) == 0xc0) { int track = stream_id & 0x1f; - xprintf (VERBOSE|DEMUX|AUDIO, ", audio #%d", track); - w = read_bytes(this, 1); flags = read_bytes(this, 1); header_len = read_bytes(this, 1); @@ -205,8 +191,6 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, uint32_t scr) w = read_bytes(this, 2); pts |= (w & 0xFFFE) >> 1; - xprintf (VERBOSE|DEMUX|VPTS, ", pts=%d",pts); - header_len -= 5 ; } @@ -238,8 +222,6 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, uint32_t scr) } else if ((stream_id >= 0xbc) && ((stream_id & 0xf0) == 0xe0)) { - xprintf (VERBOSE|DEMUX|VIDEO, ",video"); - w = read_bytes(this, 1); flags = read_bytes(this, 1); header_len = read_bytes(this, 1); @@ -257,8 +239,6 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, uint32_t scr) w = read_bytes(this, 2); pts |= (w & 0xFFFE) >> 1; - xprintf (VERBOSE|DEMUX|VPTS, ", pts=%d",pts); - header_len -= 5 ; } @@ -285,14 +265,11 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, uint32_t scr) this->video_fifo->put (this->video_fifo, buf); } else { - xprintf (VERBOSE|DEMUX, ",unknown stream - skipped"); i = this->input->read (this->input, this->dummy_space, len); /* (*this->input->seek) (len,SEEK_CUR); */ } - xprintf (VERBOSE|DEMUX, ")\n"); - } static void parse_mpeg1_packet (demux_mpeg_t *this, int stream_id, uint32_t scr) { @@ -303,12 +280,8 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int stream_id, uint32_t scr) int pts; buf_element_t *buf = NULL; - xprintf (VERBOSE|DEMUX, " packet ("); - len = read_bytes(this, 2); - xprintf (VERBOSE|DEMUX, "len=%d",len); - pts=0; if (stream_id != 0xbf) { @@ -347,8 +320,6 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int stream_id, uint32_t scr) w = read_bytes(this, 2); len -= 2; pts |= (w & 0xFFFE) >> 1; - xprintf (VERBOSE|DEMUX|VPTS, ", pts=%d",pts); - /* pts = 0; */ } else if ((w & 0xF0) == 0x30) { @@ -366,15 +337,16 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int stream_id, uint32_t scr) pts |= (w & 0xFFFE) >> 1; /* printf ("pts2=%d\n",pts); */ - xprintf (VERBOSE|DEMUX|VPTS, ", pts2=%d",pts); /* Decoding Time Stamp */ w = read_bytes(this, 3); len -= 3; w = read_bytes(this, 2); len -= 2; } else { - xprintf (VERBOSE|DEMUX, ", w = %02x",w); + + /* if (w != 0x0f) xprintf (VERBOSE|DEMUX, " ERROR w (%02x) != 0x0F ",w); + */ } } @@ -382,8 +354,6 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int stream_id, uint32_t scr) if ((stream_id & 0xe0) == 0xc0) { int track = stream_id & 0x1f; - xprintf (VERBOSE|DEMUX|AUDIO, ", audio #%d", track); - if(this->audio_fifo) { buf = this->input->read_block (this->input, this->audio_fifo, len); } else { @@ -411,7 +381,6 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int stream_id, uint32_t scr) } else if ((stream_id & 0xf0) == 0xe0) { - xprintf (VERBOSE|DEMUX|VIDEO, ", video #%d", stream_id & 0x0f); buf = this->input->read_block (this->input, this->video_fifo, len); @@ -433,14 +402,13 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int stream_id, uint32_t scr) this->video_fifo->put (this->video_fifo, buf); } else if (stream_id == 0xbd) { - xprintf (VERBOSE|DEMUX|AC3, ", ac3"); + i = this->input->read (this->input, this->dummy_space, len); } else { - xprintf (VERBOSE|DEMUX, ", unknown (stream_id = %d)",stream_id); + this->input->read (this->input, this->dummy_space, len); } - xprintf (VERBOSE|DEMUX, ")\n"); } static uint32_t parse_pack(demux_mpeg_t *this) { @@ -449,17 +417,13 @@ static uint32_t parse_pack(demux_mpeg_t *this) { int mpeg_version; uint32_t scr; - xprintf (VERBOSE|DEMUX, "pack {\n"); buf = read_bytes (this, 1); - xprintf (VERBOSE|DEMUX|VIDEO, " mpeg version : %02x",buf>>4); if ((buf>>4) == 4) { int stuffing, i; - xprintf (VERBOSE|DEMUX|VIDEO, " => mpeg II \n"); - mpeg_version = 2; /* system_clock_reference */ @@ -491,7 +455,7 @@ static uint32_t parse_pack(demux_mpeg_t *this) { read_bytes (this, 1); } else { - xprintf (VERBOSE|DEMUX|VIDEO, " => mpeg I \n"); + mpeg_version = 1; /* system_clock_reference */ @@ -549,7 +513,6 @@ static uint32_t parse_pack(demux_mpeg_t *this) { if (buf == 0x000001bb) { buf = read_bytes (this, 2); - xprintf (VERBOSE|DEMUX, " system_header (%d +6 bytes)\n",buf); this->input->read (this->input, this->dummy_space, buf); @@ -570,10 +533,8 @@ static uint32_t parse_pack(demux_mpeg_t *this) { parse_mpeg2_packet (this, buf & 0xFF, scr); buf = read_bytes (this, 4); - xprintf (VERBOSE|DEMUX, " code = %08x\n",buf); - } - xprintf (VERBOSE|DEMUX, "}\n"); + } return buf; @@ -586,7 +547,6 @@ static uint32_t parse_pack_preview (demux_mpeg_t *this, int *num_buffers) /* system_clock_reference */ buf = read_bytes (this, 1); - xprintf (VERBOSE|DEMUX|VIDEO, " mpeg version : %02x",buf>>4); if ((buf>>4) == 4) { buf = read_bytes(this, 2); @@ -638,8 +598,6 @@ static uint32_t parse_pack_preview (demux_mpeg_t *this, int *num_buffers) *num_buffers = *num_buffers - 1; } - xprintf (VERBOSE|DEMUX, "}\n"); - return buf; } @@ -647,7 +605,7 @@ static uint32_t parse_pack_preview (demux_mpeg_t *this, int *num_buffers) static void demux_mpeg_resync (demux_mpeg_t *this, uint32_t buf) { while ((buf !=0x000001ba) && (this->status == DEMUX_OK)) { - xprintf (VERBOSE|DEMUX, "resync : %08x\n",buf); + buf = (buf << 8) | read_bytes (this, 1); } } @@ -680,8 +638,6 @@ static void *demux_mpeg_loop (void *this_gen) { } } - xprintf (VERBOSE|DEMUX, "demux loop finished (status: %d, buf:%x)\n", - this->status, w); printf ("demux loop finished (status: %d, buf:%x)\n", this->status, w); @@ -884,8 +840,6 @@ static int demux_mpeg_open(demux_plugin_t *this_gen, } ending = strrchr(MRL, '.'); - xprintf(VERBOSE|DEMUX, "demux_mpeg_can_handle: ending %s of %s\n", - ending, MRL); if(!ending) return DEMUX_CANNOT_HANDLE; @@ -946,7 +900,6 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { this = xine_xmalloc (sizeof (demux_mpeg_t)); config = xine->config; - xine_debug = config->lookup_int (config, "xine_debug", 0); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_mpeg_open; diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c index 74c32c062..df44419e7 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.61 2001/11/17 14:26:37 f1rmb Exp $ + * $Id: demux_mpeg_block.c,v 1.62 2001/11/18 03:53:23 guenter Exp $ * * demultiplexer for mpeg 1/2 program streams * @@ -40,8 +40,6 @@ #define NUM_PREVIEW_BUFFERS 250 -static uint32_t xine_debug; - typedef struct demux_mpeg_block_s { demux_plugin_t demux_plugin; @@ -162,8 +160,6 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m if (p[3] == 0xBA) { /* program stream pack header */ - xprintf (VERBOSE|DEMUX, "program stream pack header\n"); - bMpeg1 = (p[4] & 0x40) == 0; if (bMpeg1) { @@ -229,8 +225,6 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m int header_len; - xprintf (VERBOSE|DEMUX, "program stream system header\n"); - header_len = (p[4] << 8) | p[5]; p += 6 + header_len; @@ -277,8 +271,6 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m packet_len = p[4] << 8 | p[5]; stream_id = p[3]; - xprintf (VERBOSE|DEMUX, "packet id = %02x len = %d\n",stream_id, packet_len); - if (bMpeg1) { if (stream_id == 0xBF) { @@ -379,8 +371,6 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m if((p[0] & 0xE0) == 0x20) { spu_id = (p[0] & 0x1f); - xprintf(VERBOSE|DEMUX, "SPU PES packet, id 0x%03x\n",p[0] & 0x1f); - buf->content = p+1; buf->size = packet_len-1; buf->type = BUF_SPU_PACKAGE + spu_id; @@ -394,7 +384,6 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m if ((p[0]&0xF0) == 0x80) { - xprintf (VERBOSE|DEMUX|AC3, "ac3 PES packet, track %02x\n",track); /* printf ( "ac3 PES packet, track %02x\n",track); */ buf->content = p+4; @@ -424,7 +413,6 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m int num_channels; int dynamic_range; - xprintf (VERBOSE|DEMUX,"LPCM packet, len : %d %02x\n",packet_len-4, p[0]); /* * found in http://members.freemail.absa.co.za/ginggs/dvd/mpeg2_lpcm.txt * appears to be correct. @@ -455,9 +443,6 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m } dynamic_range = p[6]; - xprintf(VERBOSE|DEMUX, "LPCM audio format: %dkHz, %d bit, %d channel\n", - sample_rate/1000, bits_per_sample, num_channels); - buf->decoder_info[1] = sample_rate; buf->decoder_info[2] = bits_per_sample; buf->decoder_info[3] = num_channels; @@ -483,7 +468,6 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m } else if ((stream_id >= 0xbc) && ((stream_id & 0xf0) == 0xe0)) { - xprintf (VERBOSE|DEMUX, "video %d\n", stream_id); buf->content = p; buf->size = packet_len; @@ -501,8 +485,6 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m track = stream_id & 0x1f; - xprintf (VERBOSE|DEMUX|MPEG, "mpg audio #%d", track); - buf->content = p; buf->size = packet_len; buf->type = BUF_AUDIO_MPEG + track; @@ -517,9 +499,7 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m return ; - } else { - xprintf (VERBOSE | DEMUX, "unknown packet, id = %x\n",stream_id); - } + } buf->free_buffer (buf); @@ -948,9 +928,6 @@ static int demux_mpeg_block_open(demux_plugin_t *this_gen, ending = strrchr(MRL, '.'); - xprintf(VERBOSE|DEMUX, "demux_mpeg_block_can_handle: ending %s of %s\n", - ending ? ending :"(none)", MRL); - if(!ending) return DEMUX_CANNOT_HANDLE; @@ -1005,7 +982,6 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { this = xine_xmalloc (sizeof (demux_mpeg_block_t)); this->xine = xine; config = xine->config; - xine_debug = config->lookup_int (config, "xine_debug", 0); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_mpeg_block_open; diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 634b9174e..cc7acebad 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.28 2001/11/17 14:26:37 f1rmb Exp $ + * $Id: demux_mpgaudio.c,v 1.29 2001/11/18 03:53:23 guenter Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -62,7 +62,6 @@ typedef struct { int stream_length; } demux_mpgaudio_t ; -static uint32_t xine_debug; int tabsel_123[2][3][16] = { { {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,}, @@ -212,8 +211,6 @@ static void *demux_mpgaudio_loop (void *this_gen) { } while (this->status == DEMUX_OK) ; - xprintf (VERBOSE|DEMUX, "demux loop finished (status: %d)\n", this->status); - this->status = DEMUX_FINISHED; if (this->send_end_buffers) { @@ -324,7 +321,7 @@ static void demux_mpgaudio_start (demux_plugin_t *this_gen, start_pos = start_time * this->input->get_length(this->input) / this->stream_length; - xprintf (VERBOSE|DEMUX, "=>seek to %Ld\n",start_pos); + this->input->seek (this->input, start_pos, SEEK_SET); } @@ -379,7 +376,6 @@ static int demux_mpgaudio_open(demux_plugin_t *this_gen, MRL = input->get_mrl (input); suffix = strrchr(MRL, '.'); - xprintf(VERBOSE|DEMUX, "%s: suffix %s of %s\n", __FUNCTION__, suffix, MRL); if(!suffix) return DEMUX_CANNOT_HANDLE; @@ -446,7 +442,6 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { this = malloc (sizeof (demux_mpgaudio_t)); config = xine->config; - xine_debug = config->lookup_int (config, "xine_debug", 0); this->demux_plugin.interface_version = DEMUX_MPGAUDIO_IFACE_VERSION; this->demux_plugin.open = demux_mpgaudio_open; diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index 79338c447..f9d44e3ad 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.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_ogg.c,v 1.9 2001/11/17 14:26:37 f1rmb Exp $ + * $Id: demux_ogg.c,v 1.10 2001/11/18 03:53:23 guenter Exp $ * * demultiplexer for ogg streams * @@ -44,8 +44,6 @@ #define MAX_STREAMS 16 -static uint32_t xine_debug; - typedef struct demux_ogg_s { demux_plugin_t demux_plugin; @@ -407,7 +405,6 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { this = xine_xmalloc (sizeof (demux_ogg_t)); config = xine->config; - xine_debug = config->lookup_int (config, "xine_debug", 0); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_ogg_open; diff --git a/src/demuxers/demux_pes.c b/src/demuxers/demux_pes.c index 4b4e728b5..2fb0b9bcf 100644 --- a/src/demuxers/demux_pes.c +++ b/src/demuxers/demux_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_pes.c,v 1.13 2001/11/17 14:26:37 f1rmb Exp $ + * $Id: demux_pes.c,v 1.14 2001/11/18 03:53:23 guenter Exp $ * * demultiplexer for mpeg 2 PES (Packetized Elementary Streams) * reads streams of variable blocksizes @@ -43,8 +43,6 @@ #define NUM_PREVIEW_BUFFERS 400 -static uint32_t xine_debug; - typedef struct demux_pes_s { demux_plugin_t demux_plugin; @@ -80,7 +78,6 @@ static uint32_t read_bytes (demux_pes_t *this, int n) { this->status = DEMUX_FINISHED; - xprintf (VERBOSE|DEMUX, "Unexpected end of stream\n"); } @@ -120,8 +117,6 @@ static void parse_mpeg2_packet (demux_pes_t *this, int nID) { int track; - xprintf (VERBOSE|DEMUX|AC3, ",ac3"); - w = read_bytes(this, 1); flags = read_bytes(this, 1); header_len = read_bytes(this, 1); @@ -139,8 +134,6 @@ static void parse_mpeg2_packet (demux_pes_t *this, int nID) { w = read_bytes(this, 2); pts |= (w & 0xFFFE) >> 1; - xprintf (VERBOSE|DEMUX|VPTS, ", pts=%d",pts); - header_len -= 5 ; } @@ -150,8 +143,6 @@ static void parse_mpeg2_packet (demux_pes_t *this, int nID) { // track = this->dummy_space[0] & 0x0F ; track = 0; - xprintf (VERBOSE|DEMUX, ", track=%02x", track); - /* contents */ if(this->audio_fifo) @@ -181,8 +172,6 @@ static void parse_mpeg2_packet (demux_pes_t *this, int nID) { } else if ((nID & 0xe0) == 0xc0) { int track = nID & 0x1f; - xprintf (VERBOSE|DEMUX|AUDIO, ", audio #%d", track); - w = read_bytes(this, 1); flags = read_bytes(this, 1); header_len = read_bytes(this, 1); @@ -200,8 +189,6 @@ static void parse_mpeg2_packet (demux_pes_t *this, int nID) { w = read_bytes(this, 2); pts |= (w & 0xFFFE) >> 1; - xprintf (VERBOSE|DEMUX|VPTS, ", pts=%d",pts); - header_len -= 5 ; } @@ -229,8 +216,6 @@ static void parse_mpeg2_packet (demux_pes_t *this, int nID) { } else if ((nID >= 0xbc) && ((nID & 0xf0) == 0xe0)) { - xprintf (VERBOSE|DEMUX|VIDEO, ",video"); - w = read_bytes(this, 1); flags = read_bytes(this, 1); header_len = read_bytes(this, 1); @@ -248,8 +233,6 @@ static void parse_mpeg2_packet (demux_pes_t *this, int nID) { w = read_bytes(this, 2); pts |= (w & 0xFFFE) >> 1; - xprintf (VERBOSE|DEMUX|VPTS, ", pts=%d",pts); - header_len -= 5 ; } @@ -277,14 +260,11 @@ static void parse_mpeg2_packet (demux_pes_t *this, int nID) { this->video_fifo->put (this->video_fifo, buf); } else { - xprintf (VERBOSE|DEMUX, ",unknown stream - skipped"); i = this->input->read (this->input, this->dummy_space, nLen); /* (*this->input->seek) (nLen,SEEK_CUR); */ } - xprintf (VERBOSE|DEMUX, ")\n"); - } @@ -301,8 +281,6 @@ static uint32_t parse_pack(demux_pes_t *this) buf = read_bytes (this, 3); - xprintf (VERBOSE|DEMUX, "}\n"); - return buf; } @@ -310,7 +288,6 @@ static uint32_t parse_pack(demux_pes_t *this) static void demux_pes_resync (demux_pes_t *this, uint32_t buf) { while ((buf !=0x000001) && (this->status == DEMUX_OK)) { - xprintf (VERBOSE|DEMUX, "resync : %08x\n",buf); buf = (buf << 8) | read_bytes (this, 1); } } @@ -343,8 +320,6 @@ static void *demux_pes_loop (void *this_gen) { } } - xprintf (VERBOSE|DEMUX, "demux loop finished (status: %d, buf:%x)\n", - this->status, w); printf ("demux loop finished (status: %d, buf:%x)\n", this->status, w); @@ -442,7 +417,6 @@ static void demux_pes_start (demux_plugin_t *this_gen, } while ( (this->status == DEMUX_OK) && (num_buffers>0)) ; - xprintf (VERBOSE|DEMUX, "=>seek to %Ld\n",start_pos); this->input->seek (this->input, start_pos+3, SEEK_SET); /* FIXME: implement time seek */ @@ -523,8 +497,6 @@ static int demux_pes_open(demux_plugin_t *this_gen, } ending = strrchr(MRL, '.'); - xprintf(VERBOSE|DEMUX, "demux_pes_can_handle: ending %s of %s\n", - ending, MRL); if(!ending) return DEMUX_CANNOT_HANDLE; @@ -578,7 +550,6 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { this = xine_xmalloc (sizeof (demux_pes_t)); config = xine->config; - xine_debug = config->lookup_int (config, "xine_debug", 0); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_pes_open; diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 9bb7990ac..723bba78c 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.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_qt.c,v 1.13 2001/11/17 19:40:27 miguelfreitas Exp $ + * $Id: demux_qt.c,v 1.14 2001/11/18 03:53:23 guenter Exp $ * * demultiplexer for quicktime streams, based on: * @@ -54,8 +54,6 @@ #include "libw32dll/wine/vfw.h" #include "libw32dll/wine/mmreg.h" -static uint32_t xine_debug; - /* OpenQuicktime Codec Parameter Types */ #define QUICKTIME_UNKNOWN_PARAMETER -1 #define QUICKTIME_STRING_PARAMETER 0 @@ -4378,7 +4376,6 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { this = xine_xmalloc (sizeof (demux_qt_t)); config = xine->config; - xine_debug = config->lookup_int (config, "xine_debug", 0); this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->demux_plugin.open = demux_qt_open; diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 137b56969..add6bafd6 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.28 2001/11/17 14:26:37 f1rmb Exp $ + * $Id: demux_ts.c,v 1.29 2001/11/18 03:53:23 guenter Exp $ * * Demultiplexer for MPEG2 Transport Streams. * @@ -69,6 +69,10 @@ #include "demux.h" /* +#define TS_LOG +*/ + +/* * The maximum number of PIDs we are prepared to handle in a single program is the * number that fits in a single-packet PMT. */ @@ -147,8 +151,6 @@ typedef struct { unsigned int audioMedia; } demux_ts; -static uint32_t xine_debug; - static void demux_ts_build_crc32_table(demux_ts *this) { uint32_t i, j, k; @@ -230,6 +232,7 @@ static void demux_ts_parse_pat (demux_ts *this, unsigned char *original_pkt, crc32 |= (uint32_t)pkt[6+section_length] << 8; crc32 |= (uint32_t)pkt[7+section_length] ; +#ifdef TS_LOG xprintf (VERBOSE|DEMUX,"PAT table_id=%d\n", table_id); xprintf (VERBOSE|DEMUX,"\tsection_syntax=%d\n", @@ -246,6 +249,7 @@ static void demux_ts_parse_pat (demux_ts *this, unsigned char *original_pkt, section_number); xprintf (VERBOSE|DEMUX,"\tlast_section_number=%d\n", last_section_number); +#endif if (!(current_next_indicator)) { /* @@ -298,10 +302,12 @@ static void demux_ts_parse_pat (demux_ts *this, unsigned char *original_pkt, */ program_count = 0; while ((this->program_number[program_count] != INVALID_PROGRAM) ) { +#ifdef TS_LOG xprintf(VERBOSE|DEMUX, "PAT acquiring count=%d programNumber=0x%04x pmtPid=0x%04x\n", program_count, this->program_number[program_count], this->pmt_pid[program_count]); +#endif program_count++; } } @@ -330,9 +336,10 @@ static int demux_ts_parse_pes_header (demux_ts_media *m, uint8_t *buf, int packe if (packet_len==0) return 0; +#ifdef TS_LOG xprintf(VERBOSE|DEMUX, "packet stream id = %02x len = %d\n", stream_id, packet_len); - +#endif if (p[7] & 0x80) { /* PTS avail */ @@ -425,7 +432,9 @@ static int demux_ts_parse_pes_header (demux_ts_media *m, uint8_t *buf, int packe return 1; } else { +#ifdef TS_LOG xprintf(VERBOSE | DEMUX, "unknown packet, id = %x\n",stream_id); +#endif } return 0 ; @@ -608,6 +617,7 @@ static void demux_ts_parse_pmt(demux_ts *this, crc32 |= (uint32_t)pkt[6+section_length] << 8; crc32 |= (uint32_t)pkt[7+section_length] ; +#ifdef TS_LOG xprintf (VERBOSE|DEMUX,"PMT table_id=%d\n", table_id); xprintf (VERBOSE|DEMUX,"\tsection_syntax_indicator=%d\n", @@ -624,6 +634,7 @@ static void demux_ts_parse_pmt(demux_ts *this, section_number); xprintf (VERBOSE|DEMUX,"\tlast_section_number=%d\n", last_section_number); +#endif if (!(current_next_indicator)) { /* @@ -687,7 +698,9 @@ static void demux_ts_parse_pmt(demux_ts *this, case ISO_11172_VIDEO: case ISO_13818_VIDEO: if (this->videoPid == INVALID_PID) { +#ifdef TS_LOG xprintf(VERBOSE|DEMUX, "PMT video pid 0x%04x\n", pid); +#endif demux_ts_pes_new(this, mediaIndex, pid, this->fifoVideo); } this->videoPid = pid; @@ -696,36 +709,48 @@ static void demux_ts_parse_pmt(demux_ts *this, case ISO_11172_AUDIO: case ISO_13818_AUDIO: if (this->audioPid == INVALID_PID) { +#ifdef TS_LOG xprintf(VERBOSE|DEMUX, "PMT audio pid 0x%04x\n", pid); +#endif demux_ts_pes_new(this, mediaIndex, pid, this->fifoAudio); } this->audioPid = pid; this->audioMedia = mediaIndex; break; case ISO_13818_PRIVATE: +#ifdef TS_LOG for(i=0;i<20;i++) { xprintf(VERBOSE|DEMUX, "%02x ", stream[i]); } xprintf(VERBOSE|DEMUX, "\n"); +#endif break; case PRIVATE_A52: +#ifdef TS_LOG for(i=0;i<20;i++) { xprintf(VERBOSE|DEMUX, "%02x ", stream[i]); } xprintf(VERBOSE|DEMUX, "\n"); +#endif if (this->audioPid == INVALID_PID) { +#ifdef TS_LOG xprintf(VERBOSE|DEMUX, "PMT audio pid 0x%04x\n", pid); +#endif demux_ts_pes_new(this, mediaIndex, pid, this->fifoAudio); } this->audioPid = pid; this->audioMedia = mediaIndex; break; default: +#ifdef TS_LOG xprintf(VERBOSE|DEMUX, "PMT stream_type unknown 0x%02x pid 0x%04x\n", stream[0], pid); + for(i=0;i<20;i++) { xprintf(VERBOSE|DEMUX, "%02x ", stream[i]); } xprintf(VERBOSE|DEMUX, "\n"); + +#endif break; } mediaIndex++; @@ -739,11 +764,14 @@ static void demux_ts_parse_pmt(demux_ts *this, pid = (((unsigned int)pkt[13] & 0x1f) << 8) | pkt[14]; if (this->pcrPid != pid) { +#ifdef TS_LOG + if (this->pcrPid == INVALID_PID) { xprintf(VERBOSE|DEMUX, "PMT pcr pid 0x%04x\n", pid); } else { xprintf(VERBOSE|DEMUX, "PMT pcr pid changed 0x%04x\n", pid); } +#endif this->pcrPid = pid; } } @@ -818,6 +846,7 @@ static uint32_t demux_ts_adaptation_field_parse( uint8_t *data, uint32_t adaptat transport_private_data_flag = ((data[0] >> 1) & 0x01); adaptation_field_extension_flag = (data[0] & 0x01); +#ifdef TS_LOG xprintf(VERBOSE|DEMUX, "ADAPTATION FIELD length=%d\n", adaptation_field_length); if(discontinuity_indicator) { @@ -832,6 +861,7 @@ static uint32_t demux_ts_adaptation_field_parse( uint8_t *data, uint32_t adaptat xprintf(VERBOSE|DEMUX, "\tElementary_stream_priority_indicator=%d\n", elementary_stream_priority_indicator); } +#endif if(PCR_flag) { PCR = data[offset] << 25; PCR |= data[offset+1] << 17; @@ -839,8 +869,10 @@ static uint32_t demux_ts_adaptation_field_parse( uint8_t *data, uint32_t adaptat PCR |= data[offset+3] << 1; PCR |= (data[offset+4] >> 7) & 0x01; EPCR = ((data[offset+4] & 0x1) << 8) | data[offset+5]; +#ifdef TS_LOG xprintf(VERBOSE|DEMUX, "\tPCR=%u, EPCR=%u\n", PCR,EPCR); +#endif offset+=6; } if(OPCR_flag) { @@ -850,10 +882,13 @@ static uint32_t demux_ts_adaptation_field_parse( uint8_t *data, uint32_t adaptat OPCR |= data[offset+3] << 1; OPCR |= (data[offset+4] >> 7) & 0x01; EOPCR = ((data[offset+4] & 0x1) << 8) | data[offset+5]; +#ifdef TS_LOG xprintf(VERBOSE|DEMUX, "\tOPCR=%u,EOPCR=%u\n", OPCR,EOPCR); +#endif offset+=6; } +#ifdef TS_LOG if(slicing_point_flag) { xprintf(VERBOSE|DEMUX, "\tslicing_point_flag=%d\n", slicing_point_flag); @@ -866,6 +901,7 @@ static uint32_t demux_ts_adaptation_field_parse( uint8_t *data, uint32_t adaptat xprintf(VERBOSE|DEMUX, "\tadaptation_field_extension_flag=%d\n", adaptation_field_extension_flag); } +#endif return PCR; } /* transport stream packet layer */ @@ -939,12 +975,16 @@ static void demux_ts_parse_packet (demux_ts *this) { * Do the demuxing in descending order of packet frequency! */ if (pid == this->videoPid ) { +#ifdef TS_LOG xprintf(VERBOSE|DEMUX, "Video pid = 0x%04x\n",pid); +#endif demux_ts_buffer_pes (this, originalPkt+data_offset, this->videoMedia, payload_unit_start_indicator, continuity_counter, data_len); return; } else if (pid == this->audioPid) { +#ifdef TS_LOG xprintf(VERBOSE|DEMUX, "Audio pid = 0x%04x\n",pid); +#endif demux_ts_buffer_pes (this, originalPkt+data_offset, this->audioMedia, payload_unit_start_indicator, continuity_counter, data_len); return; @@ -952,16 +992,20 @@ static void demux_ts_parse_packet (demux_ts *this) { demux_ts_parse_pat (this, originalPkt, originalPkt+data_offset-4, payload_unit_start_indicator); return; } else if (pid == 0x1fff) { +#ifdef TS_LOG xprintf(VERBOSE|DEMUX,"Null Packet\n"); +#endif return; } if ((this->audioPid == INVALID_PID) && (this->videoPid == INVALID_PID)) { program_count = 0; while ((this->program_number[program_count] != INVALID_PROGRAM) ) { if ( pid == this->pmt_pid[program_count] ) { +#ifdef TS_LOG xprintf(VERBOSE|DEMUX,"PMT prog 0x%04x pid 0x%04x\n", this->program_number[program_count], this->pmt_pid[program_count]); +#endif demux_ts_parse_pmt (this, originalPkt, originalPkt+data_offset-4, payload_unit_start_indicator); return; } @@ -984,7 +1028,9 @@ static void *demux_ts_loop(void *gen_this) { demux_ts_parse_packet(this); } while (this->status == DEMUX_OK) ; +#ifdef TS_LOG xprintf(VERBOSE|DEMUX, "demux loop finished (status: %d)\n", this->status); +#endif this->status = DEMUX_FINISHED; buf = this->fifoVideo->buffer_pool_alloc(this->fifoVideo); @@ -1048,7 +1094,9 @@ static int demux_ts_open(demux_plugin_t *this_gen, input_plugin_t *input, } ending = strrchr(mrl, '.'); if (ending) { +#ifdef TS_LOG xprintf(VERBOSE|DEMUX, "demux_ts_open: ending %s of %s\n", ending, mrl); +#endif if ((!strcasecmp(ending, ".m2t")) || (!strcasecmp(ending, ".ts")) || (!strcasecmp(ending, ".trp")) ) { @@ -1176,7 +1224,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) { */ this = xine_xmalloc(sizeof(*this)); config = xine->config; - xine_debug = config->lookup_int(config, "xine_debug", 0); + this->plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION; this->plugin.open = demux_ts_open; this->plugin.start = demux_ts_start; diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index efdc470ba..09b04c2a0 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.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_dvd.c,v 1.35 2001/11/17 14:26:38 f1rmb Exp $ + * $Id: input_dvd.c,v 1.36 2001/11/18 03:53:23 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -52,8 +52,6 @@ #include "dvd_udf.h" #include "read_cache.h" -static uint32_t xine_debug; - #if defined(__sun) #define RDVD "/vol/dev/aliases/cdrom0" #define DVD RDVD @@ -259,8 +257,6 @@ static int openDVDFile (dvd_input_plugin_t *this, int lbnum; int encrypted=0; - xprintf (VERBOSE|INPUT, "input_dvd : openDVDFile >%s<\n", filename); - if (openDrive(this) < 0) { printf ("input_dvd: cannot open dvd drive >%s<\n", this->device); return 0; @@ -314,8 +310,6 @@ static int openDVDFile (dvd_input_plugin_t *this, snprintf (str, sizeof(str), "/VIDEO_TS/%s", filename); - xprintf (VERBOSE|INPUT, "UDFFindFile %s\n", str); - if (!(lbnum = UDFFindFile(this->dvd_fd, str, size))) { printf ("input_dvd: cannot open file >%s<\n", filename); @@ -348,8 +342,6 @@ static int dvd_plugin_open (input_plugin_t *this_gen, char *mrl) { this->mrl = mrl; - xprintf (VERBOSE|INPUT, "input dvd : input_plugin_open >%s<\n", mrl); - /* * do we handle this kind of MRL ? */ @@ -358,16 +350,13 @@ static int dvd_plugin_open (input_plugin_t *this_gen, char *mrl) { filename = (char *) &mrl[6]; - xprintf (VERBOSE|INPUT, "input dvd : dvd_plugin_open media type correct." - " file name is %s\n", filename); - sscanf (filename, "VTS_%d_%d.VOB", &this->gVTSMajor, &this->gVTSMinor); this->file_lbstart = openDVDFile (this, filename, &this->file_size) ; this->file_lbcur = this->file_lbstart; if (!this->file_lbstart) { - fprintf (stderr, "Unable to find >%s< on dvd.\n", filename); + printf ("input_dvd: Unable to find >%s< on dvd.\n", filename); return 0; } @@ -401,11 +390,11 @@ static off_t dvd_plugin_read (input_plugin_t *this_gen, return DVD_VIDEO_LB_LEN; } else if (bytes_read < 0) - fprintf (stderr, "read error in input_dvd plugin (%s)\n", - strerror (errno)); + printf ("input_dvd: read error in input_dvd plugin (%s)\n", + strerror (errno)); else - fprintf (stderr, "short read in input_dvd (%d != %d)\n", - bytes_read, DVD_VIDEO_LB_LEN); + printf ("input_dvd: short read in input_dvd (%d != %d)\n", + bytes_read, DVD_VIDEO_LB_LEN); return 0; } @@ -507,19 +496,19 @@ static int dvd_plugin_eject_media (input_plugin_t *this_gen) { switch(status) { case CDS_TRAY_OPEN: if((ret = ioctl(fd, CDROMCLOSETRAY)) != 0) { - xprintf(VERBOSE|INPUT, "CDROMCLOSETRAY failed: %s\n", + printf ("input_dvd: CDROMCLOSETRAY failed: %s\n", strerror(errno)); } break; case CDS_DISC_OK: if((ret = ioctl(fd, CDROMEJECT)) != 0) { - xprintf(VERBOSE|INPUT, "CDROMEJECT failed: %s\n", strerror(errno)); + printf ("input_dvd: CDROMEJECT failed: %s\n", strerror(errno)); } break; } } else { - xprintf(VERBOSE|INPUT, "CDROM_DRIVE_STATUS failed: %s\n", + printf ("input_dvd: CDROM_DRIVE_STATUS failed: %s\n", strerror(errno)); close(fd); return 0; @@ -530,7 +519,7 @@ static int dvd_plugin_eject_media (input_plugin_t *this_gen) { # if defined (__sun) status = 0; if ((ret = ioctl(fd, CDROMEJECT)) != 0) { - xprintf(VERBOSE|INPUT, "CDROMEJECT failed: %s\n", strerror(errno)); + printf("input_dvd: CDROMEJECT failed: %s\n", strerror(errno)); } # else @@ -749,7 +738,6 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { this = (dvd_input_plugin_t *) xine_xmalloc (sizeof (dvd_input_plugin_t)); config = xine->config; - xine_debug = config->lookup_int (config, "xine_debug", 0); for (i = 0; i < MAX_DIR_ENTRIES; i++) { this->filelist[i] = (char *) xine_xmalloc (256); @@ -776,8 +764,12 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { this->input_plugin.get_optional_data = dvd_plugin_get_optional_data; this->input_plugin.is_branch_possible= NULL; - this->device = config->lookup_str(config, "dvd_device", DVD); - this->raw_device = config->lookup_str(config, "dvd_raw_device", RDVD); + this->device = config->register_string(config, "input.dvd_device", DVD, + "path to your local dvd device file", + NULL, NULL, NULL); + this->raw_device = config->register_string(config, "input.dvd_raw_device", RDVD, + "path to a raw device set up for dvd access", + NULL, NULL, NULL); #ifdef __sun check_solaris_vold_device(this); #endif diff --git a/src/input/input_file.c b/src/input/input_file.c index f262150cb..ae7267a2b 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.28 2001/11/17 14:26:38 f1rmb Exp $ + * $Id: input_file.c,v 1.29 2001/11/18 03:53:23 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -41,8 +41,6 @@ extern int errno; -static uint32_t xine_debug; - #ifndef __GNUC__ #define __FUNCTION__ __func__ #endif @@ -257,8 +255,6 @@ static int file_plugin_open (input_plugin_t *this_gen, char *mrl) { else filename = mrl; - xprintf (VERBOSE|INPUT, "Opening >%s<\n",filename); - this->fh = open (filename, O_RDONLY); if (this->fh == -1) { @@ -694,8 +690,6 @@ static char* file_plugin_get_mrl (input_plugin_t *this_gen) { static void file_plugin_close (input_plugin_t *this_gen) { file_input_plugin_t *this = (file_input_plugin_t *) this_gen; - xprintf (VERBOSE|INPUT, "closing input\n"); - close(this->fh); this->fh = -1; } @@ -705,7 +699,6 @@ static void file_plugin_close (input_plugin_t *this_gen) { */ static void file_plugin_stop (input_plugin_t *this_gen) { - xprintf (VERBOSE|INPUT, "stopping input\n"); file_plugin_close(this_gen); } @@ -751,7 +744,6 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { this = (file_input_plugin_t *) xine_xmalloc (sizeof (file_input_plugin_t)); config = xine->config; - xine_debug = config->lookup_int (config, "xine_debug", 0); this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION; this->input_plugin.get_capabilities = file_plugin_get_capabilities; diff --git a/src/input/input_http.c b/src/input/input_http.c index 7a12863af..406d9e41d 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -44,8 +44,6 @@ #define DEFAULT_HTTP_PORT 80 -static uint32_t xine_debug; - typedef struct { input_plugin_t input_plugin; @@ -607,7 +605,6 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { this = (http_input_plugin_t *) xine_xmalloc(sizeof(http_input_plugin_t)); config = xine->config; - xine_debug = config->lookup_int (config, "xine_debug", 0); this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION; this->input_plugin.get_capabilities = http_plugin_get_capabilities; diff --git a/src/input/input_net.c b/src/input/input_net.c index 67d5d3fb9..fcf0914d9 100644 --- a/src/input/input_net.c +++ b/src/input/input_net.c @@ -46,8 +46,6 @@ #endif -static uint32_t xine_debug; - #define NET_BS_LEN 2324 typedef struct { @@ -167,11 +165,8 @@ static int net_plugin_open (input_plugin_t *this_gen, char *mrl) { if(strncmp(filename, "//", 2)==0) filename+=2; - xprintf (VERBOSE|INPUT, "Opening >%s<\n", filename); - pptr=strrchr(filename, ':'); - if(pptr) - { + if(pptr) { *pptr++=0; sscanf(pptr,"%d", &port); } @@ -312,7 +307,6 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { this = (net_input_plugin_t *) xine_xmalloc(sizeof(net_input_plugin_t)); config = xine->config; - xine_debug = config->lookup_int (config, "xine_debug", 0); this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION; this->input_plugin.get_capabilities = net_plugin_get_capabilities; diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c index 1550efd23..95ddc4363 100644 --- a/src/input/input_rtp.c +++ b/src/input/input_rtp.c @@ -86,8 +86,6 @@ #define RTP_BLOCKSIZE 2048 -static uint32_t xine_debug; - typedef struct _input_buffer { struct _input_buffer *next; unsigned char *buf; @@ -473,7 +471,6 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { this = (rtp_input_plugin_t *) xine_xmalloc(sizeof(rtp_input_plugin_t)); config = xine->config; - xine_debug = config->lookup_int (config, "xine_debug", 0); for (bufn = 0; bufn < N_BUFFERS; bufn++) { input_buffer_t *buf = xine_xmalloc(sizeof(input_buffer_t)); diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c index a7c556e54..06b002b86 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.16 2001/11/17 14:26:38 f1rmb Exp $ + * $Id: input_stdin_fifo.c,v 1.17 2001/11/18 03:53:23 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -40,8 +40,6 @@ #include "xineutils.h" #include "input_plugin.h" -static uint32_t xine_debug; - typedef struct { input_plugin_t input_plugin; @@ -89,8 +87,6 @@ static int stdin_plugin_open(input_plugin_t *this_gen, char *mrl) { return 0; } - xprintf (VERBOSE|INPUT, "Opening >%s<\n",filename); - this->fh = open (filename, O_RDONLY); this->curpos = 0; @@ -267,7 +263,6 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { this = (stdin_input_plugin_t *) xine_xmalloc(sizeof(stdin_input_plugin_t)); config = xine->config; - xine_debug = config->lookup_int (config, "xine_debug", 0); this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION; this->input_plugin.get_capabilities = stdin_plugin_get_capabilities; diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c index f2591410a..20d8cb12d 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.30 2001/11/17 14:26:38 f1rmb Exp $ + * $Id: input_vcd.c,v 1.31 2001/11/18 03:53:23 guenter Exp $ * */ @@ -51,8 +51,6 @@ #include "xineutils.h" #include "input_plugin.h" -static uint32_t xine_debug; - #if defined(__sun) #define CDROM "/vol/dev/aliases/cdrom0" #else @@ -332,8 +330,6 @@ static int vcd_plugin_open (input_plugin_t *this_gen, char *mrl) { filename = (char *) &mrl[6]; - xprintf (VERBOSE|INPUT, "Opening >%s<\n",filename); - if (sscanf (filename, "%d", &this->cur_track) != 1) { fprintf (stderr, "input_vcd: malformed MRL. Use vcd://<track #>\n"); close (this->fd); @@ -853,18 +849,18 @@ static int vcd_plugin_eject_media (input_plugin_t *this_gen) { switch(status) { case CDS_TRAY_OPEN: if((ret = ioctl(this->fd, CDROMCLOSETRAY)) != 0) { - xprintf(VERBOSE|INPUT, "CDROMCLOSETRAY failed: %s\n", strerror(errno)); + printf ("input_vcd: CDROMCLOSETRAY failed: %s\n", strerror(errno)); } break; case CDS_DISC_OK: if((ret = ioctl(this->fd, CDROMEJECT)) != 0) { - xprintf(VERBOSE|INPUT, "CDROMEJECT failed: %s\n", strerror(errno)); + printf ("input_vcd: CDROMEJECT failed: %s\n", strerror(errno)); } break; } } else { - xprintf(VERBOSE|INPUT, "CDROM_DRIVE_STATUS failed: %s\n", + printf ("input_vcd: CDROM_DRIVE_STATUS failed: %s\n", strerror(errno)); close(this->fd); return 0; @@ -900,7 +896,7 @@ static int vcd_plugin_eject_media (input_plugin_t *this_gen) { if ((fd = open(this->device, O_RDONLY|O_NONBLOCK)) > -1) { if ((ret = ioctl(fd, CDROMEJECT)) != 0) { - xprintf(VERBOSE|INPUT, "CDROMEJECT failed: %s\n", strerror(errno)); + printf ("input_vcd: CDROMEJECT failed: %s\n", strerror(errno)); } close(fd); } @@ -915,8 +911,6 @@ static int vcd_plugin_eject_media (input_plugin_t *this_gen) { static void vcd_plugin_close (input_plugin_t *this_gen) { vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; - xprintf (VERBOSE|INPUT, "closing input\n"); - close(this->fd); this->fd = -1; } @@ -1110,7 +1104,6 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { this = (vcd_input_plugin_t *) xine_xmalloc(sizeof(vcd_input_plugin_t)); config = xine->config; - xine_debug = config->lookup_int (config, "xine_debug", 0); for (i = 0; i < 100; i++) { this->filelist[i] = (char *) xine_xmalloc (256); @@ -1136,7 +1129,9 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) { this->input_plugin.get_optional_data = vcd_plugin_get_optional_data; this->input_plugin.is_branch_possible= NULL; - this->device = config->lookup_str(config, "vcd_device", CDROM); + this->device = config->register_string(config, "input.vcd_device", CDROM, + "path to your local vcd device file", + NULL, NULL, NULL); this->mrls = (mrl_t **) xine_xmalloc(sizeof(mrl_t*)); this->mrls_allocated_entries = 0; diff --git a/src/liba52/xine_decoder.c b/src/liba52/xine_decoder.c index a9b4f5b75..366438660 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.10 2001/11/17 22:40:01 miguelfreitas Exp $ + * $Id: xine_decoder.c,v 1.11 2001/11/18 03:53:24 guenter Exp $ * * stuff needed to turn liba52 into a xine decoder plugin */ @@ -495,9 +495,16 @@ audio_decoder_t *init_audio_decoder_plugin (int iface_version, config_values_t * this->audio_decoder.priority = 2; - this->a52_level = (float) cfg->lookup_int (cfg, "a52_level", 100) / 100.0; - this->disable_dynrng = !cfg->lookup_int (cfg, "a52_dynrng", 0); - this->enable_surround_downmix = cfg->lookup_int(cfg, "a52_surround_downmix", 0); + this->a52_level = (float) cfg->register_range (cfg, "audio.a52_level", 100, + 0, 200, + "a/52 volume control", + NULL, NULL, NULL) / 100.0; + this->disable_dynrng = !cfg->register_bool (cfg, "audio.a52_dynrng", 0, + "enable a/52 dynamic range compensation", + NULL, NULL, NULL); + this->enable_surround_downmix = cfg->register_bool (cfg, "audio.a52_surround_downmix", 0, + "enable audio downmixing to 2.0 surround stereo", + NULL, NULL, NULL); return (audio_decoder_t *) this; } diff --git a/src/libdivx4/xine_decoder.c b/src/libdivx4/xine_decoder.c index d772b7c33..527c74398 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.10 2001/11/17 14:26:38 f1rmb Exp $ + * $Id: xine_decoder.c,v 1.11 2001/11/18 03:53:24 guenter Exp $ * * xine decoder plugin using divx4 * @@ -382,7 +382,11 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, config_values_t * /* Try to dlopen libdivxdecore, then look for decore function if it fails, print a message and return 0 so that xine ignores us from then on. */ - libdecore_name = cfg->lookup_str(cfg, "divx4_libdivxdecore", "libdivxdecore.so"); + + libdecore_name = cfg->register_string (cfg, "codec.divx4_libdivxdecore", "libdivxdecore.so", + "Relative path to libdivxdecore.so to open", + NULL, NULL, NULL); + libdecore_handle = dlopen(libdecore_name, RTLD_LAZY); if (libdecore_handle) libdecore_func = dlsym(libdecore_handle, "decore"); @@ -397,7 +401,9 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, config_values_t * } /* allow override of version checking by user */ - version = cfg->lookup_int(cfg, "divx4_forceversion", 0); + version = cfg->register_num(cfg, "codec.divx4_forceversion", 0, + "Divx version to check for (set to 0 (default) if unsure)", + NULL, NULL, NULL); if (version) { /* this dangerous stuff warrants an extra warning */ printf("divx4: assuming libdivxdecore version is %d\n", version); @@ -444,10 +450,17 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, config_values_t * this->video_decoder.decode_data = divx4_decode_data; this->video_decoder.close = divx4_close; this->video_decoder.get_identifier = divx4_get_id; - this->video_decoder.priority = cfg->lookup_int(cfg, "divx4_priority", 4); + this->video_decoder.priority = cfg->register_num (cfg, "codec.divx4_priority", 4, + "priority of the divx4 plugin (>5 => enable)", + NULL, NULL, NULL); this->decore = libdecore_func; - this->postproc = cfg->lookup_int(cfg, "divx4_postproc", 3); - this->can_handle_311 = cfg->lookup_int(cfg, "divx4_msmpeg4v3", 1); + this->postproc = cfg->register_range (cfg, "codec.divx4_postproc", 3, + 0, 6, + "the postprocessing level, 0 = none and fast, 6 = all and slow", + NULL, NULL, NULL); + this->can_handle_311 = cfg->register_bool (cfg, "codec.divx4_msmpeg4v3", 1, + "use divx4 plugin for msmpeg4v3 streams", + NULL, NULL, NULL); this->size = 0; this->version = version; diff --git a/src/libspudec/spu.c b/src/libspudec/spu.c index 4a95e0980..dcee56c55 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.22 2001/11/17 14:26:39 f1rmb Exp $ + * $Id: spu.c,v 1.23 2001/11/18 03:53:24 guenter Exp $ * */ @@ -77,8 +77,10 @@ /* Return value: reassembly complete = 1 */ int spu_reassembly (spu_seq_t *seq, int start, uint8_t *pkt_data, u_int pkt_len) { - xprintf (VERBOSE|SPU, "pkt_len: %d\n", pkt_len); - xprintf (VERBOSE|SPU, "Reassembly: start=%d seq=%p\n", start,seq); +#ifdef LOG_DEBUG + printf ("spu: pkt_len: %d\n", pkt_len); + printf ("spu: Reassembly: start=%d seq=%p\n", start,seq); +#endif if (start) { seq->seq_len = (((u_int)pkt_data[0])<<8) | pkt_data[1]; @@ -86,22 +88,32 @@ int spu_reassembly (spu_seq_t *seq, int start, uint8_t *pkt_data, u_int pkt_len) if (seq->buf_len < seq->seq_len) { if (seq->buf) { - xprintf (VERBOSE|SPU, "FREE1: seq->buf %p\n", seq->buf); +#ifdef LOG_DEBUG + printf ("spu: FREE1: seq->buf %p\n", seq->buf); +#endif free(seq->buf); seq->buf = NULL; - xprintf (VERBOSE|SPU, "FREE2: seq->buf %p\n", seq->buf); +#ifdef LOG_DEBUG + printf ("spu: FREE2: seq->buf %p\n", seq->buf); +#endif } seq->buf_len = seq->seq_len; - xprintf (VERBOSE|SPU, "MALLOC1: seq->buf %p, len=%d\n", seq->buf,seq->buf_len); +#ifdef LOG_DEBUG + printf ("spu: MALLOC1: seq->buf %p, len=%d\n", seq->buf,seq->buf_len); +#endif seq->buf = malloc(seq->buf_len); - xprintf (VERBOSE|SPU, "MALLOC2: seq->buf %p, len=%d\n", seq->buf,seq->buf_len); +#ifdef LOG_DEBUG + printf ("spu: MALLOC2: seq->buf %p, len=%d\n", seq->buf,seq->buf_len); +#endif } seq->ra_offs = 0; - xprintf (VERBOSE|SPU, "buf_len: %d\n", seq->buf_len); - xprintf (VERBOSE|SPU, "cmd_off: %d\n", seq->cmd_offs); +#ifdef LOG_DEBUG + printf ("spu: buf_len: %d\n", seq->buf_len); + printf ("spu: cmd_off: %d\n", seq->cmd_offs); +#endif } if (seq->ra_offs < seq->buf_len) { @@ -148,10 +160,14 @@ void spu_do_commands(spu_state_t *state, spu_seq_t* seq, vo_overlay_t *ovl) uint8_t *buf = state->cmd_ptr; uint8_t *next_seq; - xprintf (VERBOSE|SPU, "SPU EVENT\n"); +#ifdef LOG_DEBUG + printf ("spu: SPU EVENT\n"); +#endif state->delay = (buf[0] << 8) + buf[1]; - xprintf (VERBOSE|SPU, "\tdelay=%d\n",state->delay); +#ifdef LOG_DEBUG + printf ("spu: \tdelay=%d\n",state->delay); +#endif next_seq = seq->buf + (buf[2] << 8) + buf[3]; buf += 4; @@ -165,13 +181,17 @@ void spu_do_commands(spu_state_t *state, spu_seq_t* seq, vo_overlay_t *ovl) while (buf < next_seq && *buf != CMD_SPU_EOF) { switch (*buf) { case CMD_SPU_SHOW: /* show subpicture */ - xprintf (VERBOSE|SPU, "\tshow subpicture\n"); +#ifdef LOG_DEBUG + printf ("spu: \tshow subpicture\n"); +#endif state->visible = 1; buf++; break; case CMD_SPU_HIDE: /* hide subpicture */ - xprintf (VERBOSE|SPU, "\thide subpicture\n"); +#ifdef LOG_DEBUG + printf ("spu: \thide subpicture\n"); +#endif state->visible = 2; buf++; break; @@ -189,8 +209,10 @@ void spu_do_commands(spu_state_t *state, spu_seq_t* seq, vo_overlay_t *ovl) ovl->color[2] = state->clut[clut->entry1]; ovl->color[1] = state->clut[clut->entry2]; ovl->color[0] = state->clut[clut->entry3]; - xprintf (VERBOSE|SPU, "\tclut [%x %x %x %x]\n", - ovl->color[0], ovl->color[1], ovl->color[2], ovl->color[3]); +#ifdef LOG_DEBUG + printf ("spu: \tclut [%x %x %x %x]\n", + ovl->color[0], ovl->color[1], ovl->color[2], ovl->color[3]); +#endif state->modified = 1; buf += 3; break; @@ -203,8 +225,10 @@ void spu_do_commands(spu_state_t *state, spu_seq_t* seq, vo_overlay_t *ovl) ovl->trans[2] = trans->entry1; ovl->trans[1] = trans->entry2; ovl->trans[0] = trans->entry3; - xprintf (VERBOSE|SPU, "\ttrans [%d %d %d %d]\n", - ovl->trans[0], ovl->trans[1], ovl->trans[2], ovl->trans[3]); +#ifdef LOG_DEBUG + printf ("spu: \ttrans [%d %d %d %d]\n", + ovl->trans[0], ovl->trans[1], ovl->trans[2], ovl->trans[3]); +#endif state->modified = 1; buf += 3; break; @@ -226,8 +250,10 @@ void spu_do_commands(spu_state_t *state, spu_seq_t* seq, vo_overlay_t *ovl) ovl->clip_left = 0; ovl->clip_right = ovl->width - 1; - xprintf (VERBOSE|SPU, "\tx = %d y = %d width = %d height = %d\n", - ovl->x, ovl->y, ovl->width, ovl->height ); +#ifdef LOG_DEBUG + printf ("spu: \tx = %d y = %d width = %d height = %d\n", + ovl->x, ovl->y, ovl->width, ovl->height ); +#endif state->modified = 1; buf += 7; break; @@ -235,20 +261,24 @@ void spu_do_commands(spu_state_t *state, spu_seq_t* seq, vo_overlay_t *ovl) case CMD_SPU_SET_PXD_OFFSET: /* image top[0] field / image bottom[1] field*/ state->field_offs[0] = (((u_int)buf[1]) << 8) | buf[2]; state->field_offs[1] = (((u_int)buf[3]) << 8) | buf[4]; - xprintf (VERBOSE|SPU, "\toffset[0] = %d offset[1] = %d\n", - state->field_offs[0], state->field_offs[1]); +#ifdef LOG_DEBUG + printf ("spu: \toffset[0] = %d offset[1] = %d\n", + state->field_offs[0], state->field_offs[1]); +#endif state->modified = 1; buf += 5; break; case CMD_SPU_MENU: - xprintf (VERBOSE|SPU, "\tForce Display/Menu\n"); +#ifdef LOG_DEBUG + printf ("spu: \tForce Display/Menu\n"); +#endif state->menu = 1; buf++; break; default: - fprintf(stderr, "libspudec: unknown seqence command (%02x)\n", buf[0]); + printf("libspudec: unknown seqence command (%02x)\n", buf[0]); buf++; break; } @@ -305,7 +335,9 @@ static int spu_next_line (vo_overlay_t *spu) field ^= 1; // Toggle fields if (put_y >= spu->height) { - xprintf (VERBOSE|SPU, "put_y >= spu->height\n"); +#ifdef LOG_DEBUG + printf ("spu: put_y >= spu->height\n"); +#endif return -1; } return 0; @@ -339,14 +371,20 @@ void spu_draw_picture (spu_state_t *state, spu_seq_t* seq, vo_overlay_t *ovl) // if (ovl->rle) // free(ovl->rle); ovl->data_size = seq->cmd_offs * 2 * sizeof(rle_elem_t); - xprintf (VERBOSE|SPU, "MALLOC1: ovl->rle %p, len=%d\n", ovl->rle,ovl->data_size); +#ifdef LOG_DEBUG + printf ("spu: MALLOC1: ovl->rle %p, len=%d\n", ovl->rle,ovl->data_size); +#endif ovl->rle = malloc(ovl->data_size); - xprintf (VERBOSE|SPU, "MALLOC2: ovl->rle %p, len=%d\n", ovl->rle,ovl->data_size); +#ifdef LOG_DEBUG + printf ("spu: MALLOC2: ovl->rle %p, len=%d\n", ovl->rle,ovl->data_size); +#endif // } state->modified = 0; /* mark as already processed */ rle = ovl->rle; - xprintf (VERBOSE|SPU, "Draw RLE=%p\n",rle); +#ifdef LOG_DEBUG + printf ("spu: Draw RLE=%p\n",rle); +#endif while (bit_ptr[1] < seq->buf + seq->cmd_offs) { u_int len; @@ -382,9 +420,11 @@ void spu_draw_picture (spu_state_t *state, spu_seq_t* seq, vo_overlay_t *ovl) ovl->num_rle = rle - ovl->rle; ovl->rgb_clut = 0; - xprintf (VERBOSE|SPU, "Num RLE=%d\n",ovl->num_rle); - xprintf (VERBOSE|SPU, "Date size=%d\n",ovl->data_size); - xprintf (VERBOSE|SPU, "sizeof RLE=%d\n",sizeof(rle_elem_t)); +#ifdef LOG_DEBUG + printf ("spu: Num RLE=%d\n",ovl->num_rle); + printf ("spu: Date size=%d\n",ovl->data_size); + printf ("spu: sizeof RLE=%d\n",sizeof(rle_elem_t)); +#endif } /* Heuristic to discover the colors used by the subtitles diff --git a/src/libspudec/xine_decoder.c b/src/libspudec/xine_decoder.c index 454b13034..1f05e3ede 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.34 2001/11/17 14:26:39 f1rmb Exp $ + * $Id: xine_decoder.c,v 1.35 2001/11/18 03:53:24 guenter Exp $ * * stuff needed to turn libspu into a xine decoder plugin */ @@ -41,7 +41,9 @@ static void spudec_print_overlay( vo_overlay_t *ovl ); +/* #define LOG_DEBUG 1 +*/ #ifdef DEBUG @@ -189,15 +191,19 @@ static void spudec_reset (spudec_decoder_t *this) { for (i=0; i < MAX_EVENTS; i++) { if (this->spu_events[i].event == NULL) { - xprintf (VERBOSE|SPU, "MALLOC1: this->spu_events[%d].event %p, len=%d\n", - i, - this->spu_events[i].event, - sizeof(spu_overlay_event_t)); +#ifdef LOG_DEBUG + printf ("spu: MALLOC1: this->spu_events[%d].event %p, len=%d\n", + i, + this->spu_events[i].event, + sizeof(spu_overlay_event_t)); +#endif this->spu_events[i].event = xine_xmalloc (sizeof(spu_overlay_event_t)); - xprintf (VERBOSE|SPU, "MALLOC2: this->spu_events[%d].event %p, len=%d\n", - i, - this->spu_events[i].event, - sizeof(spu_overlay_event_t)); +#ifdef LOG_DEBUG + printf ("spu: MALLOC2: this->spu_events[%d].event %p, len=%d\n", + i, + this->spu_events[i].event, + sizeof(spu_overlay_event_t)); +#endif this->spu_events[i].event->event_type = 0; /* Empty slot */ } } @@ -208,11 +214,15 @@ static void spudec_reset (spudec_decoder_t *this) { this->spu_objects[1].handle=1; this->spu_objects[1].object_type=1; this->spu_objects[1].pts=0; - xprintf (VERBOSE|SPU, "MALLOC1: this->spu_objects[1].overlay %p, len=%d\n", - this->spu_objects[1].overlay, sizeof(vo_overlay_t)); +#ifdef LOG_DEBUG + printf ("spu: MALLOC1: this->spu_objects[1].overlay %p, len=%d\n", + this->spu_objects[1].overlay, sizeof(vo_overlay_t)); +#endif this->spu_objects[1].overlay = xine_xmalloc (sizeof(vo_overlay_t)); - xprintf (VERBOSE|SPU, "MALLOC2: this->spu_objects[1].overlay %p, len=%d\n", - this->spu_objects[1].overlay, sizeof(vo_overlay_t)); +#ifdef LOG_DEBUG + printf ("spu: MALLOC2: this->spu_objects[1].overlay %p, len=%d\n", + this->spu_objects[1].overlay, sizeof(vo_overlay_t)); +#endif /* xine_xmalloc does memset */ /* memset(this->spu_objects[1].overlay,0,sizeof(vo_overlay_t)); */ @@ -281,9 +291,13 @@ static int32_t spu_add_event(spudec_decoder_t *this, spu_overlay_event_t *event new_event=0; /* We skip the 0 entry because that is used as a pointer to the first event.*/ /* Find a free event slot */ - xprintf (VERBOSE|SPU, "284MUTEX1:spu_events lock"); +#ifdef LOG_DEBUG + printf ("spu: 284MUTEX1:spu_events lock"); +#endif pthread_mutex_lock (&this->spu_events_mutex); - xprintf (VERBOSE|SPU, "->ok\n"); +#ifdef LOG_DEBUG + printf ("spu:->ok\n"); +#endif do { new_event++; } while ((new_event<MAX_EVENTS) && (this->spu_events[new_event].event->event_type > 0)); @@ -302,7 +316,9 @@ static int32_t spu_add_event(spudec_decoder_t *this, spu_overlay_event_t *event found=1; break; } - xprintf (VERBOSE|SPU, "this_event=%d vpts %d\n",this_event, this->spu_events[this_event].event->vpts); +#ifdef LOG_DEBUG + printf ("spu:this_event=%d vpts %d\n",this_event, this->spu_events[this_event].event->vpts); +#endif if (this->spu_events[this_event].event->vpts > event->vpts ) { found=2; break; @@ -322,15 +338,19 @@ static int32_t spu_add_event(spudec_decoder_t *this, spu_overlay_event_t *event this->spu_events[new_event].event->event_type=event->event_type; this->spu_events[new_event].event->vpts=event->vpts; this->spu_events[new_event].event->object.handle=event->object.handle; - xprintf (VERBOSE|SPU, "323MALLOC1: this->spu_events[new_event=%d].event->object.overlay %p, len=%d\n", - new_event, - this->spu_events[new_event].event->object.overlay, - sizeof(vo_overlay_t)); +#ifdef LOG_DEBUG + printf ("spu: 323MALLOC1: this->spu_events[new_event=%d].event->object.overlay %p, len=%d\n", + new_event, + this->spu_events[new_event].event->object.overlay, + sizeof(vo_overlay_t)); +#endif this->spu_events[new_event].event->object.overlay = xine_xmalloc (sizeof(vo_overlay_t)); - xprintf (VERBOSE|SPU, "328MALLOC2: this->spu_events[new_event=%d].event->object.overlay %p, len=%d\n", - new_event, - this->spu_events[new_event].event->object.overlay, - sizeof(vo_overlay_t)); +#ifdef LOG_DEBUG + printf ("spu: 328MALLOC2: this->spu_events[new_event=%d].event->object.overlay %p, len=%d\n", + new_event, + this->spu_events[new_event].event->object.overlay, + sizeof(vo_overlay_t)); +#endif memcpy(this->spu_events[new_event].event->object.overlay, event->object.overlay, sizeof(vo_overlay_t)); memset(event->object.overlay,0,sizeof(vo_overlay_t)); @@ -360,9 +380,11 @@ static void spu_process (spudec_decoder_t *this, uint32_t stream_id) { /* FIXME:Get Handle after we have found if "Forced display" is set or not. */ - xprintf (VERBOSE|SPU, "Found SPU from stream %d pts=%d vpts=%d\n",stream_id, +#ifdef LOG_DEBUG + printf ("spu: Found SPU from stream %d pts=%d vpts=%d\n",stream_id, this->spu_stream_state[stream_id].pts, this->spu_stream_state[stream_id].vpts); +#endif this->state.cmd_ptr = this->cur_seq->buf + this->cur_seq->cmd_offs; this->state.next_pts = -1; /* invalidate timestamp */ this->state.modified = 1; /* Only draw picture if = 1 on first event of SPU */ @@ -389,7 +411,9 @@ static void spu_process (spudec_decoder_t *this, uint32_t stream_id) { if ((this->xine->spu_channel != stream_id) && (this->state.menu == 0) ) { - xprintf (VERBOSE|SPU, "Dropping SPU channel %d\n", stream_id); +#ifdef LOG_DEBUG + printf ("spu: Dropping SPU channel %d\n", stream_id); +#endif spu_free_handle(this, handle); return; } @@ -404,15 +428,19 @@ static void spu_process (spudec_decoder_t *this, uint32_t stream_id) { /* Subtitle */ this->event.object.handle = handle; /* FIXME: memcpy maybe. */ - xprintf (VERBOSE|SPU, "403MALLOC: this->event.object.overlay=%p\n", - this->event.object.overlay); +#ifdef LOG_DEBUG + printf ("spu: 403MALLOC: this->event.object.overlay=%p\n", + this->event.object.overlay); +#endif this->event.object.overlay = malloc(sizeof(vo_overlay_t)); memcpy(this->event.object.overlay, &this->overlay, sizeof(vo_overlay_t)); this->overlay.rle=NULL; - xprintf (VERBOSE|SPU, "409MALLOC: this->event.object.overlay=%p\n", - this->event.object.overlay); +#ifdef LOG_DEBUG + printf ("spu: 409MALLOC: this->event.object.overlay=%p\n", + this->event.object.overlay); +#endif this->event.event_type = this->state.visible; this->event.vpts = this->spu_stream_state[stream_id].vpts+(this->state.delay*1000); } else { @@ -420,15 +448,19 @@ static void spu_process (spudec_decoder_t *this, uint32_t stream_id) { spu_free_handle(this, handle); this->event.object.handle = spu_get_menu_handle(this); /* FIXME: memcpy maybe. */ - xprintf (VERBOSE|SPU, "418MALLOC: this->event.object.overlay=%p\n", - this->event.object.overlay); +#ifdef LOG_DEBUG + printf ("spu:418MALLOC: this->event.object.overlay=%p\n", + this->event.object.overlay); +#endif this->event.object.overlay = malloc(sizeof(vo_overlay_t)); memcpy(this->event.object.overlay, &this->overlay, sizeof(vo_overlay_t)); this->overlay.rle=NULL; - xprintf (VERBOSE|SPU, "424MALLOC: this->event.object.overlay=%p\n", - this->event.object.overlay); +#ifdef LOG_DEBUG + printf ("spu: 424MALLOC: this->event.object.overlay=%p\n", + this->event.object.overlay); +#endif this->event.event_type = EVENT_MENU_SPU; this->event.vpts = this->spu_stream_state[stream_id].vpts+(this->state.delay*1000); } @@ -536,15 +568,17 @@ static void spudec_nextseq(spudec_decoder_t* this) { } static void spudec_print_overlay( vo_overlay_t *ovl ) { - xprintf (VERBOSE|SPU, "OVERLAY to show\n"); - xprintf (VERBOSE|SPU, "\tx = %d y = %d width = %d height = %d\n", - ovl->x, ovl->y, ovl->width, ovl->height ); - xprintf (VERBOSE|SPU, "\tclut [%x %x %x %x]\n", - ovl->color[0], ovl->color[1], ovl->color[2], ovl->color[3]); - xprintf (VERBOSE|SPU, "\ttrans [%d %d %d %d]\n", - ovl->trans[0], ovl->trans[1], ovl->trans[2], ovl->trans[3]); - xprintf (VERBOSE|SPU, "\tclip top=%d bottom=%d left=%d right=%d\n", - ovl->clip_top, ovl->clip_bottom, ovl->clip_left, ovl->clip_right); +#ifdef LOG_DEBUG + printf ("spu: OVERLAY to show\n"); + printf ("spu: \tx = %d y = %d width = %d height = %d\n", + ovl->x, ovl->y, ovl->width, ovl->height ); + printf ("spu: \tclut [%x %x %x %x]\n", + ovl->color[0], ovl->color[1], ovl->color[2], ovl->color[3]); + printf ("spu: \ttrans [%d %d %d %d]\n", + ovl->trans[0], ovl->trans[1], ovl->trans[2], ovl->trans[3]); + printf ("spu: \tclip top=%d bottom=%d left=%d right=%d\n", + ovl->clip_top, ovl->clip_bottom, ovl->clip_left, ovl->clip_right); +#endif return; } @@ -556,9 +590,13 @@ static void spu_process_event( spudec_decoder_t *this, int vpts ) { // uint32_t pts; // int i; // vo_overlay_t overlay; - xprintf (VERBOSE|SPU, "557MUTEX1:spu_events lock"); +#ifdef LOG_DEBUG + printf ("spu: 557MUTEX1:spu_events lock"); +#endif pthread_mutex_lock (&this->spu_events_mutex); - xprintf (VERBOSE|SPU, " -> ok.\n"); +#ifdef LOG_DEBUG + printf ("spu: -> ok.\n"); +#endif this_event=this->spu_events[0].next_event; if ((!this_event) || (vpts < this->spu_events[this_event].event->vpts) ) { pthread_mutex_unlock (&this->spu_events_mutex); @@ -568,60 +606,84 @@ static void spu_process_event( spudec_decoder_t *this, int vpts ) { handle=this->spu_events[this_event].event->object.handle; switch( this->spu_events[this_event].event->event_type ) { case EVENT_SHOW_SPU: - xprintf (VERBOSE|SPU, "SHOW SPU NOW\n"); +#ifdef LOG_DEBUG + printf ("spu: SHOW SPU NOW\n"); +#endif if (this->spu_events[this_event].event->object.overlay != NULL) { this->spu_objects[handle].handle = handle; - xprintf (VERBOSE|SPU, "POINTER1: this->spu_objects[handle=%d].overlay=%p\n", - handle, - this->spu_objects[handle].overlay); +#ifdef LOG_DEBUG + printf ("spu: POINTER1: this->spu_objects[handle=%d].overlay=%p\n", + handle, + this->spu_objects[handle].overlay); +#endif this->spu_objects[handle].overlay = this->spu_events[this_event].event->object.overlay; - xprintf (VERBOSE|SPU, "POINTER2: this->spu_objects[handle=%d].overlay=%p\n", - handle, - this->spu_objects[handle].overlay); +#ifdef LOG_DEBUG + printf ("spu: POINTER2: this->spu_objects[handle=%d].overlay=%p\n", + handle, + this->spu_objects[handle].overlay); +#endif this->spu_events[this_event].event->object.overlay = NULL; } this->spu_showing[1].handle = handle; break; case EVENT_HIDE_SPU: - xprintf (VERBOSE|SPU, "HIDE SPU NOW\n"); +#ifdef LOG_DEBUG + printf ("spu: HIDE SPU NOW\n"); +#endif this->spu_showing[1].handle = -1; if(this->spu_objects[handle].overlay->rle) { - xprintf (VERBOSE|SPU, "FREE1: this->spu_objects[%d].overlay->rle %p\n", - handle, - this->spu_objects[handle].overlay->rle); +#ifdef LOG_DEBUG + printf ("spu: FREE1: this->spu_objects[%d].overlay->rle %p\n", + handle, + this->spu_objects[handle].overlay->rle); +#endif free(this->spu_objects[handle].overlay->rle); this->spu_objects[handle].overlay->rle = NULL; - xprintf (VERBOSE|SPU, "FREE2: this->spu_objects[%d].overlay->rle %p\n", - handle, - this->spu_objects[handle].overlay->rle); +#ifdef LOG_DEBUG + printf ("spu: FREE2: this->spu_objects[%d].overlay->rle %p\n", + handle, + this->spu_objects[handle].overlay->rle); +#endif } - xprintf (VERBOSE|SPU, "RLE clear=%08X\n",(uint32_t)this->spu_objects[handle].overlay->rle); +#ifdef LOG_DEBUG + printf ("spu: RLE clear=%08X\n",(uint32_t)this->spu_objects[handle].overlay->rle); +#endif if (this->spu_objects[handle].overlay) { - xprintf (VERBOSE|SPU, "FREE1: this->spu_objects[%d].overlay %p\n", - handle, - this->spu_objects[handle].overlay); +#ifdef LOG_DEBUG + printf ("spu: FREE1: this->spu_objects[%d].overlay %p\n", + handle, + this->spu_objects[handle].overlay); +#endif free(this->spu_objects[handle].overlay); this->spu_objects[handle].overlay = NULL; - xprintf (VERBOSE|SPU, "FREE2: this->spu_objects[%d].overlay %p\n", - handle, - this->spu_objects[handle].overlay); +#ifdef LOG_DEBUG + printf ("spu: FREE2: this->spu_objects[%d].overlay %p\n", + handle, + this->spu_objects[handle].overlay); +#endif } spu_free_handle( this, handle ); break; case EVENT_HIDE_MENU: - xprintf (VERBOSE|SPU, "HIDE MENU NOW %d\n",handle); +#ifdef LOG_DEBUG + printf ("spu: HIDE MENU NOW %d\n",handle); +#endif this->spu_showing[1].handle = -1; if(this->spu_objects[handle].overlay->rle) { +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "FREE1: this->spu_objects[%d].overlay->rle %p\n", - handle, - this->spu_objects[handle].overlay->rle); + handle, + this->spu_objects[handle].overlay->rle); +#endif free(this->spu_objects[handle].overlay->rle); this->spu_objects[handle].overlay->rle = NULL; +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "FREE2: this->spu_objects[%d].overlay->rle %p\n", - handle, - this->spu_objects[handle].overlay->rle); + handle, + this->spu_objects[handle].overlay->rle); +#endif } /* FIXME: maybe free something here */ @@ -629,24 +691,34 @@ static void spu_process_event( spudec_decoder_t *this, int vpts ) { break; case EVENT_MENU_SPU: +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "MENU SPU NOW\n"); +#endif if (this->spu_events[this_event].event->object.overlay != NULL) { vo_overlay_t *overlay = this->spu_objects[handle].overlay; vo_overlay_t *event_overlay = this->spu_events[this_event].event->object.overlay; +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "event_overlay\n"); +#endif spudec_print_overlay(event_overlay); +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "overlay\n"); +#endif spudec_print_overlay(overlay); this->spu_objects[handle].handle = handle; /* This should not change for menus */ /* If rle is not empty, free it first */ if(overlay && overlay->rle) { +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "FREE1: overlay->rle %p\n", - overlay->rle); + overlay->rle); +#endif free (overlay->rle); overlay->rle = NULL; +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "FREE2: overlay->rle %p\n", - overlay->rle); + overlay->rle); +#endif } overlay->rle = event_overlay->rle; overlay->data_size = event_overlay->data_size; @@ -660,7 +732,9 @@ static void spu_process_event( spudec_decoder_t *this, int vpts ) { event_overlay->color[1] + event_overlay->color[2] + event_overlay->color[3]) > 0 ) { +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "mixing clut\n"); +#endif overlay->color[0] = event_overlay->color[0]; overlay->color[1] = event_overlay->color[1]; overlay->color[2] = event_overlay->color[2]; @@ -670,33 +744,47 @@ static void spu_process_event( spudec_decoder_t *this, int vpts ) { event_overlay->trans[1] + event_overlay->trans[2] + event_overlay->trans[3]) > 0 ) { +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "mixing trans\n"); +#endif overlay->trans[0] = event_overlay->trans[0]; overlay->trans[1] = event_overlay->trans[1]; overlay->trans[2] = event_overlay->trans[2]; overlay->trans[3] = event_overlay->trans[3]; } this->spu_showing[1].handle = handle; +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "overlay after\n"); +#endif spudec_print_overlay(overlay); +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "FREE1: event_overlay %p\n", this->spu_events[this_event].event->object.overlay = NULL); +#endif /* The null test was done at the start of this case statement */ free (this->spu_events[this_event].event->object.overlay); this->spu_events[this_event].event->object.overlay = NULL; +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "FREE2: event_ovlerlay %p\n", this->spu_events[this_event].event->object.overlay); +#endif } break; case EVENT_MENU_BUTTON: +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "MENU BUTTON NOW\n"); +#endif if (this->spu_events[this_event].event->object.overlay != NULL) { vo_overlay_t *overlay = this->spu_objects[handle].overlay; vo_overlay_t *event_overlay = this->spu_events[this_event].event->object.overlay; +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "event_overlay\n"); +#endif spudec_print_overlay(event_overlay); +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "overlay\n"); +#endif spudec_print_overlay(overlay); this->spu_objects[handle].handle = handle; /* This should not change for menus */ overlay->clip_top = event_overlay->clip_top; @@ -708,7 +796,9 @@ static void spu_process_event( spudec_decoder_t *this, int vpts ) { event_overlay->color[1] + event_overlay->color[2] + event_overlay->color[3]) > 0 ) { +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "mixing clut\n"); +#endif overlay->color[0] = event_overlay->color[0]; overlay->color[1] = event_overlay->color[1]; overlay->color[2] = event_overlay->color[2]; @@ -718,27 +808,37 @@ static void spu_process_event( spudec_decoder_t *this, int vpts ) { event_overlay->trans[1] + event_overlay->trans[2] + event_overlay->trans[3]) > 0 ) { +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "mixing trans\n"); +#endif overlay->trans[0] = event_overlay->trans[0]; overlay->trans[1] = event_overlay->trans[1]; overlay->trans[2] = event_overlay->trans[2]; overlay->trans[3] = event_overlay->trans[3]; } this->spu_showing[1].handle = handle; +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "overlay after\n"); +#endif spudec_print_overlay(overlay); +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "FREE1: event_overlay %p\n", this->spu_events[this_event].event->object.overlay = NULL); +#endif /* The null test was done at the start of this case statement */ free (this->spu_events[this_event].event->object.overlay); this->spu_events[this_event].event->object.overlay = NULL; +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "FREE2: event_ovlerlay %p\n", this->spu_events[this_event].event->object.overlay); +#endif } break; default: +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "Unhandled event type\n"); +#endif break; } @@ -793,22 +893,29 @@ static void spudec_event_listener(void *this_gen, xine_event_t *event_gen) { spu_overlay_event_t *overlay_event = NULL; vo_overlay_t *overlay = NULL; spu_button_t *but = event->data; +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "MALLOC1: overlay_event %p, len=%d\n", overlay_event, sizeof(spu_overlay_event_t)); +#endif overlay_event = xine_xmalloc (sizeof(spu_overlay_event_t)); +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "MALLOC2: overlay_event %p, len=%d\n", overlay_event, sizeof(spu_overlay_event_t)); xprintf (VERBOSE|SPU, "MALLOC1: overlay %p, len=%d\n", overlay, sizeof(vo_overlay_t)); +#endif overlay = xine_xmalloc (sizeof(vo_overlay_t)); +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "MALLOC2: overlay %p, len=%d\n", overlay, sizeof(vo_overlay_t)); +#endif overlay_event->object.overlay=overlay; +#ifdef LOG_DEBUG xprintf (VERBOSE|SPU, "BUTTON\n"); xprintf (VERBOSE|SPU, "\tshow=%d\n",but->show); xprintf (VERBOSE|SPU, "\tclut [%x %x %x %x]\n", @@ -817,6 +924,7 @@ static void spudec_event_listener(void *this_gen, xine_event_t *event_gen) { but->trans[0], but->trans[1], but->trans[2], but->trans[3]); xprintf (VERBOSE|SPU, "\tleft = %d right = %d top = %d bottom = %d\n", but->left, but->right, but->top, but->bottom ); +#endif if (!this->state.menu) return; if (but->show) { @@ -882,10 +990,9 @@ spu_decoder_t *init_spu_decoder_plugin (int iface_version, xine_t *xine) { spudec_decoder_t *this ; if (iface_version != 4) { - fprintf(stderr, - "libspudec: Doesn't support plugin API version %d.\n" - "libspudec: This means there is a version mismatch between XINE and\n" - "libspudec: this plugin.\n", iface_version); + printf("libspudec: Doesn't support plugin API version %d.\n" + "libspudec: This means there is a version mismatch between XINE and\n" + "libspudec: this plugin.\n", iface_version); return NULL; } diff --git a/src/libw32dll/w32codec.c b/src/libw32dll/w32codec.c index dfe0ca762..e51b575a7 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.47 2001/11/17 19:41:09 miguelfreitas Exp $ + * $Id: w32codec.c,v 1.48 2001/11/18 03:53:24 guenter Exp $ * * routines for using w32 codecs * DirectShow support by Miguel Freitas (Nov/2001) @@ -1114,7 +1114,9 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, config_values_t * return NULL; } - win32_def_path = cfg->lookup_str (cfg, "win32_path", "/usr/lib/win32"); + win32_def_path = cfg->register_string (cfg, "codec.win32_path", "/usr/lib/win32", + "path to win32 codec dlls", + NULL, NULL, NULL); this = (w32v_decoder_t *) xine_xmalloc (sizeof (w32v_decoder_t)); @@ -1147,7 +1149,9 @@ audio_decoder_t *init_audio_decoder_plugin (int iface_version, config_values_t * return NULL; } - win32_def_path = cfg->lookup_str (cfg, "win32_path", "/usr/lib/win32"); + win32_def_path = cfg->register_string (cfg, "codec.win32_path", "/usr/lib/win32", + "path to win32 codec dlls", + NULL, NULL, NULL); this = (w32a_decoder_t *) xine_xmalloc (sizeof (w32a_decoder_t)); diff --git a/src/video_out/video_out_syncfb.c b/src/video_out/video_out_syncfb.c index 9397dffdb..4b088eb88 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.46 2001/11/17 14:26:39 f1rmb Exp $ + * $Id: video_out_syncfb.c,v 1.47 2001/11/18 03:53:24 guenter Exp $ * * video_out_syncfb.c, SyncFB (for Matrox G200/G400 cards) interface for xine * @@ -60,8 +60,6 @@ #include "alphablend.h" #include "xineutils.h" -uint32_t xine_debug; - typedef struct { int value; int min; @@ -96,12 +94,12 @@ typedef struct { vo_overlay_t *overlay; - // syncfb module related stuff - int fd; // file descriptor of the syncfb device - int yuv_format; // either YUV420P3, YUV420P2 or YUV422 - int overlay_state; // 0 = off, 1 = on - uint8_t* video_mem; // mmapped video memory - int default_repeat; // how many times a frame will be repeatedly displayed + /* syncfb module related stuff */ + int fd; /* file descriptor of the syncfb device */ + int yuv_format; /* either YUV420P3, YUV420P2 or YUV422 */ + int overlay_state; /* 0 = off, 1 = on */ + uint8_t* video_mem; /* mmapped video memory */ + int default_repeat; /* how many times a frame will be repeatedly displayed */ uint32_t supported_capabilities; syncfb_config_t syncfb_config; @@ -160,13 +158,13 @@ typedef struct { int gX11Fail; -// -// internal video_out_syncfb functions -// +/* + * internal video_out_syncfb functions + */ -// returns boolean value (1 success, 0 failure) -int syncfb_overlay_on(syncfb_driver_t* this) -{ +/* returns boolean value (1 success, 0 failure) */ +int syncfb_overlay_on(syncfb_driver_t* this) { + if(ioctl(this->fd, SYNCFB_ON)) { printf("video_out_syncfb: error. (on ioctl failed)\n"); return 0; @@ -176,9 +174,8 @@ int syncfb_overlay_on(syncfb_driver_t* this) } } -// returns boolean value (1 success, 0 failure) -int syncfb_overlay_off(syncfb_driver_t* this) -{ +/* returns boolean value (1 success, 0 failure) */ +int syncfb_overlay_off(syncfb_driver_t* this) { if(ioctl(this->fd, SYNCFB_OFF)) { printf("video_out_syncfb: error. (off ioctl failed)\n"); return 0; @@ -188,8 +185,7 @@ int syncfb_overlay_off(syncfb_driver_t* this) } } -static void write_frame_YUV422(syncfb_driver_t* this, syncfb_frame_t* frame) -{ +static void write_frame_YUV422(syncfb_driver_t* this, syncfb_frame_t* frame) { uint_8* y = (uint_8 *)frame->vo_frame.base[0]; uint_8* cb = (uint_8 *)frame->vo_frame.base[1]; uint_8* cr = (uint_8 *)frame->vo_frame.base[2]; @@ -498,9 +494,10 @@ static void syncfb_adapt_to_output_area(syncfb_driver_t* this, this->output_width = (this->output_width + 1) & 0xfffe; /* Round to even */ this->output_height = (this->output_height + 1) & 0xfffe; /* Round to even */ - // try to minimize our config ioctls by checking if anything really has - // changed, otherwise leave things untouched because every config ioctl - // also turns off and on the SyncFB module. + /* try to minimize our config ioctls by checking if anything really has + * changed, otherwise leave things untouched because every config ioctl + * also turns off and on the SyncFB module. + */ if(prev_output_width != this->output_width || prev_output_height != this->output_height || prev_output_xoffset != this->output_xoffset || @@ -525,13 +522,14 @@ static void syncfb_adapt_to_output_area(syncfb_driver_t* this, prev_v_w_visibility = this->video_win_visibility; prev_logo_visibility = this->logo_visibility; - // - // configuring SyncFB module from this point on. - // + /* + * configuring SyncFB module from this point on. + */ syncfb_overlay_off(this); - // sanity checking - certain situations *may* crash the SyncFB module, so - // take care that we always have valid numbers. + /* sanity checking - certain situations *may* crash the SyncFB module, so + * take care that we always have valid numbers. + */ if(posx >= 0 && posy >= 0 && this->frame_width > 0 && this->frame_height > 0 && this->output_width > 0 && this->output_height > 0 && this->frame_format > 0) { if(ioctl(this->fd, SYNCFB_GET_CONFIG, &this->syncfb_config)) printf("video_out_syncfb: error. (get_config ioctl failed)\n"); @@ -612,10 +610,6 @@ static void syncfb_calc_format(syncfb_driver_t* this, image_ratio = (double) this->delivered_width / (double) this->delivered_height; - xprintf (VERBOSE | VIDEO, "display_ratio : %f\n", this->display_ratio); - xprintf (VERBOSE | VIDEO, "stream aspect ratio : %f , code : %d\n", - image_ratio, ratio_code); - switch (this->props[VO_PROP_ASPECT_RATIO].value) { case ASPECT_AUTO: switch (ratio_code) { @@ -630,10 +624,10 @@ static void syncfb_calc_format(syncfb_driver_t* this, desired_ratio = image_ratio; break; case 0: /* forbidden */ - fprintf (stderr, "invalid ratio, using 4:3\n"); + printf ("video_out_syncfb: invalid ratio, using 4:3\n"); default: - xprintf (VIDEO, "unknown aspect ratio (%d) in stream => using 4:3\n", - ratio_code); + printf ("video_out_syncfb: unknown aspect ratio (%d) in stream => using 4:3\n", + ratio_code); case XINE_ASPECT_RATIO_4_3: /* 4:3 */ desired_ratio = 4.0 / 3.0; break; @@ -721,11 +715,11 @@ static void syncfb_translate_gui2video(syncfb_driver_t* this, } -// -// X error handler functions -// (even though the syncfb plugin doesn't check for gX11Fail yet, it is -// probably a good idea to leave this in place for future use) -// +/* + * X error handler functions + * (even though the syncfb plugin doesn't check for gX11Fail yet, it is + * probably a good idea to leave this in place for future use) + */ int HandleXError(Display* display, XErrorEvent* xevent) { char str [1024]; @@ -738,24 +732,25 @@ int HandleXError(Display* display, XErrorEvent* xevent) { return 0; } -static void x11_InstallXErrorHandler(syncfb_driver_t* this) -{ +static void x11_InstallXErrorHandler(syncfb_driver_t* this) { + XSetErrorHandler (HandleXError); XFlush (this->display); } -static void x11_DeInstallXErrorHandler(syncfb_driver_t* this) -{ +static void x11_DeInstallXErrorHandler(syncfb_driver_t* this) { + XSetErrorHandler (NULL); XFlush (this->display); } -// -// video_out_syncfb functions available to the outside world :) -// +/* + * video_out_syncfb functions available to the outside world :) + */ static uint32_t syncfb_get_capabilities(vo_driver_t* this_gen) { - // FIXME: VO_CAP_CONTRAST and VO_CAP_BRIGHTNESS unsupported at the moment, - // because they seem to be disabled in the syncfb module anyway. :( + /* FIXME: VO_CAP_CONTRAST and VO_CAP_BRIGHTNESS unsupported at the moment, + * because they seem to be disabled in the syncfb module anyway. :( + */ syncfb_driver_t* this = (syncfb_driver_t *) this_gen; return this->supported_capabilities; @@ -765,8 +760,8 @@ static void syncfb_frame_field (vo_frame_t *vo_img, int which_field) { /* not needed for Xv */ } -static void syncfb_frame_dispose(vo_frame_t* vo_img) -{ +static void syncfb_frame_dispose(vo_frame_t* vo_img) { + syncfb_frame_t* frame = (syncfb_frame_t *) vo_img ; if(frame->vo_frame.base[0]) { @@ -778,8 +773,8 @@ static void syncfb_frame_dispose(vo_frame_t* vo_img) free (frame); } -static vo_frame_t* syncfb_alloc_frame(vo_driver_t* this_gen) -{ +static vo_frame_t* syncfb_alloc_frame(vo_driver_t* this_gen) { + syncfb_frame_t* frame; frame = (syncfb_frame_t *) malloc(sizeof (syncfb_frame_t)); @@ -805,8 +800,8 @@ static vo_frame_t* syncfb_alloc_frame(vo_driver_t* this_gen) static void syncfb_update_frame_format(vo_driver_t* this_gen, vo_frame_t* frame_gen, uint32_t width, uint32_t height, - int ratio_code, int format, int flags) -{ + int ratio_code, int format, int flags) { + syncfb_frame_t* frame = (syncfb_frame_t *) frame_gen; if((frame->width != width) @@ -823,8 +818,10 @@ static void syncfb_update_frame_format(vo_driver_t* this_gen, frame->height = height; frame->format = format; - // we only know how to do 4:2:0 planar yuv right now. - // we prepare for YUY2 sizes + /* + * we only know how to do 4:2:0 planar yuv right now. + * we prepare for YUY2 sizes + */ frame->id = shmget(IPC_PRIVATE, frame->width * frame->height * 2, IPC_CREAT | 0777); if(frame->id < 0 ) { @@ -853,8 +850,8 @@ static void syncfb_update_frame_format(vo_driver_t* this_gen, frame->ratio_code = ratio_code; } -static void syncfb_overlay_blend(vo_driver_t* this_gen, vo_frame_t* frame_gen, vo_overlay_t* overlay) -{ +static void syncfb_overlay_blend(vo_driver_t* this_gen, vo_frame_t* frame_gen, vo_overlay_t* overlay) { + syncfb_frame_t* frame = (syncfb_frame_t *) frame_gen; if(overlay->rle) { @@ -862,8 +859,8 @@ static void syncfb_overlay_blend(vo_driver_t* this_gen, vo_frame_t* frame_gen, v } } -static void syncfb_display_frame(vo_driver_t* this_gen, vo_frame_t* frame_gen) -{ +static void syncfb_display_frame(vo_driver_t* this_gen, vo_frame_t* frame_gen) { + syncfb_driver_t* this = (syncfb_driver_t *) this_gen; syncfb_frame_t* frame = (syncfb_frame_t *) frame_gen; @@ -879,7 +876,7 @@ static void syncfb_display_frame(vo_driver_t* this_gen, vo_frame_t* frame_gen) syncfb_calc_format(this, frame->width, frame->height, frame->ratio_code); } - // the rest is only successful and safe, if the overlay is really on + /* 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"); @@ -906,15 +903,15 @@ static void syncfb_display_frame(vo_driver_t* this_gen, vo_frame_t* frame_gen) this->bufinfo.id = -1; } -static int syncfb_get_property(vo_driver_t* this_gen, int property) -{ +static int syncfb_get_property(vo_driver_t* this_gen, int property) { + syncfb_driver_t* this = (syncfb_driver_t *) this_gen; return this->props[property].value; } -static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) -{ +static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) { + syncfb_driver_t* this = (syncfb_driver_t *) this_gen; switch (property) { @@ -1034,16 +1031,16 @@ static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) return value; } -static void syncfb_get_property_min_max (vo_driver_t *this_gen, int property, int *min, int *max) -{ +static void syncfb_get_property_min_max (vo_driver_t *this_gen, int property, int *min, int *max) { + syncfb_driver_t *this = (syncfb_driver_t *) this_gen; *min = this->props[property].min; *max = this->props[property].max; } -static int syncfb_gui_data_exchange (vo_driver_t* this_gen, int data_type, void *data) -{ +static int syncfb_gui_data_exchange (vo_driver_t* this_gen, int data_type, void *data) { + syncfb_driver_t* this = (syncfb_driver_t *) this_gen; x11_rectangle_t* area; @@ -1055,7 +1052,7 @@ static int syncfb_gui_data_exchange (vo_driver_t* this_gen, int data_type, void } break; - // FIXME: consider if this is of use for us... + /* FIXME: consider if this is of use for us... */ case GUI_DATA_EX_EXPOSE_EVENT: break; @@ -1104,21 +1101,21 @@ static int syncfb_gui_data_exchange (vo_driver_t* this_gen, int data_type, void return 0; } -static void syncfb_exit (vo_driver_t* this_gen) -{ +static void syncfb_exit (vo_driver_t* this_gen) { + syncfb_driver_t *this = (syncfb_driver_t *) this_gen; - // get it off the screen - I wanna see my desktop again :-) + /* get it off the screen - I wanna see my desktop again :-) */ syncfb_overlay_off(this); - // don't know if it is necessary are even right, but anyway...?! + /* don't know if it is necessary are even right, but anyway...?! */ munmap(0, this->capabilities.memory_size); close(this->fd); } -vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) -{ +vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { + XWindowAttributes attr; XColor dummy; @@ -1128,8 +1125,8 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) int i = 0; char* device_name; - device_name = config->lookup_str(config, "syncfb_device", "/dev/syncfb"); - xine_debug = config->lookup_int(config, "xine_debug", 0); + device_name = config->register_string (config, "video.syncfb_device", "/dev/syncfb", + "syncfb (teletux) device node", NULL, NULL, NULL); if(!(this = malloc (sizeof (syncfb_driver_t)))) { printf("video_out_syncfb: aborting. (malloc failed)\n"); @@ -1137,14 +1134,14 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) } memset(this, 0, sizeof(syncfb_driver_t)); - // check for syncfb device + /* check for syncfb device */ if((this->fd = open(device_name, O_RDWR)) < 0) { printf("video_out_syncfb: aborting. (unable to open device \"%s\")\n", device_name); free(this); return NULL; } - // get capabilities from the syncfb module + /* 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"); @@ -1165,15 +1162,17 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) this->props[i].key = NULL; } - // mmap whole video memory + /* mmap whole video memory */ this->video_mem = (char *) mmap(0, this->capabilities.memory_size, PROT_WRITE, MAP_SHARED, this->fd, 0); - // check for formats we need... + /* check for formats we need... */ this->supported_capabilities = 0; this->yuv_format = 0; - // simple fallback mechanism - we want YUV 4:2:0 (3 plane) but we can also - // convert YV12 material to YUV 4:2:0 (2 plane) and YUV 4:2:2 ... + /* + * simple fallback mechanism - we want YUV 4:2:0 (3 plane) but we can also + * convert YV12 material to YUV 4:2:0 (2 plane) and YUV 4:2:2 ... + */ if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV420P3)) { this->supported_capabilities |= VO_CAP_YV12; this->yuv_format = VIDEO_PALETTE_YUV420P3; @@ -1193,8 +1192,9 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) printf("video_out_syncfb: SyncFB module supports YUY2.\n"); } if(this->capabilities.palettes & (1<<VIDEO_PALETTE_RGB565)) { -// FIXME: no RGB support yet -// this->supported_capabilities |= VO_CAP_RGB; + /* FIXME: no RGB support yet + * this->supported_capabilities |= VO_CAP_RGB; + */ printf("video_out_syncfb: SyncFB module supports RGB565.\n"); } @@ -1229,7 +1229,9 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) this->bufinfo.id = -1; this->config = config; - this->default_repeat = config->lookup_int(config, "syncfb_default_repeat", 3); + this->default_repeat = config->register_num (config, "video.syncfb_default_repeat", 3, + "Specifies how many times a frame is repeated", + NULL, NULL, NULL); this->display = visual->display; this->display_ratio = visual->display_ratio; this->displayed_height = 0; diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c index 85cbaf261..4a919fd7f 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.50 2001/11/17 14:26:39 f1rmb Exp $ + * $Id: video_out_xshm.c,v 1.51 2001/11/18 03:53:24 guenter Exp $ * * video_out_xshm.c, X11 shared memory extension interface for xine * @@ -59,8 +59,6 @@ #include "yuv2rgb.h" #include "xineutils.h" -uint32_t xine_debug; - extern int XShmGetEventBase(Display *); typedef struct xshm_frame_s { @@ -471,10 +469,10 @@ static void xshm_calc_output_size (xshm_driver_t *this) { desired_ratio = image_ratio; break; case 0: /* forbidden -> 4:3 */ - fprintf (stderr, "invalid ratio, using 4:3\n"); + printf ("video_out_xshm: invalid ratio, using 4:3\n"); default: - xprintf (VIDEO, "unknown aspect ratio (%d) in stream => using 4:3\n", - this->delivered_ratio_code); + printf ("video_out_xshm: unknown aspect ratio (%d) in stream => using 4:3\n", + this->delivered_ratio_code); case XINE_ASPECT_RATIO_4_3: /* 4:3 */ desired_ratio = 4.0 / 3.0; break; @@ -778,8 +776,10 @@ static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { || (frame->rgb_height != this->last_frame_rgb_height) || (frame->drawable_ref != this->last_frame_drawable_ref) ) { + /* xprintf (VIDEO, "video_out_xshm: requesting dest size of %d x %d \n", frame->rgb_width, frame->rgb_height); + */ this->request_dest_size (this->user_data, frame->rgb_width, frame->rgb_height, @@ -883,7 +883,7 @@ static int xshm_set_property (vo_driver_t *this_gen, aspect_ratio_name(value)); } else if ( property == VO_PROP_BRIGHTNESS) { yuv2rgb_set_gamma(this->yuv2rgb,value); - this->config->set_int (this->config, "xshm_gamma", value); + printf("video_out_xshm: gamma changed to %d\n",value); } else { printf ("video_out_xshm: tried to set unsupported property %d\n", property); @@ -1169,7 +1169,6 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { visual = (x11_visual_t *) visual_gen; display = visual->display; - xine_debug = config->lookup_int (config, "xine_debug", 0); /* * allocate plugin struct @@ -1196,7 +1195,9 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { this->output_scale_factor = 1.0; this->gui_width = 0; this->gui_height = 0; - this->zoom_mpeg1 = config->lookup_int (config, "zoom_mpeg1", 1); + this->zoom_mpeg1 = config->register_bool (config, "video.zoom_mpeg1", 1, + "Zoom small video formats to double size", + NULL, NULL, NULL); /* * FIXME: replace getenv() with config->lookup_int, merge with zoom_mpeg1? * @@ -1339,7 +1340,9 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { } this->yuv2rgb = yuv2rgb_init (mode, swapped, this->fast_rgb); - yuv2rgb_set_gamma(this->yuv2rgb, config->lookup_int (config, "xshm_gamma", 0)); + yuv2rgb_set_gamma(this->yuv2rgb, config->register_range (config, "video.xshm_gamma", 0, + -100, 100, "gamma correction for XShm driver", + NULL, NULL, NULL)); return &this->vo_driver; } diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index 4299bac9f..2be189506 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.75 2001/11/17 14:26:39 f1rmb Exp $ + * $Id: video_out_xv.c,v 1.76 2001/11/18 03:53:24 guenter Exp $ * * video_out_xv.c, X11 video extension interface for xine * @@ -58,14 +58,17 @@ #include "deinterlace.h" #include "xineutils.h" -uint32_t xine_debug; +/* +#define XV_LOG +*/ typedef struct { int value; int min; int max; Atom atom; - char *key; + + cfg_entry_t *entry; } xv_property_t; @@ -154,6 +157,8 @@ typedef struct { int *dest_x, int *dest_y, int *dest_height, int *dest_width); + char scratch[256]; + } xv_driver_t; int gX11Fail; @@ -680,9 +685,11 @@ static void xv_calc_format (xv_driver_t *this, image_ratio = (double) this->delivered_width / (double) this->delivered_height; - xprintf (VERBOSE | VIDEO, "display_ratio : %f\n", this->display_ratio); - xprintf (VERBOSE | VIDEO, "stream aspect ratio : %f , code : %d\n", - image_ratio, ratio_code); +#ifdef XV_LOG + printf ("video_out_xv: display_ratio : %f\n", this->display_ratio); + printf ("video_out_xv: stream aspect ratio : %f , code : %d\n", + image_ratio, ratio_code); +#endif switch (this->props[VO_PROP_ASPECT_RATIO].value) { case ASPECT_AUTO: @@ -700,8 +707,8 @@ static void xv_calc_format (xv_driver_t *this, case 0: /* forbidden */ fprintf (stderr, "invalid ratio, using 4:3\n"); default: - xprintf (VIDEO, "unknown aspect ratio (%d) in stream => using 4:3\n", - ratio_code); + printf ("video_out_xv: unknown aspect ratio (%d) in stream => using 4:3\n", + ratio_code); case XINE_ASPECT_RATIO_4_3: /* 4:3 */ desired_ratio = 4.0 / 3.0; break; @@ -885,8 +892,7 @@ static int xv_set_property (vo_driver_t *this_gen, this->props[property].atom, &this->props[property].value); - this->config->set_int (this->config, this->props[property].key, - this->props[property].value); + this->props[property].entry->num_value = this->props[property].value; return this->props[property].value; } else { @@ -1116,19 +1122,27 @@ static void xv_check_capability (xv_driver_t *this, int property, XvAttribute attr, int base_id, char *str_prop) { - int nDefault; + int int_default; + cfg_entry_t *entry; this->capabilities |= capability; this->props[property].min = attr.min_value; this->props[property].max = attr.max_value; this->props[property].atom = XInternAtom (this->display, str_prop, False); - this->props[property].key = str_prop; XvGetPortAttribute (this->display, this->xv_port, - this->props[property].atom, &nDefault); + this->props[property].atom, &int_default); + + sprintf (this->scratch, "video.%s", str_prop); - xv_set_property (&this->vo_driver, property, - this->config->lookup_int (this->config, str_prop, nDefault)); + this->config->register_num (this->config, this->scratch, int_default, + "Xv property", NULL, NULL, NULL); + + entry = this->config->lookup_entry (this->config, this->scratch); + + this->props[property].entry = entry; + + xv_set_property (&this->vo_driver, property, entry->num_value); } vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { @@ -1146,9 +1160,10 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { XColor dummy; XvImage *myimage; XShmSegmentInfo myshminfo; + static char *deinterlace_methods[] = {"none", "bob", "weave", "greedy", "onefield", + "onefieldxy", NULL}; display = visual->display; - xine_debug = config->lookup_int (config, "xine_debug", 0); /* * check for Xvideo support @@ -1266,7 +1281,7 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { this->props[i].min = 0; this->props[i].max = 0; this->props[i].atom = None; - this->props[i].key = NULL; + this->props[i].entry = NULL; } this->props[VO_PROP_INTERLACED].value = 0; @@ -1317,7 +1332,9 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { int xv_filter; /* This setting is specific to Permedia 2/3 cards. */ atom = XInternAtom (this->display, attr[k].name, False); - xv_filter = config->lookup_int (config, "XV_FILTER", 0); + xv_filter = config->register_num (config, "video.XV_FILTER", 0, + "bilinear scaling mode (permedia 2/3)", + NULL, NULL, NULL); XvSetPortAttribute (this->display, this->xv_port, atom, xv_filter); printf("video_out_xv: bilinear scaling mode (XV_FILTER) = %d\n", xv_filter); @@ -1343,9 +1360,11 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { this->xv_format_rgb = 0; for(i = 0; i < formats; i++) { - xprintf(VERBOSE|VIDEO, "video_out_xv: Xv image format: 0x%x (%4.4s) %s\n", +#ifdef XV_LOG + printf ("video_out_xv: Xv image format: 0x%x (%4.4s) %s\n", fo[i].id, (char*)&fo[i].id, (fo[i].format == XvPacked) ? "packed" : "planar"); +#endif if (fo[i].id == IMGFMT_YV12) { this->xv_format_yv12 = fo[i].id; this->capabilities |= VO_CAP_YV12; @@ -1369,7 +1388,10 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) { myimage = create_ximage (this, &myshminfo, 100, 100, IMGFMT_YV12); dispose_ximage (this, &myshminfo, myimage); - this->deinterlace_method = config->lookup_int (config, "deinterlace_method", 4); + this->deinterlace_method = config->register_enum (config, "video.deinterlace_method", 4, + deinterlace_methods, + "Software deinterlace method (Key I toggles deinterlacer on/off", + NULL, NULL, NULL); this->deinterlace_enabled = 0; return &this->vo_driver; diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index 9fd141769..a3dbd5319 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.30 2001/11/17 17:29:39 jcdutton Exp $ + * $Id: audio_out.c,v 1.31 2001/11/18 03:53:25 guenter Exp $ * * 22-8-2001 James imported some useful AC3 sections from the previous alsa driver. * (c) 2001 Andy Lo A Foe <andy@alsaplayer.org> @@ -350,8 +350,10 @@ static void *ao_loop (void *this_gen) { /* drop package */ - xprintf (VERBOSE|AUDIO, "audio_out: audio package (vpts = %d %d) dropped\n", - buf->vpts, gap); +#ifdef AUDIO_OUT_LOG + printf ("audio_out: audio package (vpts = %d %d) dropped\n", + buf->vpts, gap); +#endif } else { @@ -464,6 +466,7 @@ static void *ao_loop (void *this_gen) { /* ac3 seems to be swabbed data */ swab(buf->mem,this->frame_buffer+4, ac5_length ); + if (ac5_length <= 248) { ac5_pcm_length = 64; } else if (ac5_length <= 504) { @@ -482,6 +485,24 @@ static void *ao_loop (void *this_gen) { break; + + + + + memset(this->frame_buffer,0xff,6144); + this->frame_buffer[0] = 0xf872; /* spdif syncword */ + this->frame_buffer[1] = 0x4e1f; /* ............. */ + this->frame_buffer[2] = 0x0001; /* */ + + this->frame_buffer[3] = 0x3ee0; + + /* ac3 seems to be swabbed data */ + swab(buf->mem,this->frame_buffer+4, 2014 ); + + this->driver->write(this->driver, this->frame_buffer, 1024); + + break; + } } @@ -541,7 +562,9 @@ static int ao_open(ao_instance_t *this, this->frame_rate_factor = (double) this->output_frame_rate / (double) this->input_frame_rate; this->audio_step = (uint32_t) 90000 * (uint32_t) 32768 / this->input_frame_rate; this->frames_per_kpts = this->output_frame_rate * 1024 / 90000; - xprintf (VERBOSE|AUDIO, "audio_out : audio_step %d pts per 32768 frames\n", this->audio_step); +#ifdef AUDIO_OUT_LOG + printf ("audio_out : audio_step %d pts per 32768 frames\n", this->audio_step); +#endif this->metronom->set_audio_rate(this->metronom, this->audio_step); @@ -644,6 +667,7 @@ ao_instance_t *ao_new_instance (ao_driver_t *driver, metronom_t *metronom, ao_instance_t *this; int i; + static char *resample_modes[] = {"auto", "off", "on", NULL}; this = xine_xmalloc (sizeof (ao_instance_t)) ; @@ -664,8 +688,12 @@ ao_instance_t *ao_new_instance (ao_driver_t *driver, metronom_t *metronom, this->zero_space = xine_xmalloc (ZERO_BUF_SIZE * 2 * 6); this->gap_tolerance = driver->get_gap_tolerance (this->driver); - this->resample_conf = config->lookup_int (config, "audio_resample_mode", 0); - this->force_rate = config->lookup_int (config, "audio_force_rate", 0); + this->resample_conf = config->register_enum (config, "audio.resample_mode", 0, + resample_modes, "adjust whether resampling is done or not", + NULL, NULL, NULL); + this->force_rate = config->register_range (config, "audio.force_rate", 0, + 0, 96000, "if !=0 always resample to given rate", + NULL, NULL, NULL); /* * pre-allocate memory for samples @@ -688,4 +716,3 @@ ao_instance_t *ao_new_instance (ao_driver_t *driver, metronom_t *metronom, return this; } - diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c index 0eddae1a9..8926aff7d 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.5 2001/11/17 14:26:39 f1rmb Exp $ + * $Id: configfile.c,v 1.6 2001/11/18 03:53:25 guenter Exp $ * * config file management - implementation * @@ -27,49 +27,64 @@ #include "config.h" #endif +#include <sys/stat.h> +#include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <assert.h> #include "configfile.h" #include "xineutils.h" -/* + +/* * internal utility functions - *******************************/ + */ -void config_file_add (config_values_t *this, char *key, char *value) { +static char *copy_string (char *str) { - cfg_entry_t *entry; - int len; + char *cpy; + int len; - entry = (cfg_entry_t *) xine_xmalloc (sizeof (cfg_entry_t)); + len = strlen (str); + + cpy = xine_xmalloc (len+256); + + strncpy (cpy, str, len); - len = strlen (key); - entry->key = (char *) xine_xmalloc (len+2); - strncpy (entry->key, key, len+1); + return cpy; +} + +static cfg_entry_t *config_file_add (config_values_t *this, char *key) { + + cfg_entry_t *entry; - len = strlen (value); - entry->value = (char *) xine_xmalloc (len+21); - strncpy (entry->value, value, len+1); + entry = (cfg_entry_t *) xine_xmalloc (sizeof (cfg_entry_t)); + entry->key = copy_string (key); + entry->type = CONFIG_TYPE_UNKNOWN; - entry->next = NULL; + entry->next = NULL; - if (this->data->gConfigLast) - this->data->gConfigLast->next = entry; + if (this->last) + this->last->next = entry; else - this->data->gConfig = entry; + this->first = entry; - this->data->gConfigLast = entry; - -} + this->last = entry; + printf ("configfile: add entry key=%s\n", key); + return entry; +} +/* + * external interface + */ -cfg_entry_t *config_file_search (config_values_t *this, char *key) { +cfg_entry_t *config_file_lookup_entry (config_values_t *this, char *key) { cfg_entry_t *entry; - entry = this->data->gConfig; + entry = this->first; while (entry && strcmp (entry->key, key)) entry = entry->next; @@ -77,118 +92,314 @@ cfg_entry_t *config_file_search (config_values_t *this, char *key) { return entry; } +static char *config_file_register_string (config_values_t *this, + char *key, char *def_value, + char *description, + char *help, + config_cb_t changed_cb, + void *cb_data) { + cfg_entry_t *entry; -/* - * external interface - ***********************/ + assert (key); + assert (def_value); + assert (description); -static char *config_file_lookup_str (config_values_t *this, - char *key, char*str_default) { - cfg_entry_t *entry; + printf ("configfile: registering %s\n", key); - if(key == NULL) - return ((str_default != NULL) ? str_default : NULL); - - entry = config_file_search (this, key); + /* make sure this entry exists, create it if not */ - if (entry) - return entry->value; + entry = config_file_lookup_entry (this, key); - if(str_default) - config_file_add (this, key, str_default); + if (!entry) { + entry = config_file_add (this, key); + entry->unknown_value = copy_string(def_value); + } + + /* convert entry to string type if necessary */ - return str_default; -} + if (entry->type != CONFIG_TYPE_STRING) { + entry->type = CONFIG_TYPE_STRING; + entry->str_value = entry->unknown_value; + } + /* fill out rest of struct */ + entry->str_default = copy_string(def_value); + entry->description = description; + entry->help = help; + entry->callback = changed_cb; + entry->callback_data = cb_data; + return entry->str_value; +} -static int config_file_lookup_int (config_values_t *this, - char *key, int n_default) { +static int config_file_register_num (config_values_t *this, + char *key, int def_value, + char *description, + char *help, + config_cb_t changed_cb, + void *cb_data) { cfg_entry_t *entry; - char str[25]; - if(key == NULL) - return n_default; + assert (key); + assert (description); + + printf ("configfile: registering %s\n", key); + + /* make sure this entry exists, create it if not */ - entry = config_file_search (this, key); + entry = config_file_lookup_entry (this, key); - if (entry) { - int n; + if (!entry) { + entry = config_file_add (this, key); + entry->unknown_value = NULL; + } + + /* convert entry to num type if necessary */ - if (sscanf (entry->value, "%d", &n) == 1) - return n; + if (entry->type != CONFIG_TYPE_NUM) { + entry->type = CONFIG_TYPE_NUM; + + if (entry->unknown_value) + sscanf (entry->unknown_value, "%d", &entry->num_value); + else + entry->num_value = def_value; } - sprintf (str, "%d", n_default); + + /* fill out rest of struct */ - config_file_add (this, key, str); + entry->num_default = def_value; + entry->description = description; + entry->help = help; + entry->callback = changed_cb; + entry->callback_data = cb_data; - return n_default; + return entry->num_value; } +static int config_file_register_bool (config_values_t *this, + char *key, int def_value, + char *description, + char *help, + config_cb_t changed_cb, + void *cb_data) { + cfg_entry_t *entry; + assert (key); + assert (description); + + printf ("configfile: registering %s\n", key); + + /* make sure this entry exists, create it if not */ + + entry = config_file_lookup_entry (this, key); + + if (!entry) { + entry = config_file_add (this, key); + entry->unknown_value = NULL; + } + + /* convert entry to bool type if necessary */ + + if (entry->type != CONFIG_TYPE_BOOL) { + entry->type = CONFIG_TYPE_BOOL; + + if (entry->unknown_value) + sscanf (entry->unknown_value, "%d", &entry->num_value); + else + entry->num_value = def_value; + } + + + /* fill out rest of struct */ + + entry->num_default = def_value; + entry->description = description; + entry->help = help; + entry->callback = changed_cb; + entry->callback_data = cb_data; + + return entry->num_value; +} + +static int config_file_register_range (config_values_t *this, + char *key, int def_value, + int min, int max, + char *description, + char *help, + config_cb_t changed_cb, + void *cb_data) { -static void config_file_set_int (config_values_t *this, - char *key, int value) { - cfg_entry_t *entry; - if(key == NULL) - return; + assert (key); + assert (description); - entry = config_file_search (this, key); + printf ("configfile: registering %s\n", key); - if (entry) { - sprintf (entry->value, "%d", value); + /* make sure this entry exists, create it if not */ + + entry = config_file_lookup_entry (this, key); + if (!entry) { + entry = config_file_add (this, key); + entry->unknown_value = NULL; } - else { - char str[25]; - sprintf (str, "%d", value); + + /* convert entry to range type if necessary */ - config_file_add (this, key, str); + if (entry->type != CONFIG_TYPE_RANGE) { + entry->type = CONFIG_TYPE_RANGE; + + if (entry->unknown_value) + sscanf (entry->unknown_value, "%d", &entry->num_value); + else + entry->num_value = def_value; } + + /* fill out rest of struct */ + + entry->num_default = def_value; + entry->range_min = min; + entry->range_max = max; + entry->description = description; + entry->help = help; + entry->callback = changed_cb; + entry->callback_data = cb_data; + + return entry->num_value; } +static int config_file_parse_enum (char *str, char **values) { + char **value; + int i; + + + value = values; + i = 0; + while (*value) { -static void config_file_set_str (config_values_t *this, - char *key, char *value) { + printf ("configfile: parse enum, >%s< ?= >%s<\n", + *value, str); + + if (!strcmp (*value, str)) + return i; + + value++; + i++; + } + + printf ("configfile: warning, >%s< is not a valid enum here, using 0\n", + str); + + return 0; +} + +static int config_file_register_enum (config_values_t *this, + char *key, int def_value, + char **values, + char *description, + char *help, + config_cb_t changed_cb, + void *cb_data) { cfg_entry_t *entry; - if(key == NULL || value == NULL) - return; + assert (key); + assert (values); + assert (description); - entry = config_file_search (this, key); + printf ("configfile: registering %s\n", key); - if (entry) { - int len; + /* make sure this entry exists, create it if not */ + + entry = config_file_lookup_entry (this, key); + if (!entry) { + entry = config_file_add (this, key); + entry->unknown_value = NULL; + } + + /* convert entry to enum type if necessary */ - free (entry->value); + if (entry->type != CONFIG_TYPE_ENUM) { + entry->type = CONFIG_TYPE_ENUM; - len = strlen (value); - entry->value = (char *) xine_xmalloc (len+20); - strncpy (entry->value, value, len); + if (entry->unknown_value) + entry->num_value = config_file_parse_enum (entry->unknown_value, values); + else + entry->num_value = def_value; } - else { - config_file_add (this, key, value); + + /* fill out rest of struct */ + + entry->num_default = def_value; + entry->enum_values = values; + entry->description = description; + entry->help = help; + entry->callback = changed_cb; + entry->callback_data = cb_data; + + return entry->num_value; +} + +static void config_file_update_num (config_values_t *this, + char *key, int value) { + + cfg_entry_t *entry; + + entry = this->lookup_entry (this, key); + + if (!entry) { + + printf ("configfile: WARNING! tried to update unknown key %s (to %d)\n", + key, value); + return; + } + + entry->num_value = value; + + if (entry->callback) + entry->callback (entry->callback_data, entry); } +static void config_file_update_string (config_values_t *this, + char *key, char *value) { + + cfg_entry_t *entry; + + entry = this->lookup_entry (this, key); + + if (!entry) { + + printf ("configfile: WARNING! tried to update unknown key %s (to %s)\n", + key, value); + return; + + } + entry->str_value = copy_string (value); + if (entry->callback) + entry->callback (entry->callback_data, entry); +} static void config_file_save (config_values_t *this) { FILE *f_config; char filename[1024]; - sprintf (filename, "%s/.xinerc", xine_get_homedir()); + sprintf (filename, "%s/.xine", xine_get_homedir()); + mkdir (filename, 0755); + + sprintf (filename, "%s/.xine/config", xine_get_homedir()); + + printf ("writing config file to %s\n", filename); f_config = fopen (filename, "w"); @@ -196,22 +407,76 @@ static void config_file_save (config_values_t *this) { cfg_entry_t *entry; - fprintf (f_config, "#\n# xine config file\n#\n"); + fprintf (f_config, "#\n# xine config file\n#\n\n"); - entry = this->data->gConfig; + entry = this->first; while (entry) { - fprintf (f_config, "%s:%s\n",entry->key,entry->value); + fprintf (f_config, "# %s\n", entry->description); + switch (entry->type) { + case CONFIG_TYPE_UNKNOWN: + + fprintf (f_config, "%s:%s\n", + entry->key, entry->unknown_value); + + break; + case CONFIG_TYPE_RANGE: + fprintf (f_config, "# [%d..%d], default: %d\n", + entry->range_min, entry->range_max, entry->num_default); + fprintf (f_config, "%s:%d\n", entry->key, entry->num_value); + fprintf (f_config, "\n"); + break; + case CONFIG_TYPE_STRING: + fprintf (f_config, "# string, default: %s\n", + entry->str_default); + fprintf (f_config, "%s:%s\n", entry->key, entry->str_value); + fprintf (f_config, "\n"); + break; + case CONFIG_TYPE_ENUM: { + int i; + char **value; + + fprintf (f_config, "# {"); + value = entry->enum_values; + while (*value) { + fprintf (f_config, " %s ", *value); + value++; + } + + fprintf (f_config, "}, default: %d\n", + entry->num_default); + fprintf (f_config, "%s:", entry->key); + + i = 0; value = entry->enum_values; + while (i< (entry->num_value-1)) { + i++; + value++; + } + + fprintf (f_config, "%s\n", *value); + fprintf (f_config, "\n"); + break; + } + case CONFIG_TYPE_NUM: + fprintf (f_config, "# numeric, default: %d\n", + entry->num_default); + fprintf (f_config, "%s:%d\n", entry->key, entry->num_value); + fprintf (f_config, "\n"); + break; + case CONFIG_TYPE_BOOL: + fprintf (f_config, "# bool, default: %d\n", + entry->num_default); + fprintf (f_config, "%s:%d\n", entry->key, entry->num_value); + fprintf (f_config, "\n"); + break; + } + entry = entry->next; - } - + } fclose (f_config); } } - - - static void config_file_read (config_values_t *this, char *filename){ FILE *f_config; @@ -222,56 +487,56 @@ static void config_file_read (config_values_t *this, char *filename){ char line[1024]; char *value; - + while (fgets (line, 1023, f_config)) { line[strlen(line)-1]= (char) 0; /* eliminate lf */ if (line[0] == '#') continue; - + if ((value = strchr (line, ':'))) { + + cfg_entry_t *entry; + *value = (char) 0; - value++; - - config_file_add (this, line, value); + value++; + + entry = config_file_add (this, line); + entry->unknown_value = copy_string (value); } - } fclose (f_config); } } - - - config_values_t *config_file_init (char *filename) { config_values_t *this; - cfg_data_t *data; if ( (this = xine_xmalloc(sizeof(config_values_t))) ) { - if ( (data = xine_xmalloc(sizeof(cfg_data_t))) ) { - data->gConfig = NULL; - data->gConfigLast = NULL; - this->data = data; - config_file_read (this, filename); - } - else { - fprintf (stderr, "WARNING: could not allocate config data\n"); - } - } - else { - fprintf (stderr, "WARNING: could not allocate config values list\n"); + this->first = NULL; + this->last = NULL; + + config_file_read (this, filename); + + } else { + printf ("configfile: could not allocate config object\n"); + exit (1); } - this->lookup_str = config_file_lookup_str; - this->lookup_int = config_file_lookup_int; - this->set_str = config_file_set_str; - this->set_int = config_file_set_int; - this->save = config_file_save; - this->read = config_file_read; + this->register_string = config_file_register_string; + this->register_range = config_file_register_range; + this->register_enum = config_file_register_enum; + this->register_num = config_file_register_num; + this->register_bool = config_file_register_bool; + this->update_num = config_file_update_num; + this->update_string = config_file_update_string; + this->parse_enum = config_file_parse_enum; + this->lookup_entry = config_file_lookup_entry; + this->save = config_file_save; + this->read = config_file_read; return this; } @@ -279,6 +544,9 @@ config_values_t *config_file_init (char *filename) { /* * $Log: configfile.c,v $ + * Revision 1.6 2001/11/18 03:53:25 guenter + * new configfile interface, code cleanup, xprintf is gone + * * Revision 1.5 2001/11/17 14:26:39 f1rmb * Add 'xine_' prefix to all of xine-utils functions (what about cpu * acceleration?). Merge xine-utils header files to a new one "xineutils.h". diff --git a/src/xine-engine/configfile.h b/src/xine-engine/configfile.h index eb332afea..a5c195f1b 100644 --- a/src/xine-engine/configfile.h +++ b/src/xine-engine/configfile.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: configfile.h,v 1.3 2001/07/26 11:12:26 f1rmb Exp $ + * $Id: configfile.h,v 1.4 2001/11/18 03:53:25 guenter Exp $ * * config file management * @@ -32,54 +32,143 @@ extern "C" { #include <inttypes.h> -typedef struct cfg_entry_s { - struct cfg_entry_s *next; - char *key; - char *value; -} cfg_entry_t; +typedef struct cfg_entry_s cfg_entry_t; +typedef void (*config_cb_t) (void *, cfg_entry_t *); -typedef struct { - cfg_entry_t *gConfig; - cfg_entry_t *gConfigLast; -} cfg_data_t; +struct cfg_entry_s { + cfg_entry_t *next; + + char *key; + int type; + + /* type unknown */ + char *unknown_value; + + /* type string */ + char *str_value; + char *str_default; + + /* common to range, enum, num, bool: */ + + int num_value; + int num_default; + + /* type range specific: */ + int range_min; + int range_max; + + /* type enum specific: */ + char **enum_values; + + /* help info for the user */ + char *description; + char *help; + + /* callback function and data for live changeable values */ + config_cb_t callback; + void *callback_data; +}; + +/* + * config entry data types + */ + +#define CONFIG_TYPE_UNKNOWN 0 +#define CONFIG_TYPE_RANGE 1 +#define CONFIG_TYPE_STRING 2 +#define CONFIG_TYPE_ENUM 3 +#define CONFIG_TYPE_NUM 4 +#define CONFIG_TYPE_BOOL 5 typedef struct config_values_s config_values_t; struct config_values_s { + /* - * lookup config values + * register config values + * + * these functions return the current value of the + * registered item, i.e. the default value if it was + * not found in the config file or the current value + * from the config file otherwise */ - char* (*lookup_str) (config_values_t *this, - char *key, char *str_default); - - int (*lookup_int) (config_values_t *this, - char *key, int n_default); - + + char* (*register_string) (config_values_t *this, + char *key, + char *def_value, + char *description, + char *help, + config_cb_t changed_cb, + void *cb_data); + + int (*register_range) (config_values_t *this, + char *key, + int def_value, + int min, int max, + char *description, + char *help, + config_cb_t changed_cb, + void *cb_data); + + int (*register_enum) (config_values_t *this, + char *key, + int def_value, + char **values, + char *description, + char *help, + config_cb_t changed_cb, + void *cb_data); + + int (*register_num) (config_values_t *this, + char *key, + int def_value, + char *description, + char *help, + config_cb_t changed_cb, + void *cb_data); + + int (*register_bool) (config_values_t *this, + char *key, + int def_value, + char *description, + char *help, + config_cb_t changed_cb, + void *cb_data); + + /* convenience function to update range, enum, num and bool values */ + void (*update_num) (config_values_t *this, + char *key, int value); + + /* convenience function to update string values */ + void (*update_string) (config_values_t *this, + char *key, char *value); + + /* small utility function for enum handling */ + int (*parse_enum) (char *str, char **values); + /* - * set config values + * lookup config entries + * + * remember to call the changed_cb if it exists + * and you changed the value of this item */ - - void (*set_str) (config_values_t *this, - char *key, char *value) ; - - void (*set_int) (config_values_t *this, - char *key, int value) ; - + + cfg_entry_t* (*lookup_entry) (config_values_t *this, + char *key); + /* * write config file to disk */ void (*save) (config_values_t *this); /* - * read config file from disk, ovverriding values in memory - * if you also want to clear values that are not in the file, - * use _init instead! + * read config file from disk, overriding values in memory */ void (*read) (config_values_t *this, char *filename); /* - * contains private data of this config file + * config values are stored here: */ - cfg_data_t *data; + cfg_entry_t *first, *last; }; /* @@ -96,6 +185,9 @@ config_values_t *config_file_init (char *filename); /* * $Log: configfile.h,v $ + * Revision 1.4 2001/11/18 03:53:25 guenter + * new configfile interface, code cleanup, xprintf is gone + * * Revision 1.3 2001/07/26 11:12:26 f1rmb * Updated doxy sections in xine.h.tmpl.in. Added man3. Removed french man page. Added API doc in html. Add new rpm package (doc). Fixes some little bugs in * proto decl, etc... diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index a1feeac35..147e3b88a 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.54 2001/11/17 14:26:39 f1rmb Exp $ + * $Id: load_plugins.c,v 1.55 2001/11/18 03:53:25 guenter Exp $ * * * Load input/demux/audio_out/video_out/codec plugins @@ -179,7 +179,7 @@ void load_demux_plugins (xine_t *this, } void xine_list_demux_plugins (config_values_t *config, - char **identifiers, char **mimetypes) { + char **identifiers, char **mimetypes) { DIR *dir; xine_t *this; int sizeid, sizemime; @@ -193,7 +193,6 @@ void xine_list_demux_plugins (config_values_t *config, *mimetypes = xine_xmalloc (sizemime); this->config = config; - xine_debug = config->lookup_int (config, "xine_debug", 0); install_segv_handler(); @@ -223,10 +222,9 @@ void xine_list_demux_plugins (config_values_t *config, plugin_name = str; if(!(plugin = dlopen (str, RTLD_LAZY))) { - fprintf(stderr, "load_plugins: cannot open demux plugin %s:\n%s\n", + printf ("load_plugins: cannot open demux plugin %s:\n%s\n", str, dlerror()); - } - else { + } else { void *(*initplug) (int, xine_t *); if((initplug = dlsym(plugin, "init_demuxer_plugin")) != NULL) { diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c index 950f80cd2..2924d6a4b 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.36 2001/11/17 14:26:39 f1rmb Exp $ + * $Id: metronom.c,v 1.37 2001/11/18 03:53:25 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -389,7 +389,9 @@ static void metronom_set_audio_rate (metronom_t *this, uint32_t pts_per_smpls) { pthread_mutex_unlock (&this->lock); - xprintf (METRONOM | VERBOSE, "metronom: %d pts per %d samples\n", pts_per_smpls, AUDIO_SAMPLE_NUM); +#ifdef METRONOM_LOG + printf ("metronom: %d pts per %d samples\n", pts_per_smpls, AUDIO_SAMPLE_NUM); +#endif } @@ -613,9 +615,11 @@ static uint32_t metronom_got_audio_samples (metronom_t *this, uint32_t pts, uint32_t nsamples, uint32_t scr) { uint32_t vpts; - - xprintf (METRONOM | VERBOSE, "metronom: got %d audio samples (pts=%d)\n", - nsamples,pts); + +#ifdef METRONOM_LOG + printf ("metronom: got %d audio samples (pts=%d)\n", + nsamples,pts); +#endif pthread_mutex_lock (&this->lock); diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index b9c98703d..ad8cb6df9 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.55 2001/11/17 14:26:39 f1rmb Exp $ + * $Id: video_out.c,v 1.56 2001/11/18 03:53:25 guenter Exp $ * */ @@ -203,8 +203,6 @@ static void *video_out_loop (void *this_gen) { cur_pts = this->metronom->get_current_time (this->metronom); - xprintf (VERBOSE|VIDEO, "video_out : video loop iteration at audio pts %d\n", cur_pts); - #ifdef VIDEO_OUT_LOG printf ("video_out : video loop iteration at audio pts %d\n", cur_pts); #endif @@ -227,10 +225,6 @@ static void *video_out_loop (void *this_gen) { if (diff >this->pts_per_half_frame) { - xprintf (VERBOSE|VIDEO, "video_out : throwing away image with pts %d because " - "it's too old (diff : %d > %d).\n",pts,diff, - this->pts_per_half_frame); - printf ( "video_out : throwing away image with pts %d because " "it's too old (diff : %d > %d).\n",pts,diff, this->pts_per_half_frame); @@ -286,8 +280,12 @@ static void *video_out_loop (void *this_gen) { pthread_mutex_lock (&img->mutex); img->driver_locked = 1; + +#ifdef VIDEO_OUT_LOG if (!img->display_locked) - xprintf (VERBOSE|VIDEO, "video_out: ALERT! frame was not locked for display queue\n"); + printf ("video_out: ALERT! frame was not locked for display queue\n"); +#endif + img->display_locked = 0; pthread_mutex_unlock (&img->mutex); @@ -485,17 +483,17 @@ static int vo_frame_draw (vo_frame_t *img) { img->PTS = pic_vpts; this->num_frames_delivered++; - xprintf (VERBOSE|VIDEO,"video_out: got image. vpts for picture is %d\n", pic_vpts); - cur_vpts = this->metronom->get_current_time(this->metronom); diff = pic_vpts - cur_vpts; frames_to_skip = ((-1 * diff) / this->pts_per_frame + 3) * 2; - xprintf (VERBOSE|VIDEO,"video_out:: delivery diff : %d\n",diff); - if( img->display_locked ) - { +#ifdef VIDEO_OUT_LOG + printf ("video_out: delivery diff : %d\n",diff); +#endif + + if (img->display_locked) { printf ("video_out: ALERT! frame is already locked for displaying\n"); return frames_to_skip; } @@ -505,7 +503,9 @@ static int vo_frame_draw (vo_frame_t *img) { if (diff<(-1 * this->pts_per_half_frame)) { this->num_frames_discarded++; - xprintf (VERBOSE|VIDEO, "vo_frame_draw: rejected, %d frames to skip\n", frames_to_skip); +#ifdef VIDEO_OUT_LOG + printf ("video_out: frame rejected, %d frames to skip\n", frames_to_skip); +#endif /* printf ("vo_frame_draw: rejected, %d frames to skip\n", frames_to_skip); */ @@ -527,7 +527,9 @@ static int vo_frame_draw (vo_frame_t *img) { * put frame into FIFO-Buffer */ - xprintf (VERBOSE|VIDEO, "frame is ok => appending to display buffer\n"); +#ifdef VIDEO_OUT_LOG + printf ("video_out: frame is ok => appending to display buffer\n"); +#endif this->last_frame = img; diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 70eaadf45..89329a9e8 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.75 2001/11/17 22:40:01 miguelfreitas Exp $ + * $Id: xine.c,v 1.76 2001/11/18 03:53:25 guenter Exp $ * * top-level xine functions * @@ -57,9 +57,6 @@ #define __FUNCTION__ __func__ #endif -/* debugging purposes only */ -uint32_t xine_debug; - void * xine_notify_stream_finished_thread (void * this_gen) { xine_t *this = this_gen; xine_event_t event; @@ -386,11 +383,12 @@ xine_t *xine_init (vo_driver_t *vo, config_values_t *config) { xine_t *this = xine_xmalloc (sizeof (xine_t)); + static char *demux_strategies[] = {"default", "reverse", "content", + "extension", NULL}; + printf("xine_init entered\n"); this->config = config; - xine_debug = config->lookup_int (config, "xine_debug", 0); - /* probe for optimized memcpy or config setting */ xine_probe_fast_memcpy(config); @@ -425,7 +423,9 @@ xine_t *xine_init (vo_driver_t *vo, load_input_plugins (this, config, INPUT_PLUGIN_IFACE_VERSION); - this->demux_strategy = config->lookup_int (config, "demux_strategy", 0); + this->demux_strategy = config->register_enum (config, "misc.demux_strategy", 0, + demux_strategies, "demuxer selection strategy", + NULL, NULL, NULL); load_demux_plugins(this, config, DEMUXER_PLUGIN_IFACE_VERSION); @@ -487,7 +487,7 @@ int xine_get_current_position (xine_t *this) { pthread_mutex_lock (&this->xine_lock); if (!this->cur_input_plugin) { - xprintf (VERBOSE|INPUT, "xine_get_current_position: no input source\n"); + printf ("xine: xine_get_current_position: no input source\n"); pthread_mutex_unlock (&this->xine_lock); return 0; } diff --git a/src/xine-utils/memcpy.c b/src/xine-utils/memcpy.c index 39cbad416..3e1de857d 100644 --- a/src/xine-utils/memcpy.c +++ b/src/xine-utils/memcpy.c @@ -362,6 +362,7 @@ static struct { uint32_t cpu_require; } memcpy_method[] = { + { NULL, NULL, 0, 0 }, { "glibc memcpy()", memcpy, 0, 0 }, #ifdef ARCH_X86 { "linux kernel memcpy()", linux_kernel_memcpy, 0, 0 }, @@ -407,6 +408,8 @@ void xine_probe_fast_memcpy(config_values_t *config) char *buf1, *buf2; int i, j, best; static int config_flags = -1; + static char *memcpy_methods[] = {"probe", "glibc", "kernel", + "mmx", "mmxext", "sse", NULL}; #ifdef ARCH_X86 config_flags = xine_mm_accel(); @@ -414,9 +417,13 @@ void xine_probe_fast_memcpy(config_values_t *config) config_flags = 0; #endif - best = config->lookup_int (config, "fast_memcpy", -1); + best = config->register_enum (config, "misc.memcpy_method", 0, + memcpy_methods, + "Memcopy method to use in xine for large data chunks.", + NULL, NULL, NULL); + /* check if function is configured and valid for this machine */ - if( best != -1 && + if( best != 0 && (config_flags & memcpy_method[best].cpu_require) == memcpy_method[best].cpu_require ) { printf("xine: using %s\n", memcpy_method[best].name ); @@ -424,7 +431,7 @@ void xine_probe_fast_memcpy(config_values_t *config) return; } - best = -1; + best = 0; xine_fast_memcpy = memcpy; @@ -440,7 +447,7 @@ void xine_probe_fast_memcpy(config_values_t *config) /* make sure buffers are present on physical memory */ memcpy(buf1,buf2,BUFSIZE); - for(i=0; memcpy_method[i].name; i++) + for(i=1; memcpy_method[i].name; i++) { if( (config_flags & memcpy_method[i].cpu_require) != memcpy_method[i].cpu_require ) @@ -464,13 +471,15 @@ void xine_probe_fast_memcpy(config_values_t *config) printf("\t%s : %lld\n",memcpy_method[i].name, t); - if( best == -1 || t < memcpy_method[best].time ) + if( best == 0 || t < memcpy_method[best].time ) best = i; } - printf("xine: using %s\n", memcpy_method[best].name ); + + printf("memcpy: using %s\n", memcpy_method[best].name ); xine_fast_memcpy = memcpy_method[best].function; - config->set_int (config, "fast_memcpy", best ); - + + config->update_num (config, "misc.memcpy_method", best); + free(buf1); free(buf2); } diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index e181ea1aa..1655b3dd8 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.2 2001/11/17 22:40:01 miguelfreitas Exp $ + * $Id: xineutils.h,v 1.3 2001/11/18 03:53:25 guenter Exp $ * */ #ifndef XINEUTILS_H @@ -540,22 +540,6 @@ void xine_probe_fast_memcpy(config_values_t *config); /* Debugging/Monitoring */ -extern uint32_t xine_debug; - -#define VERBOSE (xine_debug & 0x8000>>1) // 16384 -#define METRONOM (xine_debug & 0x8000>>2) // 8192 -#define AUDIO (xine_debug & 0x8000>>3) // 4096 -#define DEMUX (xine_debug & 0x8000>>4) // 2048 -#define INPUT (xine_debug & 0x8000>>5) // 1024 -#define VIDEO (xine_debug & 0x8000>>6) // 512 -#define VPTS (xine_debug & 0x8000>>7) // 256 -#define MPEG (xine_debug & 0x8000>>8) // 128 -#define VAVI (xine_debug & 0x8000>>9) // 64 -#define AC3 (xine_debug & 0x8000>>10) // 32 -#define LOOP (xine_debug & 0x8000>>11) // 16 -#define GUI (xine_debug & 0x8000>>12) // 8 -#define SPU (xine_debug & 0x8000>>13) // 4 - #ifdef __GNUC__ #define perr(FMT,ARGS...) {fprintf(stderr, FMT, ##ARGS);fflush(stderr);} #else /* C99 version: */ @@ -566,19 +550,6 @@ extern uint32_t xine_debug; /* * Debug stuff */ -#ifdef __GNUC__ -#define xprintf(LVL, FMT, ARGS...) { \ - if(LVL) { \ - printf(FMT, ##ARGS); \ - } \ - } -#else /* C99 version: */ -#define xprintf(LVL, ...) { \ - if(LVL) { \ - printf(__VA_ARGS__); \ - } \ - } -#endif /* __GNUC__ */ /* * profiling @@ -591,12 +562,6 @@ void xine_profiler_print_results (void); #else /* no DEBUG, release version */ -#ifdef __GNUC__ -#define xprintf(LVL, FMT, ARGS...) -#else /* C99 version: */ -#define xprintf(LVL, ...) -#endif - #define xine_profiler_init() #define xine_profiler_allocate_slot(label) (-1) #define xine_profiler_start_count(id) |