From d63f8a8529e4d3d90a9949f51f0f5e88f198e1b2 Mon Sep 17 00:00:00 2001 From: Daniel Caujolle-Bert Date: Sun, 29 Apr 2001 23:22:32 +0000 Subject: Some input plugin storing references fixes. CVS patchset: 48 CVS date: 2001/04/29 23:22:32 --- src/demuxers/demux_avi.c | 7 ++++--- src/demuxers/demux_elem.c | 9 +++++---- src/demuxers/demux_mpeg.c | 22 ++++++++++++---------- src/demuxers/demux_mpeg_block.c | 11 +++++++---- src/demuxers/demux_mpgaudio.c | 16 ++++++++-------- 5 files changed, 36 insertions(+), 29 deletions(-) diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c index 0f4013c65..12b5b99e4 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.6 2001/04/28 21:23:04 guenter Exp $ + * $Id: demux_avi.c,v 1.7 2001/04/29 23:22:32 f1rmb Exp $ * * demultiplexer for avi streams * @@ -888,7 +888,8 @@ static void demux_avi_start (demux_plugin_t *this_gen, pthread_create (&this->thread, NULL, demux_avi_loop, this) ; } -static int demux_avi_open(demux_plugin_t *this_gen, input_plugin_t *input, int stage) { +static int demux_avi_open(demux_plugin_t *this_gen, + input_plugin_t *input, int stage) { demux_avi_t *this = (demux_avi_t *) this_gen; @@ -929,7 +930,7 @@ static int demux_avi_open(demux_plugin_t *this_gen, input_plugin_t *input, int s case STAGE_BY_EXTENSION: { char *ending, *mrl; - mrl = this->input->get_mrl (this->input); + mrl = input->get_mrl (input); ending = strrchr(mrl, '.'); xprintf(VERBOSE|DEMUX, "demux_avi_can_handle: ending %s of %s\n", diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c index 7adbb82c4..a142ddd4d 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.4 2001/04/29 22:42:46 f1rmb Exp $ + * $Id: demux_elem.c,v 1.5 2001/04/29 23:22:32 f1rmb Exp $ * * demultiplexer for elementary mpeg streams * @@ -178,8 +178,6 @@ static int demux_mpeg_elem_open(demux_plugin_t *this_gen, demux_mpeg_elem_t *this = (demux_mpeg_elem_t *) this_gen; - this->input = input; - switch(stage) { case STAGE_BY_CONTENT: { @@ -204,6 +202,7 @@ static int demux_mpeg_elem_open(demux_plugin_t *this_gen, switch(buf[3]) { case 0xb3: + this->input = input; return DEMUX_CAN_HANDLE; break; } @@ -223,8 +222,10 @@ static int demux_mpeg_elem_open(demux_plugin_t *this_gen, xprintf(VERBOSE|DEMUX, "%s: suffix %s of %s\n", __FUNCTION__, suffix, MRL); if(suffix) { - if(!strcasecmp(suffix, ".mpv")) + if(!strcasecmp(suffix, ".mpv")) { + this->input = input; return DEMUX_CAN_HANDLE; + } } return DEMUX_CANNOT_HANDLE; diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c index 6011627b1..0f29463cc 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.5 2001/04/28 21:23:04 guenter Exp $ + * $Id: demux_mpeg.c,v 1.6 2001/04/29 23:22:32 f1rmb Exp $ * * demultiplexer for mpeg 1/2 program streams * reads streams of variable blocksizes @@ -510,24 +510,23 @@ static void demux_mpeg_start (demux_plugin_t *this_gen, pthread_create (&this->thread, NULL, demux_mpeg_loop, this) ; } -static int demux_mpeg_open(demux_plugin_t *this_gen, input_plugin_t *ip, int stage) { +static int demux_mpeg_open(demux_plugin_t *this_gen, + input_plugin_t *input, int stage) { demux_mpeg_t *this = (demux_mpeg_t *) this_gen; - this->input = ip; - switch(stage) { case STAGE_BY_CONTENT: { uint8_t buf[4096]; - if((ip->get_capabilities(ip) & INPUT_CAP_SEEKABLE) != 0) { - ip->seek(ip, 0, SEEK_SET); + if((input->get_capabilities(input) & INPUT_CAP_SEEKABLE) != 0) { + input->seek(input, 0, SEEK_SET); - if(ip->get_blocksize(ip)) + if(input->get_blocksize(input)) return DEMUX_CANNOT_HANDLE; - if(ip->read(ip, buf, 6)) { + if(input->read(input, buf, 6)) { if(buf[0] || buf[1] || (buf[2] != 0x01)) return DEMUX_CANNOT_HANDLE; @@ -536,11 +535,13 @@ static int demux_mpeg_open(demux_plugin_t *this_gen, input_plugin_t *ip, int sta case 0xba: if((buf[4] & 0xf0) == 0x20) + this->input = input; return DEMUX_CAN_HANDLE; break; case 0xe0: if((buf[6] & 0xc0) != 0x80) + this->input = input; return DEMUX_CAN_HANDLE; break; @@ -554,7 +555,7 @@ static int demux_mpeg_open(demux_plugin_t *this_gen, input_plugin_t *ip, int sta case STAGE_BY_EXTENSION: { char *media; char *ending; - char *MRL = ip->get_mrl(ip); + char *MRL = input->get_mrl(input); media = strstr(MRL, "://"); if(media) { @@ -562,6 +563,7 @@ static int demux_mpeg_open(demux_plugin_t *this_gen, input_plugin_t *ip, int sta || (!(strncasecmp(MRL, "fifo", 4)))) { if(!(strncasecmp((media+3), "mpeg1", 5))) { perr("%s(%d)mpeg\n", __FUNCTION__, stage); + this->input = input; return DEMUX_CAN_HANDLE; } else if(!(strncasecmp((media+3), "mpeg2", 5))) { @@ -584,6 +586,7 @@ static int demux_mpeg_open(demux_plugin_t *this_gen, input_plugin_t *ip, int sta if(!strcasecmp(ending, ".mpg") || (!strcasecmp(ending, ".mpeg"))) { + this->input = input; return DEMUX_CAN_HANDLE; } } @@ -639,4 +642,3 @@ demux_plugin_t *init_demuxer_plugin(int iface, config_values_t *config) { return NULL; } } - diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c index ac18aae9c..4cff99930 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.5 2001/04/28 21:23:04 guenter Exp $ + * $Id: demux_mpeg_block.c,v 1.6 2001/04/29 23:22:32 f1rmb Exp $ * * demultiplexer for mpeg 1/2 program streams * @@ -387,7 +387,7 @@ static void demux_mpeg_block_start (demux_plugin_t *this_gen, buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_CONTROL_START; this->video_fifo->put (this->video_fifo, buf); - buf = this->audio_fifo->buffer_pool_alloc (this->video_fifo); + buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_CONTROL_START; this->audio_fifo->put (this->audio_fifo, buf); @@ -403,8 +403,6 @@ static int demux_mpeg_block_open(demux_plugin_t *this_gen, demux_mpeg_block_t *this = (demux_mpeg_block_t *) this_gen; - this->input = input; - switch(stage) { case STAGE_BY_CONTENT: { @@ -427,12 +425,14 @@ static int demux_mpeg_block_open(demux_plugin_t *this_gen, case 0xba: if((buf[4] & 0xc0) == 0x40) + this->input = input; return DEMUX_CAN_HANDLE; break; case 0xe0: if((buf[6] & 0xc0) == 0x80) + this->input = input; return DEMUX_CAN_HANDLE; break; @@ -459,10 +459,12 @@ static int demux_mpeg_block_open(demux_plugin_t *this_gen, && (!strncmp((media+3), "mpeg2", 5) ))) ) { this->blocksize = 2048; + this->input = input; return DEMUX_CAN_HANDLE; } if(!strncmp(MRL, "vcd", 3)) { this->blocksize = 2324; + this->input = input; return DEMUX_CAN_HANDLE; } } @@ -481,6 +483,7 @@ static int demux_mpeg_block_open(demux_plugin_t *this_gen, if(!strcasecmp(ending, ".vob")) { this->blocksize = 2048; + this->input = input; return DEMUX_CAN_HANDLE; } } diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 02a412155..4d2f3cf83 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.3 2001/04/29 22:42:46 f1rmb Exp $ + * $Id: demux_mpgaudio.c,v 1.4 2001/04/29 23:22:32 f1rmb Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -311,7 +311,7 @@ static void demux_mpgaudio_start (demux_plugin_t *this_gen, buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_CONTROL_START; this->video_fifo->put (this->video_fifo, buf); - buf = this->audio_fifo->buffer_pool_alloc (this->video_fifo); + buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_CONTROL_START; this->audio_fifo->put (this->audio_fifo, buf); @@ -326,8 +326,6 @@ static int demux_mpgaudio_open(demux_plugin_t *this_gen, input_plugin_t *input, int stage) { demux_mpgaudio_t *this = (demux_mpgaudio_t *) this_gen; - this->input = input; - switch(stage) { case STAGE_BY_CONTENT: { @@ -394,8 +392,10 @@ static int demux_mpgaudio_open(demux_plugin_t *this_gen, head = (buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3]; if(mpg123_head_check(head) && - (((head >> 8) & 0x1) == 0x0) && (((head >> 6) & 0x3) == 0x1)) + (((head >> 8) & 0x1) == 0x0) && (((head >> 6) & 0x3) == 0x1)) { + this->input = input; return DEMUX_CAN_HANDLE; + } } } } @@ -408,15 +408,16 @@ static int demux_mpgaudio_open(demux_plugin_t *this_gen, char *MRL; MRL = input->get_mrl (input); - + suffix = strrchr(MRL, '.'); - xprintf(VERBOSE|DEMUX, "%s: suffix %s of %s\n", __FUNCTION, suffix, MRL); + xprintf(VERBOSE|DEMUX, "%s: suffix %s of %s\n", __FUNCTION__, suffix, MRL); if(!suffix) return DEMUX_CANNOT_HANDLE; if(!strcasecmp(suffix, ".mp3") || (!strcasecmp(suffix, ".mp2"))) { + this->input = input; return DEMUX_CAN_HANDLE; } } @@ -471,4 +472,3 @@ demux_plugin_t *init_demuxer_plugin(int iface, config_values_t *config) { return NULL; } } - -- cgit v1.2.3