summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarco Zuehlke <andruil@users.sourceforge.net>2003-07-03 12:35:18 +0000
committerMarco Zuehlke <andruil@users.sourceforge.net>2003-07-03 12:35:18 +0000
commit112e8b4d178d46ce76a05c2441e8c5cb183b6db5 (patch)
tree64e77d51d7ed4a0507e64dcbc93be93953c0c41e /src
parentfd5347763569f9b3367d80079c99c6a4b1721149 (diff)
downloadxine-lib-112e8b4d178d46ce76a05c2441e8c5cb183b6db5.tar.gz
xine-lib-112e8b4d178d46ce76a05c2441e8c5cb183b6db5.tar.bz2
cleaning up; removing unused stuff
CVS patchset: 5127 CVS date: 2003/07/03 12:35:18
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/demux_cdda.c40
-rw-r--r--src/demuxers/demux_eawve.c129
-rw-r--r--src/demuxers/demux_elem.c156
-rw-r--r--src/demuxers/demux_film.c156
-rw-r--r--src/demuxers/demux_fli.c85
5 files changed, 191 insertions, 375 deletions
diff --git a/src/demuxers/demux_cdda.c b/src/demuxers/demux_cdda.c
index d2ebe764c..300d2e938 100644
--- a/src/demuxers/demux_cdda.c
+++ b/src/demuxers/demux_cdda.c
@@ -16,14 +16,15 @@
* 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
- *
+ */
+
+/*
* CDDA "Demuxer" by Mike Melanson (melanson@pcisys.net)
* All this demuxer does is read raw CD frames and shovel them to the
* linear PCM "decoder" (which in turn sends them directly to the audio
* output target; this is a really fancy CD-playing architecture).
*
- * $Id: demux_cdda.c,v 1.7 2003/05/06 15:20:13 esnel Exp $
- *
+ * $Id: demux_cdda.c,v 1.8 2003/07/03 12:35:18 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -37,6 +38,11 @@
#include <stdlib.h>
#include <ctype.h>
+/********** logging **********/
+#define LOG_MODULE "demux_cdda"
+/* #define LOG_VERBOSE */
+/* #define LOG */
+
#include "xine_internal.h"
#include "xineutils.h"
#include "demux.h"
@@ -47,33 +53,19 @@
#define CD_BYTES_PER_SECOND (44100 * 2 * 2)
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;
int seek_flag; /* this is set when a seek just occurred */
-
- char last_mrl[1024];
} demux_cdda_t;
typedef struct {
-
demux_class_t demux_class;
-
- /* class-wide, global variables here */
-
- xine_t *xine;
- config_values_t *config;
} demux_cdda_class_t;
static int demux_cdda_send_chunk (demux_plugin_t *this_gen) {
@@ -191,14 +183,12 @@ static int demux_cdda_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_cdda_t *this;
- if (! (input->get_capabilities(input) & INPUT_CAP_SEEKABLE)) {
- if (stream->xine->verbosity >= XINE_VERBOSITY_DEBUG)
- printf(_("demux_cdda.c: 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;
}
@@ -237,8 +227,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;
}
@@ -269,9 +257,7 @@ void *demux_cdda_init_plugin (xine_t *xine, void *data) {
demux_cdda_class_t *this;
- this = xine_xmalloc (sizeof (demux_cdda_class_t));
- this->config = xine->config;
- this->xine = xine;
+ this = xine_xmalloc (sizeof (demux_cdda_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;
diff --git a/src/demuxers/demux_eawve.c b/src/demuxers/demux_eawve.c
index 9e24a17cb..faf9bb07c 100644
--- a/src/demuxers/demux_eawve.c
+++ b/src/demuxers/demux_eawve.c
@@ -16,8 +16,10 @@
* 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_eawve.c,v 1.16 2003/04/26 20:15:59 guenter Exp $
+ */
+
+/*
+ * $Id: demux_eawve.c,v 1.17 2003/07/03 12:35:18 andruil Exp $
*
* demux_eawve.c, Demuxer plugin for Electronic Arts' WVE file format
*
@@ -33,6 +35,11 @@
#include <fcntl.h>
#include <unistd.h>
+/********** logging **********/
+#define LOG_MODULE "demux_eawve"
+/* #define LOG_VERBOSE */
+/* #define LOG */
+
#include "xine_internal.h"
#include "xineutils.h"
#include "bswap.h"
@@ -45,32 +52,24 @@
((uint32_t)(ch0) << 24))
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 thread_running;
- int status;
-
- int num_channels;
- int compression_type;
- int num_samples;
- int sample_counter;
-
- char last_mrl[1024];
-} demux_eawve_t;
+ demux_plugin_t demux_plugin;
-typedef struct {
+ xine_stream_t *stream;
+ fifo_buffer_t *video_fifo;
+ fifo_buffer_t *audio_fifo;
+ input_plugin_t *input;
+ int status;
- demux_class_t demux_class;
+ int thread_running;
- /* class-wide, global variables here */
+ int num_channels;
+ int compression_type;
+ int num_samples;
+ int sample_counter;
+} demux_eawve_t;
- xine_t *xine;
- config_values_t *config;
+typedef struct {
+ demux_class_t demux_class;
} demux_eawve_class_t;
typedef struct {
@@ -81,7 +80,7 @@ typedef struct {
/*
* Read an arbitary number of byte into a word
*/
-
+
static uint32_t read_arbitary(input_plugin_t *input)
{
uint8_t size, byte;
@@ -114,12 +113,8 @@ static int process_header(demux_eawve_t *this)
int inHeader;
uint32_t blockid, size;
- if (this->input->get_current_pos(this->input) != 0) {
- if ((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) == 0) {
- return 0;
- }
+ if (this->input->get_current_pos(this->input) != 0)
this->input->seek(this->input, 0, SEEK_SET);
- }
if (this->input->read(this->input, (void*)&blockid, 4) != 4) {
return 0;
@@ -137,7 +132,7 @@ static int process_header(demux_eawve_t *this)
return 0;
}
if (be2me_32(blockid) != FOURCC_TAG('P', 'T', '\0', '\0')) {
- printf("demux_eawve: PT header missing\n");
+ lprintf("PT header missing\n");
return 0;
}
@@ -151,7 +146,7 @@ static int process_header(demux_eawve_t *this)
switch (byte) {
case 0xFD:
- printf("demux_eawve: entered audio subheader\n");
+ lprintf("entered audio subheader\n");
inSubheader = 1;
while (inSubheader) {
uint8_t subbyte;
@@ -162,39 +157,39 @@ static int process_header(demux_eawve_t *this)
switch (subbyte) {
case 0x82:
this->num_channels = read_arbitary(this->input);
- printf("demux_eawve: num_channels (element 0x82) set to 0x%08x\n", this->num_channels);
+ lprintf("num_channels (element 0x82) set to 0x%08x\n", this->num_channels);
break;
case 0x83:
this->compression_type = read_arbitary(this->input);
- printf("demux_eawve: compression_type (element 0x83) set to 0x%08x\n", this->compression_type);
+ lprintf("compression_type (element 0x83) set to 0x%08x\n", this->compression_type);
break;
case 0x85:
this->num_samples = read_arbitary(this->input);
- printf("demux_eawve: num_samples (element 0x85) set to 0x%08x\n", this->num_samples);
+ lprintf("num_samples (element 0x85) set to 0x%08x\n", this->num_samples);
break;
default:
- printf("demux_eawve: element 0x%02x set to 0x%08x\n", subbyte, read_arbitary(this->input));
+ lprintf("element 0x%02x set to 0x%08x\n", subbyte, read_arbitary(this->input));
break;
case 0x8A:
- printf("demux_eawve: element 0x%02x set to 0x%08x\n", subbyte, read_arbitary(this->input));
- printf("demux_eawve: exited audio subheader\n");
+ lprintf("element 0x%02x set to 0x%08x\n", subbyte, read_arbitary(this->input));
+ lprintf("exited audio subheader\n");
inSubheader = 0;
break;
}
}
break;
default:
- printf("demux_eawve: header element 0x%02x set to 0x%08x\n", byte, read_arbitary(this->input));
+ lprintf("header element 0x%02x set to 0x%08x\n", byte, read_arbitary(this->input));
break;
case 0xFF:
- printf("demux_eawve: end of header block reached\n");
+ lprintf("end of header block reached\n");
inHeader = 0;
break;
}
}
if ((this->num_channels != 2) || (this->compression_type != 7)) {
- printf("demux_eawve: unsupported stream type\n");
+ lprintf("unsupported stream type\n");
return 0;
}
@@ -216,7 +211,7 @@ static int demux_eawve_send_chunk(demux_eawve_t *this)
chunk_header_t header;
if (this->input->read(this->input, (void*)&header, sizeof(chunk_header_t)) != sizeof(chunk_header_t)) {
- printf("demux_eawve: read error\n");
+ lprintf("read error\n");
this->status = DEMUX_FINISHED;
return this->status;
}
@@ -247,7 +242,7 @@ static int demux_eawve_send_chunk(demux_eawve_t *this)
header.size -= buf->size;
if (this->input->read(this->input, buf->content, buf->size) != buf->size) {
- printf("demux_eawve: read error\n");
+ lprintf("read error\n");
this->status = DEMUX_FINISHED;
buf->free_buffer(buf);
break;
@@ -275,7 +270,7 @@ static int demux_eawve_send_chunk(demux_eawve_t *this)
default: {
if (this->input->seek(this->input, header.size, SEEK_CUR) < 0) {
- printf("demux_eawve: read error\n");
+ lprintf("read error\n");
this->status = DEMUX_FINISHED;
}
}
@@ -358,12 +353,14 @@ static int demux_eawve_get_optional_data(demux_plugin_t *this_gen,
return DEMUX_OPTIONAL_UNSUPPORTED;
}
-static demux_plugin_t* open_plugin(demux_class_t *class_gen, xine_stream_t *stream, input_plugin_t *input_gen)
+static demux_plugin_t* open_plugin(demux_class_t *class_gen, xine_stream_t *stream, input_plugin_t *input)
{
- input_plugin_t *input = (input_plugin_t *) input_gen;
demux_eawve_t *this;
+ if (!INPUT_IS_SEEKABLE(input))
+ return NULL;
+
this = xine_xmalloc(sizeof(demux_eawve_t));
this->stream = stream;
this->input = input;
@@ -384,39 +381,27 @@ static demux_plugin_t* open_plugin(demux_class_t *class_gen, xine_stream_t *stre
switch (stream->content_detection_method) {
- case METHOD_BY_CONTENT:
- case METHOD_EXPLICIT:
- if ((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) == 0) {
- free(this);
- return NULL;
- }
-
- if (!process_header(this)) {
- free(this);
- return NULL;
- }
- break;
-
case METHOD_BY_EXTENSION: {
- char *ending, *mrl;
+ char *extensions, *mrl;
- mrl = input->get_mrl(input);
+ mrl = input->get_mrl (input);
+ extensions = class_gen->get_extensions (class_gen);
- ending = strrchr(mrl, '.');
- if (!ending) {
- free(this);
- return NULL;
- }
- if (strncasecmp(ending, ".wve", 4)) {
- free(this);
+ if (!xine_demux_check_extension (mrl, extensions)) {
+ free (this);
return NULL;
}
+ }
+ /* falling through is intended */
+
+ case METHOD_BY_CONTENT:
+ case METHOD_EXPLICIT:
if (!process_header(this)) {
free(this);
return NULL;
}
- }
+
break;
default:
@@ -424,8 +409,6 @@ static demux_plugin_t* open_plugin(demux_class_t *class_gen, xine_stream_t *stre
return NULL;
}
- strncpy(this->last_mrl, input->get_mrl(input), 1024);
-
return &this->demux_plugin;
}
@@ -458,9 +441,7 @@ void *demux_eawve_init_plugin(xine_t *xine, void *data)
{
demux_eawve_class_t *this;
- this = xine_xmalloc(sizeof(demux_eawve_class_t));
- this->config = xine->config;
- this->xine = xine;
+ this = xine_xmalloc(sizeof(demux_eawve_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;
diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c
index 49167cc94..bc72c4d68 100644
--- a/src/demuxers/demux_elem.c
+++ b/src/demuxers/demux_elem.c
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a free video player.
@@ -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
- *
- * $Id: demux_elem.c,v 1.71 2003/05/19 23:31:07 tmattern Exp $
+ */
+
+/*
+ * $Id: demux_elem.c,v 1.72 2003/07/03 12:35:18 andruil Exp $
*
* demultiplexer for elementary mpeg streams
- *
*/
#ifdef HAVE_CONFIG_H
@@ -33,66 +34,46 @@
#include <unistd.h>
#include <string.h>
+/********** logging **********/
+#define LOG_MODULE "demux_elem"
+/* #define LOG_VERBOSE */
+/* #define LOG */
+
#include "xine_internal.h"
#include "xineutils.h"
#include "compat.h"
#include "demux.h"
-/*
-#define LOG
-*/
-
#define NUM_PREVIEW_BUFFERS 50
-#define SCRATCH_SIZE ((MAX_PREVIEW_SIZE>4096)?MAX_PREVIEW_SIZE:4096)
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 blocksize;
int status;
-
- uint8_t scratch[SCRATCH_SIZE];
- char last_mrl[1024];
+ int blocksize;
} demux_mpeg_elem_t ;
typedef struct {
-
demux_class_t demux_class;
-
- /* class-wide, global variables here */
-
- xine_t *xine;
- config_values_t *config;
} demux_mpeg_elem_class_t;
static int demux_mpeg_elem_next (demux_mpeg_elem_t *this, int preview_mode) {
buf_element_t *buf;
-#ifdef LOG
- printf ("demux_elem: next piece\n");
-#endif
-
+ lprintf ("next piece\n");
buf = this->input->read_block(this->input, this->video_fifo, this->blocksize);
if (!buf) {
this->status = DEMUX_FINISHED;
return 0;
}
-#ifdef LOG
- printf ("demux_elem: size = %d\n", buf->size);
-#endif
-
+
+ lprintf ("size = %d\n", buf->size);
if (buf->size <= 0) {
buf->free_buffer (buf);
this->status = DEMUX_FINISHED;
@@ -140,11 +121,11 @@ static void demux_mpeg_elem_send_headers (demux_plugin_t *this_gen) {
xine_demux_control_start(this->stream);
- if ((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) != 0) {
+ if (INPUT_IS_SEEKABLE(this->input)) {
int num_buffers = NUM_PREVIEW_BUFFERS;
-
+
this->input->seek (this->input, 0, SEEK_SET);
-
+
this->status = DEMUX_OK ;
while ((num_buffers > 0) && (this->status == DEMUX_OK)) {
demux_mpeg_elem_next(this, 1);
@@ -162,26 +143,23 @@ static int demux_mpeg_elem_seek (demux_plugin_t *this_gen,
off_t start_pos, int start_time) {
demux_mpeg_elem_t *this = (demux_mpeg_elem_t *) this_gen;
-
+
this->status = DEMUX_OK;
- if (this->stream->demux_thread_running)
+ if (this->stream->demux_thread_running)
xine_demux_flush_engine(this->stream);
-
- if ((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) != 0) {
-
+
+ if (INPUT_IS_SEEKABLE(this->input)) {
+
/* FIXME: implement time seek */
if (start_pos != this->input->seek (this->input, start_pos, SEEK_SET)) {
this->status = DEMUX_FINISHED;
return this->status;
- }
-
-#ifdef LOG
- printf ("demux_elem: seeking to %lld\n", start_pos);
-#endif
+ }
+ lprintf ("seeking to %lld\n", start_pos);
}
-
+
/*
* now start demuxing
*/
@@ -209,73 +187,34 @@ static int demux_mpeg_elem_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_mpeg_elem_t *this;
- this = xine_xmalloc (sizeof (demux_mpeg_elem_t));
- this->stream = stream;
- this->input = input;
-
- this->demux_plugin.send_headers = demux_mpeg_elem_send_headers;
- this->demux_plugin.send_chunk = demux_mpeg_elem_send_chunk;
- this->demux_plugin.seek = demux_mpeg_elem_seek;
- this->demux_plugin.dispose = demux_mpeg_elem_dispose;
- this->demux_plugin.get_status = demux_mpeg_elem_get_status;
- this->demux_plugin.get_stream_length = demux_mpeg_elem_get_stream_length;
- this->demux_plugin.get_video_frame = NULL;
- this->demux_plugin.got_video_frame_cb= NULL;
- this->demux_plugin.get_capabilities = demux_mpeg_elem_get_capabilities;
- this->demux_plugin.get_optional_data = demux_mpeg_elem_get_optional_data;
- this->demux_plugin.demux_class = class_gen;
-
- this->status = DEMUX_FINISHED;
-
switch (stream->content_detection_method) {
case METHOD_BY_CONTENT: {
- uint8_t *scratch = this->scratch;
+ uint8_t scratch[4];
- if (!xine_demux_read_header(this->input, scratch, 4))
+ if (xine_demux_read_header(input, scratch, 4) != 4)
return NULL;
-
-#ifdef LOG
- printf ("demux_elem: %02x %02x %02x %02x\n",
- scratch[0], scratch[1],
- scratch[2], scratch[3]);
-#endif
-
- if (scratch[0] || scratch[1] || (scratch[2] != 0x01) || (scratch[3] != 0xb3)) {
- free (this);
- return NULL;
- }
-
- this->input = input;
-
-#ifdef LOG
- printf ("demux_elem: input accepted.\n");
-#endif
+ lprintf ("%02x %02x %02x %02x\n", scratch[0], scratch[1], scratch[2], scratch[3]);
+
+ if (scratch[0] || scratch[1] || (scratch[2] != 0x01) || (scratch[3] != 0xb3))
+ return NULL;
+ lprintf ("input accepted.\n");
}
break;
case METHOD_BY_EXTENSION: {
- char *ending, *mrl;
+ char *extensions, *mrl;
mrl = input->get_mrl (input);
+ extensions = class_gen->get_extensions (class_gen);
- ending = strrchr(mrl, '.');
-
- if (!ending) {
- free (this);
+ if (!xine_demux_check_extension (mrl, extensions))
return NULL;
- }
-
- if (strncasecmp (ending, ".mpv", 4)) {
- free (this);
- return NULL;
- }
}
break;
@@ -283,11 +222,26 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
break;
default:
- free (this);
return NULL;
}
- strncpy (this->last_mrl, input->get_mrl (input), 1024);
+ this = xine_xmalloc (sizeof (demux_mpeg_elem_t));
+ this->stream = stream;
+ this->input = input;
+
+ this->demux_plugin.send_headers = demux_mpeg_elem_send_headers;
+ this->demux_plugin.send_chunk = demux_mpeg_elem_send_chunk;
+ this->demux_plugin.seek = demux_mpeg_elem_seek;
+ this->demux_plugin.dispose = demux_mpeg_elem_dispose;
+ this->demux_plugin.get_status = demux_mpeg_elem_get_status;
+ this->demux_plugin.get_stream_length = demux_mpeg_elem_get_stream_length;
+ this->demux_plugin.get_video_frame = NULL;
+ this->demux_plugin.got_video_frame_cb= NULL;
+ this->demux_plugin.get_capabilities = demux_mpeg_elem_get_capabilities;
+ this->demux_plugin.get_optional_data = demux_mpeg_elem_get_optional_data;
+ this->demux_plugin.demux_class = class_gen;
+
+ this->status = DEMUX_FINISHED;
return &this->demux_plugin;
}
@@ -319,9 +273,7 @@ static void *init_plugin (xine_t *xine, void *data) {
demux_mpeg_elem_class_t *this;
- this = xine_xmalloc (sizeof (demux_mpeg_elem_class_t));
- this->config = xine->config;
- this->xine = xine;
+ this = xine_xmalloc (sizeof (demux_mpeg_elem_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;
diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c
index 536d51ee5..e8f44f67f 100644
--- a/src/demuxers/demux_film.c
+++ b/src/demuxers/demux_film.c
@@ -21,7 +21,7 @@
* For more information on the FILM file format, visit:
* http://www.pcisys.net/~melanson/codecs/
*
- * $Id: demux_film.c,v 1.60 2003/04/26 20:16:01 guenter Exp $
+ * $Id: demux_film.c,v 1.61 2003/07/03 12:35:18 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -34,6 +34,18 @@
#include <string.h>
#include <stdlib.h>
+/********** logging **********/
+#define LOG_MODULE "demux_film"
+/* #define LOG_VERBOSE */
+
+/* set DEBUG_FILM_LOAD to dump the frame index after the demuxer loads a
+ * FILM file */
+#define DEBUG_FILM_LOAD 0
+
+/* set DEBUG_FILM_DEMUX to output information about the A/V chunks that the
+ * demuxer is dispatching to the engine */
+#define DEBUG_FILM_DEMUX 0
+
#include "xine_internal.h"
#include "xineutils.h"
#include "compat.h"
@@ -59,21 +71,16 @@ typedef struct {
} film_sample_t;
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;
- 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 */
@@ -100,39 +107,12 @@ typedef struct {
unsigned int current_sample;
unsigned int last_sample;
int total_time;
-
- char last_mrl[1024];
} demux_film_t ;
typedef struct {
-
demux_class_t demux_class;
-
- /* class-wide, global variables here */
-
- xine_t *xine;
- config_values_t *config;
} demux_film_class_t;
-/* set DEBUG_FILM_LOAD to dump the frame index after the demuxer loads a
- * FILM file */
-#define DEBUG_FILM_LOAD 0
-
-/* set DEBUG_FILM_DEMUX to output information about the A/V chunks that the
- * demuxer is dispatching to the engine */
-#define DEBUG_FILM_DEMUX 0
-
-#if DEBUG_FILM_LOAD
-#define debug_film_load printf
-#else
-static inline void debug_film_load(const char *format, ...) { }
-#endif
-
-#if DEBUG_FILM_DEMUX
-#define debug_film_demux printf
-#else
-static inline void debug_film_demux(const char *format, ...) { }
-#endif
/* Open a FILM file
* This function is called from the _open() function of this demuxer.
@@ -142,7 +122,6 @@ static int open_film_file(demux_film_t *film) {
unsigned char *film_header;
unsigned int film_header_size;
unsigned char scratch[16];
- unsigned char preview[MAX_PREVIEW_SIZE];
unsigned int chunk_type;
unsigned int chunk_size;
unsigned int i, j;
@@ -158,33 +137,18 @@ static int open_film_file(demux_film_t *film) {
film->audio_bits = 0;
film->audio_channels = 0;
- if (film->input->get_capabilities(film->input) & INPUT_CAP_SEEKABLE) {
- /* reset the file */
- film->input->seek(film->input, 0, SEEK_SET);
-
- /* get the signature, header length and file version */
- if (film->input->read(film->input, scratch, 16) != 16) {
- return 0;
- }
- } else {
- film->input->get_optional_data(film->input, preview,
- INPUT_OPTIONAL_DATA_PREVIEW);
-
- /* copy over the header bytes for processing */
- memcpy(scratch, preview, 16);
- }
+ /* get the signature, header length and file version */
+ if (xine_demux_read_header(film->input, scratch, 16) != 16)
+ return 0;
/* FILM signature correct? */
if (strncmp(scratch, "FILM", 4)) {
return 0;
}
- debug_film_load(" demux_film: found 'FILM' signature\n");
+ llprintf(DEBUG_FILM_LOAD, "found 'FILM' signature\n");
- /* file is qualified; if the input was not seekable, skip over the header
- * bytes in the stream */
- if ((film->input->get_capabilities(film->input) & INPUT_CAP_SEEKABLE) == 0) {
- film->input->seek(film->input, 16, SEEK_SET);
- }
+ /* file is qualified; skip over the header bytes in the stream */
+ film->input->seek(film->input, 16, SEEK_SET);
/* header size = header size - 16-byte FILM signature */
film_header_size = BE_32(&scratch[4]) - 16;
@@ -192,7 +156,7 @@ static int open_film_file(demux_film_t *film) {
if (!film_header)
return 0;
strncpy(film->version, &scratch[8], 4);
- debug_film_load(" demux_film: 0x%X header bytes, version %c%c%c%c\n",
+ llprintf(DEBUG_FILM_LOAD, "0x%X header bytes, version %c%c%c%c\n",
film_header_size,
film->version[0],
film->version[1],
@@ -230,7 +194,7 @@ static int open_film_file(demux_film_t *film) {
switch(chunk_type) {
case FDSC_TAG:
- debug_film_load(" demux_film: parsing FDSC chunk\n");
+ llprintf(DEBUG_FILM_LOAD, "parsing FDSC chunk\n");
/* always fetch the video information */
film->bih.biWidth = BE_32(&film_header[i + 16]);
@@ -266,27 +230,27 @@ static int open_film_file(demux_film_t *film) {
film->audio_type = 0;
if (film->video_type)
- debug_film_load(" video: %dx%d %c%c%c%c\n",
+ llprintf(DEBUG_FILM_LOAD, "video: %dx%d %c%c%c%c\n",
film->bih.biWidth, film->bih.biHeight,
film_header[i + 8],
film_header[i + 9],
film_header[i + 10],
film_header[i + 11]);
else
- debug_film_load(" no video\n");
+ llprintf(DEBUG_FILM_LOAD, "no video\n");
if (film->audio_type)
- debug_film_load(" audio: %d Hz, %d channels, %d bits PCM\n",
+ llprintf(DEBUG_FILM_LOAD, "audio: %d Hz, %d channels, %d bits PCM\n",
film->sample_rate,
film->audio_channels,
film->audio_bits);
else
- debug_film_load(" no audio\n");
+ llprintf(DEBUG_FILM_LOAD, "no audio\n");
break;
case STAB_TAG:
- debug_film_load(" demux_film: parsing STAB chunk\n");
+ llprintf(DEBUG_FILM_LOAD, "parsing STAB chunk\n");
/* load the sample table */
if (film->sample_table)
@@ -297,14 +261,14 @@ static int open_film_file(demux_film_t *film) {
xine_xmalloc(film->sample_count * sizeof(film_sample_t));
for (j = 0; j < film->sample_count; j++) {
- film->sample_table[j].sample_offset =
+ film->sample_table[j].sample_offset =
BE_32(&film_header[(i + 16) + j * 16 + 0])
+ film_header_size + 16;
- film->sample_table[j].sample_size =
+ film->sample_table[j].sample_size =
BE_32(&film_header[(i + 16) + j * 16 + 4]);
- pts =
+ pts =
BE_32(&film_header[(i + 16) + j * 16 + 8]);
- film->sample_table[j].duration =
+ film->sample_table[j].duration =
BE_32(&film_header[(i + 16) + j * 16 + 12]);
if (pts == 0xFFFFFFFF) {
@@ -315,7 +279,7 @@ static int open_film_file(demux_film_t *film) {
/* figure out audio pts */
film->sample_table[j].pts = audio_byte_count;
film->sample_table[j].pts *= 90000;
- film->sample_table[j].pts /=
+ film->sample_table[j].pts /=
(film->sample_rate * film->audio_channels * (film->audio_bits / 8));
audio_byte_count += film->sample_table[j].sample_size;
@@ -329,7 +293,7 @@ static int open_film_file(demux_film_t *film) {
film->sample_table[j].keyframe = 0;
else
film->sample_table[j].keyframe = 1;
-
+
/* remove the keyframe bit */
film->sample_table[j].pts = pts & 0x7FFFFFFF;
@@ -347,7 +311,7 @@ static int open_film_file(demux_film_t *film) {
if (film->sample_table[j].pts > largest_pts)
largest_pts = film->sample_table[j].pts;
- debug_film_load(" sample %4d @ %8llX, %8X bytes, %s, pts %lld, duration %lld%s\n",
+ llprintf(DEBUG_FILM_LOAD, "sample %4d @ %8llX, %8X bytes, %s, pts %lld, duration %lld%s\n",
j,
film->sample_table[j].sample_offset,
film->sample_table[j].sample_size,
@@ -364,12 +328,12 @@ static int open_film_file(demux_film_t *film) {
if (chunk_size == film->sample_count * 16)
i += 16;
- /* allocate enough space in the interleave preload buffer for the
+ /* allocate enough space in the interleave preload buffer for the
* first chunk (which will be more than enough for successive chunks) */
if (film->audio_type) {
if (film->interleave_buffer)
free(film->interleave_buffer);
- film->interleave_buffer =
+ film->interleave_buffer =
xine_xmalloc(film->sample_table[0].sample_size);
}
break;
@@ -434,7 +398,7 @@ static int demux_film_send_chunk(demux_plugin_t *this_gen) {
}
}
- debug_film_demux(" demux_film: dispatching frame...\n");
+ llprintf(DEBUG_FILM_DEMUX, "dispatching frame...\n");
if ((!this->sample_table[i].audio) &&
(this->video_type == BUF_VIDEO_CINEPAK)) {
@@ -509,7 +473,7 @@ static int demux_film_send_chunk(demux_plugin_t *this_gen) {
if (!remaining_sample_bytes)
buf->decoder_flags |= BUF_FLAG_FRAME_END;
- debug_film_demux(" sending video buf with %d bytes, %lld pts, %d duration\n",
+ llprintf(DEBUG_FILM_DEMUX, "sending video buf with %d bytes, %lld pts, %d duration\n",
buf->size, buf->pts, buf->decoder_info[0]);
this->video_fifo->put(this->video_fifo, buf);
}
@@ -552,7 +516,7 @@ static int demux_film_send_chunk(demux_plugin_t *this_gen) {
if (!remaining_sample_bytes)
buf->decoder_flags |= BUF_FLAG_FRAME_END;
- debug_film_demux(" sending video buf with %d bytes, %lld pts, %d duration\n",
+ llprintf(DEBUG_FILM_DEMUX, "sending video buf with %d bytes, %lld pts, %d duration\n",
buf->size, buf->pts, buf->decoder_info[0]);
this->video_fifo->put(this->video_fifo, buf);
}
@@ -611,7 +575,7 @@ static int demux_film_send_chunk(demux_plugin_t *this_gen) {
if (!remaining_sample_bytes)
buf->decoder_flags |= BUF_FLAG_FRAME_END;
- debug_film_demux(" sending mono audio buf with %d bytes, %lld pts, %d duration\n",
+ llprintf(DEBUG_FILM_DEMUX, "sending mono audio buf with %d bytes, %lld pts, %d duration\n",
buf->size, buf->pts, buf->decoder_info[0]);
this->audio_fifo->put(this->audio_fifo, buf);
@@ -681,7 +645,7 @@ static int demux_film_send_chunk(demux_plugin_t *this_gen) {
if (!remaining_sample_bytes)
buf->decoder_flags |= BUF_FLAG_FRAME_END;
- debug_film_demux(" sending stereo audio buf with %d bytes, %lld pts, %d duration\n",
+ llprintf(DEBUG_FILM_DEMUX, "sending stereo audio buf with %d bytes, %lld pts, %d duration\n",
buf->size, buf->pts, buf->decoder_info[0]);
this->audio_fifo->put(this->audio_fifo, buf);
}
@@ -761,7 +725,7 @@ static int demux_film_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;
/* perform a binary search on the sample table, testing the offset
@@ -873,9 +837,8 @@ static int demux_film_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_film_t *this;
this = xine_xmalloc (sizeof (demux_film_t));
@@ -898,42 +861,27 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
switch (stream->content_detection_method) {
- case METHOD_BY_CONTENT:
- case METHOD_EXPLICIT:
-
- if (!open_film_file(this)) {
- free (this);
- return NULL;
- }
-
- break;
-
case METHOD_BY_EXTENSION: {
- char *ending, *mrl;
+ char *extensions, *mrl;
mrl = input->get_mrl (input);
+ extensions = class_gen->get_extensions (class_gen);
- ending = strrchr(mrl, '.');
-
- if (!ending) {
+ if (!xine_demux_check_extension (mrl, extensions)) {
free (this);
return NULL;
}
+ }
+ /* falling through is intended */
- if (strncasecmp (ending, ".cpk", 4) &&
- strncasecmp (ending, ".cak", 4) &&
- strncasecmp (ending, ".film", 5)) {
- free (this);
- return NULL;
- }
+ case METHOD_BY_CONTENT:
+ case METHOD_EXPLICIT:
if (!open_film_file(this)) {
free (this);
return NULL;
}
- }
-
break;
default:
@@ -941,8 +889,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;
}
@@ -974,8 +920,6 @@ void *demux_film_init_plugin (xine_t *xine, void *data) {
demux_film_class_t *this;
this = xine_xmalloc (sizeof (demux_film_class_t));
- this->config = xine->config;
- this->xine = xine;
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;
diff --git a/src/demuxers/demux_fli.c b/src/demuxers/demux_fli.c
index ecf84a6ba..ea6db80c0 100644
--- a/src/demuxers/demux_fli.c
+++ b/src/demuxers/demux_fli.c
@@ -16,13 +16,15 @@
* 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
- *
+ */
+
+/*
* FLI File Demuxer by Mike Melanson (melanson@pcisys.net)
* For information on the FLI format, as well as various traps to
* avoid while programming a FLI decoder, visit:
* http://www.pcisys.net/~melanson/codecs/
*
- * $Id: demux_fli.c,v 1.41 2003/05/31 02:04:17 tmmm Exp $
+ * $Id: demux_fli.c,v 1.42 2003/07/03 12:35:18 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -51,19 +53,12 @@
#define FLI_MC_PTS_INC 6000 /* pts increment for Magic Carpet game FLIs */
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 start;
int status;
/* video information */
@@ -78,38 +73,18 @@ typedef struct {
unsigned int frame_count;
int64_t pts_counter;
- char last_mrl[1024];
-
- off_t stream_len;
+ off_t stream_len;
} demux_fli_t;
typedef struct {
-
demux_class_t demux_class;
-
- /* class-wide, global variables here */
-
- xine_t *xine;
- config_values_t *config;
} demux_fli_class_t;
/* returns 1 if the FLI file was opened successfully, 0 otherwise */
static int open_fli_file(demux_fli_t *this) {
- unsigned char preview[MAX_PREVIEW_SIZE];
-
- if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) {
- this->input->seek(this->input, 0, SEEK_SET);
- if (this->input->read(this->input, this->fli_header, FLI_HEADER_SIZE) !=
- FLI_HEADER_SIZE)
- return 0;
- } else {
- this->input->get_optional_data(this->input, preview,
- INPUT_OPTIONAL_DATA_PREVIEW);
-
- /* copy over the header bytes for processing */
- memcpy(this->fli_header, preview, FLI_HEADER_SIZE);
- }
+ if (xine_demux_read_header(this->input, this->fli_header, FLI_HEADER_SIZE) != FLI_HEADER_SIZE)
+ return 0;
/* validate the file */
this->magic_number = LE_16(&this->fli_header[4]);
@@ -117,17 +92,14 @@ static int open_fli_file(demux_fli_t *this) {
(this->magic_number != FLI_FILE_MAGIC_2))
return 0;
- /* file is qualified; if the input was not seekable, skip over the
- * signature bytes in the stream */
- if ((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) == 0) {
- this->input->seek(this->input, FLI_HEADER_SIZE, SEEK_SET);
- }
+ /* file is qualified; skip over the signature bytes in the stream */
+ this->input->seek(this->input, FLI_HEADER_SIZE, SEEK_SET);
/* check if this is a special FLI file from Magic Carpet game */
if (LE_16(&this->fli_header[16]) == FLI_CHUNK_MAGIC_1) {
/* if the input is non-seekable, do not bother with playing the
* special file type */
- if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) {
+ if (INPUT_IS_SEEKABLE(this->input)) {
this->input->seek(this->input, FLI_HEADER_SIZE_MC, SEEK_SET);
} else {
return 0;
@@ -325,9 +297,8 @@ static int demux_fli_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_fli_t *this;
this = xine_xmalloc (sizeof (demux_fli_t));
@@ -350,41 +321,27 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
switch (stream->content_detection_method) {
- case METHOD_BY_CONTENT:
- case METHOD_EXPLICIT:
-
- if (!open_fli_file(this)) {
- free (this);
- return NULL;
- }
-
- break;
-
case METHOD_BY_EXTENSION: {
- char *ending, *mrl;
+ char *extensions, *mrl;
mrl = input->get_mrl (input);
+ extensions = class_gen->get_extensions (class_gen);
- ending = strrchr(mrl, '.');
-
- if (!ending) {
+ if (!xine_demux_check_extension (mrl, extensions)) {
free (this);
return NULL;
}
+ }
+ /* falling through is intended */
- if (strncasecmp (ending, ".fli", 4) &&
- strncasecmp (ending, ".flc", 4)) {
- free (this);
- return NULL;
- }
+ case METHOD_BY_CONTENT:
+ case METHOD_EXPLICIT:
if (!open_fli_file(this)) {
free (this);
return NULL;
}
- }
-
break;
default:
@@ -392,8 +349,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;
}
@@ -424,9 +379,7 @@ static void *init_plugin (xine_t *xine, void *data) {
demux_fli_class_t *this;
- this = xine_xmalloc (sizeof (demux_fli_class_t));
- this->config = xine->config;
- this->xine = xine;
+ this = xine_xmalloc (sizeof (demux_fli_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;