From 090e1e22be28d8dc5dfbc188d449dcf1cd964afc Mon Sep 17 00:00:00 2001 From: Marco Zuehlke Date: Fri, 4 Jul 2003 15:12:50 +0000 Subject: cleaning up; removing unused stuff CVS patchset: 5131 CVS date: 2003/07/04 15:12:50 --- src/demuxers/demux_slave.c | 125 ++++++++++++++++++++------------------------ src/demuxers/demux_smjpeg.c | 54 ++++++------------- src/demuxers/demux_snd.c | 36 ++++--------- src/demuxers/demux_str.c | 101 +++++++++++++---------------------- src/demuxers/demux_vox.c | 68 +++++++++--------------- 5 files changed, 144 insertions(+), 240 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_slave.c b/src/demuxers/demux_slave.c index 8a0152367..65ec99ccc 100644 --- a/src/demuxers/demux_slave.c +++ b/src/demuxers/demux_slave.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2000-2003 the xine project * May 2003 - Miguel Freitas * This plugin was sponsored by 1Control @@ -18,13 +18,14 @@ * You should have received a copy of the GNU General Public License * 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_slave.c,v 1.2 2003/05/15 20:23:16 miguelfreitas Exp $ + */ + +/* + * $Id: demux_slave.c,v 1.3 2003/07/04 15:12:51 andruil Exp $ * * demuxer for slave "protocol" * master xine must be started with XINE_PARAM_BROADCASTER_PORT set, that is, * 'xine --broadcast-port ' - * */ #ifdef HAVE_CONFIG_H @@ -37,6 +38,11 @@ #include #include +/********** logging **********/ +#define LOG_MODULE "demux_slave" +/* #define LOG_VERBOSE */ +/* #define LOG */ + #include "xine_internal.h" #include "xineutils.h" #include "compat.h" @@ -47,41 +53,29 @@ #define NETWORK_PREBUFFER 90000 typedef struct { - demux_plugin_t demux_plugin; xine_stream_t *stream; - - config_values_t *config; - fifo_buffer_t *video_fifo; fifo_buffer_t *audio_fifo; - input_plugin_t *input; + int status; int64_t last_vpts; int send_newpts; - int status; - + /* additional decoder flags and other dec-spec. stuff */ uint32_t decoder_info[BUF_NUM_DEC_INFO]; /* pointers to dec-spec. stuff */ void *decoder_info_ptr[BUF_NUM_DEC_INFO]; xine_list_t *dec_infos; /* dec-spec. stuff */ - + uint8_t scratch[SCRATCH_SIZE+1]; int scratch_used; - } demux_slave_t ; typedef struct { - demux_class_t demux_class; - - /* class-wide, global variables here */ - - xine_t *xine; - config_values_t *config; } demux_slave_class_t; @@ -101,36 +95,36 @@ static int demux_slave_next (demux_slave_t *this) { this->scratch[this->scratch_used] = '\0'; if( !n ) { - printf("demux_slave: connection closed\n"); + lprintf("connection closed\n"); this->status = DEMUX_FINISHED; return 0; } - + p = strchr(this->scratch,'\n'); s = strchr(this->scratch,' '); if( !s || s > p ) s = p; - + if( !p || !s || (s-this->scratch+1) > MAX_COMMAND_SIZE ) { - printf("demux_slave: protocol error\n"); + lprintf("protocol error\n"); this->status = DEMUX_FINISHED; return 0; } - + *s++ = '\0'; p++; - + if( !strcmp(this->scratch,"buffer") ) { int32_t size ; /* size of _content_ */ uint32_t type; int64_t pts; /* presentation time stamp, used for a/v sync */ int64_t disc_off; /* discontinuity offset */ uint32_t decoder_flags; /* stuff like keyframe, is_header ... see below */ - + if( sscanf(s,"fifo=%10s size=%d type=%u pts=%lld disc=%lld flags=%u", fifo_name, &size, &type, &pts, &disc_off, &decoder_flags) != 6 ) { - printf("demux_slave: 'buffer' command error\n"); + lprintf("'buffer' command error\n"); this->status = DEMUX_FINISHED; return 0; } @@ -139,7 +133,7 @@ static int demux_slave_next (demux_slave_t *this) { this->send_newpts = 0; this->last_vpts = 0; } - + /* if we join an already existing broadcaster we must take care * of the initial pts. */ @@ -147,28 +141,27 @@ static int demux_slave_next (demux_slave_t *this) { xine_demux_control_newpts( this->stream, pts, 0 ); this->send_newpts = 0; } - + /* check if we are not late on playback. * that might happen if user hits "pause" on the master, for example. */ - if( pts && + if( pts && (curvpts = this->stream->xine->clock->get_current_time(this->stream->xine->clock)) > (this->last_vpts + CHECK_VPTS_INTERVAL) ) { if( this->last_vpts && pts - (NETWORK_PREBUFFER/2) + this->stream->metronom->get_option(this->stream->metronom, METRONOM_VPTS_OFFSET) < curvpts ) { - if (this->stream->xine->verbosity >= XINE_VERBOSITY_LOG) - printf("demux_slave: we are running late, forcing newpts.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "we are running late, forcing newpts.\n"); xine_demux_control_newpts( this->stream, pts - NETWORK_PREBUFFER, 0 ); } - this->last_vpts = curvpts; + this->last_vpts = curvpts; } - - + + if( !strcmp(fifo_name,"video") || !this->audio_fifo ) buf = this->video_fifo->buffer_pool_alloc(this->video_fifo); - else + else buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); /* copy data to buf, either from stratch or network */ @@ -179,13 +172,13 @@ static int demux_slave_next (demux_slave_t *this) { memcpy(buf->content, p, n); if( n < size ) this->input->read(this->input, &buf->content[n], size-n); - + p += n; n = this->scratch_used - (p-this->scratch); if( n ) memmove(this->scratch, p, n); this->scratch_used = n; - + /* populate our buf */ buf->size = size; buf->type = type; @@ -195,42 +188,42 @@ static int demux_slave_next (demux_slave_t *this) { /* set decoder info */ for( i = 0; i < BUF_NUM_DEC_INFO; i++ ) { - buf->decoder_info[i] = this->decoder_info[i]; - buf->decoder_info_ptr[i] = this->decoder_info_ptr[i]; + buf->decoder_info[i] = this->decoder_info[i]; + buf->decoder_info_ptr[i] = this->decoder_info_ptr[i]; } memset(this->decoder_info, 0, sizeof(this->decoder_info)); memset(this->decoder_info_ptr, 0, sizeof(this->decoder_info_ptr)); - + if( !strcmp(fifo_name,"video") ) this->video_fifo->put(this->video_fifo, buf); else if (this->audio_fifo) this->audio_fifo->put(this->audio_fifo, buf); else buf->free_buffer(buf); - + } else if( !strcmp(this->scratch,"decoder_info") ) { - + uint32_t decoder_info; int has_data; int size; - + if( sscanf(s,"index=%d decoder_info=%u has_data=%d", &i, &decoder_info, &has_data) != 3 || i < 0 || i > BUF_NUM_DEC_INFO) { - printf("demux_slave: 'decoder_info' command error\n"); + lprintf("'decoder_info' command error\n"); this->status = DEMUX_FINISHED; return 0; } - + this->decoder_info[i] = decoder_info; - + size = (has_data) ? decoder_info : 0; if( size ) { this->decoder_info_ptr[i] = malloc(size); xine_list_append_content(this->dec_infos, this->decoder_info_ptr[i]); } - + n = this->scratch_used - (p-this->scratch); if( n > size ) n = size; @@ -238,30 +231,30 @@ static int demux_slave_next (demux_slave_t *this) { memcpy(this->decoder_info_ptr[i], p, n); if( n < size ) this->input->read(this->input, (char *)this->decoder_info_ptr[i]+n, size-n); - + p += n; n = this->scratch_used - (p-this->scratch); if( n ) memmove(this->scratch, p, n); this->scratch_used = n; - + } else if( !strcmp(this->scratch,"flush_engine") ) { - + xine_demux_flush_engine( this->stream ); n = this->scratch_used - (p-this->scratch); if( n ) memmove(this->scratch, p, n); this->scratch_used = n; - + } else { - printf("demux_slave: unknown command '%s'\n", this->scratch); + lprintf("unknown command '%s'\n", this->scratch); n = this->scratch_used - (p-this->scratch); if( n ) memmove(this->scratch, p, n); this->scratch_used = n; } - + return 1; } @@ -310,7 +303,7 @@ static int demux_slave_seek (demux_plugin_t *this_gen, static void demux_slave_dispose (demux_plugin_t *this_gen) { demux_slave_t *this = (demux_slave_t *) this_gen; void *data; - + /* free all decoder information */ data = xine_list_first_content (this->dec_infos); while (data) { @@ -341,17 +334,15 @@ static int demux_slave_get_optional_data(demux_plugin_t *this_gen, static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *stream, - input_plugin_t *input_gen) { + input_plugin_t *input) { - input_plugin_t *input = (input_plugin_t *) input_gen; demux_slave_t *this; static char slave_id_str[] = "master xine v1\n"; - int len; this = xine_xmalloc (sizeof (demux_slave_t)); switch (stream->content_detection_method) { - + case METHOD_BY_EXTENSION: { char *mrl; @@ -359,14 +350,14 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str if(!strncmp(mrl, "slave://", 8)) break; - + free (this); return NULL; } - + case METHOD_BY_CONTENT: { - if ( (len = xine_demux_read_header(input, this->scratch, SCRATCH_SIZE)) > 0) { + if ( xine_demux_read_header(input, this->scratch, SCRATCH_SIZE) > 0) { if (!strncmp(this->scratch,slave_id_str,strlen(slave_id_str))) break; } @@ -400,13 +391,13 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->demux_plugin.demux_class = class_gen; this->status = DEMUX_FINISHED; - + this->input->read(this->input, this->scratch,strlen(slave_id_str)); - this->scratch_used = 0; + this->scratch_used = 0; memset(this->decoder_info, 0, sizeof(this->decoder_info)); memset(this->decoder_info_ptr, 0, sizeof(this->decoder_info_ptr)); - + return &this->demux_plugin; } @@ -437,9 +428,7 @@ static void *init_plugin (xine_t *xine, void *data) { demux_slave_class_t *this; - this = xine_xmalloc (sizeof (demux_slave_class_t)); - this->config = xine->config; - this->xine = xine; + this = xine_xmalloc (sizeof (demux_slave_class_t)); this->demux_class.open_plugin = open_plugin; this->demux_class.get_description = get_description; diff --git a/src/demuxers/demux_smjpeg.c b/src/demuxers/demux_smjpeg.c index c44b98708..b4ec4d989 100644 --- a/src/demuxers/demux_smjpeg.c +++ b/src/demuxers/demux_smjpeg.c @@ -16,12 +16,14 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * + */ + +/* * SMJPEG File Demuxer by Mike Melanson (melanson@pcisys.net) * For more information on the SMJPEG file format, visit: * http://www.lokigames.com/development/smjpeg.php3 * - * $Id: demux_smjpeg.c,v 1.38 2003/04/17 19:01:27 miguelfreitas Exp $ + * $Id: demux_smjpeg.c,v 1.39 2003/07/04 15:12:50 andruil Exp $ */ #ifdef HAVE_CONFIG_H @@ -60,31 +62,21 @@ #define SMJPEG_CHUNK_PREAMBLE_SIZE 12 typedef struct { - demux_plugin_t demux_plugin; xine_stream_t *stream; - - config_values_t *config; - fifo_buffer_t *video_fifo; fifo_buffer_t *audio_fifo; - input_plugin_t *input; - - off_t input_length; int status; - /* when this flag is set, demuxer only dispatches audio samples until it - * encounters a video keyframe, then it starts sending every frame again */ - int waiting_for_keyframe; + off_t input_length; /* video information */ unsigned int video_type; xine_bmiheader bih; /* audio information */ - unsigned int audio_codec; unsigned int audio_type; unsigned int audio_sample_rate; unsigned int audio_bits; @@ -92,26 +84,19 @@ typedef struct { /* playback information */ unsigned int duration; /* duration in milliseconds */ - - char last_mrl[1024]; } demux_smjpeg_t; typedef struct { - demux_class_t demux_class; - - /* class-wide, global variables here */ - - xine_t *xine; - config_values_t *config; } demux_smjpeg_class_t; /* returns 1 if the SMJPEG file was opened successfully, 0 otherwise */ static int open_smjpeg_file(demux_smjpeg_t *this) { - unsigned int chunk_tag; + unsigned int chunk_tag; unsigned char signature[8]; unsigned char header_chunk[SMJPEG_HEADER_CHUNK_MAX_SIZE]; + unsigned int audio_codec = 0; if (!xine_demux_read_header(this->input, signature, SMJPEG_SIGNATURE_SIZE)) return 0; @@ -175,11 +160,11 @@ static int open_smjpeg_file(demux_smjpeg_t *this) { * files to denote a slightly different format; thus, use the * following special case */ if (BE_32(&header_chunk[8]) == APCM_TAG) { - this->audio_codec = be2me_32(APCM_TAG); + audio_codec = be2me_32(APCM_TAG); this->audio_type = BUF_AUDIO_SMJPEG_IMA; } else { - this->audio_codec = *(uint32_t *)&header_chunk[8]; - this->audio_type = formattag_to_buf_audio(this->audio_codec); + audio_codec = *(uint32_t *)&header_chunk[8]; + this->audio_type = formattag_to_buf_audio(audio_codec); } break; @@ -195,10 +180,10 @@ static int open_smjpeg_file(demux_smjpeg_t *this) { if(!this->video_type) this->video_type = BUF_VIDEO_UNKNOWN; - - if(!this->audio_type && this->audio_codec) + + if(!this->audio_type && audio_codec) this->audio_type = BUF_AUDIO_UNKNOWN; - + return 1; } @@ -406,13 +391,12 @@ static int demux_smjpeg_get_optional_data(demux_plugin_t *this_gen, } static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *stream, - input_plugin_t *input_gen) { + input_plugin_t *input) { - input_plugin_t *input = (input_plugin_t *) input_gen; demux_smjpeg_t *this; - if (! (input->get_capabilities(input) & INPUT_CAP_SEEKABLE)) { - if (stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + if (!INPUT_IS_SEEKABLE(input)) { + if (stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) printf(_("demux_smjpeg.c: input not seekable, can not handle!\n")); return NULL; } @@ -465,8 +449,6 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return NULL; } - strncpy (this->last_mrl, input->get_mrl (input), 1024); - return &this->demux_plugin; } @@ -497,9 +479,7 @@ void *demux_smjpeg_init_plugin (xine_t *xine, void *data) { demux_smjpeg_class_t *this; - this = xine_xmalloc (sizeof (demux_smjpeg_class_t)); - this->config = xine->config; - this->xine = xine; + this = xine_xmalloc (sizeof (demux_smjpeg_class_t)); this->demux_class.open_plugin = open_plugin; this->demux_class.get_description = get_description; diff --git a/src/demuxers/demux_snd.c b/src/demuxers/demux_snd.c index 57b9a4557..03fd47040 100644 --- a/src/demuxers/demux_snd.c +++ b/src/demuxers/demux_snd.c @@ -16,11 +16,12 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * + */ + +/* * SND/AU File Demuxer by Mike Melanson (melanson@pcisys.net) * - * $Id: demux_snd.c,v 1.29 2003/04/17 19:01:28 miguelfreitas Exp $ - * + * $Id: demux_snd.c,v 1.30 2003/07/04 15:12:50 andruil Exp $ */ #ifdef HAVE_CONFIG_H @@ -46,18 +47,12 @@ #define snd_TAG 0x2E736E64 typedef struct { - demux_plugin_t demux_plugin; - xine_stream_t *stream; - - config_values_t *config; - + xine_stream_t *stream; fifo_buffer_t *video_fifo; fifo_buffer_t *audio_fifo; - input_plugin_t *input; - int status; unsigned int audio_type; @@ -74,18 +69,10 @@ typedef struct { off_t data_size; int seek_flag; /* this is set when a seek just occurred */ - - char last_mrl[1024]; } demux_snd_t; typedef struct { - demux_class_t demux_class; - - /* class-wide, global variables here */ - - xine_t *xine; - config_values_t *config; } demux_snd_class_t; /* returns 1 if the SND file was opened successfully, 0 otherwise */ @@ -94,7 +81,7 @@ static int open_snd_file(demux_snd_t *this) { unsigned char header[SND_HEADER_SIZE]; unsigned int encoding; - if (!xine_demux_read_header(this->input, header, SND_HEADER_SIZE)) + if (xine_demux_read_header(this->input, header, SND_HEADER_SIZE) != SND_HEADER_SIZE) return 0; /* check the signature */ @@ -259,7 +246,7 @@ static int demux_snd_seek (demux_plugin_t *this_gen, /* if input is non-seekable, do not proceed with the rest of this * seek function */ - if ((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) == 0) + if (!INPUT_IS_SEEKABLE(this->input)) return this->status; /* check the boundary offsets */ @@ -314,9 +301,8 @@ static int demux_snd_get_optional_data(demux_plugin_t *this_gen, } static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *stream, - input_plugin_t *input_gen) { + input_plugin_t *input) { - input_plugin_t *input = (input_plugin_t *) input_gen; demux_snd_t *this; this = xine_xmalloc (sizeof (demux_snd_t)); @@ -367,8 +353,6 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return NULL; } - strncpy (this->last_mrl, input->get_mrl (input), 1024); - return &this->demux_plugin; } @@ -402,9 +386,7 @@ void *demux_snd_init_plugin (xine_t *xine, void *data) { demux_snd_class_t *this; - this = xine_xmalloc (sizeof (demux_snd_class_t)); - this->config = xine->config; - this->xine = xine; + this = xine_xmalloc (sizeof (demux_snd_class_t)); this->demux_class.open_plugin = open_plugin; this->demux_class.get_description = get_description; diff --git a/src/demuxers/demux_str.c b/src/demuxers/demux_str.c index 60cf46b91..395a97697 100644 --- a/src/demuxers/demux_str.c +++ b/src/demuxers/demux_str.c @@ -16,16 +16,19 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * + */ + +/* * STR File Demuxer by Mike Melanson (melanson@pcisys.net) * and Stuart Caie (kyzer@4u.net) * This demuxer handles either raw STR files (which are just a concatenation * of raw compact disc sectors) or STR files with RIFF headers. * - * $Id: demux_str.c,v 1.11 2003/05/04 12:17:45 f1rmb Exp $ + * $Id: demux_str.c,v 1.12 2003/07/04 15:12:51 andruil Exp $ */ -/* CD-XA format: +/* + * CD-XA format: * * - the format is a series of 2352 byte CD sectors * - 0x000: 12 bytes: sync header (00 FF FF FF FF FF FF FF FF FF FF 00) @@ -116,6 +119,11 @@ #include #include +/********** logging **********/ +#define LOG_MODULE "demux_str" +/* #define LOG_VERBOSE */ +/* #define LOG */ + #include "xine_internal.h" #include "xineutils.h" #include "compat.h" @@ -154,22 +162,17 @@ #define FRAME_DURATION 45000 typedef struct { - demux_plugin_t demux_plugin; xine_stream_t *stream; - - config_values_t *config; - fifo_buffer_t *video_fifo; fifo_buffer_t *audio_fifo; - input_plugin_t *input; + int status; off_t data_start; off_t data_size; off_t current_pos; - int status; xine_bmiheader bih[STR_MAX_CHANNELS]; unsigned char audio_info[STR_MAX_CHANNELS]; @@ -178,18 +181,10 @@ typedef struct { int seek_flag; int default_video_channel; - - char last_mrl[1024]; } demux_str_t; typedef struct { - demux_class_t demux_class; - - /* class-wide, global variables here */ - - xine_t *xine; - config_values_t *config; } demux_str_class_t; @@ -205,9 +200,7 @@ static int open_str_file(demux_str_t *this) { this->input->seek(this->input, 0, SEEK_SET); if (this->input->read(this->input, check_bytes, STR_CHECK_BYTES) != STR_CHECK_BYTES) { -#ifdef LOG - printf("PSX STR: read error\n"); -#endif + lprintf("read error\n"); return 0; } @@ -223,39 +216,31 @@ static int open_str_file(demux_str_t *this) { /* we need to check up to 32 sectors for up to 32 audio/video channels */ for (sector = 0; sector < STR_MAX_CHANNELS; sector++) { -#ifdef LOG - printf("PSX STR: file=%d channel=%-2d submode=%02x coding_info=%02x\n", - check_bytes[local_offset + 0x10], - check_bytes[local_offset + 0x11], - check_bytes[local_offset + 0x12], - check_bytes[local_offset + 0x13]); -#endif + lprintf("file=%d channel=%-2d submode=%02x coding_info=%02x\n", + check_bytes[local_offset + 0x10], + check_bytes[local_offset + 0x11], + check_bytes[local_offset + 0x12], + check_bytes[local_offset + 0x13]); /* check for 12-byte sync marker */ if ((BE_32(&check_bytes[local_offset + 0]) != 0x00FFFFFF) || (BE_32(&check_bytes[local_offset + 4]) != 0xFFFFFFFF) || (BE_32(&check_bytes[local_offset + 8]) != 0xFFFFFF00)) { -#ifdef LOG - printf("PSX STR: sector %d sync error\n", sector); -#endif + lprintf("sector %d sync error\n", sector); return 0; } /* the 32 bits starting at 0x10 and at 0x14 should be the same */ if (BE_32(&check_bytes[local_offset + 0x10]) != BE_32(&check_bytes[local_offset + 0x14])) { -#ifdef LOG - printf("PSX STR: sector %d control bits copy error\n", sector); -#endif + lprintf("sector %d control bits copy error\n", sector); return 0; } /* channel should be from 0 to 31 */ channel = check_bytes[local_offset + 0x11]; if (channel >= STR_MAX_CHANNELS) { -#ifdef LOG - printf("PSX STR: sector %d channel %d error\n", sector, channel); -#endif + lprintf("sector %d channel %d error\n", sector, channel); return 0; } @@ -290,15 +275,12 @@ static int open_str_file(demux_str_t *this) { break; default: -#ifdef LOG - printf("PSX STR: sector %d channel %d unknown type error\n", - sector, channel); -#endif - /* several films (e.g. 37xa16.xap in Strider 1) have empty - * sectors with 0 as the type, despite having plenty of - * video/audio sectors - */ - /*return 0*/; + lprintf("sector %d channel %d unknown type error\n", sector, channel); + /* several films (e.g. 37xa16.xap in Strider 1) have empty + * sectors with 0 as the type, despite having plenty of + * video/audio sectors + */ + /*return 0*/; } /* seek to the next sector and read in the header */ @@ -306,9 +288,7 @@ static int open_str_file(demux_str_t *this) { this->input->seek(this->input, this->data_start + ((sector+1) * CD_RAW_SECTOR_SIZE), SEEK_SET); if (this->input->read(this->input, check_bytes, 0x30) != 0x30) { -#ifdef LOG - printf("PSX STR: sector %d read error\n", sector); -#endif + lprintf("sector %d read error\n", sector); return 0; } } @@ -341,7 +321,7 @@ static int open_str_file(demux_str_t *this) { else { strcpy(audinfo, "No audio"); } - printf("PSX STR: channel %-2d %-22s%s\n", channel, vidinfo, audinfo); + lprintf("channel %-2d %-22s%s\n", channel, vidinfo, audinfo); } } #endif @@ -528,11 +508,9 @@ static int demux_str_seek (demux_plugin_t *this_gen, /* round to ensure we start on a sector */ start_pos /= CD_RAW_SECTOR_SIZE; -#ifdef LOG - printf("PSX STR: seeking to sector %d (%02d:%02d)\n", - (int)start_pos, (int)start_pos / (60*75), - ((int)start_pos / 75)%60); -#endif + lprintf("seeking to sector %d (%02d:%02d)\n", + (int)start_pos, (int)start_pos / (60*75), + ((int)start_pos / 75)%60); /* reposition at the chosen sector */ this->current_pos = start_pos * CD_RAW_SECTOR_SIZE; @@ -573,14 +551,13 @@ static int demux_str_get_optional_data(demux_plugin_t *this_gen, } static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *stream, - input_plugin_t *input_gen) { + input_plugin_t *input) { - input_plugin_t *input = (input_plugin_t *) input_gen; demux_str_t *this; - if (! (input->get_capabilities(input) & INPUT_CAP_SEEKABLE)) { - if (stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) - printf(_("deux_str: PSX STR: input not seekable, can not handle!\n")); + if (!INPUT_IS_SEEKABLE(input)) { + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + "input not seekable, can not handle!\n"); return NULL; } @@ -631,8 +608,6 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return NULL; } - strncpy (this->last_mrl, input->get_mrl (input), 1024); - return &this->demux_plugin; } @@ -662,9 +637,7 @@ void *demux_str_init_plugin (xine_t *xine, void *data) { demux_str_class_t *this; - this = xine_xmalloc (sizeof (demux_str_class_t)); - this->config = xine->config; - this->xine = xine; + this = xine_xmalloc (sizeof (demux_str_class_t)); this->demux_class.open_plugin = open_plugin; this->demux_class.get_description = get_description; diff --git a/src/demuxers/demux_vox.c b/src/demuxers/demux_vox.c index 480ef3042..4b6b4aad7 100644 --- a/src/demuxers/demux_vox.c +++ b/src/demuxers/demux_vox.c @@ -16,11 +16,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * + */ + +/* * VOX Demuxer by Mike Melanson (melanson@pcisys.net) * This a demuxer for .vox files containing raw Dialogic ADPCM data. * - * $Id: demux_vox.c,v 1.4 2003/04/17 19:01:32 miguelfreitas Exp $ + * $Id: demux_vox.c,v 1.5 2003/07/04 15:12:51 andruil Exp $ * */ @@ -44,31 +46,17 @@ #define DIALOGIC_SAMPLERATE 8000 typedef struct { - demux_plugin_t demux_plugin; xine_stream_t *stream; - - config_values_t *config; - fifo_buffer_t *video_fifo; fifo_buffer_t *audio_fifo; - input_plugin_t *input; - int status; - - char last_mrl[1024]; } demux_vox_t; typedef struct { - demux_class_t demux_class; - - /* class-wide, global variables here */ - - xine_t *xine; - config_values_t *config; } demux_vox_class_t; static int demux_vox_send_chunk (demux_plugin_t *this_gen) { @@ -196,29 +184,10 @@ static int demux_vox_get_optional_data(demux_plugin_t *this_gen, } static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *stream, - input_plugin_t *input_gen) { + input_plugin_t *input) { - input_plugin_t *input = (input_plugin_t *) input_gen; demux_vox_t *this; - this = xine_xmalloc (sizeof (demux_vox_t)); - this->stream = stream; - this->input = input; - - this->demux_plugin.send_headers = demux_vox_send_headers; - this->demux_plugin.send_chunk = demux_vox_send_chunk; - this->demux_plugin.seek = demux_vox_seek; - this->demux_plugin.dispose = demux_vox_dispose; - this->demux_plugin.get_status = demux_vox_get_status; - this->demux_plugin.get_stream_length = demux_vox_get_stream_length; - this->demux_plugin.get_video_frame = NULL; - this->demux_plugin.got_video_frame_cb= NULL; - this->demux_plugin.get_capabilities = demux_vox_get_capabilities; - this->demux_plugin.get_optional_data = demux_vox_get_optional_data; - this->demux_plugin.demux_class = class_gen; - - this->status = DEMUX_FINISHED; - switch (stream->content_detection_method) { case METHOD_BY_CONTENT: @@ -229,19 +198,32 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); - if (!xine_demux_check_extension (mrl, extensions)) { - free (this); + if (!xine_demux_check_extension (mrl, extensions)) return NULL; - } } break; default: - free (this); return NULL; } - strncpy (this->last_mrl, input->get_mrl (input), 1024); + this = xine_xmalloc (sizeof (demux_vox_t)); + this->stream = stream; + this->input = input; + + this->demux_plugin.send_headers = demux_vox_send_headers; + this->demux_plugin.send_chunk = demux_vox_send_chunk; + this->demux_plugin.seek = demux_vox_seek; + this->demux_plugin.dispose = demux_vox_dispose; + this->demux_plugin.get_status = demux_vox_get_status; + this->demux_plugin.get_stream_length = demux_vox_get_stream_length; + this->demux_plugin.get_video_frame = NULL; + this->demux_plugin.got_video_frame_cb= NULL; + this->demux_plugin.get_capabilities = demux_vox_get_capabilities; + this->demux_plugin.get_optional_data = demux_vox_get_optional_data; + this->demux_plugin.demux_class = class_gen; + + this->status = DEMUX_FINISHED; return &this->demux_plugin; } @@ -273,9 +255,7 @@ void *demux_vox_init_plugin (xine_t *xine, void *data) { demux_vox_class_t *this; - this = xine_xmalloc (sizeof (demux_vox_class_t)); - this->config = xine->config; - this->xine = xine; + this = xine_xmalloc (sizeof (demux_vox_class_t)); this->demux_class.open_plugin = open_plugin; this->demux_class.get_description = get_description; -- cgit v1.2.3