diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/demuxers/demux_mpeg.c | 191 |
1 files changed, 4 insertions, 187 deletions
diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c index eb287a0bf..890aba2c1 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.88 2002/10/24 23:13:05 tmattern Exp $ + * $Id: demux_mpeg.c,v 1.89 2002/10/25 02:05:27 guenter Exp $ * * demultiplexer for mpeg 1/2 program streams * reads streams of variable blocksizes @@ -960,194 +960,11 @@ static int demux_mpeg_seek (demux_plugin_t *this_gen, return demux_mpeg_start (this_gen, start_pos, start_time); } -#if 0 -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; - off_t mdat_atom_offset = -1; - int64_t mdat_atom_size = -1; - unsigned int fourcc_tag; - int i, j; - - this->input = input; - - switch(stage) { - - case STAGE_BY_CONTENT: { - uint8_t buf[4096]; - - if((input->get_capabilities(input) & INPUT_CAP_SEEKABLE) != 0) { - input->seek(input, 0, SEEK_SET); - - if(input->get_blocksize(input)) - return DEMUX_CANNOT_HANDLE; - - if(input->read(input, buf, 16) == 16) { - - if(!buf[0] && !buf[1] && (buf[2] == 0x01)) - switch(buf[3]) { +static void demux_mpeg_dispose (demux_plugin_t *this_gen) { - case 0xba: - if((buf[4] & 0xf0) == 0x20) { - uint32_t pckbuf ; + demux_mpeg_stop (this_gen); - pckbuf = read_bytes (this, 1); - if ((pckbuf>>4) != 4) { - this->input = input; - return demux_mpeg_send_headers (this); - } - } - break; -#if 0 - case 0xe0: - if((buf[6] & 0xc0) != 0x80) { - uint32_t pckbuf ; - - pckbuf = read_bytes (this, 1); - if ((pckbuf>>4) != 4) { - this->input = input; - return demux_mpeg_send_headers (this); - } - } - break; -#endif - } - - /* special case for MPEG streams hidden inside QT files; check - * is there is an mdat atom */ - find_mdat_atom(input, &mdat_atom_offset, &mdat_atom_size); - if (mdat_atom_offset != -1) { - /* seek to the start of the mdat data, which might be in different - * depending on the size type of the atom */ - if (mdat_atom_size == 1) - input->seek(input, mdat_atom_offset + 16, SEEK_SET); - else - input->seek(input, mdat_atom_offset + 8, SEEK_SET); - - /* go through the same MPEG detection song and dance */ - if(input->read(input, buf, 6)) { - if(buf[0] || buf[1] || (buf[2] != 0x01)) - return DEMUX_CANNOT_HANDLE; - - switch(buf[3]) { - - case 0xba: - if((buf[4] & 0xf0) == 0x20) { - uint32_t pckbuf ; - - pckbuf = read_bytes (this, 1); - if ((pckbuf>>4) != 4) { - this->input = input; - return demux_mpeg_send_headers (this); - } - } - break; - } - } - } - - /* special case for MPEG streams with a RIFF header */ - fourcc_tag = BE_32(&buf[0]); - if (fourcc_tag == RIFF_TAG) { - fourcc_tag = BE_32(&buf[8]); - /* disregard the RIFF file if it is certainly a better known - * format like AVI or WAVE */ - if ((fourcc_tag == WAVE_TAG) || - (fourcc_tag == AVI_TAG)) - return DEMUX_CANNOT_HANDLE; - - /* Iterate through first n kilobytes of RIFF file searching for - * MPEG video marker. No, it's not a very efficient approach, but - * if execution has reached this special case, this is currently - * the best chance for detecting the file automatically. Also, - * be extra lazy and do not bother skipping over the data - * header. */ - for (i = 0; i < RIFF_CHECK_KILOBYTES; i++) { - if (input->read(input, buf, 1024) != 1024) - return DEMUX_CANNOT_HANDLE; - - for (j = 0; j < 1024 - 4; j++) { - if (BE_32(&buf[j]) == MPEG_MARKER) { - this->input = input; - return demux_mpeg_send_headers (this); - } - } - } - } - } - } - return DEMUX_CANNOT_HANDLE; - } - break; - - case STAGE_BY_EXTENSION: { - char *media; - char *ending; - char *MRL = input->get_mrl(input); - char *m, *valid_mrls, *valid_ends; - - xine_strdupa(valid_mrls, - this->config->register_string(this->config, - "mrl.mrls_mpeg", VALID_MRLS, - _("valid mrls for mpeg demuxer"), - NULL, 20, NULL, NULL)); - - media = strstr(MRL, "://"); - if (media) { - while((m = xine_strsep(&valid_mrls, ",")) != NULL) { - - while(*m == ' ' || *m == '\t') m++; - - if(!strncmp(MRL, m, strlen(m))) { - - if(!strncmp((media + 3), "mpeg1", 5)) { - this->input = input; - return demux_mpeg_send_headers (this); - } - else if(!strncasecmp((media + 3), "mpeg2", 5)) { - return DEMUX_CANNOT_HANDLE; - } - - xine_log (this->xine, XINE_LOG_MSG, _("demux_mpeg: please specify mpeg(mpeg1/mpeg2) stream type.\n")); - return DEMUX_CANNOT_HANDLE; - } - } - } - - ending = strrchr(MRL, '.'); - - if(!ending) - return DEMUX_CANNOT_HANDLE; - - xine_strdupa(valid_ends, - this->config->register_string(this->config, - "mrl.ends_mpeg", VALID_ENDS, - _("valid mrls ending for mpeg demuxer"), - NULL, 20, NULL, NULL)); - while((m = xine_strsep(&valid_ends, ",")) != NULL) { - - while(*m == ' ' || *m == '\t') m++; - - if(!strcasecmp((ending + 1), m)) { - this->input = input; - return demux_mpeg_send_headers (this); - } - } - } - break; - - default: - return DEMUX_CANNOT_HANDLE; - break; - } - - return DEMUX_CANNOT_HANDLE; -} -#endif - -static void demux_mpeg_dispose (demux_plugin_t *this) { - free (this); + free (this_gen); } static int demux_mpeg_get_stream_length (demux_plugin_t *this_gen) { |