summaryrefslogtreecommitdiff
path: root/src/demuxers
diff options
context:
space:
mode:
authorMarco Zuehlke <andruil@users.sourceforge.net>2003-07-16 00:52:45 +0000
committerMarco Zuehlke <andruil@users.sourceforge.net>2003-07-16 00:52:45 +0000
commitc9451e4e24ba657e8d9ca0528f4a384847ec8063 (patch)
tree8be630b29873502d4be6024004f889d99abeaa1a /src/demuxers
parent9da02c7370fcca339301e39aed337d3946bbbf10 (diff)
downloadxine-lib-c9451e4e24ba657e8d9ca0528f4a384847ec8063.tar.gz
xine-lib-c9451e4e24ba657e8d9ca0528f4a384847ec8063.tar.bz2
more cleanup; remove unused variables; use lprintf
CVS patchset: 5167 CVS date: 2003/07/16 00:52:45
Diffstat (limited to 'src/demuxers')
-rw-r--r--src/demuxers/demux_4xm.c8
-rw-r--r--src/demuxers/demux_ac3.c11
-rw-r--r--src/demuxers/demux_aiff.c14
-rw-r--r--src/demuxers/demux_aud.c9
-rw-r--r--src/demuxers/demux_cdda.c22
-rw-r--r--src/demuxers/demux_eawve.c48
-rw-r--r--src/demuxers/demux_elem.c10
-rw-r--r--src/demuxers/demux_film.c11
-rw-r--r--src/demuxers/demux_fli.c38
-rw-r--r--src/demuxers/demux_idcin.c25
-rw-r--r--src/demuxers/demux_image.c17
-rw-r--r--src/demuxers/demux_ipmovie.c12
-rw-r--r--src/demuxers/demux_mng.c143
-rw-r--r--src/demuxers/demux_nsf.c80
-rw-r--r--src/demuxers/demux_nsv.c156
-rw-r--r--src/demuxers/demux_pva.c101
-rw-r--r--src/demuxers/demux_rawdv.c86
-rw-r--r--src/demuxers/demux_realaudio.c64
-rw-r--r--src/demuxers/demux_roq.c82
-rw-r--r--src/demuxers/demux_slave.c12
-rw-r--r--src/demuxers/demux_smjpeg.c38
-rw-r--r--src/demuxers/demux_snd.c13
-rw-r--r--src/demuxers/demux_str.c11
-rw-r--r--src/demuxers/demux_voc.c47
-rw-r--r--src/demuxers/demux_vox.c13
-rw-r--r--src/demuxers/demux_vqa.c57
-rw-r--r--src/demuxers/demux_wav.c53
-rw-r--r--src/demuxers/demux_wc3movie.c83
-rw-r--r--src/demuxers/demux_yuv4mpeg2.c47
-rw-r--r--src/demuxers/demux_yuv_frames.c181
30 files changed, 501 insertions, 991 deletions
diff --git a/src/demuxers/demux_4xm.c b/src/demuxers/demux_4xm.c
index 60ff7dde2..49e18fb4b 100644
--- a/src/demuxers/demux_4xm.c
+++ b/src/demuxers/demux_4xm.c
@@ -23,7 +23,7 @@
* For more information on the 4xm file format, visit:
* http://www.pcisys.net/~melanson/codecs/
*
- * $Id: demux_4xm.c,v 1.3 2003/07/03 00:58:52 andruil Exp $
+ * $Id: demux_4xm.c,v 1.4 2003/07/16 00:52:45 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -206,8 +206,8 @@ static int open_fourxm_file(demux_fourxm_t *fourxm) {
}
static int demux_fourxm_send_chunk(demux_plugin_t *this_gen) {
-
demux_fourxm_t *this = (demux_fourxm_t *) this_gen;
+
buf_element_t *buf = NULL;
unsigned int fourcc_tag;
unsigned int size;
@@ -343,7 +343,6 @@ static int demux_fourxm_send_chunk(demux_plugin_t *this_gen) {
}
static void demux_fourxm_send_headers(demux_plugin_t *this_gen) {
-
demux_fourxm_t *this = (demux_fourxm_t *) this_gen;
buf_element_t *buf;
@@ -421,7 +420,6 @@ static int demux_fourxm_get_status (demux_plugin_t *this_gen) {
}
static int demux_fourxm_get_stream_length (demux_plugin_t *this_gen) {
-
/* demux_fourxm_t *this = (demux_fourxm_t *) this_gen;*/
return 0;
@@ -509,14 +507,12 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_fourxm_class_t *this = (demux_fourxm_class_t *) this_gen;
free (this);
}
void *demux_fourxm_init_plugin (xine_t *xine, void *data) {
-
demux_fourxm_class_t *this;
this = xine_xmalloc (sizeof (demux_fourxm_class_t));
diff --git a/src/demuxers/demux_ac3.c b/src/demuxers/demux_ac3.c
index 5bbbe17f7..b5e50d174 100644
--- a/src/demuxers/demux_ac3.c
+++ b/src/demuxers/demux_ac3.c
@@ -23,7 +23,7 @@
* This demuxer detects raw AC3 data in a file and shovels AC3 data
* directly to the AC3 decoder.
*
- * $Id: demux_ac3.c,v 1.8 2003/07/03 00:58:52 andruil Exp $
+ * $Id: demux_ac3.c,v 1.9 2003/07/16 00:52:45 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -118,7 +118,6 @@ static const struct frmsize_s frmsizecod_tbl[64] =
/* returns 1 if the AC3 file was opened successfully, 0 otherwise */
static int open_ac3_file(demux_ac3_t *this) {
-
unsigned char preamble[AC3_PREAMBLE_BYTES];
/* check if the sync mark matches up */
@@ -160,8 +159,8 @@ static int open_ac3_file(demux_ac3_t *this) {
}
static int demux_ac3_send_chunk (demux_plugin_t *this_gen) {
-
demux_ac3_t *this = (demux_ac3_t *) this_gen;
+
buf_element_t *buf = NULL;
off_t current_stream_pos;
int64_t audio_pts;
@@ -170,7 +169,7 @@ static int demux_ac3_send_chunk (demux_plugin_t *this_gen) {
current_stream_pos = this->input->get_current_pos(this->input);
frame_number = current_stream_pos / this->frame_size;
- /*
+ /*
* Each frame represents 256 new audio samples according to the a52 spec.
* Thus, the pts computation should work something like:
*
@@ -221,7 +220,6 @@ static int demux_ac3_send_chunk (demux_plugin_t *this_gen) {
}
static void demux_ac3_send_headers(demux_plugin_t *this_gen) {
-
demux_ac3_t *this = (demux_ac3_t *) this_gen;
buf_element_t *buf;
@@ -284,7 +282,6 @@ static int demux_ac3_get_status (demux_plugin_t *this_gen) {
/* return the approximate length in milliseconds */
static int demux_ac3_get_stream_length (demux_plugin_t *this_gen) {
-
demux_ac3_t *this = (demux_ac3_t *) this_gen;
return this->running_time;
@@ -372,14 +369,12 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_ac3_class_t *this = (demux_ac3_class_t *) this_gen;
free (this);
}
void *demux_ac3_init_plugin (xine_t *xine, void *data) {
-
demux_ac3_class_t *this;
this = xine_xmalloc (sizeof (demux_ac3_class_t));
diff --git a/src/demuxers/demux_aiff.c b/src/demuxers/demux_aiff.c
index 9ede53241..3d0b2015f 100644
--- a/src/demuxers/demux_aiff.c
+++ b/src/demuxers/demux_aiff.c
@@ -21,7 +21,7 @@
/*
* AIFF File Demuxer by Mike Melanson (melanson@pcisys.net)
*
- * $Id: demux_aiff.c,v 1.30 2003/07/03 00:58:52 andruil Exp $
+ * $Id: demux_aiff.c,v 1.31 2003/07/16 00:52:45 andruil Exp $
*
*/
@@ -168,8 +168,8 @@ static int open_aiff_file(demux_aiff_t *this) {
}
static int demux_aiff_send_chunk (demux_plugin_t *this_gen) {
-
demux_aiff_t *this = (demux_aiff_t *) this_gen;
+
buf_element_t *buf = NULL;
unsigned int remaining_sample_bytes;
off_t current_file_pos;
@@ -232,7 +232,6 @@ static int demux_aiff_send_chunk (demux_plugin_t *this_gen) {
}
static void demux_aiff_send_headers(demux_plugin_t *this_gen) {
-
demux_aiff_t *this = (demux_aiff_t *) this_gen;
buf_element_t *buf;
@@ -318,20 +317,17 @@ static int demux_aiff_get_status (demux_plugin_t *this_gen) {
/* return the approximate length in miliseconds */
static int demux_aiff_get_stream_length (demux_plugin_t *this_gen) {
-
demux_aiff_t *this = (demux_aiff_t *) this_gen;
return this->running_time;
}
-static uint32_t demux_aiff_get_capabilities(demux_plugin_t *this_gen)
-{
+static uint32_t demux_aiff_get_capabilities(demux_plugin_t *this_gen){
return DEMUX_CAP_NOCAP;
}
static int demux_aiff_get_optional_data(demux_plugin_t *this_gen,
- void *data, int data_type)
-{
+ void *data, int data_type){
return DEMUX_OPTIONAL_UNSUPPORTED;
}
@@ -410,14 +406,12 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_aiff_class_t *this = (demux_aiff_class_t *) this_gen;
free (this);
}
void *demux_aiff_init_plugin (xine_t *xine, void *data) {
-
demux_aiff_class_t *this;
this = xine_xmalloc (sizeof (demux_aiff_class_t));
diff --git a/src/demuxers/demux_aud.c b/src/demuxers/demux_aud.c
index 9411e8c40..a3298ff84 100644
--- a/src/demuxers/demux_aud.c
+++ b/src/demuxers/demux_aud.c
@@ -34,7 +34,7 @@
* data. This makes seeking conceptually impossible. Upshot: Random
* seeking is not supported.
*
- * $Id: demux_aud.c,v 1.9 2003/07/03 00:58:52 andruil Exp $
+ * $Id: demux_aud.c,v 1.10 2003/07/16 00:52:45 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -82,7 +82,6 @@ typedef struct {
/* returns 1 if the AUD file was opened successfully, 0 otherwise */
static int open_aud_file(demux_aud_t *this) {
-
unsigned char header[AUD_HEADER_SIZE];
if (xine_demux_read_header(this->input, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE)
@@ -124,8 +123,8 @@ static int open_aud_file(demux_aud_t *this) {
}
static int demux_aud_send_chunk(demux_plugin_t *this_gen) {
-
demux_aud_t *this = (demux_aud_t *) this_gen;
+
unsigned char chunk_preamble[AUD_CHUNK_PREAMBLE_SIZE];
unsigned int chunk_size;
off_t current_file_pos;
@@ -186,7 +185,6 @@ static int demux_aud_send_chunk(demux_plugin_t *this_gen) {
}
static void demux_aud_send_headers(demux_plugin_t *this_gen) {
-
demux_aud_t *this = (demux_aud_t *) this_gen;
buf_element_t *buf;
@@ -250,7 +248,6 @@ static int demux_aud_get_status (demux_plugin_t *this_gen) {
}
static int demux_aud_get_stream_length (demux_plugin_t *this_gen) {
-
return 0;
}
@@ -335,14 +332,12 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_aud_class_t *this = (demux_aud_class_t *) this_gen;
free (this);
}
void *demux_aud_init_plugin (xine_t *xine, void *data) {
-
demux_aud_class_t *this;
this = xine_xmalloc (sizeof (demux_aud_class_t));
diff --git a/src/demuxers/demux_cdda.c b/src/demuxers/demux_cdda.c
index 300d2e938..c265a02d1 100644
--- a/src/demuxers/demux_cdda.c
+++ b/src/demuxers/demux_cdda.c
@@ -24,7 +24,7 @@
* 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.8 2003/07/03 12:35:18 andruil Exp $
+ * $Id: demux_cdda.c,v 1.9 2003/07/16 00:52:45 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -69,7 +69,6 @@ typedef struct {
} demux_cdda_class_t;
static int demux_cdda_send_chunk (demux_plugin_t *this_gen) {
-
demux_cdda_t *this = (demux_cdda_t *) this_gen;
buf_element_t *buf = NULL;
@@ -100,7 +99,6 @@ static int demux_cdda_send_chunk (demux_plugin_t *this_gen) {
}
static void demux_cdda_send_headers(demux_plugin_t *this_gen) {
-
demux_cdda_t *this = (demux_cdda_t *) this_gen;
buf_element_t *buf;
@@ -134,9 +132,7 @@ static void demux_cdda_send_headers(demux_plugin_t *this_gen) {
}
}
-static int demux_cdda_seek (demux_plugin_t *this_gen,
- off_t start_pos, int start_time) {
-
+static int demux_cdda_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time) {
demux_cdda_t *this = (demux_cdda_t *) this_gen;
if (start_pos)
@@ -164,21 +160,18 @@ static int demux_cdda_get_status (demux_plugin_t *this_gen) {
/* return the approximate length in miliseconds */
static int demux_cdda_get_stream_length (demux_plugin_t *this_gen) {
-
demux_cdda_t *this = (demux_cdda_t *) this_gen;
- return (int)((int64_t) this->input->get_length(this->input)
+ return (int)((int64_t) this->input->get_length(this->input)
* 1000 / CD_BYTES_PER_SECOND);
}
-static uint32_t demux_cdda_get_capabilities(demux_plugin_t *this_gen)
-{
+static uint32_t demux_cdda_get_capabilities(demux_plugin_t *this_gen){
return DEMUX_CAP_NOCAP;
}
static int demux_cdda_get_optional_data(demux_plugin_t *this_gen,
- void *data, int data_type)
-{
+ void *data, int data_type){
return DEMUX_OPTIONAL_UNSUPPORTED;
}
@@ -188,7 +181,8 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
demux_cdda_t *this;
if (!INPUT_IS_SEEKABLE(input)) {
- xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "input not seekable, can not handle!\n");
+ xprintf(stream->xine, XINE_VERBOSITY_DEBUG,
+ _("input not seekable, can not handle!\n"));
return NULL;
}
@@ -247,14 +241,12 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_cdda_class_t *this = (demux_cdda_class_t *) this_gen;
free (this);
}
void *demux_cdda_init_plugin (xine_t *xine, void *data) {
-
demux_cdda_class_t *this;
this = xine_xmalloc (sizeof (demux_cdda_class_t));
diff --git a/src/demuxers/demux_eawve.c b/src/demuxers/demux_eawve.c
index faf9bb07c..c1c5de639 100644
--- a/src/demuxers/demux_eawve.c
+++ b/src/demuxers/demux_eawve.c
@@ -19,7 +19,7 @@
*/
/*
- * $Id: demux_eawve.c,v 1.17 2003/07/03 12:35:18 andruil Exp $
+ * $Id: demux_eawve.c,v 1.18 2003/07/16 00:52:45 andruil Exp $
*
* demux_eawve.c, Demuxer plugin for Electronic Arts' WVE file format
*
@@ -81,8 +81,7 @@ typedef struct {
* Read an arbitary number of byte into a word
*/
-static uint32_t read_arbitary(input_plugin_t *input)
-{
+static uint32_t read_arbitary(input_plugin_t *input){
uint8_t size, byte;
int i;
uint32_t word;
@@ -108,8 +107,7 @@ static uint32_t read_arbitary(input_plugin_t *input)
* Returns 1 if the WVE file is valid and successfully opened, 0 otherwise
*/
-static int process_header(demux_eawve_t *this)
-{
+static int process_header(demux_eawve_t *this){
int inHeader;
uint32_t blockid, size;
@@ -206,8 +204,7 @@ static int process_header(demux_eawve_t *this)
* !IMPORTANT! !IMPORTANT! !IMPORTANT! !IMPORTANT! !IMPORTANT!
*/
-static int demux_eawve_send_chunk(demux_eawve_t *this)
-{
+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)) {
@@ -280,8 +277,7 @@ static int demux_eawve_send_chunk(demux_eawve_t *this)
return this->status;
}
-static void demux_eawve_send_headers(demux_plugin_t *this_gen)
-{
+static void demux_eawve_send_headers(demux_plugin_t *this_gen){
demux_eawve_t *this = (demux_eawve_t *) this_gen;
this->video_fifo = this->stream->video_fifo;
@@ -314,8 +310,7 @@ static void demux_eawve_send_headers(demux_plugin_t *this_gen)
}
}
-static int demux_eawve_seek(demux_eawve_t *this, off_t start_pos, int start_time)
-{
+static int demux_eawve_seek(demux_eawve_t *this, off_t start_pos, int start_time){
if (!this->thread_running) {
xine_demux_control_newpts(this->stream, 0, 0);
@@ -329,18 +324,15 @@ static int demux_eawve_seek(demux_eawve_t *this, off_t start_pos, int start_time
return this->status;
}
-static void demux_eawve_dispose(demux_eawve_t *this)
-{
+static void demux_eawve_dispose(demux_eawve_t *this){
free(this);
}
-static int demux_eawve_get_status(demux_eawve_t *this)
-{
+static int demux_eawve_get_status(demux_eawve_t *this){
return this->status;
}
-static int demux_eawve_get_stream_length(demux_eawve_t *this)
-{
+static int demux_eawve_get_stream_length(demux_eawve_t *this){
return (int)((int64_t)this->num_samples * 1000 / 22050);
}
@@ -353,9 +345,7 @@ 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)
-{
-
+static demux_plugin_t* open_plugin(demux_class_t *class_gen, xine_stream_t *stream, input_plugin_t *input){
demux_eawve_t *this;
if (!INPUT_IS_SEEKABLE(input))
@@ -412,33 +402,27 @@ static demux_plugin_t* open_plugin(demux_class_t *class_gen, xine_stream_t *stre
return &this->demux_plugin;
}
-static char *get_description(demux_class_t *this_gen)
-{
+static char *get_description(demux_class_t *this_gen){
return "Electronics Arts WVE format demux plugin";
}
-static char *get_identifier(demux_class_t *this_gen)
-{
+static char *get_identifier(demux_class_t *this_gen){
return "EA WVE";
}
-static char *get_extensions(demux_class_t *this_gen)
-{
+static char *get_extensions(demux_class_t *this_gen){
return "wve";
}
-static char *get_mimetypes(demux_class_t *this_gen)
-{
+static char *get_mimetypes(demux_class_t *this_gen){
return NULL;
}
-static void class_dispose(demux_class_t *this)
-{
+static void class_dispose(demux_class_t *this){
free(this);
}
-void *demux_eawve_init_plugin(xine_t *xine, void *data)
-{
+void *demux_eawve_init_plugin(xine_t *xine, void *data){
demux_eawve_class_t *this;
this = xine_xmalloc(sizeof(demux_eawve_class_t));
diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c
index bc72c4d68..ca34413a9 100644
--- a/src/demuxers/demux_elem.c
+++ b/src/demuxers/demux_elem.c
@@ -19,7 +19,7 @@
*/
/*
- * $Id: demux_elem.c,v 1.72 2003/07/03 12:35:18 andruil Exp $
+ * $Id: demux_elem.c,v 1.73 2003/07/16 00:52:45 andruil Exp $
*
* demultiplexer for elementary mpeg streams
*/
@@ -93,7 +93,6 @@ static int demux_mpeg_elem_next (demux_mpeg_elem_t *this, int preview_mode) {
}
static int demux_mpeg_elem_send_chunk (demux_plugin_t *this_gen) {
-
demux_mpeg_elem_t *this = (demux_mpeg_elem_t *) this_gen;
if (!demux_mpeg_elem_next(this, 0))
@@ -109,7 +108,6 @@ static int demux_mpeg_elem_get_status (demux_plugin_t *this_gen) {
static void demux_mpeg_elem_send_headers (demux_plugin_t *this_gen) {
-
demux_mpeg_elem_t *this = (demux_mpeg_elem_t *) this_gen;
this->video_fifo = this->stream->video_fifo;
@@ -118,9 +116,9 @@ static void demux_mpeg_elem_send_headers (demux_plugin_t *this_gen) {
this->blocksize = this->input->get_blocksize(this->input);
if (!this->blocksize)
this->blocksize = 2048;
-
+
xine_demux_control_start(this->stream);
-
+
if (INPUT_IS_SEEKABLE(this->input)) {
int num_buffers = NUM_PREVIEW_BUFFERS;
@@ -263,14 +261,12 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_mpeg_elem_class_t *this = (demux_mpeg_elem_class_t *) this_gen;
free (this);
}
static void *init_plugin (xine_t *xine, void *data) {
-
demux_mpeg_elem_class_t *this;
this = xine_xmalloc (sizeof (demux_mpeg_elem_class_t));
diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c
index 312bde64b..62fff9232 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.62 2003/07/03 15:45:49 andruil Exp $
+ * $Id: demux_film.c,v 1.63 2003/07/16 00:52:45 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -358,8 +358,8 @@ static int open_film_file(demux_film_t *film) {
}
static int demux_film_send_chunk(demux_plugin_t *this_gen) {
-
demux_film_t *this = (demux_film_t *) this_gen;
+
buf_element_t *buf = NULL;
unsigned int cvid_chunk_size;
unsigned int i, j, k;
@@ -655,7 +655,6 @@ static int demux_film_send_chunk(demux_plugin_t *this_gen) {
}
static void demux_film_send_headers(demux_plugin_t *this_gen) {
-
demux_film_t *this = (demux_film_t *) this_gen;
buf_element_t *buf;
@@ -706,9 +705,9 @@ static void demux_film_send_headers(demux_plugin_t *this_gen) {
}
}
-static int demux_film_seek (demux_plugin_t *this_gen,
- off_t start_pos, int start_time) {
+static int demux_film_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time) {
demux_film_t *this = (demux_film_t *) this_gen;
+
int best_index;
int left, middle, right;
int found;
@@ -909,14 +908,12 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_film_class_t *this = (demux_film_class_t *) this_gen;
free (this);
}
void *demux_film_init_plugin (xine_t *xine, void *data) {
-
demux_film_class_t *this;
this = xine_xmalloc (sizeof (demux_film_class_t));
diff --git a/src/demuxers/demux_fli.c b/src/demuxers/demux_fli.c
index ea6db80c0..3d354cfb0 100644
--- a/src/demuxers/demux_fli.c
+++ b/src/demuxers/demux_fli.c
@@ -24,7 +24,7 @@
* avoid while programming a FLI decoder, visit:
* http://www.pcisys.net/~melanson/codecs/
*
- * $Id: demux_fli.c,v 1.42 2003/07/03 12:35:18 andruil Exp $
+ * $Id: demux_fli.c,v 1.43 2003/07/16 00:52:45 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -151,8 +151,8 @@ static int open_fli_file(demux_fli_t *this) {
}
static int demux_fli_send_chunk(demux_plugin_t *this_gen) {
-
demux_fli_t *this = (demux_fli_t *) this_gen;
+
buf_element_t *buf = NULL;
unsigned char fli_buf[6];
unsigned int chunk_size;
@@ -160,7 +160,7 @@ static int demux_fli_send_chunk(demux_plugin_t *this_gen) {
off_t current_file_pos;
current_file_pos = this->input->get_current_pos(this->input);
-
+
/* get the chunk size nd magic number */
if (this->input->read(this->input, fli_buf, 6) != 6) {
this->status = DEMUX_FINISHED;
@@ -168,8 +168,8 @@ static int demux_fli_send_chunk(demux_plugin_t *this_gen) {
}
chunk_size = LE_32(&fli_buf[0]);
chunk_magic = LE_16(&fli_buf[4]);
-
- if ((chunk_magic == FLI_CHUNK_MAGIC_1) ||
+
+ if ((chunk_magic == FLI_CHUNK_MAGIC_1) ||
(chunk_magic == FLI_CHUNK_MAGIC_2)) {
/* send a buffer with only the chunk header */
@@ -192,20 +192,20 @@ static int demux_fli_send_chunk(demux_plugin_t *this_gen) {
buf->extra_info->input_time = this->pts_counter / 90;
buf->extra_info->input_length = this->stream_len;
buf->pts = this->pts_counter;
-
+
if (chunk_size > buf->max_size)
buf->size = buf->max_size;
else
buf->size = chunk_size;
chunk_size -= buf->size;
-
+
if (this->input->read(this->input, buf->content, buf->size) !=
buf->size) {
buf->free_buffer(buf);
this->status = DEMUX_FINISHED;
break;
}
-
+
if (!chunk_size)
buf->decoder_flags |= BUF_FLAG_FRAME_END;
this->video_fifo->put(this->video_fifo, buf);
@@ -213,12 +213,11 @@ static int demux_fli_send_chunk(demux_plugin_t *this_gen) {
this->pts_counter += this->frame_pts_inc;
} else
this->input->seek(this->input, chunk_size, SEEK_CUR);
-
+
return this->status;
}
static void demux_fli_send_headers(demux_plugin_t *this_gen) {
-
demux_fli_t *this = (demux_fli_t *) this_gen;
buf_element_t *buf;
@@ -232,7 +231,7 @@ static void demux_fli_send_headers(demux_plugin_t *this_gen) {
this->stream->stream_info[XINE_STREAM_INFO_HAS_AUDIO] = 0;
this->stream->stream_info[XINE_STREAM_INFO_VIDEO_WIDTH] = this->width;
this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] = this->height;
- this->stream->stream_info[XINE_STREAM_INFO_FRAME_DURATION] =
+ this->stream->stream_info[XINE_STREAM_INFO_FRAME_DURATION] =
this->frame_pts_inc;
/* send start buffers */
@@ -250,9 +249,7 @@ static void demux_fli_send_headers(demux_plugin_t *this_gen) {
this->video_fifo->put (this->video_fifo, buf);
}
-static int demux_fli_seek (demux_plugin_t *this_gen,
- off_t start_pos, int start_time) {
-
+static int demux_fli_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time) {
demux_fli_t *this = (demux_fli_t *) this_gen;
/* if thread is not running, initialize demuxer */
@@ -261,13 +258,11 @@ static int demux_fli_seek (demux_plugin_t *this_gen,
/* send new pts */
xine_demux_control_newpts(this->stream, 0, 0);
- this->status = DEMUX_OK;
-
- this->stream_len = this->input->get_length(this->input);
-
+ this->status = DEMUX_OK;
+ this->stream_len = this->input->get_length(this->input);
this->pts_counter = 0;
}
-
+
return this->status;
}
@@ -283,7 +278,6 @@ static int demux_fli_get_status (demux_plugin_t *this_gen) {
}
static int demux_fli_get_stream_length (demux_plugin_t *this_gen) {
-
return 0;
}
@@ -369,14 +363,12 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_fli_class_t *this = (demux_fli_class_t *) this_gen;
free (this);
}
static void *init_plugin (xine_t *xine, void *data) {
-
demux_fli_class_t *this;
this = xine_xmalloc (sizeof (demux_fli_class_t));
@@ -396,7 +388,7 @@ static void *init_plugin (xine_t *xine, void *data) {
*/
plugin_info_t xine_plugin_info[] = {
- /* type, API, "name", version, special_info, init_function */
+ /* type, API, "name", version, special_info, init_function */
{ PLUGIN_DEMUX, 21, "fli", XINE_VERSION_CODE, NULL, init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_idcin.c b/src/demuxers/demux_idcin.c
index 56dd7f256..93ecd20e1 100644
--- a/src/demuxers/demux_idcin.c
+++ b/src/demuxers/demux_idcin.c
@@ -65,7 +65,7 @@
* - if any bytes exceed 63, do not shift the bytes at all before
* transmitting them to the video decoder
*
- * $Id: demux_idcin.c,v 1.40 2003/07/03 15:45:49 andruil Exp $
+ * $Id: demux_idcin.c,v 1.41 2003/07/16 00:52:45 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -127,8 +127,8 @@ typedef struct {
} demux_idcin_class_t;
static int demux_idcin_send_chunk(demux_plugin_t *this_gen) {
-
demux_idcin_t *this = (demux_idcin_t *) this_gen;
+
buf_element_t *buf = NULL;
unsigned int command;
unsigned char preamble[8];
@@ -276,7 +276,6 @@ static int demux_idcin_send_chunk(demux_plugin_t *this_gen) {
/* returns 1 if the CIN file was opened successfully, 0 otherwise */
static int open_idcin_file(demux_idcin_t *this) {
-
unsigned char header[IDCIN_HEADER_SIZE];
if (xine_demux_read_header(this->input, header, IDCIN_HEADER_SIZE) != IDCIN_HEADER_SIZE)
@@ -305,7 +304,7 @@ static int open_idcin_file(demux_idcin_t *this) {
/* check the audio sample rate */
this->audio_sample_rate = LE_32(&header[8]);
- if ((this->audio_sample_rate != 0) &&
+ if ((this->audio_sample_rate != 0) &&
((this->audio_sample_rate < 8000) || (this->audio_sample_rate > 48000)))
return 0;
@@ -319,11 +318,11 @@ static int open_idcin_file(demux_idcin_t *this) {
if (this->audio_channels > 2)
return 0;
- /* if execution got this far, qualify it as a valid Id CIN file
+ /* if execution got this far, qualify it as a valid Id CIN file
* and continue loading */
lprintf("%dx%d video, %d Hz, %d channels, %d bits PCM audio\n",
this->video_width, this->video_height,
- this->audio_sample_rate,
+ this->audio_sample_rate,
this->audio_channels,
this->audio_bytes_per_sample * 8);
@@ -337,11 +336,11 @@ static int open_idcin_file(demux_idcin_t *this) {
/* load stream information */
this->stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO] = 1;
- this->stream->stream_info[XINE_STREAM_INFO_HAS_AUDIO] =
+ this->stream->stream_info[XINE_STREAM_INFO_HAS_AUDIO] =
(this->audio_channels) ? 1 : 0;
this->stream->stream_info[XINE_STREAM_INFO_VIDEO_WIDTH] =
this->video_width;
- this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] =
+ this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] =
this->video_height;
this->stream->stream_info[XINE_STREAM_INFO_AUDIO_CHANNELS] =
this->audio_channels;
@@ -354,7 +353,6 @@ static int open_idcin_file(demux_idcin_t *this) {
}
static void demux_idcin_send_headers(demux_plugin_t *this_gen) {
-
demux_idcin_t *this = (demux_idcin_t *) this_gen;
buf_element_t *buf;
@@ -418,9 +416,7 @@ static void demux_idcin_send_headers(demux_plugin_t *this_gen) {
}
}
-static int demux_idcin_seek (demux_plugin_t *this_gen,
- off_t start_pos, int start_time) {
-
+static int demux_idcin_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time) {
demux_idcin_t *this = (demux_idcin_t *) this_gen;
/* if thread is not running, initialize demuxer */
@@ -430,7 +426,7 @@ static int demux_idcin_seek (demux_plugin_t *this_gen,
xine_demux_control_newpts(this->stream, 0, 0);
this->status = DEMUX_OK;
-
+
/* reposition stream past the Huffman tables */
this->input->seek(this->input, 0x14 + 0x10000, SEEK_SET);
@@ -453,7 +449,6 @@ static int demux_idcin_get_status (demux_plugin_t *this_gen) {
}
static int demux_idcin_get_stream_length (demux_plugin_t *this_gen) {
-
return 0;
}
@@ -540,14 +535,12 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_idcin_class_t *this = (demux_idcin_class_t *) this_gen;
free (this);
}
void *demux_idcin_init_plugin (xine_t *xine, void *data) {
-
demux_idcin_class_t *this;
this = xine_xmalloc (sizeof (demux_idcin_class_t));
diff --git a/src/demuxers/demux_image.c b/src/demuxers/demux_image.c
index 7f9fa86d7..e8adde119 100644
--- a/src/demuxers/demux_image.c
+++ b/src/demuxers/demux_image.c
@@ -19,7 +19,7 @@
*/
/*
- * $Id: demux_image.c,v 1.4 2003/07/03 15:45:49 andruil Exp $
+ * $Id: demux_image.c,v 1.5 2003/07/16 00:52:45 andruil Exp $
*
* image dummy demultiplexer
*/
@@ -85,7 +85,6 @@ static int demux_image_send_chunk (demux_plugin_t *this_gen) {
}
static void demux_image_send_headers (demux_plugin_t *this_gen) {
-
demux_image_t *this = (demux_image_t *) this_gen;
this->video_fifo = this->stream->video_fifo;
@@ -101,13 +100,12 @@ static void demux_image_send_headers (demux_plugin_t *this_gen) {
static int demux_image_seek (demux_plugin_t *this_gen,
off_t start_pos, int start_time) {
- demux_image_t *this = (demux_image_t *) this_gen;
-
+ demux_image_t *this = (demux_image_t *) this_gen;
+
return this->status;
}
static int demux_image_get_stream_length (demux_plugin_t *this_gen) {
-
/* demux_image_t *this = (demux_image_t *) this_gen; */
return 0;
@@ -123,8 +121,7 @@ static int demux_image_get_optional_data(demux_plugin_t *this_gen,
}
static void demux_image_dispose (demux_plugin_t *this_gen) {
-
- demux_image_t *this = (demux_image_t *) this_gen;
+ demux_image_t *this = (demux_image_t *) this_gen;
lprintf("closed\n");
free (this);
@@ -209,7 +206,6 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_image_class_t *this = (demux_image_class_t *) this_gen;
lprintf("class closed\n");
@@ -217,9 +213,8 @@ static void class_dispose (demux_class_t *this_gen) {
}
static void *init_class (xine_t *xine, void *data) {
-
demux_image_class_t *this;
-
+
this = xine_xmalloc (sizeof (demux_image_class_t));
this->demux_class.open_plugin = open_plugin;
@@ -238,7 +233,7 @@ static void *init_class (xine_t *xine, void *data) {
*/
plugin_info_t xine_plugin_info[] = {
- /* type, API, "name", version, special_info, init_function */
+ /* type, API, "name", version, special_info, init_function */
{ PLUGIN_DEMUX, 21, "image", XINE_VERSION_CODE, NULL, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_ipmovie.c b/src/demuxers/demux_ipmovie.c
index ac3f89bb3..b8ee737fc 100644
--- a/src/demuxers/demux_ipmovie.c
+++ b/src/demuxers/demux_ipmovie.c
@@ -23,7 +23,7 @@
* For more information regarding the Interplay MVE file format, visit:
* http://www.pcisys.net/~melanson/codecs/
*
- * $Id: demux_ipmovie.c,v 1.10 2003/07/03 15:45:49 andruil Exp $
+ * $Id: demux_ipmovie.c,v 1.11 2003/07/16 00:52:45 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -374,7 +374,7 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) {
chunk_type = CHUNK_BAD;
break;
}
- if (this->input->read(this->input, scratch, opcode_size) !=
+ if (this->input->read(this->input, scratch, opcode_size) !=
opcode_size) {
chunk_type = CHUNK_BAD;
break;
@@ -501,7 +501,6 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) {
/* returns 1 if the MVE file was opened successfully, 0 otherwise */
static int open_ipmovie_file(demux_ipmovie_t *this) {
-
unsigned char signature[IPMOVIE_SIGNATURE_SIZE];
this->audio_type = 0;
@@ -533,7 +532,6 @@ static int open_ipmovie_file(demux_ipmovie_t *this) {
}
static int demux_ipmovie_send_chunk(demux_plugin_t *this_gen) {
-
demux_ipmovie_t *this = (demux_ipmovie_t *) this_gen;
if (process_ipmovie_chunk(this) == CHUNK_BAD)
@@ -543,7 +541,6 @@ static int demux_ipmovie_send_chunk(demux_plugin_t *this_gen) {
}
static void demux_ipmovie_send_headers(demux_plugin_t *this_gen) {
-
demux_ipmovie_t *this = (demux_ipmovie_t *) this_gen;
buf_element_t *buf;
@@ -631,7 +628,6 @@ static int demux_ipmovie_get_status (demux_plugin_t *this_gen) {
}
static int demux_ipmovie_get_stream_length (demux_plugin_t *this_gen) {
-
return 0;
}
@@ -717,17 +713,15 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_ipmovie_class_t *this = (demux_ipmovie_class_t *) this_gen;
free (this);
}
void *demux_ipmovie_init_plugin (xine_t *xine, void *data) {
-
demux_ipmovie_class_t *this;
- this = xine_xmalloc (sizeof (demux_ipmovie_class_t));
+ this = xine_xmalloc (sizeof (demux_ipmovie_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;
diff --git a/src/demuxers/demux_mng.c b/src/demuxers/demux_mng.c
index e64aee3bf..34ee31401 100644
--- a/src/demuxers/demux_mng.c
+++ b/src/demuxers/demux_mng.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_mng.c,v 1.8 2003/04/26 20:16:09 guenter Exp $
+ */
+
+/*
+ * $Id: demux_mng.c,v 1.9 2003/07/16 00:52:45 andruil Exp $
*
* demux_mng.c, Demuxer plugin for Multiple-image Network Graphics format
*
@@ -35,49 +37,45 @@
#include <libmng.h>
+/********** logging **********/
+#define LOG_MODULE "demux_mng"
+/* #define LOG_VERBOSE */
+/* #define LOG */
+
#include "xine_internal.h"
#include "xineutils.h"
#include "demux.h"
typedef struct {
- demux_plugin_t demux_plugin;
- xine_stream_t *stream;
- config_values_t *config;
- fifo_buffer_t *video_fifo;
- input_plugin_t *input;
-
- int thread_running;
- int status;
-
- mng_handle mngh;
- xine_bmiheader bih;
- uint8_t *image;
- int started, tick_count, timer_count;
-
- char last_mrl[1024];
+ demux_plugin_t demux_plugin;
+
+ xine_stream_t *stream;
+ fifo_buffer_t *video_fifo;
+ input_plugin_t *input;
+ int status;
+
+ mng_handle mngh;
+ xine_bmiheader bih;
+ uint8_t *image;
+
+ int started;
+ int tick_count;
+ int timer_count;
} demux_mng_t;
typedef struct {
demux_class_t demux_class;
-
- /* class-wide, global variables here */
-
- xine_t *xine;
- config_values_t *config;
} demux_mng_class_t;
-static mng_ptr mymng_alloc(mng_uint32 size)
-{
+static mng_ptr mymng_alloc(mng_uint32 size){
return (mng_ptr)calloc(1, size);
}
-static void mymng_free(mng_ptr p, mng_uint32 size)
-{
+static void mymng_free(mng_ptr p, mng_uint32 size){
free(p);
}
-mng_bool mymng_open_stream(mng_handle mngh)
-{
+mng_bool mymng_open_stream(mng_handle mngh){
demux_mng_t *this = (demux_mng_t*)mng_get_userdata(mngh);
if (this->input->get_current_pos(this->input) != 0) {
@@ -90,8 +88,7 @@ mng_bool mymng_open_stream(mng_handle mngh)
return MNG_TRUE;
}
-mng_bool mymng_close_stream(mng_handle mngh)
-{
+mng_bool mymng_close_stream(mng_handle mngh){
demux_mng_t *this = (demux_mng_t*)mng_get_userdata(mngh);
this->status = DEMUX_FINISHED;
@@ -99,8 +96,7 @@ mng_bool mymng_close_stream(mng_handle mngh)
return MNG_TRUE;
}
-mng_bool mymng_read_stream(mng_handle mngh, mng_ptr buffer, mng_uint32 size, mng_uint32 *bytesread)
-{
+mng_bool mymng_read_stream(mng_handle mngh, mng_ptr buffer, mng_uint32 size, mng_uint32 *bytesread){
demux_mng_t *this = (demux_mng_t*)mng_get_userdata(mngh);
*bytesread = this->input->read(this->input, buffer, size);
@@ -108,8 +104,7 @@ mng_bool mymng_read_stream(mng_handle mngh, mng_ptr buffer, mng_uint32 size, mng
return MNG_TRUE;
}
-mng_bool mymng_process_header(mng_handle mngh, mng_uint32 width, mng_uint32 height)
-{
+mng_bool mymng_process_header(mng_handle mngh, mng_uint32 width, mng_uint32 height){
demux_mng_t *this = (demux_mng_t*)mng_get_userdata(mngh);
this->bih.biWidth = width;
@@ -122,15 +117,13 @@ mng_bool mymng_process_header(mng_handle mngh, mng_uint32 width, mng_uint32 heig
return MNG_TRUE;
}
-mng_uint32 mymng_get_tick_count(mng_handle mngh)
-{
+mng_uint32 mymng_get_tick_count(mng_handle mngh){
demux_mng_t *this = (demux_mng_t*)mng_get_userdata(mngh);
return this->tick_count;
}
-mng_bool mymng_set_timer(mng_handle mngh, mng_uint32 msecs)
-{
+mng_bool mymng_set_timer(mng_handle mngh, mng_uint32 msecs){
demux_mng_t *this = (demux_mng_t*)mng_get_userdata(mngh);
this->timer_count = msecs;
@@ -138,15 +131,13 @@ mng_bool mymng_set_timer(mng_handle mngh, mng_uint32 msecs)
return MNG_TRUE;
}
-mng_ptr mymng_get_canvas_line(mng_handle mngh, mng_uint32 line)
-{
+mng_ptr mymng_get_canvas_line(mng_handle mngh, mng_uint32 line){
demux_mng_t *this = (demux_mng_t*)mng_get_userdata(mngh);
return this->image + line * this->bih.biWidth * 3;
}
-mng_bool mymng_refresh(mng_handle mngh, mng_uint32 x, mng_uint32 y, mng_uint32 w, mng_uint32 h)
-{
+mng_bool mymng_refresh(mng_handle mngh, mng_uint32 x, mng_uint32 y, mng_uint32 w, mng_uint32 h){
return MNG_TRUE;
}
@@ -156,14 +147,13 @@ mng_bool mymng_refresh(mng_handle mngh, mng_uint32 x, mng_uint32 y, mng_uint32 w
* !IMPORTANT! !IMPORTANT! !IMPORTANT! !IMPORTANT! !IMPORTANT!
*/
-static int demux_mng_send_chunk(demux_mng_t *this)
-{
+static int demux_mng_send_chunk(demux_mng_t *this){
int size = this->bih.biWidth * this->bih.biHeight * 3;
uint8_t *image_ptr = this->image;
int err = mng_display_resume(this->mngh);
if ((err != MNG_NOERROR) && (err != MNG_NEEDTIMERWAIT)) {
- fprintf(stderr, "demux_mng: mng_display_resume returned an error (%d)\n", err);
+ lprintf("mng_display_resume returned an error (%d)\n", err);
this->status = DEMUX_FINISHED;
}
@@ -202,8 +192,7 @@ static int demux_mng_send_chunk(demux_mng_t *this)
return this->status;
}
-static void demux_mng_send_headers(demux_mng_t *this)
-{
+static void demux_mng_send_headers(demux_mng_t *this){
buf_element_t *buf;
this->video_fifo = this->stream->video_fifo;
@@ -229,29 +218,25 @@ static void demux_mng_send_headers(demux_mng_t *this)
this->video_fifo->put(this->video_fifo, buf);
}
-static int demux_mng_seek(demux_mng_t *this, off_t start_pos, int start_time)
-{
+static int demux_mng_seek(demux_mng_t *this, off_t start_pos, int start_time){
return this->status;
}
-static void demux_mng_dispose(demux_mng_t *this)
-{
+static void demux_mng_dispose(demux_mng_t *this){
+
mng_cleanup(&this->mngh);
- if (this->image) {
+ if (this->image)
free(this->image);
- }
free(this);
}
-static int demux_mng_get_status(demux_mng_t *this)
-{
+static int demux_mng_get_status(demux_mng_t *this){
return this->status;
}
-static int demux_mng_get_stream_length(demux_mng_t *this)
-{
+static int demux_mng_get_stream_length(demux_mng_t *this){
return 0;
}
@@ -263,9 +248,8 @@ static int demux_mng_get_optional_data(demux_plugin_t *this_gen, void *data, int
return DEMUX_OPTIONAL_UNSUPPORTED;
}
-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_gen;
+static demux_plugin_t* open_plugin(demux_class_t *class_gen, xine_stream_t *stream, input_plugin_t *input){
+
demux_mng_t *this;
this = xine_xmalloc (sizeof (demux_mng_t));
@@ -289,25 +273,20 @@ 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) {
+ if (!INPUT_IS_SEEKABLE(this->input)) {
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) {
- free(this);
- return NULL;
- }
-
- if (strncasecmp(ending, ".mng", 4) && strncasecmp(ending, ".png", 4)) {
- free(this);
+ if (!xine_demux_check_extension (mrl, extensions)) {
+ free (this);
return NULL;
}
}
@@ -346,46 +325,36 @@ static demux_plugin_t* open_plugin(demux_class_t *class_gen, xine_stream_t *stre
}
}
- strncpy (this->last_mrl, input->get_mrl(input), 1024);
-
return &this->demux_plugin;
}
-static char *get_description(demux_class_t *this_gen)
-{
+static char *get_description(demux_class_t *this_gen){
return "Multiple-image Network Graphics demux plugin";
}
-static char *get_identifier(demux_class_t *this_gen)
-{
+static char *get_identifier(demux_class_t *this_gen){
return "MNG";
}
-static char *get_extensions(demux_class_t *this_gen)
-{
+static char *get_extensions(demux_class_t *this_gen){
return "png mng";
}
-static char *get_mimetypes(demux_class_t *this_gen)
-{
+static char *get_mimetypes(demux_class_t *this_gen){
return "image/png: png: PNG image;"
"image/x-png: png: PNG image;"
"video/mng: mng: MNG animation;"
"video/x-mng: mng: MNG animation;";
}
-static void class_dispose(demux_class_t *this)
-{
+static void class_dispose(demux_class_t *this){
free (this);
}
-static void *init_plugin(xine_t *xine, void *data)
-{
+static void *init_plugin(xine_t *xine, void *data){
demux_mng_class_t *this;
- this = xine_xmalloc (sizeof (demux_mng_class_t));
- this->config = xine->config;
- this->xine = xine;
+ this = xine_xmalloc (sizeof (demux_mng_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;
diff --git a/src/demuxers/demux_nsf.c b/src/demuxers/demux_nsf.c
index 7453eda3e..7d0ac49bc 100644
--- a/src/demuxers/demux_nsf.c
+++ b/src/demuxers/demux_nsf.c
@@ -16,7 +16,9 @@
* 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
- *
+ */
+
+/*
* NSF File "Demuxer" by Mike Melanson (melanson@pcisys.net)
* This is really just a loader for NES Music File Format (extension NSF)
* which loads an entire NSF file and passes it over to the NSF audio
@@ -28,7 +30,7 @@
* For more information regarding the NSF format, visit:
* http://www.tripoint.org/kevtris/nes/nsfspec.txt
*
- * $Id: demux_nsf.c,v 1.13 2003/04/26 20:16:17 guenter Exp $
+ * $Id: demux_nsf.c,v 1.14 2003/07/16 00:52:45 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -41,6 +43,11 @@
#include <string.h>
#include <stdlib.h>
+/********** logging **********/
+#define LOG_MODULE "demux_nsf"
+/* #define LOG_VERBOSE */
+/* #define LOG */
+
#include "xine_internal.h"
#include "xineutils.h"
#include "compat.h"
@@ -55,20 +62,12 @@
#define NSF_PTS_INC (90000 / NSF_REFRESH_RATE)
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;
char *title;
@@ -81,25 +80,14 @@ typedef struct {
int64_t current_pts;
int file_sent;
-
- char last_mrl[1024];
-
} demux_nsf_t;
typedef struct {
-
demux_class_t demux_class;
-
- /* class-wide, global variables here */
-
- xine_t *xine;
- config_values_t *config;
} demux_nsf_class_t;
-
/* returns 1 if the NSF file was opened successfully, 0 otherwise */
static int open_nsf_file(demux_nsf_t *this) {
-
unsigned char header[NSF_HEADER_SIZE];
this->input->seek(this->input, 0, SEEK_SET);
@@ -127,7 +115,6 @@ static int open_nsf_file(demux_nsf_t *this) {
}
static int demux_nsf_send_chunk(demux_plugin_t *this_gen) {
-
demux_nsf_t *this = (demux_nsf_t *) this_gen;
buf_element_t *buf;
int bytes_read;
@@ -172,7 +159,7 @@ static int demux_nsf_send_chunk(demux_plugin_t *this_gen) {
buf->decoder_info[1] = this->current_song;
this->new_song = 0;
- sprintf(title, "%s, song %d/%d",
+ sprintf(title, "%s, song %d/%d",
this->title, this->current_song, this->total_songs);
if (this->stream->meta_info[XINE_META_INFO_TITLE])
free (this->stream->meta_info[XINE_META_INFO_TITLE]);
@@ -197,7 +184,6 @@ static int demux_nsf_send_chunk(demux_plugin_t *this_gen) {
}
static void demux_nsf_send_headers(demux_plugin_t *this_gen) {
-
demux_nsf_t *this = (demux_nsf_t *) this_gen;
buf_element_t *buf;
char copyright[100];
@@ -293,7 +279,6 @@ static int demux_nsf_get_status (demux_plugin_t *this_gen) {
/* return the approximate length in miliseconds */
static int demux_nsf_get_stream_length (demux_plugin_t *this_gen) {
-
return 0;
}
@@ -307,14 +292,13 @@ static int demux_nsf_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_nsf_t *this;
- if (! (input->get_capabilities(input) & INPUT_CAP_SEEKABLE)) {
- if (stream->xine->verbosity >= XINE_VERBOSITY_DEBUG)
- printf(_("demux_nsf.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;
}
@@ -338,40 +322,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_nsf_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, ".nsf", 4)) {
- free (this);
- return NULL;
- }
+ case METHOD_BY_CONTENT:
+ case METHOD_EXPLICIT:
if (!open_nsf_file(this)) {
free (this);
return NULL;
}
- }
-
break;
default:
@@ -379,8 +350,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;
}
@@ -401,19 +370,15 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_nsf_class_t *this = (demux_nsf_class_t *) this_gen;
free (this);
}
void *demux_nsf_init_plugin (xine_t *xine, void *data) {
-
demux_nsf_class_t *this;
- this = xine_xmalloc (sizeof (demux_nsf_class_t));
- this->config = xine->config;
- this->xine = xine;
+ this = xine_xmalloc (sizeof (demux_nsf_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;
@@ -424,4 +389,3 @@ void *demux_nsf_init_plugin (xine_t *xine, void *data) {
return this;
}
-
diff --git a/src/demuxers/demux_nsv.c b/src/demuxers/demux_nsv.c
index c0b61c28d..c1641681c 100644
--- a/src/demuxers/demux_nsv.c
+++ b/src/demuxers/demux_nsv.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2002 the xine project
+ * Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a free video player.
*
@@ -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
- *
+ */
+
+/*
* Nullsoft Video (NSV) file demuxer by Mike Melanson (melanson@pcisys.net)
* For more information regarding the NSV file format, visit:
* http://www.pcisys.net/~melanson/codecs/
*
- * $Id: demux_nsv.c,v 1.2 2003/05/27 03:39:52 tmmm Exp $
+ * $Id: demux_nsv.c,v 1.3 2003/07/16 00:52:45 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -34,6 +36,11 @@
#include <string.h>
#include <stdlib.h>
+/********** logging **********/
+#define LOG_MODULE "demux_nsv"
+/* #define LOG_VERBOSE */
+/* #define LOG */
+
#include "xine_internal.h"
#include "xineutils.h"
#include "compat.h"
@@ -53,78 +60,39 @@
#define BEEF 0xBEEF
-/* debug support */
-#define DEBUG_NSV 0
-
-#if DEBUG_NSV
-#define debug_nsv printf
-#else
-static inline void debug_nsv(const char *format, ...) { }
-#endif
-
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 thread_running;
-
- off_t data_start;
off_t data_size;
- int status;
unsigned int fps;
unsigned int frame_pts_inc;
- unsigned int video_fourcc;
unsigned int video_type;
int64_t video_pts;
-
- unsigned int audio_fourcc;
unsigned int audio_type;
- unsigned int audio_bits;
- unsigned int audio_channels;
- unsigned int audio_sample_rate;
- unsigned int audio_frame_count;
xine_bmiheader bih;
- xine_waveformatex wave;
-
- char last_mrl[1024];
-
} demux_nsv_t;
typedef struct {
-
demux_class_t demux_class;
-
- /* class-wide, global variables here */
-
- xine_t *xine;
- config_values_t *config;
} demux_nsv_class_t;
/* returns 1 if the NSV file was opened successfully, 0 otherwise */
static int open_nsv_file(demux_nsv_t *this) {
+ unsigned char preview[28];
+ unsigned int video_fourcc;
+ unsigned int audio_fourcc;
- 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, preview, 4) != 4)
- return 0;
- } else {
- this->input->get_optional_data(this->input, preview,
- INPUT_OPTIONAL_DATA_PREVIEW);
- }
+ if (xine_demux_read_header(this->input, preview, 4) != 4)
+ return 0;
/* check for a 'NSV' signature */
if ((preview[0] != 'N') ||
@@ -132,13 +100,10 @@ static int open_nsv_file(demux_nsv_t *this) {
(preview[2] != 'V'))
return 0;
- debug_nsv(" demux_nsv: NSV file detected\n");
+ lprintf("NSV file detected\n");
- /* file is qualified, proceed to load; jump over the first 4 bytes if
- * stream is non-seekable */
- if ((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) == 0) {
- this->input->seek(this->input, 4, SEEK_SET);
- }
+ /* file is qualified, proceed to load; jump over the first 4 bytes */
+ this->input->seek(this->input, 4, SEEK_SET);
this->data_size = this->input->get_length(this->input);
@@ -149,7 +114,7 @@ static int open_nsv_file(demux_nsv_t *this) {
if (this->input->read(this->input, &preview[4], 24) != 24)
return 0;
- debug_nsv(" demux_nsv: found NSVf chunk\n");
+ lprintf("found NSVf chunk\n");
this->data_size = BE_32(&preview[8]);
/* skip the rest of the data */
@@ -169,27 +134,28 @@ static int open_nsv_file(demux_nsv_t *this) {
if (this->input->read(this->input, &preview[4], 12) != 12)
return 0;
- this->video_fourcc = ME_32(&preview[4]);
+ video_fourcc = ME_32(&preview[4]);
if (BE_32(&preview[4]) == NONE_TAG)
this->video_type = 0;
else
- this->video_type = fourcc_to_buf_video(this->video_fourcc);
- this->audio_fourcc = ME_32(&preview[8]);
+ this->video_type = fourcc_to_buf_video(video_fourcc);
+
+ audio_fourcc = ME_32(&preview[8]);
if (BE_32(&preview[8]) == NONE_TAG)
this->audio_type = 0;
else
- this->audio_type = formattag_to_buf_audio(this->audio_fourcc);
+ this->audio_type = formattag_to_buf_audio(audio_fourcc);
this->bih.biSize = sizeof(this->bih);
this->bih.biWidth = LE_16(&preview[12]);
this->bih.biHeight = LE_16(&preview[14]);
- this->bih.biCompression = this->video_fourcc;
+ this->bih.biCompression = video_fourcc;
this->video_pts = 0;
/* may not be true, but set it for the time being */
this->frame_pts_inc = 3003;
- debug_nsv(" video: %c%c%c%c, buffer type %08X, %dx%d\n",
+ lprintf("video: %c%c%c%c, buffer type %08X, %dx%d\n",
preview[4],
preview[5],
preview[6],
@@ -202,8 +168,8 @@ static int open_nsv_file(demux_nsv_t *this) {
}
static int demux_nsv_send_chunk(demux_plugin_t *this_gen) {
-
demux_nsv_t *this = (demux_nsv_t *) this_gen;
+
unsigned char header[8];
buf_element_t *buf;
off_t current_file_pos;
@@ -213,9 +179,9 @@ static int demux_nsv_send_chunk(demux_plugin_t *this_gen) {
current_file_pos = this->input->get_current_pos(this->input);
- debug_nsv (" dispatching video & audio chunks...\n");
+ lprintf("dispatching video & audio chunks...\n");
- /*
+ /*
* Read 7 bytes and expect the stream to be sitting at 1 of 3 places:
* 1) start of a new 'NSVs' chunk; need to seek over the next 9 bytes,
* read 7 bytes, and move onto case 2
@@ -236,7 +202,7 @@ static int demux_nsv_send_chunk(demux_plugin_t *this_gen) {
/* situation #3 from the comment */
case 0xBEEF:
- debug_nsv (" situation #3\n");
+ lprintf("situation #3\n");
video_size = LE_32(&header[2]);
video_size >>= 4;
video_size &= 0xFFFFF;
@@ -245,7 +211,7 @@ static int demux_nsv_send_chunk(demux_plugin_t *this_gen) {
/* situation #1 from the comment, characters 'NS' (swapped) from the stream */
case 0x534E:
- debug_nsv (" situation #1\n");
+ lprintf("situation #1\n");
this->input->seek(this->input, 9, SEEK_CUR);
if (this->input->read(this->input, header, 7) != 7) {
this->status = DEMUX_FINISHED;
@@ -256,7 +222,7 @@ static int demux_nsv_send_chunk(demux_plugin_t *this_gen) {
/* situation #2 from the comment */
default:
- debug_nsv (" situation #2\n");
+ lprintf("situation #2\n");
/* need 1 more byte */
if (this->input->read(this->input, &header[7], 1) != 1) {
this->status = DEMUX_FINISHED;
@@ -270,19 +236,19 @@ static int demux_nsv_send_chunk(demux_plugin_t *this_gen) {
/* 29.97 fps */
this->frame_pts_inc = 3003;
break;
-
+
case 3:
/* 23.976 fps */
this->frame_pts_inc = 3753;
break;
-
+
case 5:
/* 14.98 fps */
this->frame_pts_inc = 6006;
break;
default:
- printf ("demux_nsv: unknown framerate: 0x%02X\n", this->fps);
+ lprintf("unknown framerate: 0x%02X\n", this->fps);
this->frame_pts_inc = 90000;
break;
}
@@ -298,7 +264,7 @@ static int demux_nsv_send_chunk(demux_plugin_t *this_gen) {
}
- debug_nsv (" sending video chunk with size 0x%X, audio chunk with size 0x%X\n",
+ lprintf("sending video chunk with size 0x%X, audio chunk with size 0x%X\n",
video_size, audio_size);
while (video_size) {
@@ -362,7 +328,6 @@ static int demux_nsv_send_chunk(demux_plugin_t *this_gen) {
}
static void demux_nsv_send_headers(demux_plugin_t *this_gen) {
-
demux_nsv_t *this = (demux_nsv_t *) this_gen;
buf_element_t *buf;
@@ -391,11 +356,6 @@ static void demux_nsv_send_headers(demux_plugin_t *this_gen) {
buf->type = this->video_type;
this->video_fifo->put (this->video_fifo, buf);
}
-
- /* send init info to the audio decoder */
- if (this->audio_fifo && this->audio_type) {
-
- }
}
static int demux_nsv_seek (demux_plugin_t *this_gen,
@@ -403,7 +363,7 @@ static int demux_nsv_seek (demux_plugin_t *this_gen,
demux_nsv_t *this = (demux_nsv_t *) this_gen;
- debug_nsv(" demux_nsv: starting demuxer\n");
+ lprintf("starting demuxer\n");
/* if thread is not running, initialize demuxer */
if( !this->stream->demux_thread_running ) {
@@ -428,7 +388,6 @@ static int demux_nsv_get_status (demux_plugin_t *this_gen) {
}
static int demux_nsv_get_stream_length (demux_plugin_t *this_gen) {
-
return 0;
}
@@ -438,14 +397,12 @@ static uint32_t demux_nsv_get_capabilities(demux_plugin_t *this_gen) {
static int demux_nsv_get_optional_data(demux_plugin_t *this_gen,
void *data, int data_type) {
-
return DEMUX_OPTIONAL_UNSUPPORTED;
}
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_nsv_t *this;
this = xine_xmalloc (sizeof (demux_nsv_t));
@@ -468,40 +425,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_nsv_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, ".nsv", 4)) {
- free (this);
- return NULL;
- }
+ case METHOD_BY_CONTENT:
+ case METHOD_EXPLICIT:
if (!open_nsv_file(this)) {
free (this);
return NULL;
}
- }
-
break;
default:
@@ -509,8 +453,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;
}
@@ -531,19 +473,15 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_nsv_class_t *this = (demux_nsv_class_t *) this_gen;
free (this);
}
void *demux_nsv_init_plugin (xine_t *xine, void *data) {
-
demux_nsv_class_t *this;
- this = xine_xmalloc (sizeof (demux_nsv_class_t));
- this->config = xine->config;
- this->xine = xine;
+ this = xine_xmalloc (sizeof (demux_nsv_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;
diff --git a/src/demuxers/demux_pva.c b/src/demuxers/demux_pva.c
index c2afd4076..9d423d55b 100644
--- a/src/demuxers/demux_pva.c
+++ b/src/demuxers/demux_pva.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
- *
+ */
+
+/*
* TechnoTrend PVA File Demuxer by Mike Melanson (melanson@pcisys.net)
* For more information regarding the PVA file format, refer to this PDF:
* http://www.technotrend.de/download/av_format_v1.pdf
*
- * $Id: demux_pva.c,v 1.9 2003/04/26 20:16:21 guenter Exp $
+ * $Id: demux_pva.c,v 1.10 2003/07/16 00:52:45 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -34,6 +36,11 @@
#include <string.h>
#include <stdlib.h>
+/********** logging **********/
+#define LOG_MODULE "demux_pva"
+/* #define LOG_VERBOSE */
+/* #define LOG */
+
#include "xine_internal.h"
#include "xineutils.h"
#include "compat.h"
@@ -48,40 +55,22 @@
#define PTS_VIDEO 1
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 thread_running;
-
int send_newpts;
- int buf_flag_seek;
int64_t last_pts[2];
- off_t data_start;
off_t data_size;
- int status;
-
- char last_mrl[1024];
-
} demux_pva_t;
typedef struct {
-
demux_class_t demux_class;
-
- /* class-wide, global variables here */
-
- xine_t *xine;
- config_values_t *config;
} demux_pva_class_t;
@@ -89,8 +78,7 @@ typedef struct {
i guess llabs may not be available everywhere */
#define abs(x) ( ((x)<0) ? -(x) : (x) )
-static void check_newpts( demux_pva_t *this, int64_t pts, int video )
-{
+static void check_newpts( demux_pva_t *this, int64_t pts, int video ){
int64_t diff;
diff = pts - this->last_pts[video];
@@ -98,12 +86,8 @@ static void check_newpts( demux_pva_t *this, int64_t pts, int video )
if( pts &&
(this->send_newpts || (this->last_pts[video] && abs(diff)>WRAP_THRESHOLD) ) ) {
- if (this->buf_flag_seek) {
- xine_demux_control_newpts(this->stream, pts, BUF_FLAG_SEEK);
- this->buf_flag_seek = 0;
- } else {
- xine_demux_control_newpts(this->stream, pts, 0);
- }
+ xine_demux_control_newpts(this->stream, pts, 0);
+
this->send_newpts = 0;
this->last_pts[1-video] = 0;
}
@@ -112,11 +96,8 @@ static void check_newpts( demux_pva_t *this, int64_t pts, int video )
this->last_pts[video] = pts;
}
-
-
/* returns 1 if the PVA file was opened successfully, 0 otherwise */
static int open_pva_file(demux_pva_t *this) {
-
unsigned char preamble[PVA_PREAMBLE_SIZE];
this->input->seek(this->input, 0, SEEK_SET);
@@ -142,8 +123,8 @@ static int open_pva_file(demux_pva_t *this) {
}
static int demux_pva_send_chunk(demux_plugin_t *this_gen) {
-
demux_pva_t *this = (demux_pva_t *) this_gen;
+
buf_element_t *buf;
int chunk_size;
unsigned char preamble[PVA_PREAMBLE_SIZE];
@@ -153,7 +134,7 @@ static int demux_pva_send_chunk(demux_plugin_t *this_gen) {
unsigned int flags, header_len;
if (this->input->read(this->input, preamble, PVA_PREAMBLE_SIZE) !=
- PVA_PREAMBLE_SIZE) {
+ PVA_PREAMBLE_SIZE) {
this->status = DEMUX_FINISHED;
return this->status;
}
@@ -166,8 +147,7 @@ static int demux_pva_send_chunk(demux_plugin_t *this_gen) {
chunk_size = BE_16(&preamble[6]);
- current_file_pos = this->input->get_current_pos(this->input) -
- this->data_start;
+ current_file_pos = this->input->get_current_pos(this->input);
if (preamble[2] == 1) {
@@ -289,7 +269,6 @@ static int demux_pva_send_chunk(demux_plugin_t *this_gen) {
}
static void demux_pva_send_headers(demux_plugin_t *this_gen) {
-
demux_pva_t *this = (demux_pva_t *) this_gen;
buf_element_t *buf;
int n;
@@ -354,7 +333,6 @@ static void demux_pva_send_headers(demux_plugin_t *this_gen) {
this->video_fifo->put(this->audio_fifo, buf);
}
-
}
#define SEEK_BUFFER_SIZE 1024
@@ -405,7 +383,7 @@ static int demux_pva_seek (demux_plugin_t *this_gen,
this->status = DEMUX_OK;
- } else
+ } else
xine_demux_flush_engine(this->stream);
return this->status;
@@ -423,7 +401,6 @@ static int demux_pva_get_status (demux_plugin_t *this_gen) {
}
static int demux_pva_get_stream_length (demux_plugin_t *this_gen) {
-
return 0;
}
@@ -437,14 +414,13 @@ static int demux_pva_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_pva_t *this;
- if (! (input->get_capabilities(input) & INPUT_CAP_SEEKABLE)) {
- if (stream->xine->verbosity >= XINE_VERBOSITY_DEBUG)
- printf(_("demux_pva.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;
}
@@ -468,39 +444,26 @@ 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_pva_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, ".pva", 4)) {
- free (this);
- return NULL;
- }
+ case METHOD_BY_CONTENT:
+ case METHOD_EXPLICIT:
if (!open_pva_file(this)) {
free (this);
return NULL;
}
-
- }
-
break;
default:
@@ -508,8 +471,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;
}
@@ -530,19 +491,15 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_pva_class_t *this = (demux_pva_class_t *) this_gen;
free (this);
}
static void *init_plugin (xine_t *xine, void *data) {
-
demux_pva_class_t *this;
- this = xine_xmalloc (sizeof (demux_pva_class_t));
- this->config = xine->config;
- this->xine = xine;
+ this = xine_xmalloc (sizeof (demux_pva_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;
diff --git a/src/demuxers/demux_rawdv.c b/src/demuxers/demux_rawdv.c
index 8f094fd91..4163c66a0 100644
--- a/src/demuxers/demux_rawdv.c
+++ b/src/demuxers/demux_rawdv.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
- *
- * $Id: demux_rawdv.c,v 1.8 2003/06/16 12:22:06 miguelfreitas Exp $
+ */
+
+/*
+ * $Id: demux_rawdv.c,v 1.9 2003/07/16 00:52:45 andruil Exp $
*
* demultiplexer for raw dv streams
- *
*/
#ifdef HAVE_CONFIG_H
@@ -43,38 +44,25 @@
#define PAL_FRAME_SIZE 144000
#define PAL_FRAME_RATE 25
-typedef struct {
-
+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 frame_size;
int bytes_left;
-
+
uint32_t cur_frame;
uint32_t duration;
uint64_t pts;
-
- int status;
-
} demux_raw_dv_t ;
typedef struct {
-
demux_class_t demux_class;
-
- /* class-wide, global variables here */
-
- xine_t *xine;
- config_values_t *config;
} demux_raw_dv_class_t;
@@ -84,7 +72,7 @@ static int demux_raw_dv_next (demux_raw_dv_t *this) {
buf = this->video_fifo->buffer_pool_alloc(this->video_fifo);
buf->content = buf->mem;
-
+
if( this->bytes_left <= buf->max_size ) {
buf->size = this->bytes_left;
buf->decoder_flags |= BUF_FLAG_FRAME_END;
@@ -92,9 +80,9 @@ static int demux_raw_dv_next (demux_raw_dv_t *this) {
buf->size = buf->max_size;
}
this->bytes_left -= buf->size;
-
+
n = this->input->read (this->input, buf->content, buf->size);
-
+
if (n != buf->size) {
buf->free_buffer(buf);
return 0;
@@ -123,18 +111,17 @@ static int demux_raw_dv_next (demux_raw_dv_t *this) {
abuf->extra_info->input_time = buf->extra_info->input_time;
abuf->extra_info->input_pos = buf->extra_info->input_pos;
this->audio_fifo->put (this->audio_fifo, abuf);
- }
+ }
if (!this->bytes_left) {
this->bytes_left = this->frame_size;
this->pts += this->duration;
this->cur_frame++;
}
-
+
return 1;
}
static int demux_raw_dv_send_chunk (demux_plugin_t *this_gen) {
-
demux_raw_dv_t *this = (demux_raw_dv_t *) this_gen;
if (!demux_raw_dv_next(this))
@@ -150,8 +137,8 @@ static int demux_raw_dv_get_status (demux_plugin_t *this_gen) {
static void demux_raw_dv_send_headers (demux_plugin_t *this_gen) {
-
demux_raw_dv_t *this = (demux_raw_dv_t *) this_gen;
+
buf_element_t *buf, *abuf;
xine_bmiheader *bih;
unsigned char *scratch, scratch2[4];
@@ -165,8 +152,8 @@ static void demux_raw_dv_send_headers (demux_plugin_t *this_gen) {
scratch = (unsigned char *) malloc(NTSC_FRAME_SIZE);
if (scratch == NULL )
return;
-
- if ((this->input->get_capabilities(this->input)) & INPUT_CAP_SEEKABLE) {
+
+ if (INPUT_IS_SEEKABLE(this->input)) {
this->input->seek(this->input, 0, SEEK_SET);
if( this->input->read (this->input, scratch, NTSC_FRAME_SIZE) != NTSC_FRAME_SIZE )
return;
@@ -179,7 +166,7 @@ static void demux_raw_dv_send_headers (demux_plugin_t *this_gen) {
i = NTSC_FRAME_SIZE;
else
i = PAL_FRAME_SIZE;
-
+
i -= NTSC_FRAME_SIZE;
while (i > 0) {
if( this->input->read (this->input, scratch2, 4) != 4 )
@@ -187,24 +174,24 @@ static void demux_raw_dv_send_headers (demux_plugin_t *this_gen) {
i -= 4;
}
}
-
+
buf = this->video_fifo->buffer_pool_alloc(this->video_fifo);
buf->content = buf->mem;
buf->type = BUF_VIDEO_DV;
buf->decoder_flags |= BUF_FLAG_HEADER;
-
+
bih = (xine_bmiheader *)buf->content;
-
+
if( !(scratch[3] & 0x80) ) {
/* NTSC */
- this->frame_size = NTSC_FRAME_SIZE;
+ this->frame_size = NTSC_FRAME_SIZE;
this->duration = buf->decoder_info[1] = 3003;
bih->biWidth = 720;
bih->biHeight = 480;
this->stream->stream_info[XINE_STREAM_INFO_VIDEO_BITRATE] = NTSC_FRAME_SIZE * NTSC_FRAME_RATE * 8;
} else {
/* PAL */
- this->frame_size = PAL_FRAME_SIZE;
+ this->frame_size = PAL_FRAME_SIZE;
this->duration = buf->decoder_info[1] = 3600;
bih->biWidth = 720;
bih->biHeight = 576;
@@ -242,17 +229,17 @@ static void demux_raw_dv_send_headers (demux_plugin_t *this_gen) {
packet. */
const unsigned char *s = &scratch[i * 150 * 80 + 6 * 80 + j * 16 * 80 + 3];
/* Pack id 0x50 contains audio metadata */
- if (s[0] == 0x50) {
+ if (s[0] == 0x50) {
/* printf("aaux %d: %2.2x %2.2x %2.2x %2.2x %2.2x\n",
j, s[0], s[1], s[2], s[3], s[4]);
*/
int smp, flag;
-
+
done = 1;
-
+
smp = (s[4] >> 3) & 0x07;
flag = s[3] & 0x20;
-
+
if (flag == 0) {
switch (smp) {
case 0:
@@ -265,7 +252,7 @@ static void demux_raw_dv_send_headers (demux_plugin_t *this_gen) {
abuf->decoder_info[1] = 32000;
break;
}
- } else {
+ } else {
switch (smp) {
case 0:
abuf->decoder_info[1] = 48000;
@@ -289,8 +276,8 @@ static void demux_raw_dv_send_headers (demux_plugin_t *this_gen) {
abuf->decoder_info[3] = 2; /* Audio bits (ffmpeg only supports 2 channels) */
this->audio_fifo->put (this->audio_fifo, abuf);
this->stream->stream_info[XINE_STREAM_INFO_HAS_AUDIO] = 1;
- }
-
+ }
+
}
static int demux_raw_dv_seek (demux_plugin_t *this_gen,
@@ -298,8 +285,8 @@ static int demux_raw_dv_seek (demux_plugin_t *this_gen,
demux_raw_dv_t *this = (demux_raw_dv_t *) this_gen;
-
- if (!(this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE)) {
+
+ if (!INPUT_IS_SEEKABLE(this->input)) {
this->status = DEMUX_OK;
return this->status;
}
@@ -342,9 +329,8 @@ static int demux_raw_dv_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_raw_dv_t *this;
this = xine_xmalloc (sizeof (demux_raw_dv_t));
@@ -363,7 +349,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.get_optional_data = demux_raw_dv_get_optional_data;
this->demux_plugin.demux_class = class_gen;
- if (!(this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE)) {
+ if (!INPUT_IS_SEEKABLE(this->input)) {
/* "live" DV streams require more prebuffering */
this->stream->metronom_prebuffer = 90000;
}
@@ -413,19 +399,15 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_raw_dv_class_t *this = (demux_raw_dv_class_t *) this_gen;
free (this);
}
static void *init_plugin (xine_t *xine, void *data) {
-
demux_raw_dv_class_t *this;
- this = xine_xmalloc (sizeof (demux_raw_dv_class_t));
- this->config = xine->config;
- this->xine = xine;
+ this = xine_xmalloc (sizeof (demux_raw_dv_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;
@@ -442,7 +424,7 @@ static void *init_plugin (xine_t *xine, void *data) {
*/
plugin_info_t xine_plugin_info[] = {
- /* type, API, "name", version, special_info, init_function */
+ /* type, API, "name", version, special_info, init_function */
{ PLUGIN_DEMUX, 21, "rawdv", XINE_VERSION_CODE, NULL, init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_realaudio.c b/src/demuxers/demux_realaudio.c
index a184e6f69..843d78115 100644
--- a/src/demuxers/demux_realaudio.c
+++ b/src/demuxers/demux_realaudio.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
- *
+ */
+
+/*
* RealAudio File Demuxer by Mike Melanson (melanson@pcisys.net)
*
- * $Id: demux_realaudio.c,v 1.20 2003/05/06 20:19:56 esnel Exp $
- *
+ * $Id: demux_realaudio.c,v 1.21 2003/07/16 00:52:45 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -44,50 +45,36 @@
#define RA_AUDIO_HEADER_SIZE 0x39
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;
xine_waveformatex wave;
- unsigned int audio_fourcc;
unsigned int audio_type;
off_t data_start;
off_t data_size;
int seek_flag; /* this is set when a seek just occurred */
-
- char last_mrl[1024];
} demux_ra_t;
typedef struct {
-
demux_class_t demux_class;
-
- /* class-wide, global variables here */
-
- xine_t *xine;
- config_values_t *config;
} demux_ra_class_t;
/* returns 1 if the RealAudio file was opened successfully, 0 otherwise */
static int open_ra_file(demux_ra_t *this) {
-
unsigned char file_header[RA_FILE_HEADER_SIZE];
unsigned char audio_header[RA_AUDIO_HEADER_SIZE];
+ unsigned int audio_fourcc;
/* check the signature */
- if (!xine_demux_read_header(this->input, file_header, RA_FILE_HEADER_SIZE))
+ if (xine_demux_read_header(this->input, file_header, RA_FILE_HEADER_SIZE) !=
+ RA_FILE_HEADER_SIZE)
return 0;
if ((file_header[0] != '.') ||
@@ -100,7 +87,7 @@ static int open_ra_file(demux_ra_t *this) {
/* load the audio header */
if (this->input->read(this->input, audio_header, RA_AUDIO_HEADER_SIZE) !=
- RA_AUDIO_HEADER_SIZE)
+ RA_AUDIO_HEADER_SIZE)
return 0;
/* find the important information */
@@ -110,23 +97,23 @@ static int open_ra_file(demux_ra_t *this) {
this->wave.nSamplesPerSec = BE_16(&audio_header[0x20]);
this->wave.nBlockAlign = BE_16(&audio_header[0x1A]);
this->wave.wBitsPerSample = audio_header[0x25];
- this->audio_fourcc = *(unsigned int *)&audio_header[0x2E];
- this->audio_type = formattag_to_buf_audio(this->audio_fourcc);
+ audio_fourcc = *(unsigned int *)&audio_header[0x2E];
+ this->audio_type = formattag_to_buf_audio(audio_fourcc);
/* skip extra header data (such as song title etc.) */
if (this->input->seek(this->input, this->data_start, SEEK_SET) !=
- this->data_start)
+ this->data_start)
return 0;
if( !this->audio_type )
this->audio_type = BUF_AUDIO_UNKNOWN;
-
+
return 1;
}
static int demux_ra_send_chunk(demux_plugin_t *this_gen) {
-
demux_ra_t *this = (demux_ra_t *) this_gen;
+
buf_element_t *buf = NULL;
unsigned int remaining_sample_bytes;
off_t current_file_pos;
@@ -138,12 +125,8 @@ static int demux_ra_send_chunk(demux_plugin_t *this_gen) {
current_file_pos =
this->input->get_current_pos(this->input) - this->data_start;
-
-
current_pts = 0; /* let the engine sort out the pts for now */
-
-
if (this->seek_flag) {
xine_demux_control_newpts(this->stream, current_pts, 0);
this->seek_flag = 0;
@@ -183,7 +166,6 @@ static int demux_ra_send_chunk(demux_plugin_t *this_gen) {
}
static void demux_ra_send_headers(demux_plugin_t *this_gen) {
-
demux_ra_t *this = (demux_ra_t *) this_gen;
buf_element_t *buf;
@@ -228,10 +210,10 @@ static int demux_ra_seek (demux_plugin_t *this_gen,
this->seek_flag = 1;
this->status = DEMUX_OK;
xine_demux_flush_engine (this->stream);
-
+
/* 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 */
@@ -271,12 +253,11 @@ static int demux_ra_get_status (demux_plugin_t *this_gen) {
/* return the approximate length in miliseconds */
static int demux_ra_get_stream_length (demux_plugin_t *this_gen) {
-
demux_ra_t *this = (demux_ra_t *) this_gen;
- if(this->wave.nAvgBytesPerSec)
+ if(this->wave.nAvgBytesPerSec)
return (int)((int64_t) this->data_size * 1000 / this->wave.nAvgBytesPerSec);
- else
+ else
return 0;
}
@@ -290,9 +271,8 @@ static int demux_ra_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_ra_t *this;
this = xine_xmalloc (sizeof (demux_ra_t));
@@ -343,8 +323,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;
}
@@ -365,19 +343,15 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_ra_class_t *this = (demux_ra_class_t *) this_gen;
free (this);
}
void *demux_realaudio_init_plugin (xine_t *xine, void *data) {
-
demux_ra_class_t *this;
- this = xine_xmalloc (sizeof (demux_ra_class_t));
- this->config = xine->config;
- this->xine = xine;
+ this = xine_xmalloc (sizeof (demux_ra_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;
diff --git a/src/demuxers/demux_roq.c b/src/demuxers/demux_roq.c
index 1de16199b..da3abddb7 100644
--- a/src/demuxers/demux_roq.c
+++ b/src/demuxers/demux_roq.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
- *
+ */
+
+/*
* RoQ File Demuxer by Mike Melanson (melanson@pcisys.net)
* For more information regarding the RoQ file format, visit:
* http://www.csse.monash.edu.au/~timf/
*
- * $Id: demux_roq.c,v 1.39 2003/04/26 20:16:23 guenter Exp $
+ * $Id: demux_roq.c,v 1.40 2003/07/16 00:52:45 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -34,6 +36,11 @@
#include <string.h>
#include <stdlib.h>
+/********** logging **********/
+#define LOG_MODULE "demux_roq"
+/* #define LOG_VERBOSE */
+/* #define LOG */
+
#include "xine_internal.h"
#include "xineutils.h"
#include "compat.h"
@@ -51,50 +58,36 @@
#define RoQ_SOUND_STEREO 0x1021
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;
- unsigned int fps;
- unsigned int frame_pts_inc;
+ unsigned int frame_pts_inc;
unsigned int width;
unsigned int height;
unsigned int audio_channels;
-
- char last_mrl[1024];
} demux_roq_t ;
typedef struct {
-
demux_class_t demux_class;
-
- /* class-wide, global variables here */
-
- xine_t *xine;
- config_values_t *config;
} demux_roq_class_t;
/* returns 1 if the RoQ file was opened successfully, 0 otherwise */
static int open_roq_file(demux_roq_t *this) {
-
char preamble[RoQ_CHUNK_PREAMBLE_SIZE];
int i;
unsigned int chunk_type;
unsigned int chunk_size;
+ unsigned int fps;
- if (!xine_demux_read_header(this->input, preamble, RoQ_CHUNK_PREAMBLE_SIZE))
+ this->input->seek(this->input, 0, SEEK_SET);
+ if (this->input->read(this->input, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
+ RoQ_CHUNK_PREAMBLE_SIZE)
return 0;
/* check for the RoQ magic numbers */
@@ -102,10 +95,6 @@ static int open_roq_file(demux_roq_t *this) {
(LE_32(&preamble[2]) != 0xFFFFFFFF))
return 0;
- /* file is qualified; skip over the header bytes in the stream */
- this->input->seek(this->input, RoQ_CHUNK_PREAMBLE_SIZE, SEEK_SET);
-
-
this->width = this->height = 0;
this->audio_channels = 0; /* assume no audio at first */
@@ -118,12 +107,12 @@ static int open_roq_file(demux_roq_t *this) {
*
* therefore, the frame pts increment is 90000 / fps
*/
- this->fps = LE_16(&preamble[6]);
- this->frame_pts_inc = 90000 / this->fps;
+ fps = LE_16(&preamble[6]);
+ this->frame_pts_inc = 90000 / fps;
/* iterate through the first 2 seconds worth of chunks searching for
* the RoQ_INFO chunk and an audio chunk */
- i = this->fps * 2;
+ i = fps * 2;
while (i-- > 0) {
/* if this read fails, then maybe it's just a really small RoQ file
* (even less than 2 seconds) */
@@ -177,8 +166,8 @@ static int open_roq_file(demux_roq_t *this) {
}
static int demux_roq_send_chunk(demux_plugin_t *this_gen) {
-
demux_roq_t *this = (demux_roq_t *) this_gen;
+
buf_element_t *buf = NULL;
char preamble[RoQ_CHUNK_PREAMBLE_SIZE];
unsigned int chunk_type;
@@ -257,7 +246,7 @@ static int demux_roq_send_chunk(demux_plugin_t *this_gen) {
if (chunk_type == RoQ_QUAD_CODEBOOK) {
/* if it is, figure in the size of the next VQ chunk, too */
this->input->seek(this->input, chunk_size, SEEK_CUR);
- if (this->input->read(this->input, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
+ if (this->input->read(this->input, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
RoQ_CHUNK_PREAMBLE_SIZE) {
this->status = DEMUX_FINISHED;
return this->status;
@@ -296,14 +285,13 @@ static int demux_roq_send_chunk(demux_plugin_t *this_gen) {
}
video_pts_counter += this->frame_pts_inc;
} else {
- printf ("demux_roq: encountered bad chunk type: %d\n", chunk_type);
+ lprintf("encountered bad chunk type: %d\n", chunk_type);
}
return this->status;
}
static void demux_roq_send_headers(demux_plugin_t *this_gen) {
-
demux_roq_t *this = (demux_roq_t *) this_gen;
buf_element_t *buf;
@@ -314,7 +302,7 @@ static void demux_roq_send_headers(demux_plugin_t *this_gen) {
/* load stream information */
this->stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO] = 1;
- this->stream->stream_info[XINE_STREAM_INFO_HAS_AUDIO] =
+ this->stream->stream_info[XINE_STREAM_INFO_HAS_AUDIO] =
(this->audio_channels) ? 1 : 0;
this->stream->stream_info[XINE_STREAM_INFO_VIDEO_WIDTH] = this->width;
this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] = this->height;
@@ -366,13 +354,13 @@ static int demux_roq_seek (demux_plugin_t *this_gen,
xine_demux_control_newpts(this->stream, 0, 0);
this->status = DEMUX_OK;
-
+
/* start after the signature chunk */
this->input->seek(this->input, RoQ_CHUNK_PREAMBLE_SIZE, SEEK_SET);
-
+
this->status = DEMUX_OK;
}
-
+
return this->status;
}
@@ -388,7 +376,6 @@ static int demux_roq_get_status (demux_plugin_t *this_gen) {
}
static int demux_roq_get_stream_length (demux_plugin_t *this_gen) {
-
return 0;
}
@@ -402,11 +389,16 @@ static int demux_roq_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_roq_t *this;
+ if (!INPUT_IS_SEEKABLE(input)) {
+ xprintf(stream->xine, XINE_VERBOSITY_DEBUG,
+ _("input not seekable, can not handle!\n"));
+ return NULL;
+ }
+
this = xine_xmalloc (sizeof (demux_roq_t));
this->stream = stream;
this->input = input;
@@ -424,7 +416,7 @@ 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;
-
+
switch (stream->content_detection_method) {
case METHOD_BY_EXTENSION: {
@@ -455,8 +447,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;
}
@@ -477,19 +467,15 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_roq_class_t *this = (demux_roq_class_t *) this_gen;
free (this);
}
void *demux_roq_init_plugin (xine_t *xine, void *data) {
-
demux_roq_class_t *this;
- this = xine_xmalloc (sizeof (demux_roq_class_t));
- this->config = xine->config;
- this->xine = xine;
+ this = xine_xmalloc (sizeof (demux_roq_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;
@@ -507,7 +493,7 @@ void *demux_roq_init_plugin (xine_t *xine, void *data) {
#if 0
plugin_info_t xine_plugin_info[] = {
- /* type, API, "name", version, special_info, init_function */
+ /* type, API, "name", version, special_info, init_function */
{ PLUGIN_DEMUX, 21, "roq", XINE_VERSION_CODE, NULL, demux_roq_init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_slave.c b/src/demuxers/demux_slave.c
index 65ec99ccc..a828549e2 100644
--- a/src/demuxers/demux_slave.c
+++ b/src/demuxers/demux_slave.c
@@ -21,7 +21,7 @@
*/
/*
- * $Id: demux_slave.c,v 1.3 2003/07/04 15:12:51 andruil Exp $
+ * $Id: demux_slave.c,v 1.4 2003/07/16 00:52:45 andruil Exp $
*
* demuxer for slave "protocol"
* master xine must be started with XINE_PARAM_BROADCASTER_PORT set, that is,
@@ -259,7 +259,6 @@ static int demux_slave_next (demux_slave_t *this) {
}
static int demux_slave_send_chunk (demux_plugin_t *this_gen) {
-
demux_slave_t *this = (demux_slave_t *) this_gen;
demux_slave_next(this);
@@ -275,7 +274,6 @@ static int demux_slave_get_status (demux_plugin_t *this_gen) {
static void demux_slave_send_headers (demux_plugin_t *this_gen) {
-
demux_slave_t *this = (demux_slave_t *) this_gen;
this->video_fifo = this->stream->video_fifo;
@@ -292,9 +290,7 @@ static void demux_slave_send_headers (demux_plugin_t *this_gen) {
this->send_newpts = 1;
}
-static int demux_slave_seek (demux_plugin_t *this_gen,
- off_t start_pos, int start_time) {
-
+static int demux_slave_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time) {
demux_slave_t *this = (demux_slave_t *) this_gen;
return this->status;
@@ -357,7 +353,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
case METHOD_BY_CONTENT: {
- if ( 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;
}
@@ -418,14 +414,12 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_slave_class_t *this = (demux_slave_class_t *) this_gen;
free (this);
}
static void *init_plugin (xine_t *xine, void *data) {
-
demux_slave_class_t *this;
this = xine_xmalloc (sizeof (demux_slave_class_t));
diff --git a/src/demuxers/demux_smjpeg.c b/src/demuxers/demux_smjpeg.c
index b4ec4d989..44e35d1d8 100644
--- a/src/demuxers/demux_smjpeg.c
+++ b/src/demuxers/demux_smjpeg.c
@@ -23,7 +23,7 @@
* For more information on the SMJPEG file format, visit:
* http://www.lokigames.com/development/smjpeg.php3
*
- * $Id: demux_smjpeg.c,v 1.39 2003/07/04 15:12:50 andruil Exp $
+ * $Id: demux_smjpeg.c,v 1.40 2003/07/16 00:52:45 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -36,6 +36,11 @@
#include <string.h>
#include <stdlib.h>
+/********** logging **********/
+#define LOG_MODULE "demux_smjpeg"
+/* #define LOG_VERBOSE */
+/* #define LOG */
+
#include "xine_internal.h"
#include "xineutils.h"
#include "compat.h"
@@ -92,13 +97,13 @@ typedef struct {
/* 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 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))
+ if (xine_demux_read_header(this->input, signature, SMJPEG_SIGNATURE_SIZE) !=
+ SMJPEG_SIGNATURE_SIZE)
return 0;
/* check for the SMJPEG signature */
@@ -138,8 +143,8 @@ static int open_smjpeg_file(demux_smjpeg_t *this) {
break;
case _VID_TAG:
- if (this->input->read(this->input, header_chunk,
- SMJPEG_VIDEO_HEADER_SIZE) != SMJPEG_VIDEO_HEADER_SIZE)
+ if (this->input->read(this->input, header_chunk,
+ SMJPEG_VIDEO_HEADER_SIZE) != SMJPEG_VIDEO_HEADER_SIZE)
return 0;
this->bih.biWidth = BE_16(&header_chunk[8]);
@@ -149,8 +154,8 @@ static int open_smjpeg_file(demux_smjpeg_t *this) {
break;
case _SND_TAG:
- if (this->input->read(this->input, header_chunk,
- SMJPEG_AUDIO_HEADER_SIZE) != SMJPEG_AUDIO_HEADER_SIZE)
+ if (this->input->read(this->input, header_chunk,
+ SMJPEG_AUDIO_HEADER_SIZE) != SMJPEG_AUDIO_HEADER_SIZE)
return 0;
this->audio_sample_rate = BE_16(&header_chunk[4]);
@@ -188,8 +193,8 @@ static int open_smjpeg_file(demux_smjpeg_t *this) {
}
static int demux_smjpeg_send_chunk(demux_plugin_t *this_gen) {
-
demux_smjpeg_t *this = (demux_smjpeg_t *) this_gen;
+
buf_element_t *buf = NULL;
unsigned int chunk_tag;
int64_t pts;
@@ -201,7 +206,7 @@ static int demux_smjpeg_send_chunk(demux_plugin_t *this_gen) {
/* load the next sample */
current_file_pos = this->input->get_current_pos(this->input);
- if (this->input->read(this->input, preamble,
+ if (this->input->read(this->input, preamble,
SMJPEG_CHUNK_PREAMBLE_SIZE) != SMJPEG_CHUNK_PREAMBLE_SIZE) {
this->status = DEMUX_FINISHED;
return this->status; /* skip to next while() iteration to bail out */
@@ -295,12 +300,11 @@ static int demux_smjpeg_send_chunk(demux_plugin_t *this_gen) {
if (chunk_tag == vidD_TAG)
last_frame_pts = buf->pts;
-
+
return this->status;
}
static void demux_smjpeg_send_headers(demux_plugin_t *this_gen) {
-
demux_smjpeg_t *this = (demux_smjpeg_t *) this_gen;
buf_element_t *buf;
@@ -311,7 +315,7 @@ static void demux_smjpeg_send_headers(demux_plugin_t *this_gen) {
/* load stream information */
this->stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO] = 1;
- this->stream->stream_info[XINE_STREAM_INFO_HAS_AUDIO] =
+ this->stream->stream_info[XINE_STREAM_INFO_HAS_AUDIO] =
(this->audio_channels) ? 1 : 0;
this->stream->stream_info[XINE_STREAM_INFO_VIDEO_WIDTH] = this->bih.biWidth;
this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] = this->bih.biHeight;
@@ -347,9 +351,7 @@ static void demux_smjpeg_send_headers(demux_plugin_t *this_gen) {
}
}
-static int demux_smjpeg_seek (demux_plugin_t *this_gen,
- off_t start_pos, int start_time) {
-
+static int demux_smjpeg_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time) {
demux_smjpeg_t *this = (demux_smjpeg_t *) this_gen;
/* if thread is not running, initialize demuxer */
@@ -396,8 +398,8 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
demux_smjpeg_t *this;
if (!INPUT_IS_SEEKABLE(input)) {
- if (stream->xine->verbosity >= XINE_VERBOSITY_DEBUG)
- printf(_("demux_smjpeg.c: input not seekable, can not handle!\n"));
+ xprintf(stream->xine, XINE_VERBOSITY_DEBUG,
+ _("input not seekable, can not handle!\n"));
return NULL;
}
@@ -469,14 +471,12 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_smjpeg_class_t *this = (demux_smjpeg_class_t *) this_gen;
free (this);
}
void *demux_smjpeg_init_plugin (xine_t *xine, void *data) {
-
demux_smjpeg_class_t *this;
this = xine_xmalloc (sizeof (demux_smjpeg_class_t));
diff --git a/src/demuxers/demux_snd.c b/src/demuxers/demux_snd.c
index 03fd47040..3fd2af0a8 100644
--- a/src/demuxers/demux_snd.c
+++ b/src/demuxers/demux_snd.c
@@ -21,7 +21,7 @@
/*
* SND/AU File Demuxer by Mike Melanson (melanson@pcisys.net)
*
- * $Id: demux_snd.c,v 1.30 2003/07/04 15:12:50 andruil Exp $
+ * $Id: demux_snd.c,v 1.31 2003/07/16 00:52:45 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -77,7 +77,6 @@ typedef struct {
/* returns 1 if the SND file was opened successfully, 0 otherwise */
static int open_snd_file(demux_snd_t *this) {
-
unsigned char header[SND_HEADER_SIZE];
unsigned int encoding;
@@ -147,8 +146,8 @@ static int open_snd_file(demux_snd_t *this) {
}
static int demux_snd_send_chunk(demux_plugin_t *this_gen) {
-
demux_snd_t *this = (demux_snd_t *) this_gen;
+
buf_element_t *buf = NULL;
unsigned int remaining_sample_bytes;
off_t current_file_pos;
@@ -199,7 +198,6 @@ static int demux_snd_send_chunk(demux_plugin_t *this_gen) {
}
static void demux_snd_send_headers(demux_plugin_t *this_gen) {
-
demux_snd_t *this = (demux_snd_t *) this_gen;
buf_element_t *buf;
@@ -235,9 +233,7 @@ static void demux_snd_send_headers(demux_plugin_t *this_gen) {
}
}
-static int demux_snd_seek (demux_plugin_t *this_gen,
- off_t start_pos, int start_time) {
-
+static int demux_snd_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time) {
demux_snd_t *this = (demux_snd_t *) this_gen;
this->seek_flag = 1;
@@ -285,7 +281,6 @@ static int demux_snd_get_status (demux_plugin_t *this_gen) {
/* return the approximate length in miliseconds */
static int demux_snd_get_stream_length (demux_plugin_t *this_gen) {
-
demux_snd_t *this = (demux_snd_t *) this_gen;
return this->running_time * 1000;
@@ -376,14 +371,12 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_snd_class_t *this = (demux_snd_class_t *) this_gen;
free (this);
}
void *demux_snd_init_plugin (xine_t *xine, void *data) {
-
demux_snd_class_t *this;
this = xine_xmalloc (sizeof (demux_snd_class_t));
diff --git a/src/demuxers/demux_str.c b/src/demuxers/demux_str.c
index 395a97697..ea3d3779f 100644
--- a/src/demuxers/demux_str.c
+++ b/src/demuxers/demux_str.c
@@ -24,7 +24,7 @@
* 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.12 2003/07/04 15:12:51 andruil Exp $
+ * $Id: demux_str.c,v 1.13 2003/07/16 00:52:45 andruil Exp $
*/
/*
@@ -499,9 +499,7 @@ static void demux_str_send_headers(demux_plugin_t *this_gen) {
}
}
-static int demux_str_seek (demux_plugin_t *this_gen,
- off_t start_pos, int start_time) {
-
+static int demux_str_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time) {
demux_str_t *this = (demux_str_t *) this_gen;
xine_demux_flush_engine (this->stream);
@@ -537,8 +535,6 @@ static int demux_str_get_stream_length (demux_plugin_t *this_gen) {
return (int)((int64_t) this->input->get_length(this->input)
* 1000 / (CD_RAW_SECTOR_SIZE * 75));
-
- return 0;
}
static uint32_t demux_str_get_capabilities(demux_plugin_t *this_gen) {
@@ -557,7 +553,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
if (!INPUT_IS_SEEKABLE(input)) {
xprintf(stream->xine, XINE_VERBOSITY_DEBUG,
- "input not seekable, can not handle!\n");
+ _("input not seekable, can not handle!\n"));
return NULL;
}
@@ -634,7 +630,6 @@ static void class_dispose (demux_class_t *this_gen) {
}
void *demux_str_init_plugin (xine_t *xine, void *data) {
-
demux_str_class_t *this;
this = xine_xmalloc (sizeof (demux_str_class_t));
diff --git a/src/demuxers/demux_voc.c b/src/demuxers/demux_voc.c
index e5f8e2ab7..974dd1d60 100644
--- a/src/demuxers/demux_voc.c
+++ b/src/demuxers/demux_voc.c
@@ -16,15 +16,16 @@
* 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
- *
+ */
+
+/*
* Creative Voice File Demuxer by Mike Melanson (melanson@pcisys.net)
* Note that this demuxer does not yet support very many things that can
* possibly be seen in a VOC file. It only plays the first block in a file.
* It will only play that block if it is PCM data. More variations will be
* supported as they are encountered.
*
- * $Id: demux_voc.c,v 1.30 2003/04/17 19:01:32 miguelfreitas Exp $
- *
+ * $Id: demux_voc.c,v 1.31 2003/07/16 00:52:45 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -50,21 +51,14 @@
#define BLOCK_PREAMBLE_SIZE 4
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;
- unsigned int voc_audio_type;
unsigned int audio_type;
unsigned int audio_sample_rate;
unsigned int audio_bits;
@@ -75,29 +69,20 @@ typedef struct {
unsigned int running_time;
int seek_flag; /* this is set when a seek just occurred */
-
- char last_mrl[1024];
} demux_voc_t;
typedef struct {
-
demux_class_t demux_class;
-
- /* class-wide, global variables here */
-
- xine_t *xine;
- config_values_t *config;
} demux_voc_class_t;
/* returns 1 if the VOC file was opened successfully, 0 otherwise */
static int open_voc_file(demux_voc_t *this) {
-
unsigned char header[VOC_HEADER_SIZE];
unsigned char preamble[BLOCK_PREAMBLE_SIZE];
off_t first_block_offset;
signed char sample_rate_divisor;
- if (!xine_demux_read_header(this->input, header, VOC_HEADER_SIZE))
+ if (xine_demux_read_header(this->input, header, VOC_HEADER_SIZE) != VOC_HEADER_SIZE)
return 0;
/* check the signature */
@@ -129,7 +114,6 @@ static int open_voc_file(demux_voc_t *this) {
return 0;
/* this app only knows how to deal with format 0 data (raw PCM) */
- this->voc_audio_type = preamble[1];
if (preamble[1] != 0) {
xine_log(this->stream->xine, XINE_LOG_MSG,
_("unknown VOC compression type (0x%02X); please report to xine developers\n"),
@@ -149,8 +133,8 @@ static int open_voc_file(demux_voc_t *this) {
}
static int demux_voc_send_chunk(demux_plugin_t *this_gen) {
-
demux_voc_t *this = (demux_voc_t *) this_gen;
+
buf_element_t *buf = NULL;
unsigned int remaining_sample_bytes;
off_t current_file_pos;
@@ -208,7 +192,6 @@ static int demux_voc_send_chunk(demux_plugin_t *this_gen) {
}
static void demux_voc_send_headers(demux_plugin_t *this_gen) {
-
demux_voc_t *this = (demux_voc_t *) this_gen;
buf_element_t *buf;
@@ -244,9 +227,7 @@ static void demux_voc_send_headers(demux_plugin_t *this_gen) {
}
}
-static int demux_voc_seek (demux_plugin_t *this_gen,
- off_t start_pos, int start_time) {
-
+static int demux_voc_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time) {
demux_voc_t *this = (demux_voc_t *) this_gen;
this->seek_flag = 1;
@@ -255,7 +236,7 @@ static int demux_voc_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 */
@@ -294,7 +275,6 @@ static int demux_voc_get_status (demux_plugin_t *this_gen) {
/* return the approximate length in miliseconds */
static int demux_voc_get_stream_length (demux_plugin_t *this_gen) {
-
demux_voc_t *this = (demux_voc_t *) this_gen;
return this->running_time * 1000;
@@ -310,9 +290,8 @@ static int demux_voc_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_voc_t *this;
this = xine_xmalloc (sizeof (demux_voc_t));
@@ -363,8 +342,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;
}
@@ -385,19 +362,15 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_voc_class_t *this = (demux_voc_class_t *) this_gen;
free (this);
}
void *demux_voc_init_plugin (xine_t *xine, void *data) {
-
demux_voc_class_t *this;
- this = xine_xmalloc (sizeof (demux_voc_class_t));
- this->config = xine->config;
- this->xine = xine;
+ this = xine_xmalloc (sizeof (demux_voc_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 4b6b4aad7..9027d716a 100644
--- a/src/demuxers/demux_vox.c
+++ b/src/demuxers/demux_vox.c
@@ -22,7 +22,7 @@
* 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.5 2003/07/04 15:12:51 andruil Exp $
+ * $Id: demux_vox.c,v 1.6 2003/07/16 00:52:45 andruil Exp $
*
*/
@@ -60,8 +60,8 @@ typedef struct {
} demux_vox_class_t;
static int demux_vox_send_chunk (demux_plugin_t *this_gen) {
-
demux_vox_t *this = (demux_vox_t *) this_gen;
+
buf_element_t *buf = NULL;
off_t current_file_pos;
int64_t audio_pts;
@@ -100,7 +100,6 @@ static int demux_vox_send_chunk (demux_plugin_t *this_gen) {
}
static void demux_vox_send_headers(demux_plugin_t *this_gen) {
-
demux_vox_t *this = (demux_vox_t *) this_gen;
buf_element_t *buf;
@@ -133,9 +132,7 @@ static void demux_vox_send_headers(demux_plugin_t *this_gen) {
}
}
-static int demux_vox_seek (demux_plugin_t *this_gen,
- off_t start_pos, int start_time) {
-
+static int demux_vox_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time) {
demux_vox_t *this = (demux_vox_t *) this_gen;
/* if thread is not running, initialize demuxer */
@@ -167,7 +164,6 @@ static int demux_vox_get_status (demux_plugin_t *this_gen) {
/* return the approximate length in miliseconds */
static int demux_vox_get_stream_length (demux_plugin_t *this_gen) {
-
demux_vox_t *this = (demux_vox_t *) this_gen;
return (int)((int64_t)this->input->get_length(this->input)
@@ -245,14 +241,12 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_vox_class_t *this = (demux_vox_class_t *) this_gen;
free (this);
}
void *demux_vox_init_plugin (xine_t *xine, void *data) {
-
demux_vox_class_t *this;
this = xine_xmalloc (sizeof (demux_vox_class_t));
@@ -266,4 +260,3 @@ void *demux_vox_init_plugin (xine_t *xine, void *data) {
return this;
}
-
diff --git a/src/demuxers/demux_vqa.c b/src/demuxers/demux_vqa.c
index 06da3e506..f1468a64c 100644
--- a/src/demuxers/demux_vqa.c
+++ b/src/demuxers/demux_vqa.c
@@ -16,7 +16,9 @@
* 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
- *
+ */
+
+/*
* VQA File Demuxer by Mike Melanson (melanson@pcisys.net)
* For more information regarding the VQA file format, visit:
* http://www.pcisys.net/~melanson/codecs/
@@ -27,7 +29,7 @@
* block needs information from the previous audio block in order to be
* decoded, thus making random seeking difficult.
*
- * $Id: demux_vqa.c,v 1.29 2003/04/26 20:16:26 guenter Exp $
+ * $Id: demux_vqa.c,v 1.30 2003/07/16 00:52:45 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -66,21 +68,16 @@
#define VQA_PREAMBLE_SIZE 8
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 filesize;
- int status;
unsigned char header[VQA_HEADER_SIZE];
@@ -91,27 +88,18 @@ typedef struct {
int64_t video_pts;
unsigned int audio_frames;
unsigned int iteration;
-
- char last_mrl[1024];
} demux_vqa_t ;
typedef struct {
-
demux_class_t demux_class;
-
- /* class-wide, global variables here */
-
- xine_t *xine;
- config_values_t *config;
} demux_vqa_class_t;
/* returns 1 if the VQA file was opened successfully, 0 otherwise */
static int open_vqa_file(demux_vqa_t *this) {
-
unsigned char scratch[12];
unsigned int chunk_size;
- if (!xine_demux_read_header(this->input, scratch, 12))
+ if (xine_demux_read_header(this->input, scratch, 12) != 12)
return 0;
/* check for the VQA signatures */
@@ -151,8 +139,8 @@ static int open_vqa_file(demux_vqa_t *this) {
}
static int demux_vqa_send_chunk(demux_plugin_t *this_gen) {
-
demux_vqa_t *this = (demux_vqa_t *) this_gen;
+
buf_element_t *buf = NULL;
unsigned char preamble[VQA_PREAMBLE_SIZE];
unsigned int chunk_size;
@@ -183,23 +171,23 @@ static int demux_vqa_send_chunk(demux_plugin_t *this_gen) {
buf->extra_info->input_length = this->filesize;
buf->extra_info->input_time = audio_pts / 90;
buf->pts = audio_pts;
-
+
if (chunk_size > buf->max_size)
buf->size = buf->max_size;
else
buf->size = chunk_size;
chunk_size -= buf->size;
-
+
if (this->input->read(this->input, buf->content, buf->size) !=
buf->size) {
buf->free_buffer(buf);
this->status = DEMUX_FINISHED;
break;
}
-
+
if (!chunk_size)
buf->decoder_flags |= BUF_FLAG_FRAME_END;
-
+
this->audio_fifo->put (this->audio_fifo, buf);
}else{
this->input->seek(this->input, chunk_size, SEEK_CUR);
@@ -256,7 +244,6 @@ static int demux_vqa_send_chunk(demux_plugin_t *this_gen) {
}
static void demux_vqa_send_headers(demux_plugin_t *this_gen) {
-
demux_vqa_t *this = (demux_vqa_t *) this_gen;
buf_element_t *buf;
@@ -267,11 +254,11 @@ static void demux_vqa_send_headers(demux_plugin_t *this_gen) {
/* load stream information */
this->stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO] = 1;
- this->stream->stream_info[XINE_STREAM_INFO_HAS_AUDIO] =
+ this->stream->stream_info[XINE_STREAM_INFO_HAS_AUDIO] =
(this->audio_channels) ? 1 : 0;
- this->stream->stream_info[XINE_STREAM_INFO_VIDEO_WIDTH] =
+ this->stream->stream_info[XINE_STREAM_INFO_VIDEO_WIDTH] =
LE_16(&this->header[6]);
- this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] =
+ this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] =
LE_16(&this->header[8]);
this->stream->stream_info[XINE_STREAM_INFO_AUDIO_CHANNELS] =
this->audio_channels;
@@ -314,7 +301,6 @@ static int demux_vqa_seek (demux_plugin_t *this_gen,
/* if thread is not running, initialize demuxer */
if( !this->stream->demux_thread_running ) {
-
this->status = DEMUX_OK;
}
@@ -322,7 +308,6 @@ static int demux_vqa_seek (demux_plugin_t *this_gen,
}
static void demux_vqa_dispose (demux_plugin_t *this_gen) {
-
demux_vqa_t *this = (demux_vqa_t *) this_gen;
free(this);
@@ -335,7 +320,6 @@ static int demux_vqa_get_status (demux_plugin_t *this_gen) {
}
static int demux_vqa_get_stream_length (demux_plugin_t *this_gen) {
-
return 0;
}
@@ -349,9 +333,8 @@ static int demux_vqa_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_vqa_t *this;
this = xine_xmalloc (sizeof (demux_vqa_t));
@@ -402,8 +385,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,19 +405,15 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_vqa_class_t *this = (demux_vqa_class_t *) this_gen;
free (this);
}
void *demux_vqa_init_plugin (xine_t *xine, void *data) {
-
demux_vqa_class_t *this;
- this = xine_xmalloc (sizeof (demux_vqa_class_t));
- this->config = xine->config;
- this->xine = xine;
+ this = xine_xmalloc (sizeof (demux_vqa_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;
@@ -454,7 +431,7 @@ void *demux_vqa_init_plugin (xine_t *xine, void *data) {
#if 0
plugin_info_t xine_plugin_info[] = {
- /* type, API, "name", version, special_info, init_function */
+ /* type, API, "name", version, special_info, init_function */
{ PLUGIN_DEMUX, 21, "vqa", XINE_VERSION_CODE, NULL, demux_vqa_init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_wav.c b/src/demuxers/demux_wav.c
index 2fe6fc63b..75fbdb18a 100644
--- a/src/demuxers/demux_wav.c
+++ b/src/demuxers/demux_wav.c
@@ -16,12 +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
- *
+ */
+
+/*
* MS WAV File Demuxer by Mike Melanson (melanson@pcisys.net)
* based on WAV specs that are available far and wide
*
- * $Id: demux_wav.c,v 1.43 2003/05/23 15:36:58 jcdutton Exp $
- *
+ * $Id: demux_wav.c,v 1.44 2003/07/16 00:52:45 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -47,18 +48,12 @@
#define PCM_BLOCK_ALIGN 1024
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;
xine_waveformatex *wave;
@@ -69,30 +64,21 @@ typedef struct {
off_t data_size;
int seek_flag; /* this is set when a seek just occurred */
-
- char last_mrl[1024];
} demux_wav_t;
typedef struct {
-
demux_class_t demux_class;
-
- /* class-wide, global variables here */
-
- xine_t *xine;
- config_values_t *config;
} demux_wav_class_t;
/* returns 1 if the WAV file was opened successfully, 0 otherwise */
static int open_wav_file(demux_wav_t *this) {
-
uint8_t signature[WAV_SIGNATURE_SIZE];
uint32_t chunk_tag;
uint32_t chunk_size;
uint8_t chunk_preamble[8];
/* check the signature */
- if (!xine_demux_read_header(this->input, signature, WAV_SIGNATURE_SIZE))
+ if (xine_demux_read_header(this->input, signature, WAV_SIGNATURE_SIZE) != WAV_SIGNATURE_SIZE)
return 0;
if ((signature[0] != 'R') ||
@@ -183,8 +169,8 @@ static int open_wav_file(demux_wav_t *this) {
}
static int demux_wav_send_chunk(demux_plugin_t *this_gen) {
-
demux_wav_t *this = (demux_wav_t *) this_gen;
+
buf_element_t *buf = NULL;
unsigned int remaining_sample_bytes;
off_t current_file_pos;
@@ -193,7 +179,7 @@ static int demux_wav_send_chunk(demux_plugin_t *this_gen) {
/* just load data chunks from wherever the stream happens to be
* pointing; issue a DEMUX_FINISHED status if EOF is reached */
remaining_sample_bytes = this->wave->nBlockAlign;
- current_file_pos =
+ current_file_pos =
this->input->get_current_pos(this->input) - this->data_start;
current_pts = current_file_pos;
@@ -255,7 +241,7 @@ static int demux_wav_send_chunk(demux_plugin_t *this_gen) {
}
printf("\n");
#endif
-
+
if (!remaining_sample_bytes)
buf->decoder_flags |= BUF_FLAG_FRAME_END;
@@ -267,7 +253,6 @@ static int demux_wav_send_chunk(demux_plugin_t *this_gen) {
}
static void demux_wav_send_headers(demux_plugin_t *this_gen) {
-
demux_wav_t *this = (demux_wav_t *) this_gen;
buf_element_t *buf;
@@ -279,11 +264,11 @@ static void demux_wav_send_headers(demux_plugin_t *this_gen) {
/* load stream information */
this->stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO] = 0;
this->stream->stream_info[XINE_STREAM_INFO_HAS_AUDIO] = 1;
- this->stream->stream_info[XINE_STREAM_INFO_AUDIO_CHANNELS] =
+ this->stream->stream_info[XINE_STREAM_INFO_AUDIO_CHANNELS] =
this->wave->nChannels;
- this->stream->stream_info[XINE_STREAM_INFO_AUDIO_SAMPLERATE] =
+ this->stream->stream_info[XINE_STREAM_INFO_AUDIO_SAMPLERATE] =
this->wave->nSamplesPerSec;
- this->stream->stream_info[XINE_STREAM_INFO_AUDIO_BITS] =
+ this->stream->stream_info[XINE_STREAM_INFO_AUDIO_BITS] =
this->wave->wBitsPerSample;
/* send start buffers */
@@ -312,10 +297,10 @@ static int demux_wav_seek (demux_plugin_t *this_gen,
this->seek_flag = 1;
this->status = DEMUX_OK;
xine_demux_flush_engine (this->stream);
-
+
/* 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 */
@@ -355,7 +340,6 @@ static int demux_wav_get_status (demux_plugin_t *this_gen) {
/* return the approximate length in miliseconds */
static int demux_wav_get_stream_length (demux_plugin_t *this_gen) {
-
demux_wav_t *this = (demux_wav_t *) this_gen;
return (int)((int64_t) this->data_size * 1000 / this->wave->nAvgBytesPerSec);
@@ -371,9 +355,8 @@ static int demux_wav_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_wav_t *this;
this = xine_xmalloc (sizeof (demux_wav_t));
@@ -424,8 +407,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);
-
/* special block alignment hack so that the demuxer doesn't send
* packets with individual PCM samples */
if ((this->wave->nAvgBytesPerSec / this->wave->nBlockAlign) ==
@@ -455,19 +436,15 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_wav_class_t *this = (demux_wav_class_t *) this_gen;
free (this);
}
void *demux_wav_init_plugin (xine_t *xine, void *data) {
-
demux_wav_class_t *this;
- this = xine_xmalloc (sizeof (demux_wav_class_t));
- this->config = xine->config;
- this->xine = xine;
+ this = xine_xmalloc (sizeof (demux_wav_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;
diff --git a/src/demuxers/demux_wc3movie.c b/src/demuxers/demux_wc3movie.c
index 0f35dec01..e41e65a5b 100644
--- a/src/demuxers/demux_wc3movie.c
+++ b/src/demuxers/demux_wc3movie.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
- *
+ */
+
+/*
* File Demuxer for Wing Commander III MVE movie files
* by Mike Melanson (melanson@pcisys.net)
* For more information on the MVE file format, visit:
* http://www.pcisys.net/~melanson/codecs/
*
- * $Id: demux_wc3movie.c,v 1.37 2003/04/26 20:16:28 guenter Exp $
+ * $Id: demux_wc3movie.c,v 1.38 2003/07/16 00:52:45 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -35,6 +37,11 @@
#include <string.h>
#include <stdlib.h>
+/********** logging **********/
+#define LOG_MODULE "demux_wc3movie"
+/* #define LOG_VERBOSE */
+/* #define LOG */
+
#include "xine_internal.h"
#include "xineutils.h"
#include "compat.h"
@@ -71,22 +78,14 @@
#define PREAMBLE_SIZE 8
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;
- unsigned int fps;
- unsigned int frame_pts_inc;
unsigned int video_width;
unsigned int video_height;
@@ -102,18 +101,10 @@ typedef struct {
off_t data_size;
int64_t video_pts;
-
- char last_mrl[1024];
} demux_mve_t;
typedef struct {
-
demux_class_t demux_class;
-
- /* class-wide, global variables here */
-
- xine_t *xine;
- config_values_t *config;
} demux_mve_class_t;
/* bizarre palette lookup table */
@@ -153,8 +144,8 @@ const unsigned char wc3_pal_lookup[] = {
};
static int demux_mve_send_chunk(demux_plugin_t *this_gen) {
-
demux_mve_t *this = (demux_mve_t *) this_gen;
+
buf_element_t *buf = NULL;
int64_t text_pts = 0;
int64_t audio_pts = 0;
@@ -177,25 +168,18 @@ static int demux_mve_send_chunk(demux_plugin_t *this_gen) {
chunk_size = (BE_32(&preamble[4]) + 1) & (~1);
if (chunk_tag == BRCH_TAG) {
-
/* empty chunk; do nothing */
-
} else if (chunk_tag == SHOT_TAG) {
-
if (this->seek_flag) {
-
/* reset pts */
this->video_pts = 0;
xine_demux_control_newpts(this->stream, 0, BUF_FLAG_SEEK);
this->seek_flag = 0;
-
} else {
-
/* record the offset of the SHOT chunk */
- this->shot_offsets[this->current_shot] =
+ this->shot_offsets[this->current_shot] =
this->input->get_current_pos(this->input) - PREAMBLE_SIZE;
}
-
this->current_shot++;
/* this is the start of a new shot; send a new palette */
@@ -223,9 +207,7 @@ static int demux_mve_send_chunk(demux_plugin_t *this_gen) {
this->video_fifo->put (this->video_fifo, buf);
} else if (chunk_tag == AUDI_TAG) {
-
if( this->audio_fifo ) {
-
audio_pts = this->video_pts - WC3_PTS_INC;
while (chunk_size) {
@@ -258,7 +240,6 @@ static int demux_mve_send_chunk(demux_plugin_t *this_gen) {
this->input->seek(this->input, chunk_size, SEEK_CUR);
}
} else if (chunk_tag == VGA_TAG) {
-
while (chunk_size) {
buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
buf->type = BUF_VIDEO_WC3;
@@ -286,18 +267,14 @@ static int demux_mve_send_chunk(demux_plugin_t *this_gen) {
this->video_fifo->put (this->video_fifo, buf);
}
this->video_pts += WC3_PTS_INC;
-
} else if (chunk_tag == TEXT_TAG) {
-
text_pts = this->video_pts - WC3_PTS_INC;
/* unhandled thus far */
this->input->seek(this->input, chunk_size, SEEK_CUR);
-
} else {
-
/* report an unknown chunk and skip it */
- printf (_("demux_wc3movie: encountered unknown chunk: %c%c%c%c\n"),
+ lprintf("encountered unknown chunk: %c%c%c%c\n",
(chunk_tag >> 24) & 0xFF,
(chunk_tag >> 16) & 0xFF,
(chunk_tag >> 8) & 0xFF,
@@ -310,7 +287,6 @@ static int demux_mve_send_chunk(demux_plugin_t *this_gen) {
}
static void demux_mve_send_headers(demux_plugin_t *this_gen) {
-
demux_mve_t *this = (demux_mve_t *) this_gen;
buf_element_t *buf;
@@ -385,11 +361,7 @@ static int open_mve_file(demux_mve_t *this) {
unsigned char header[WC3_HEADER_SIZE];
void *title;
- /* these are the frame dimensions unless others are found */
- this->video_width = WC3_USUAL_WIDTH;
- this->video_height = WC3_USUAL_HEIGHT;
-
- if (!xine_demux_read_header(this->input, header, WC3_HEADER_SIZE))
+ if (xine_demux_read_header(this->input, header, WC3_HEADER_SIZE) != WC3_HEADER_SIZE)
return 0;
if ((BE_32(&header[0]) != FORM_TAG) ||
@@ -398,7 +370,11 @@ static int open_mve_file(demux_mve_t *this) {
return 0;
/* file is qualified */
-
+
+ /* these are the frame dimensions unless others are found */
+ this->video_width = WC3_USUAL_WIDTH;
+ this->video_height = WC3_USUAL_HEIGHT;
+
/* load the number of palettes, the only interesting piece of information
* in the _PC_ chunk; take it for granted that it will always appear at
* position 0x1C */
@@ -520,7 +496,7 @@ static int open_mve_file(demux_mve_t *this) {
default:
/* report an unknown chunk and skip it */
- printf (_("demux_wc3movie: encountered unknown chunk: %c%c%c%c\n"),
+ lprintf("encountered unknown chunk: %c%c%c%c\n",
(chunk_tag >> 24) & 0xFF,
(chunk_tag >> 16) & 0xFF,
(chunk_tag >> 8) & 0xFF,
@@ -528,15 +504,12 @@ static int open_mve_file(demux_mve_t *this) {
this->input->seek(this->input, chunk_size, SEEK_CUR);
break;
}
-
}
/* note the data start offset */
this->data_start = this->input->get_current_pos(this->input);
-
- this->data_size = this->input->get_length(this->input) - this->data_start;
-
- this->video_pts = 0;
+ this->data_size = this->input->get_length(this->input) - this->data_start;
+ this->video_pts = 0;
this->stream->meta_info[XINE_META_INFO_TITLE] = title;
@@ -571,7 +544,7 @@ static int demux_mve_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;
/* make sure the first shot has been recorded */
@@ -670,7 +643,6 @@ static int demux_mve_get_status (demux_plugin_t *this_gen) {
}
static int demux_mve_get_stream_length (demux_plugin_t *this_gen) {
-
return 0;
}
@@ -684,9 +656,8 @@ static int demux_mve_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_mve_t *this;
this = xine_xmalloc (sizeof (demux_mve_t));
@@ -737,8 +708,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;
}
@@ -759,19 +728,15 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_mve_class_t *this = (demux_mve_class_t *) this_gen;
free (this);
}
void *demux_wc3movie_init_plugin (xine_t *xine, void *data) {
-
demux_mve_class_t *this;
- this = xine_xmalloc (sizeof (demux_mve_class_t));
- this->config = xine->config;
- this->xine = xine;
+ this = xine_xmalloc (sizeof (demux_mve_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;
diff --git a/src/demuxers/demux_yuv4mpeg2.c b/src/demuxers/demux_yuv4mpeg2.c
index 33f8d3259..822a0d517 100644
--- a/src/demuxers/demux_yuv4mpeg2.c
+++ b/src/demuxers/demux_yuv4mpeg2.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
- *
+ */
+
+/*
* YUV4MPEG2 File Demuxer by Mike Melanson (melanson@pcisys.net)
* For more information regarding the YUV4MPEG2 file format and associated
* tools, visit:
* http://mjpeg.sourceforge.net/
*
- * $Id: demux_yuv4mpeg2.c,v 1.22 2003/04/26 20:16:29 guenter Exp $
+ * $Id: demux_yuv4mpeg2.c,v 1.23 2003/07/16 00:52:46 andruil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -49,23 +51,16 @@
#define Y4M_HEADER_BYTES 100
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;
off_t data_start;
off_t data_size;
- int status;
xine_bmiheader bih;
@@ -74,29 +69,20 @@ typedef struct {
unsigned int frame_size;
int seek_flag;
-
- char last_mrl[1024];
} demux_yuv4mpeg2_t;
typedef struct {
-
demux_class_t demux_class;
-
- /* class-wide, global variables here */
-
- xine_t *xine;
- config_values_t *config;
} demux_yuv4mpeg2_class_t;
/* returns 1 if the YUV4MPEG2 file was opened successfully, 0 otherwise */
static int open_yuv4mpeg2_file(demux_yuv4mpeg2_t *this) {
-
unsigned char header[Y4M_HEADER_BYTES];
int i;
this->bih.biWidth = this->bih.biHeight = this->fps = this->data_start = 0;
- if (!xine_demux_read_header(this->input, header, Y4M_HEADER_BYTES))
+ if (xine_demux_read_header(this->input, header, Y4M_HEADER_BYTES) != Y4M_HEADER_BYTES)
return 0;
/* check for the Y4M signature */
@@ -145,8 +131,9 @@ static int open_yuv4mpeg2_file(demux_yuv4mpeg2_t *this) {
i++;
else
break;
+
this->data_start = i;
- if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) {
+ if (INPUT_IS_SEEKABLE(this->input)) {
this->data_size = this->input->get_length(this->input) -
this->data_start;
}
@@ -163,8 +150,8 @@ static int open_yuv4mpeg2_file(demux_yuv4mpeg2_t *this) {
}
static int demux_yuv4mpeg2_send_chunk(demux_plugin_t *this_gen) {
-
demux_yuv4mpeg2_t *this = (demux_yuv4mpeg2_t *) this_gen;
+
buf_element_t *buf = NULL;
unsigned char preamble[Y4M_FRAME_SIGNATURE_SIZE];
int bytes_remaining;
@@ -226,7 +213,6 @@ static int demux_yuv4mpeg2_send_chunk(demux_plugin_t *this_gen) {
}
static void demux_yuv4mpeg2_send_headers(demux_plugin_t *this_gen) {
-
demux_yuv4mpeg2_t *this = (demux_yuv4mpeg2_t *) this_gen;
buf_element_t *buf;
@@ -260,7 +246,7 @@ static int demux_yuv4mpeg2_seek (demux_plugin_t *this_gen,
demux_yuv4mpeg2_t *this = (demux_yuv4mpeg2_t *) this_gen;
- if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) {
+ if (INPUT_IS_SEEKABLE(this->input)) {
/* YUV4MPEG2 files are essentially constant bit-rate video. Seek along
* the calculated frame boundaries. Divide the requested seek offset
@@ -293,7 +279,6 @@ static int demux_yuv4mpeg2_seek (demux_plugin_t *this_gen,
}
static void demux_yuv4mpeg2_dispose (demux_plugin_t *this_gen) {
-
demux_yuv4mpeg2_t *this = (demux_yuv4mpeg2_t *) this_gen;
free(this);
@@ -306,7 +291,6 @@ static int demux_yuv4mpeg2_get_status (demux_plugin_t *this_gen) {
}
static int demux_yuv4mpeg2_get_stream_length (demux_plugin_t *this_gen) {
-
demux_yuv4mpeg2_t *this = (demux_yuv4mpeg2_t *) this_gen;
return (int)((int64_t) this->data_size * 1000 /
@@ -323,9 +307,8 @@ static int demux_yuv4mpeg2_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_yuv4mpeg2_t *this;
this = xine_xmalloc (sizeof (demux_yuv4mpeg2_t));
@@ -376,8 +359,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;
}
@@ -398,19 +379,15 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_yuv4mpeg2_class_t *this = (demux_yuv4mpeg2_class_t *) this_gen;
free (this);
}
static void *init_plugin (xine_t *xine, void *data) {
-
demux_yuv4mpeg2_class_t *this;
- this = xine_xmalloc (sizeof (demux_yuv4mpeg2_class_t));
- this->config = xine->config;
- this->xine = xine;
+ this = xine_xmalloc (sizeof (demux_yuv4mpeg2_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;
diff --git a/src/demuxers/demux_yuv_frames.c b/src/demuxers/demux_yuv_frames.c
index f10dbd4cb..3a09ebafb 100644
--- a/src/demuxers/demux_yuv_frames.c
+++ b/src/demuxers/demux_yuv_frames.c
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2003 the xine project
* Copyright (C) 2003 Jeroen Asselman <j.asselman@itsec-ps.nl>
*
@@ -17,11 +17,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_yuv_frames.c,v 1.6 2003/06/16 16:42:51 holstsn Exp $
+ */
+
+/*
+ * $Id: demux_yuv_frames.c,v 1.7 2003/07/16 00:52:46 andruil Exp $
*
* dummy demultiplexer for raw yuv frames (delivered by v4l)
- *
*/
#ifdef HAVE_CONFIG_H
@@ -34,41 +35,32 @@
#include <string.h>
#include <stdlib.h>
+/********** logging **********/
+#define LOG_MODULE "demux_yuv_frames"
+/* #define LOG_VERBOSE */
+/* #define LOG */
+
#include "xine_internal.h"
#include "xineutils.h"
#include "demux.h"
#define WRAP_THRESHOLD 20000
-#define PLUGIN "demux_yuv_frames"
-/*
-#define LOG
-*/
-
typedef struct demux_yuv_frames_s {
demux_plugin_t demux_plugin;
xine_stream_t *stream;
-
fifo_buffer_t *audio_fifo;
fifo_buffer_t *video_fifo;
-
input_plugin_t *input;
-
int status;
- int seek_flag;
+
+ int seek_flag;
int64_t last_pts;
-
} demux_yuv_frames_t ;
typedef struct {
-
demux_class_t demux_class;
-
- /* class-wide, global variables here */
-
- xine_t *xine;
- config_values_t *config;
} demux_yuv_frames_class_t;
@@ -78,84 +70,73 @@ static int demux_yuv_frames_get_status (demux_plugin_t *this_gen) {
return this->status;
}
-static int switch_buf(demux_yuv_frames_t *this , buf_element_t *buf)
-{
- int result = 0;
-
- if (!buf)
- return 0;
-
- if (this->seek_flag) {
- this->seek_flag = 0;
- xine_demux_control_newpts(this->stream, buf->pts, BUF_FLAG_SEEK);
- } else
- if (abs(this->last_pts - buf->pts) > WRAP_THRESHOLD) {
- xine_demux_control_newpts(this->stream, buf->pts, 0);
- }
-
- this->last_pts = buf->pts;
-
- switch (buf->type) {
- case BUF_VIDEO_YUV_FRAMES:
- this->video_fifo->put(this->video_fifo, buf);
- result = 1; /* 1, we still should read audio */
- break;
- case BUF_AUDIO_RAWPCM:
- if (!this->stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO])
- xine_demux_control_newpts(this->stream, buf->pts, 0);
-
- this->audio_fifo->put(this->audio_fifo, buf);
- break;
- default:
-#ifdef LOG
- printf ("demux_yuv_frames: help, unknown buffer type %08x\n",
- buf->type);
-#endif
- buf->free_buffer(buf);
- }
+static int switch_buf(demux_yuv_frames_t *this , buf_element_t *buf){
+ int result = 0;
+
+ if (!buf)
+ return 0;
- return result;
+ if (this->seek_flag) {
+ this->seek_flag = 0;
+ xine_demux_control_newpts(this->stream, buf->pts, BUF_FLAG_SEEK);
+ } else if (abs(this->last_pts - buf->pts) > WRAP_THRESHOLD) {
+ xine_demux_control_newpts(this->stream, buf->pts, 0);
+ }
+
+ this->last_pts = buf->pts;
+
+ switch (buf->type) {
+ case BUF_VIDEO_YUV_FRAMES:
+ this->video_fifo->put(this->video_fifo, buf);
+ result = 1; /* 1, we still should read audio */
+ break;
+ case BUF_AUDIO_RAWPCM:
+ if (!this->stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO])
+ xine_demux_control_newpts(this->stream, buf->pts, 0);
+ this->audio_fifo->put(this->audio_fifo, buf);
+ break;
+ default:
+ lprintf ("dhelp, unknown buffer type %08x\n", buf->type);
+ buf->free_buffer(buf);
+ }
+
+ return result;
}
-static int demux_yuv_frames_send_chunk (demux_plugin_t *this_gen)
-{
- demux_yuv_frames_t *this = (demux_yuv_frames_t *) this_gen;
- buf_element_t *buf;
- int first = 1;
-
- do {
- if ( this->stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO])
- buf = this->input->read_block (this->input, this->video_fifo, 0);
- else
- buf = this->input->read_block (this->input, this->audio_fifo, 0);
-
- } while (switch_buf(this, buf));
-
- return this->status;
+static int demux_yuv_frames_send_chunk (demux_plugin_t *this_gen){
+ demux_yuv_frames_t *this = (demux_yuv_frames_t *) this_gen;
+ buf_element_t *buf;
+
+ do {
+ if ( this->stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO])
+ buf = this->input->read_block (this->input, this->video_fifo, 0);
+ else
+ buf = this->input->read_block (this->input, this->audio_fifo, 0);
+ } while (switch_buf(this, buf));
+
+ return this->status;
}
-static void demux_yuv_frames_send_headers (demux_plugin_t *this_gen)
-{
- demux_yuv_frames_t *this = (demux_yuv_frames_t *) this_gen;
- this->video_fifo = this->stream->video_fifo;
- this->audio_fifo = this->stream->audio_fifo;
-
- this->status = DEMUX_OK;
+static void demux_yuv_frames_send_headers (demux_plugin_t *this_gen){
+ demux_yuv_frames_t *this = (demux_yuv_frames_t *) this_gen;
+
+ this->video_fifo = this->stream->video_fifo;
+ this->audio_fifo = this->stream->audio_fifo;
+
+ this->status = DEMUX_OK;
}
static int demux_yuv_frames_seek (demux_plugin_t *this_gen,
off_t start_pos, int start_time) {
+ demux_yuv_frames_t *this = (demux_yuv_frames_t *) this_gen;
- demux_yuv_frames_t *this = (demux_yuv_frames_t *) this_gen;
this->seek_flag = 1;
- this->last_pts = 0;
+ this->last_pts = 0;
return this->status;
}
static int demux_yuv_frames_get_stream_length (demux_plugin_t *this_gen) {
-
/* demux_yuv_frames_t *this = (demux_yuv_frames_t *) this_gen; */
-
return 0;
}
@@ -169,16 +150,15 @@ static int demux_yuv_frames_get_optional_data(demux_plugin_t *this_gen,
}
static void demux_yuv_frames_dispose (demux_plugin_t *this_gen) {
-
- demux_yuv_frames_t *this = (demux_yuv_frames_t *) this_gen;
+ demux_yuv_frames_t *this = (demux_yuv_frames_t *) this_gen;
free (this);
}
-static demux_plugin_t *open_plugin (demux_class_t *class_gen,
- xine_stream_t *stream,
+static demux_plugin_t *open_plugin (demux_class_t *class_gen,
+ xine_stream_t *stream,
input_plugin_t *input) {
-
+
demux_yuv_frames_t *this;
switch (stream->content_detection_method) {
@@ -188,9 +168,8 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
break;
case METHOD_BY_EXTENSION: {
-
char *mrl;
-
+
mrl = input->get_mrl (input);
if (strncmp (mrl, "v4l:/", 5))
@@ -205,9 +184,8 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
default:
return NULL;
}
-#ifdef LOG
- printf ("demux_yuv_frames: input accepted.\n");
-#endif
+ lprintf ("demux_yuv_frames: input accepted.\n");
+
/*
* if we reach this point, the input has been accepted.
*/
@@ -227,22 +205,22 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
this->demux_plugin.get_capabilities = demux_yuv_frames_get_capabilities;
this->demux_plugin.get_optional_data = demux_yuv_frames_get_optional_data;
this->demux_plugin.demux_class = class_gen;
-
+
this->status = DEMUX_FINISHED;
-
+
return &this->demux_plugin;
}
/*
- * ogg demuxer class
+ * demuxer class
*/
static char *get_description (demux_class_t *this_gen) {
return "YUV frames dummy demux plugin";
}
-
+
static char *get_identifier (demux_class_t *this_gen) {
return "YUV_FRAMES";
}
@@ -256,19 +234,15 @@ static char *get_mimetypes (demux_class_t *this_gen) {
}
static void class_dispose (demux_class_t *this_gen) {
-
demux_yuv_frames_class_t *this = (demux_yuv_frames_class_t *) this_gen;
free (this);
}
static void *init_class (xine_t *xine, void *data) {
-
demux_yuv_frames_class_t *this;
-
- this = xine_xmalloc (sizeof (demux_yuv_frames_class_t));
- this->config = xine->config;
- this->xine = xine;
+
+ this = xine_xmalloc (sizeof (demux_yuv_frames_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;
@@ -285,7 +259,7 @@ static void *init_class (xine_t *xine, void *data) {
*/
plugin_info_t xine_plugin_info[] = {
- /* type, API, "name", version, special_info, init_function */
+ /* type, API, "name", version, special_info, init_function */
{ PLUGIN_DEMUX, 21, "yuv_frames", XINE_VERSION_CODE, NULL, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
@@ -293,4 +267,3 @@ plugin_info_t xine_plugin_info[] = {
/*
* vim:sw=3:sts=3:
*/
-