summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2002-06-07 02:40:46 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2002-06-07 02:40:46 +0000
commiteb4a0ced215a63478a1a941f0eecc61413eef44e (patch)
tree43490b4fc242eef9589aabc8248af5aa5854fde9
parent387d398d4c96bfe17ee38452795aeccd67e5d048 (diff)
downloadxine-lib-eb4a0ced215a63478a1a941f0eecc61413eef44e.tar.gz
xine-lib-eb4a0ced215a63478a1a941f0eecc61413eef44e.tar.bz2
- demuxer cleanup (helper functions)
- endianness fixes/cleanups (fix asf demuxer/audio for bigendian) - xine_waveformatex - increased demuxer plugin version CVS patchset: 2028 CVS date: 2002/06/07 02:40:46
-rw-r--r--src/demuxers/demux.h6
-rw-r--r--src/demuxers/demux_asf.c69
-rw-r--r--src/demuxers/demux_avi.c106
-rw-r--r--src/demuxers/demux_cda.c44
-rw-r--r--src/demuxers/demux_elem.c45
-rw-r--r--src/demuxers/demux_film.c57
-rw-r--r--src/demuxers/demux_mpeg.c60
-rw-r--r--src/demuxers/demux_mpeg_block.c75
-rw-r--r--src/demuxers/demux_mpgaudio.c59
-rw-r--r--src/demuxers/demux_ogg.c61
-rw-r--r--src/demuxers/demux_pes.c60
-rw-r--r--src/demuxers/demux_qt.c89
-rw-r--r--src/demuxers/demux_roq.c53
-rw-r--r--src/demuxers/demux_ts.c61
-rw-r--r--src/libffmpeg/xine_decoder.c27
-rw-r--r--src/xine-engine/Makefile.am2
-rw-r--r--src/xine-engine/buffer.h26
-rw-r--r--src/xine-engine/buffer_types.c227
-rw-r--r--src/xine-engine/demux.c111
-rw-r--r--src/xine-engine/xine.c32
-rw-r--r--src/xine-engine/xine_internal.h16
21 files changed, 417 insertions, 869 deletions
diff --git a/src/demuxers/demux.h b/src/demuxers/demux.h
index 873ef0dea..ed52a9d52 100644
--- a/src/demuxers/demux.h
+++ b/src/demuxers/demux.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux.h,v 1.15 2002/05/25 19:19:16 siggi Exp $
+ * $Id: demux.h,v 1.16 2002/06/07 02:40:46 miguelfreitas Exp $
*/
#ifndef HAVE_DEMUX_H
@@ -35,7 +35,7 @@ extern "C" {
#include "input_plugin.h"
#endif
-#define DEMUXER_PLUGIN_IFACE_VERSION 8
+#define DEMUXER_PLUGIN_IFACE_VERSION 9
#define DEMUX_OK 0
#define DEMUX_FINISHED 1
@@ -156,7 +156,7 @@ struct demux_plugin_s
*
* demux_plugin_t *init_demux_plugin (int iface_version, xine_t *xine);
*/
-
+
#ifdef __cplusplus
}
#endif
diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c
index 2625eb02b..eb5bada79 100644
--- a/src/demuxers/demux_asf.c
+++ b/src/demuxers/demux_asf.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_asf.c,v 1.42 2002/06/03 16:20:35 miguelfreitas Exp $
+ * $Id: demux_asf.c,v 1.43 2002/06/07 02:40:46 miguelfreitas Exp $
*
* demultiplexer for asf streams
*
@@ -324,7 +324,7 @@ static void get_str16_nolen(demux_asf_t *this, int len,
static void asf_send_audio_header (demux_asf_t *this, int stream_id) {
buf_element_t *buf;
- WAVEFORMATEX *wavex = (WAVEFORMATEX *) this->wavex ;
+ xine_waveformatex *wavex = (xine_waveformatex *) this->wavex ;
if (!this->audio_fifo)
return;
@@ -383,7 +383,7 @@ static void asf_send_video_header (demux_asf_t *this, int stream_id) {
xine_bmiheader *bih = (xine_bmiheader *) this->bih;
this->streams[this->num_streams].buf_type =
- fourcc_to_buf_video((void*)&bih->biCompression);
+ fourcc_to_buf_video(bih->biCompression);
if( !this->streams[this->num_streams].buf_type ) {
printf ("demux_asf: unknown video format %.4s\n",
@@ -495,6 +495,7 @@ static int asf_read_header (demux_asf_t *this) {
uint8_t buffer[6];
this->input->read (this->input, (uint8_t *) this->wavex, total_size);
+ xine_waveformatex_le2me( (xine_waveformatex *) this->wavex );
/*
printf ("total size: %d bytes\n", total_size);
@@ -672,20 +673,7 @@ static void hexdump (unsigned char *data, int len, xine_t *xine) {
static void asf_send_discontinuity (demux_asf_t *this, int64_t pts) {
- buf_element_t *buf;
-
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = pts;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = pts;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
-
+ xine_demux_control_newpts(this->xine, pts, 0);
}
@@ -1122,8 +1110,7 @@ static void asf_read_packet(demux_asf_t *this) {
*/
static void *demux_asf_loop (void *this_gen) {
- buf_element_t *buf;
-
+
demux_asf_t *this = (demux_asf_t *) this_gen;
printf ("demux_asf: demux loop starting...\n");
@@ -1161,18 +1148,7 @@ static void *demux_asf_loop (void *this_gen) {
this->status = DEMUX_FINISHED;
if (this->send_end_buffers) {
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM; /* stream finished */
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM; /* stream finished */
- this->audio_fifo->put (this->audio_fifo, buf);
- }
-
+ xine_demux_control_end(this->xine, BUF_FLAG_END_STREAM);
}
this->thread_running = 0;
@@ -1193,7 +1169,6 @@ static void demux_asf_close (demux_plugin_t *this_gen) {
static void demux_asf_stop (demux_plugin_t *this_gen) {
demux_asf_t *this = (demux_asf_t *) this_gen;
- buf_element_t *buf;
int i;
void *p;
@@ -1211,19 +1186,9 @@ static void demux_asf_stop (demux_plugin_t *this_gen) {
pthread_mutex_unlock( &this->mutex );
pthread_join (this->thread, &p);
- xine_flush_engine(this->xine);
-
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER;
- this->video_fifo->put (this->video_fifo, buf);
+ xine_demux_flush_engine(this->xine);
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_end(this->xine, BUF_FLAG_END_USER);
for (i=0; i<this->num_streams; i++) {
if( this->streams[i].buffer ) {
@@ -1245,7 +1210,6 @@ static int demux_asf_start (demux_plugin_t *this_gen,
off_t start_pos, int start_time) {
demux_asf_t *this = (demux_asf_t *) this_gen;
- buf_element_t *buf;
int err;
int status;
@@ -1260,16 +1224,7 @@ static int demux_asf_start (demux_plugin_t *this_gen,
/*
* send start buffer
*/
-
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_START;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_START;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_start(this->xine);
/*
* initialize asf engine
@@ -1302,7 +1257,7 @@ static int demux_asf_start (demux_plugin_t *this_gen,
}
}
else {
- xine_flush_engine(this->xine);
+ xine_demux_flush_engine(this->xine);
}
if( this->status == DEMUX_OK ) {
@@ -1446,7 +1401,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_asf_t *this;
- if (iface != 8) {
+ if (iface != 9) {
printf ("demux_asf: plugin doesn't support plugin API version %d.\n"
" this means there's a version mismatch between xine and this "
" demuxer plugin.\nInstalling current demux plugins should help.\n",
diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c
index 68c45da3c..b41b88555 100644
--- a/src/demuxers/demux_avi.c
+++ b/src/demuxers/demux_avi.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_avi.c,v 1.92 2002/06/03 16:20:36 miguelfreitas Exp $
+ * $Id: demux_avi.c,v 1.93 2002/06/07 02:40:46 miguelfreitas Exp $
*
* demultiplexer for avi streams
*
@@ -119,16 +119,12 @@ typedef struct
uint32_t audio_type; /* BUF_AUDIO_xxx type */
- long a_fmt; /* Audio format, see #defines below */
- long a_chans; /* Audio channels, 0 for no audio */
- long a_rate; /* Rate in Hz */
- long a_bits; /* bits per audio sample */
long audio_strn; /* Audio stream number */
char audio_tag[4]; /* Tag of audio data */
long audio_posc; /* Audio position: chunk */
long audio_posb; /* Audio position: byte within chunk */
- char *wavex;
+ xine_waveformatex *wavex;
int wavex_len;
audio_index_t audio_idx;
@@ -524,7 +520,8 @@ do { \
static int avi_sampsize(avi_t *AVI, int track)
{
int s;
- s = ((AVI->audio[track]->a_bits+7)/8)*AVI->audio[track]->a_chans;
+ s = ((AVI->audio[track]->wavex->wBitsPerSample+7)/8)*
+ AVI->audio[track]->wavex->nChannels;
if (s==0)
s=1; /* avoid possible zero divisions */
return s;
@@ -744,14 +741,11 @@ static avi_t *AVI_init(demux_avi_t *this) {
} else if(lasttag == 2) {
- AVI->audio[AVI->n_audio-1]->wavex=malloc(n);
- memcpy(AVI->audio[AVI->n_audio-1]->wavex, hdrl_data+i, n);
+ AVI->audio[AVI->n_audio-1]->wavex=(xine_waveformatex *)malloc(n);
AVI->audio[AVI->n_audio-1]->wavex_len=n;
- AVI->audio[AVI->n_audio-1]->a_fmt = str2ushort(hdrl_data+i );
- AVI->audio[AVI->n_audio-1]->a_chans = str2ushort(hdrl_data+i+2);
- AVI->audio[AVI->n_audio-1]->a_rate = str2ulong (hdrl_data+i+4);
- AVI->audio[AVI->n_audio-1]->a_bits = str2ushort(hdrl_data+i+14);
-
+
+ memcpy((void *)AVI->audio[AVI->n_audio-1]->wavex, hdrl_data+i, n);
+ xine_waveformatex_le2me( AVI->audio[AVI->n_audio-1]->wavex );
auds_strf_seen = 1;
}
lasttag = 0;
@@ -781,7 +775,7 @@ static avi_t *AVI_init(demux_avi_t *this) {
for(i = 0; i < AVI->n_audio; i++) {
/* Audio tag is set to "99wb" if no audio present */
- if(!AVI->audio[i]->a_chans) AVI->audio[i]->audio_strn = 99;
+ if(!AVI->audio[i]->wavex->nChannels) AVI->audio[i]->audio_strn = 99;
AVI->audio[i]->audio_tag[0] = AVI->audio[i]->audio_strn/10 + '0';
AVI->audio[i]->audio_tag[1] = AVI->audio[i]->audio_strn%10 + '0';
@@ -1059,9 +1053,9 @@ static int demux_avi_next (demux_avi_t *this) {
buf->input_time = 0;
buf->type = audio->audio_type | i;
- buf->decoder_info[1] = audio->a_rate; /* audio Rate */
- buf->decoder_info[2] = audio->a_bits; /* audio bits */
- buf->decoder_info[3] = audio->a_chans; /* audio channels */
+ buf->decoder_info[1] = audio->wavex->nSamplesPerSec; /* audio Rate */
+ buf->decoder_info[2] = audio->wavex->wBitsPerSample; /* audio bits */
+ buf->decoder_info[3] = audio->wavex->nChannels; /* audio channels */
if(this->audio_fifo) {
this->audio_fifo->put (this->audio_fifo, buf);
@@ -1124,8 +1118,6 @@ static int demux_avi_next (demux_avi_t *this) {
}
static void *demux_avi_loop (void *this_gen) {
- buf_element_t *buf = NULL;
-
demux_avi_t *this = (demux_avi_t *) this_gen;
pthread_mutex_lock( &this->mutex );
@@ -1155,17 +1147,7 @@ static void *demux_avi_loop (void *this_gen) {
} while( this->status == DEMUX_OK );
if (this->send_end_buffers) {
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_end(this->xine, BUF_FLAG_END_STREAM);
}
printf ("demux_avi: demux loop finished.\n");
@@ -1181,7 +1163,6 @@ static void *demux_avi_loop (void *this_gen) {
static void demux_avi_stop (demux_plugin_t *this_gen) {
demux_avi_t *this = (demux_avi_t *) this_gen;
- buf_element_t *buf;
void *p;
pthread_mutex_lock( &this->mutex );
@@ -1198,24 +1179,13 @@ static void demux_avi_stop (demux_plugin_t *this_gen) {
pthread_mutex_unlock( &this->mutex );
pthread_join (this->thread, &p);
- xine_flush_engine(this->xine);
+ xine_demux_flush_engine(this->xine);
/*
AVI_close (this->avi);
this->avi = NULL;
*/
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER; /* user finished */
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER; /* user finished */
- this->audio_fifo->put (this->audio_fifo, buf);
- }
-
+ xine_demux_control_end(this->xine, BUF_FLAG_END_USER);
}
static void demux_avi_close (demux_plugin_t *this_gen) {
@@ -1261,22 +1231,22 @@ static int demux_avi_start (demux_plugin_t *this_gen,
this->avi->width, this->avi->height);
for(i=0; i < this->avi->n_audio; i++)
xine_log (this->xine, XINE_LOG_FORMAT, _("demux_avi: audio format[%d] = 0x%lx\n"),
- i, this->avi->audio[i]->a_fmt);
+ i, this->avi->audio[i]->wavex->wFormatTag);
this->no_audio = 0;
for(i=0; i < this->avi->n_audio; i++) {
- this->avi->audio[i]->audio_type = formattag_to_buf_audio (this->avi->audio[i]->a_fmt);
+ this->avi->audio[i]->audio_type = formattag_to_buf_audio (this->avi->audio[i]->wavex->wFormatTag);
if( !this->avi->audio[i]->audio_type ) {
xine_log (this->xine, XINE_LOG_FORMAT, _("demux_avi: unknown audio type 0x%lx\n"),
- this->avi->audio[i]->a_fmt);
+ this->avi->audio[i]->wavex->wFormatTag);
this->no_audio = 1;
this->avi->audio[i]->audio_type = BUF_CONTROL_NOP;
}
else
xine_log (this->xine, XINE_LOG_FORMAT, _("demux_avi: audio type %s (wFormatTag 0x%x)\n"),
buf_audio_name(this->avi->audio[i]->audio_type),
- (int)this->avi->audio[i]->a_fmt);
+ (int)this->avi->audio[i]->wavex->wFormatTag);
}
}
@@ -1367,34 +1337,14 @@ static int demux_avi_start (demux_plugin_t *this_gen,
* send start buffers
*/
if( !this->thread_running && (this->status == DEMUX_OK) ) {
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_START;
- buf->decoder_flags = 0;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_START;
- buf->decoder_flags = 0;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_start(this->xine);
} else {
- xine_flush_engine(this->xine);
+ xine_demux_flush_engine(this->xine);
}
if( this->status == DEMUX_OK )
{
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = video_pts;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = video_pts;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_newpts(this->xine, video_pts, 0);
}
if( !this->thread_running && (this->status == DEMUX_OK) ) {
@@ -1405,10 +1355,10 @@ static int demux_avi_start (demux_plugin_t *this_gen,
memcpy (buf->content, &this->avi->bih, sizeof (this->avi->bih));
buf->size = sizeof (this->avi->bih);
- this->avi->video_type = fourcc_to_buf_video((void*)&this->avi->bih.biCompression);
+ this->avi->video_type = fourcc_to_buf_video(this->avi->bih.biCompression);
if( !this->avi->video_type )
- this->avi->video_type = fourcc_to_buf_video((void*)&this->avi->compressor);
+ this->avi->video_type = fourcc_to_buf_video(*(uint32_t *)this->avi->compressor);
if ( !this->avi->video_type ) {
xine_log (this->xine, XINE_LOG_FORMAT, _("demux_avi: unknown video codec '%.4s'\n"),
@@ -1434,9 +1384,9 @@ static int demux_avi_start (demux_plugin_t *this_gen,
buf->size = a->wavex_len;
buf->type = a->audio_type | i;
buf->decoder_info[0] = 0; /* first package, containing wavex */
- buf->decoder_info[1] = a->a_rate; /* Audio Rate */
- buf->decoder_info[2] = a->a_bits; /* Audio bits */
- buf->decoder_info[3] = a->a_chans; /* Audio bits */
+ buf->decoder_info[1] = a->wavex->nSamplesPerSec; /* Audio Rate */
+ buf->decoder_info[2] = a->wavex->wBitsPerSample; /* Audio bits */
+ buf->decoder_info[3] = a->wavex->nChannels; /* Audio bits */
this->audio_fifo->put (this->audio_fifo, buf);
}
}
@@ -1603,7 +1553,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_avi_t *this;
- if (iface != 8) {
+ if (iface != 9) {
xine_log (xine, XINE_LOG_PLUGIN,
_("demux_avi: this plugin doesn't support plugin API version %d.\n"
"demux_avi: this means there's a version mismatch between xine and this "
diff --git a/src/demuxers/demux_cda.c b/src/demuxers/demux_cda.c
index 22f12c29d..8b0665a19 100644
--- a/src/demuxers/demux_cda.c
+++ b/src/demuxers/demux_cda.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_cda.c,v 1.18 2002/05/27 11:01:04 guenter Exp $
+ * $Id: demux_cda.c,v 1.19 2002/06/07 02:40:46 miguelfreitas Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -90,7 +90,6 @@ static int demux_cda_next (demux_cda_t *this) {
*/
static void *demux_cda_loop (void *this_gen) {
demux_cda_t *this = (demux_cda_t *) this_gen;
- buf_element_t *buf;
pthread_mutex_lock( &this->mutex );
/* do-while needed to seek after demux finished */
@@ -121,17 +120,7 @@ static void *demux_cda_loop (void *this_gen) {
this->status = DEMUX_FINISHED;
if (this->send_end_buffers) {
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM; /* stream finished */
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM; /* stream finished */
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_end(this->xine, BUF_FLAG_END_STREAM);
}
this->thread_running = 0;
@@ -145,7 +134,6 @@ static void *demux_cda_loop (void *this_gen) {
*/
static void demux_cda_stop (demux_plugin_t *this_gen) {
demux_cda_t *this = (demux_cda_t *) this_gen;
- buf_element_t *buf;
void *p;
pthread_mutex_lock( &this->mutex );
@@ -164,20 +152,9 @@ static void demux_cda_stop (demux_plugin_t *this_gen) {
pthread_mutex_unlock( &this->mutex );
pthread_join (this->thread, &p);
- xine_flush_engine(this->xine);
-
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER; /* user finished */
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER; /* user finished */
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_flush_engine(this->xine);
+ xine_demux_control_end(this->xine, BUF_FLAG_END_USER);
}
/*
@@ -197,7 +174,6 @@ static int demux_cda_start (demux_plugin_t *this_gen,
fifo_buffer_t *audio_fifo,
off_t start_pos, int start_time) {
demux_cda_t *this = (demux_cda_t *) this_gen;
- buf_element_t *buf;
int err;
int status;
@@ -211,15 +187,7 @@ static int demux_cda_start (demux_plugin_t *this_gen,
this->video_fifo = video_fifo;
this->audio_fifo = audio_fifo;
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_START;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_START;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_start(this->xine);
}
/*
@@ -325,7 +293,7 @@ static int demux_cda_get_stream_length (demux_plugin_t *this_gen) {
demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_cda_t *this;
- if (iface != 8) {
+ if (iface != 9) {
printf ("demux_cda: plugin doesn't support plugin API version %d.\n"
" this means there's a version mismatch between xine and this "
" demuxer plugin.\nInstalling current demux plugins should help.\n",
diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c
index 015fe655b..ad37e2a85 100644
--- a/src/demuxers/demux_elem.c
+++ b/src/demuxers/demux_elem.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_elem.c,v 1.45 2002/05/27 11:01:04 guenter Exp $
+ * $Id: demux_elem.c,v 1.46 2002/06/07 02:40:46 miguelfreitas Exp $
*
* demultiplexer for elementary mpeg streams
*
@@ -104,7 +104,6 @@ static int demux_mpeg_elem_next (demux_mpeg_elem_t *this, int preview_mode) {
*
*/
static void *demux_mpeg_elem_loop (void *this_gen) {
- buf_element_t *buf = NULL;
demux_mpeg_elem_t *this = (demux_mpeg_elem_t *) this_gen;
pthread_mutex_lock( &this->mutex );
@@ -135,17 +134,7 @@ static void *demux_mpeg_elem_loop (void *this_gen) {
this->status = DEMUX_FINISHED;
if (this->send_end_buffers) {
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM; /* stream finished */
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM; /* stream finished */
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_end(this->xine, BUF_FLAG_END_STREAM);
}
printf ("demux_elem: demux loop finished.\n");
@@ -162,7 +151,6 @@ static void *demux_mpeg_elem_loop (void *this_gen) {
static void demux_mpeg_elem_stop (demux_plugin_t *this_gen) {
demux_mpeg_elem_t *this = (demux_mpeg_elem_t *) this_gen;
- buf_element_t *buf = NULL;
void *p;
pthread_mutex_lock( &this->mutex );
@@ -179,19 +167,9 @@ static void demux_mpeg_elem_stop (demux_plugin_t *this_gen) {
pthread_mutex_unlock( &this->mutex );
pthread_join (this->thread, &p);
- xine_flush_engine(this->xine);
+ xine_demux_flush_engine(this->xine);
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_end(this->xine, BUF_FLAG_END_USER);
}
/*
@@ -212,7 +190,6 @@ static int demux_mpeg_elem_start (demux_plugin_t *this_gen,
off_t start_pos, int start_time) {
demux_mpeg_elem_t *this = (demux_mpeg_elem_t *) this_gen;
- buf_element_t *buf;
int err;
int status;
@@ -228,15 +205,7 @@ static int demux_mpeg_elem_start (demux_plugin_t *this_gen,
if (!this->blocksize)
this->blocksize = 2048;
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_START;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_START;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_start(this->xine);
if((this->input->get_capabilities(this->input) & INPUT_CAP_PREVIEW) != 0) {
int num_buffers = NUM_PREVIEW_BUFFERS;
@@ -250,7 +219,7 @@ static int demux_mpeg_elem_start (demux_plugin_t *this_gen,
}
}
} else {
- xine_flush_engine(this->xine);
+ xine_demux_flush_engine(this->xine);
}
if((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) != 0) {
@@ -397,7 +366,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_mpeg_elem_t *this;
- if (iface != 8) {
+ if (iface != 9) {
printf ("demux_elem: plugin doesn't support plugin API version %d.\n"
" this means there's a version mismatch between xine and this "
" demuxer plugin.\nInstalling current demux plugins should help.\n",
diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c
index d86381bc0..47ee5a753 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.9 2002/06/03 18:13:33 miguelfreitas Exp $
+ * $Id: demux_film.c,v 1.10 2002/06/07 02:40:47 miguelfreitas Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -270,21 +270,10 @@ static void *demux_film_loop (void *this_gen) {
* must be time to send a new pts */
if (this->last_sample + 1 != this->current_sample) {
printf ("************ sending new pts\n");
- xine_flush_engine(this->xine);
+ xine_demux_flush_engine(this->xine);
/* send new pts */
- if (this->video_fifo) {
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = this->sample_table[i].pts;
- this->video_fifo->put (this->video_fifo, buf);
- }
- if (this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = this->sample_table[i].pts;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_newpts(this->xine, this->sample_table[i].pts, 0);
/* reset last_frame_pts on seek */
last_frame_pts = 0;
@@ -464,17 +453,7 @@ printf ("************ sending new pts\n");
this->status = DEMUX_FINISHED;
if (this->send_end_buffers) {
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM; /* stream finished */
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM; /* stream finished */
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_end(this->xine, BUF_FLAG_END_STREAM);
}
this->thread_running = 0;
@@ -605,16 +584,7 @@ static int demux_film_start (demux_plugin_t *this_gen,
(this->audio_channels == 1) ? "monaural" : "stereo");
/* send start buffers */
- if (this->video_fifo) {
- buf = this->video_fifo->buffer_pool_alloc(this->video_fifo);
- buf->type = BUF_CONTROL_START;
- this->video_fifo->put(this->video_fifo, buf);
- }
- if (this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo);
- buf->type = BUF_CONTROL_START;
- this->audio_fifo->put(this->audio_fifo, buf);
- }
+ xine_demux_control_start(this->xine);
/* send init info to decoders */
if (this->video_fifo && this->video_type) {
@@ -706,7 +676,6 @@ printf ("actual new index = %d\n", this->current_sample);
static void demux_film_stop (demux_plugin_t *this_gen) {
demux_film_t *this = (demux_film_t *) this_gen;
- buf_element_t *buf;
void *p;
pthread_mutex_lock( &this->mutex );
@@ -722,19 +691,9 @@ static void demux_film_stop (demux_plugin_t *this_gen) {
pthread_mutex_unlock( &this->mutex );
pthread_join (this->thread, &p);
- xine_flush_engine(this->xine);
-
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER; /* user finished */
- this->video_fifo->put (this->video_fifo, buf);
+ xine_demux_flush_engine(this->xine);
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER; /* user finished */
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_end(this->xine, BUF_FLAG_END_USER);
}
static void demux_film_close (demux_plugin_t *this_gen) {
@@ -769,7 +728,7 @@ static char *demux_film_get_mimetypes(void) {
demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_film_t *this;
- if (iface != 8) {
+ if (iface != 9) {
printf ("demux_film: plugin doesn't support plugin API version %d.\n"
" this means there's a version mismatch between xine and this "
" demuxer plugin. Installing current demux plugins should help.\n",
diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c
index 12a205c24..3e66def68 100644
--- a/src/demuxers/demux_mpeg.c
+++ b/src/demuxers/demux_mpeg.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_mpeg.c,v 1.63 2002/05/25 19:19:17 siggi Exp $
+ * $Id: demux_mpeg.c,v 1.64 2002/06/07 02:40:47 miguelfreitas Exp $
*
* demultiplexer for mpeg 1/2 program streams
* reads streams of variable blocksizes
@@ -132,19 +132,7 @@ static void check_newpts( demux_mpeg_t *this, int64_t pts, int video )
if( !this->preview_mode && pts &&
(this->send_newpts || (this->last_pts[video] && abs(diff)>WRAP_THRESHOLD) ) ) {
- buf_element_t *buf;
-
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = pts;
- this->video_fifo->put (this->video_fifo, buf);
-
- if (this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = pts;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_newpts(this->xine, pts, 0);
this->send_newpts = 0;
this->last_pts[1-video] = 0;
}
@@ -669,7 +657,6 @@ static void demux_mpeg_resync (demux_mpeg_t *this, uint32_t buf) {
static void *demux_mpeg_loop (void *this_gen) {
demux_mpeg_t *this = (demux_mpeg_t *) this_gen;
- buf_element_t *buf;
uint32_t w=0;
pthread_mutex_lock( &this->mutex );
@@ -698,17 +685,7 @@ static void *demux_mpeg_loop (void *this_gen) {
} while( this->status == DEMUX_OK );
if (this->send_end_buffers) {
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_end(this->xine, BUF_FLAG_END_STREAM);
}
printf ("demux_mpeg: demux thread finished (status: %d, buf:%x)\n",
@@ -725,7 +702,6 @@ static void *demux_mpeg_loop (void *this_gen) {
static void demux_mpeg_stop (demux_plugin_t *this_gen) {
demux_mpeg_t *this = (demux_mpeg_t *) this_gen;
- buf_element_t *buf;
void *p;
pthread_mutex_lock( &this->mutex );
@@ -742,20 +718,9 @@ static void demux_mpeg_stop (demux_plugin_t *this_gen) {
pthread_mutex_unlock( &this->mutex );
pthread_join (this->thread, &p);
- xine_flush_engine(this->xine);
-
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER; /* user finished */
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER; /* user finished */
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_flush_engine(this->xine);
+ xine_demux_control_end(this->xine, BUF_FLAG_END_USER);
}
static int demux_mpeg_get_status (demux_plugin_t *this_gen) {
@@ -770,7 +735,6 @@ static int demux_mpeg_start (demux_plugin_t *this_gen,
off_t start_pos, int start_time) {
demux_mpeg_t *this = (demux_mpeg_t *) this_gen;
- buf_element_t *buf;
int err;
int status;
@@ -785,15 +749,7 @@ static int demux_mpeg_start (demux_plugin_t *this_gen,
this->last_pts[0] = 0;
this->last_pts[1] = 0;
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_START;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_START;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_start(this->xine);
if ((this->input->get_capabilities (this->input) & INPUT_CAP_PREVIEW) != 0 ) {
@@ -850,7 +806,7 @@ static int demux_mpeg_start (demux_plugin_t *this_gen,
}
}
else {
- xine_flush_engine(this->xine);
+ xine_demux_flush_engine(this->xine);
}
/* this->status is saved because we can be interrupted between
@@ -1017,7 +973,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_mpeg_t *this;
- if (iface != 8) {
+ if (iface != 9) {
printf ("demux_mpeg: plugin doesn't support plugin API version %d.\n"
" this means there's a version mismatch between xine and this "
" demuxer plugin.\nInstalling current demux plugins should help.\n",
diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c
index e213cb61f..c21468950 100644
--- a/src/demuxers/demux_mpeg_block.c
+++ b/src/demuxers/demux_mpeg_block.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_mpeg_block.c,v 1.102 2002/05/25 19:19:17 siggi Exp $
+ * $Id: demux_mpeg_block.c,v 1.103 2002/06/07 02:40:47 miguelfreitas Exp $
*
* demultiplexer for mpeg 1/2 program streams
*
@@ -124,21 +124,9 @@ static void check_newpts( demux_mpeg_block_t *this, int64_t pts, int video )
/* check if pts is outside nav pts range. any stream without nav must enter here. */
if( pts > this->nav_last_end_pts || pts < this->nav_last_start_pts )
{
- buf_element_t *buf;
-
printf("demux_mpeg_block: pts wrap detected\n" );
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = pts;
- this->video_fifo->put (this->video_fifo, buf);
-
- if (this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = pts;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_newpts(this->xine, pts, 0);
}
this->send_newpts = 0;
@@ -387,18 +375,7 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m
printf ("demux_mpeg_block: informing metronom about new start pts\n");
#endif
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = start_pts;
- this->video_fifo->put (this->video_fifo, buf);
-
- if (this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = start_pts;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
-
+ xine_demux_control_newpts(this->xine, start_pts, 0);
}
this->nav_last_end_pts = end_pts;
@@ -665,7 +642,6 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m
static void *demux_mpeg_block_loop (void *this_gen) {
- buf_element_t *buf = NULL;
demux_mpeg_block_t *this = (demux_mpeg_block_t *) this_gen;
/* printf ("demux_mpeg_block: demux loop starting...\n"); */
@@ -702,18 +678,7 @@ static void *demux_mpeg_block_loop (void *this_gen) {
this->status = DEMUX_FINISHED;
if (this->send_end_buffers) {
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
-
+ xine_demux_control_end(this->xine, BUF_FLAG_END_STREAM);
}
this->thread_running = 0;
@@ -871,7 +836,6 @@ static void demux_mpeg_block_close (demux_plugin_t *this_gen) {
static void demux_mpeg_block_stop (demux_plugin_t *this_gen) {
demux_mpeg_block_t *this = (demux_mpeg_block_t *) this_gen;
- buf_element_t *buf;
void *p;
pthread_mutex_lock( &this->mutex );
@@ -888,20 +852,9 @@ static void demux_mpeg_block_stop (demux_plugin_t *this_gen) {
pthread_mutex_unlock( &this->mutex );
pthread_join (this->thread, &p);
- xine_flush_engine(this->xine);
+ xine_demux_flush_engine(this->xine);
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER;
-
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_end(this->xine, BUF_FLAG_END_USER);
}
static int demux_mpeg_block_get_status (demux_plugin_t *this_gen) {
@@ -960,15 +913,7 @@ static int demux_mpeg_block_start (demux_plugin_t *this_gen,
* send start buffer
*/
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_START;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_START;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_start(this->xine);
if (!this->rate)
this->rate = demux_mpeg_block_estimate_rate (this);
@@ -1045,7 +990,7 @@ static int demux_mpeg_block_start (demux_plugin_t *this_gen,
}
}
else {
- xine_flush_engine(this->xine);
+ xine_demux_flush_engine(this->xine);
}
}
else {
@@ -1228,12 +1173,12 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_mpeg_block_t *this;
- if (iface != 8) {
+ if (iface != 9) {
printf ("demux_mpeg_block: plugin doesn't support plugin API version %d.\n"
" this means there's a version mismatch between xine and this "
" demuxer plugin.\nInstalling current demux plugins should help.\n",
iface);
- return NULL;
+ return NULL;
}
this = xine_xmalloc (sizeof (demux_mpeg_block_t));
diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c
index 755e92dbf..14cb93460 100644
--- a/src/demuxers/demux_mpgaudio.c
+++ b/src/demuxers/demux_mpgaudio.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_mpgaudio.c,v 1.48 2002/05/27 11:01:04 guenter Exp $
+ * $Id: demux_mpgaudio.c,v 1.49 2002/06/07 02:40:47 miguelfreitas Exp $
*
* demultiplexer for mpeg audio (i.e. mp3) streams
*
@@ -194,19 +194,7 @@ static void check_newpts( demux_mpgaudio_t *this, int64_t pts )
if( pts &&
(this->send_newpts || (this->last_pts && abs(diff)>WRAP_THRESHOLD) ) ) {
- buf_element_t *buf;
-
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = pts;
- this->video_fifo->put (this->video_fifo, buf);
-
- if (this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = pts;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_newpts(this->xine, pts, 0);
this->send_newpts = 0;
}
@@ -266,7 +254,6 @@ static int demux_mpgaudio_next (demux_mpgaudio_t *this) {
}
static void *demux_mpgaudio_loop (void *this_gen) {
- buf_element_t *buf;
demux_mpgaudio_t *this = (demux_mpgaudio_t *) this_gen;
pthread_mutex_lock( &this->mutex );
@@ -297,17 +284,7 @@ static void *demux_mpgaudio_loop (void *this_gen) {
this->status = DEMUX_FINISHED;
if (this->send_end_buffers) {
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_end(this->xine, BUF_FLAG_END_STREAM);
}
printf ("demux_mpgaudio: demux loop finished.\n");
@@ -321,7 +298,6 @@ static void *demux_mpgaudio_loop (void *this_gen) {
static void demux_mpgaudio_stop (demux_plugin_t *this_gen) {
demux_mpgaudio_t *this = (demux_mpgaudio_t *) this_gen;
- buf_element_t *buf;
void *p;
pthread_mutex_lock( &this->mutex );
@@ -338,19 +314,9 @@ static void demux_mpgaudio_stop (demux_plugin_t *this_gen) {
pthread_mutex_unlock( &this->mutex );
pthread_join (this->thread, &p);
- xine_flush_engine(this->xine);
-
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER;
- this->video_fifo->put (this->video_fifo, buf);
+ xine_demux_flush_engine(this->xine);
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_end(this->xine, BUF_FLAG_END_USER);
}
static int demux_mpgaudio_get_status (demux_plugin_t *this_gen) {
@@ -389,7 +355,6 @@ static int demux_mpgaudio_start (demux_plugin_t *this_gen,
off_t start_pos, int start_time) {
demux_mpgaudio_t *this = (demux_mpgaudio_t *) this_gen;
- buf_element_t *buf;
int err;
int status;
@@ -431,15 +396,7 @@ static int demux_mpgaudio_start (demux_plugin_t *this_gen,
this->send_newpts = 1;
if( !this->thread_running ) {
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_START;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_START;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_start(this->xine);
/*
* now start demuxing
@@ -455,7 +412,7 @@ static int demux_mpgaudio_start (demux_plugin_t *this_gen,
}
}
else {
- xine_flush_engine(this->xine);
+ xine_demux_flush_engine(this->xine);
}
/* this->status is saved because we can be interrupted between
* pthread_mutex_unlock and return
@@ -564,7 +521,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_mpgaudio_t *this;
- if (iface != 8) {
+ if (iface != 9) {
printf ("demux_mpeg: plugin doesn't support plugin API version %d.\n"
" this means there's a version mismatch between xine and this "
" demuxer plugin.\nInstalling current demux plugins should help.\n",
diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c
index 0d58126a3..1177a0ebd 100644
--- a/src/demuxers/demux_ogg.c
+++ b/src/demuxers/demux_ogg.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_ogg.c,v 1.27 2002/06/03 13:31:13 miguelfreitas Exp $
+ * $Id: demux_ogg.c,v 1.28 2002/06/07 02:40:47 miguelfreitas Exp $
*
* demultiplexer for ogg streams
*
@@ -232,7 +232,7 @@ static void demux_ogg_send_package (demux_ogg_t *this) {
oggh = (dsogg_header_t *) &op.packet[1];
- this->buf_types[stream_num] = fourcc_to_buf_video (oggh->subtype);
+ this->buf_types[stream_num] = fourcc_to_buf_video (*(uint32_t *)oggh->subtype);
#ifdef LOG
printf ("demux_ogg: subtype %.4s\n", oggh->subtype);
@@ -371,8 +371,6 @@ static void demux_ogg_send_package (demux_ogg_t *this) {
static void *demux_ogg_loop (void *this_gen) {
demux_ogg_t *this = (demux_ogg_t *) this_gen;
- buf_element_t *buf;
-
#ifdef LOG
printf ("demux_ogg: demux loop starting...\n");
#endif
@@ -409,18 +407,7 @@ static void *demux_ogg_loop (void *this_gen) {
this->status = DEMUX_FINISHED;
if (this->send_end_buffers) {
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM; /* stream finished */
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM; /* stream finished */
- this->audio_fifo->put (this->audio_fifo, buf);
- }
-
+ xine_demux_control_end(this->xine, BUF_FLAG_END_STREAM);
}
this->thread_running = 0;
@@ -440,7 +427,6 @@ static void demux_ogg_close (demux_plugin_t *this_gen) {
static void demux_ogg_stop (demux_plugin_t *this_gen) {
demux_ogg_t *this = (demux_ogg_t *) this_gen;
- buf_element_t *buf;
void *p;
pthread_mutex_lock( &this->mutex );
@@ -459,19 +445,9 @@ static void demux_ogg_stop (demux_plugin_t *this_gen) {
pthread_mutex_unlock( &this->mutex );
pthread_join (this->thread, &p);
- xine_flush_engine(this->xine);
-
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER; /* user finished */
- this->video_fifo->put (this->video_fifo, buf);
+ xine_demux_flush_engine(this->xine);
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER; /* user finished */
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_end(this->xine, BUF_FLAG_END_USER);
}
static int demux_ogg_get_status (demux_plugin_t *this_gen) {
@@ -486,7 +462,6 @@ static int demux_ogg_start (demux_plugin_t *this_gen,
off_t start_pos, int start_time) {
demux_ogg_t *this = (demux_ogg_t *) this_gen;
- buf_element_t *buf;
int err, i;
pthread_mutex_lock( &this->mutex );
@@ -500,15 +475,7 @@ static int demux_ogg_start (demux_plugin_t *this_gen,
* send start buffer
*/
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_START;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_START;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_start(this->xine);
/*
* initialize ogg engine
@@ -546,17 +513,7 @@ static int demux_ogg_start (demux_plugin_t *this_gen,
/* send a new pts */
if( this->thread_running ) {
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = start_pos / 90;
- this->video_fifo->put (this->video_fifo, buf);
-
- if (this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = start_pos / 90;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_newpts(this->xine, start_pos / 90, 0);
}
}
@@ -576,7 +533,7 @@ static int demux_ogg_start (demux_plugin_t *this_gen,
}
}
else {
- xine_flush_engine(this->xine);
+ xine_demux_flush_engine(this->xine);
err = 0;
}
@@ -688,7 +645,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_ogg_t *this;
- if (iface != 8) {
+ if (iface != 9) {
printf( _("demux_ogg: plugin doesn't support plugin API version %d.\n"
" this means there's a version mismatch between xine and this "
" demuxer plugin.\nInstalling current demux plugins should help.\n"),
diff --git a/src/demuxers/demux_pes.c b/src/demuxers/demux_pes.c
index e38a2b370..7cb96fe49 100644
--- a/src/demuxers/demux_pes.c
+++ b/src/demuxers/demux_pes.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_pes.c,v 1.30 2002/05/27 11:01:04 guenter Exp $
+ * $Id: demux_pes.c,v 1.31 2002/06/07 02:40:47 miguelfreitas Exp $
*
* demultiplexer for mpeg 2 PES (Packetized Elementary Streams)
* reads streams of variable blocksizes
@@ -116,19 +116,7 @@ static void check_newpts( demux_pes_t *this, int64_t pts )
{
if( this->send_newpts && !this->preview_mode && pts ) {
- buf_element_t *buf;
-
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = pts;
- this->video_fifo->put (this->video_fifo, buf);
-
- if (this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = pts;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_newpts(this->xine, pts, 0);
this->send_newpts = 0;
}
}
@@ -331,7 +319,6 @@ static void demux_pes_resync (demux_pes_t *this, uint32_t buf) {
static void *demux_pes_loop (void *this_gen) {
demux_pes_t *this = (demux_pes_t *) this_gen;
- buf_element_t *buf;
uint32_t w=0;
/* do-while needed to seek after demux finished */
@@ -360,17 +347,7 @@ static void *demux_pes_loop (void *this_gen) {
} while( this->status == DEMUX_OK );
if (this->send_end_buffers) {
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM; /* stream finished */
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM; /* stream finished */
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_end(this->xine, BUF_FLAG_END_STREAM);
}
printf ("demux_pes: demux loop finished (status: %d, buf:%x)\n",
@@ -386,7 +363,6 @@ static void *demux_pes_loop (void *this_gen) {
static void demux_pes_stop (demux_plugin_t *this_gen) {
demux_pes_t *this = (demux_pes_t *) this_gen;
- buf_element_t *buf;
void *p;
pthread_mutex_lock( &this->mutex );
@@ -403,20 +379,9 @@ static void demux_pes_stop (demux_plugin_t *this_gen) {
pthread_mutex_unlock( &this->mutex );
pthread_join (this->thread, &p);
- xine_flush_engine(this->xine);
-
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER; /* user finished */
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER; /* user finished */
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_flush_engine(this->xine);
+ xine_demux_control_end(this->xine, BUF_FLAG_END_USER);
}
static int demux_pes_get_status (demux_plugin_t *this_gen) {
@@ -431,7 +396,6 @@ static int demux_pes_start (demux_plugin_t *this_gen,
off_t start_pos, int start_time) {
demux_pes_t *this = (demux_pes_t *) this_gen;
- buf_element_t *buf;
int err;
int status;
@@ -445,15 +409,7 @@ static int demux_pes_start (demux_plugin_t *this_gen,
* send start buffer
*/
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_START;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_START;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_start(this->xine);
if ((this->input->get_capabilities (this->input) & INPUT_CAP_PREVIEW) != 0 ) {
@@ -506,7 +462,7 @@ static int demux_pes_start (demux_plugin_t *this_gen,
}
}
else {
- xine_flush_engine(this->xine);
+ xine_demux_flush_engine(this->xine);
}
/* this->status is saved because we can be interrupted between
@@ -648,7 +604,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_pes_t *this;
- if (iface != 8) {
+ if (iface != 9) {
printf ("demux_pes: plugin doesn't support plugin API version %d.\n"
" this means there's a version mismatch between xine and this "
" demuxer plugin.\nInstalling current demux plugins should help.\n",
diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c
index 2151e015f..ea89cfa9d 100644
--- a/src/demuxers/demux_qt.c
+++ b/src/demuxers/demux_qt.c
@@ -30,7 +30,7 @@
* build_frame_table
* free_qt_info
*
- * $Id: demux_qt.c,v 1.45 2002/06/06 22:04:48 siggi Exp $
+ * $Id: demux_qt.c,v 1.46 2002/06/07 02:40:47 miguelfreitas Exp $
*
*/
@@ -55,8 +55,8 @@
typedef unsigned int qt_atom;
-#define BE_16(x) (be2me_16(*(unsigned short *)(x)))
-#define BE_32(x) (be2me_32(*(unsigned int *)(x)))
+#define BE_16(x) (be2me_16(*(uint16_t *)(x)))
+#define BE_32(x) (be2me_32(*(uint32_t *)(x)))
#define QT_ATOM( ch0, ch1, ch2, ch3 ) \
( (long)(unsigned char)(ch3) | ( (long)(unsigned char)(ch2) << 8 ) | \
@@ -372,13 +372,13 @@ static qt_error parse_trak_atom(qt_sample_table *sample_table,
sample_table->media_description.video.height =
BE_16(&trak_atom[i + 0x2E]);
sample_table->media_description.video.codec_format =
- BE_32(&trak_atom[i + 0x10]);
+ *(uint32_t *)&trak_atom[i + 0x10];
} else if (sample_table->type == MEDIA_AUDIO) {
/* fetch audio parameters */
sample_table->media_description.audio.codec_format =
- BE_32(&trak_atom[i + 0x10]);
+ *(uint32_t *)&trak_atom[i + 0x10];
sample_table->media_description.audio.sample_rate =
BE_16(&trak_atom[i + 0x2C]);
sample_table->media_description.audio.channels = trak_atom[i + 0x25];
@@ -1021,20 +1021,10 @@ static void *demux_qt_loop (void *this_gen) {
/* if there is an incongruency between last and current sample, it
* must be time to send a new pts */
if (this->last_frame + 1 != this->current_frame) {
- xine_flush_engine(this->xine);
+ xine_demux_flush_engine(this->xine);
/* send new pts */
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = this->qt->frames[i].pts;
- this->video_fifo->put (this->video_fifo, buf);
-
- if (this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = this->qt->frames[i].pts;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_newpts(this->xine, this->qt->frames[i].pts, 0);
/* reset last_frame_pts on seek */
last_frame_pts = 0;
@@ -1143,17 +1133,7 @@ static void *demux_qt_loop (void *this_gen) {
this->status = DEMUX_FINISHED;
if (this->send_end_buffers) {
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM; /* stream finished */
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM; /* stream finished */
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_end(this->xine, BUF_FLAG_END_STREAM);
}
this->thread_running = 0;
@@ -1222,7 +1202,6 @@ static int demux_qt_start (demux_plugin_t *this_gen,
demux_qt_t *this = (demux_qt_t *) this_gen;
buf_element_t *buf;
int err;
- unsigned int le_fourcc;
pthread_mutex_lock(&this->mutex);
@@ -1246,13 +1225,10 @@ static int demux_qt_start (demux_plugin_t *this_gen,
this->bih.biWidth = this->qt->video_width;
this->bih.biHeight = this->qt->video_height;
- /* fourcc was stored in big endian, mapping routine wants machine endian */
- this->bih.biCompression = be2me_32( this->qt->video_codec );
- this->qt->video_type = fourcc_to_buf_video(&this->bih.biCompression);
+ this->bih.biCompression = this->qt->video_codec;
+ this->qt->video_type = fourcc_to_buf_video(this->bih.biCompression);
- /* fourcc was stored in opposite byte order that mapping routine wants */
- le_fourcc = bswap_32( this->qt->audio_codec );
- this->qt->audio_type = formattag_to_buf_audio(le_fourcc);
+ this->qt->audio_type = formattag_to_buf_audio(this->qt->audio_codec);
/* print vital stats */
xine_log (this->xine, XINE_LOG_FORMAT,
@@ -1263,34 +1239,26 @@ static int demux_qt_start (demux_plugin_t *this_gen,
if (this->qt->video_codec)
xine_log (this->xine, XINE_LOG_FORMAT,
_("demux_qt: '%c%c%c%c' video @ %dx%d\n"),
- (this->qt->video_codec >> 24) & 0xFF,
- (this->qt->video_codec >> 16) & 0xFF,
- (this->qt->video_codec >> 8) & 0xFF,
- (this->qt->video_codec >> 0) & 0xFF,
+ *((char *)&this->qt->video_codec + 0),
+ *((char *)&this->qt->video_codec + 1),
+ *((char *)&this->qt->video_codec + 2),
+ *((char *)&this->qt->video_codec + 3),
this->bih.biWidth,
this->bih.biHeight);
if (this->qt->audio_codec)
xine_log (this->xine, XINE_LOG_FORMAT,
_("demux_qt: '%c%c%c%c' audio @ %d Hz, %d bits, %d channel%c\n"),
- (this->qt->audio_codec >> 24) & 0xFF,
- (this->qt->audio_codec >> 16) & 0xFF,
- (this->qt->audio_codec >> 8) & 0xFF,
- (this->qt->audio_codec >> 0) & 0xFF,
+ *((char *)&this->qt->audio_codec + 0),
+ *((char *)&this->qt->audio_codec + 1),
+ *((char *)&this->qt->audio_codec + 2),
+ *((char *)&this->qt->audio_codec + 3),
this->qt->audio_sample_rate,
this->qt->audio_bits,
this->qt->audio_channels,
(this->qt->audio_channels == 1) ? 0 : 's');
/* send start buffers */
- buf = this->video_fifo->buffer_pool_alloc(this->video_fifo);
- buf->type = BUF_CONTROL_START;
- this->video_fifo->put(this->video_fifo, buf);
-
- if (this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo);
- buf->type = BUF_CONTROL_START;
- this->audio_fifo->put(this->audio_fifo, buf);
- }
+ xine_demux_control_start(this->xine);
/* send init info to decoders */
buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
@@ -1373,7 +1341,6 @@ static int demux_qt_seek (demux_plugin_t *this_gen,
static void demux_qt_stop (demux_plugin_t *this_gen) {
demux_qt_t *this = (demux_qt_t *) this_gen;
- buf_element_t *buf;
void *p;
pthread_mutex_lock( &this->mutex );
@@ -1389,19 +1356,9 @@ static void demux_qt_stop (demux_plugin_t *this_gen) {
pthread_mutex_unlock( &this->mutex );
pthread_join (this->thread, &p);
- xine_flush_engine(this->xine);
-
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER; /* user finished */
- this->video_fifo->put (this->video_fifo, buf);
+ xine_demux_flush_engine(this->xine);
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER; /* user finished */
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_end(this->xine, BUF_FLAG_END_USER);
}
static void demux_qt_close (demux_plugin_t *this_gen) {
@@ -1439,7 +1396,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_qt_t *this;
- if (iface != 8) {
+ if (iface != 9) {
printf ("demux_qt: plugin doesn't support plugin API version %d.\n"
" this means there's a version mismatch between xine and this "
" demuxer plugin.\nInstalling current demux plugins should
diff --git a/src/demuxers/demux_roq.c b/src/demuxers/demux_roq.c
index 99ef2caea..668f5ad44 100644
--- a/src/demuxers/demux_roq.c
+++ b/src/demuxers/demux_roq.c
@@ -21,7 +21,7 @@
* For more information regarding the RoQ file format, visit:
* http://www.csse.monash.edu.au/~timf/
*
- * $Id: demux_roq.c,v 1.3 2002/06/05 13:05:19 miguelfreitas Exp $
+ * $Id: demux_roq.c,v 1.4 2002/06/07 02:40:47 miguelfreitas Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -246,17 +246,7 @@ static void *demux_roq_loop (void *this_gen) {
this->status = DEMUX_FINISHED;
if (this->send_end_buffers) {
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM; /* stream finished */
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM; /* stream finished */
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_end(this->xine, BUF_FLAG_END_STREAM);
}
this->thread_running = 0;
@@ -434,26 +424,10 @@ static int demux_roq_start (demux_plugin_t *this_gen,
(this->audio_channels == 1) ? "monaural" : "stereo");
/* send start buffers */
- buf = this->video_fifo->buffer_pool_alloc(this->video_fifo);
- buf->type = BUF_CONTROL_START;
- this->video_fifo->put(this->video_fifo, buf);
- if (this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo);
- buf->type = BUF_CONTROL_START;
- this->audio_fifo->put(this->audio_fifo, buf);
- }
+ xine_demux_control_start(this->xine);
- /* send new pts (or NOP if no audio) */
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = 0;
- this->video_fifo->put (this->video_fifo, buf);
- if (this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->disc_off = 0;
- buf->type = BUF_CONTROL_NEWPTS;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ /* send new pts */
+ xine_demux_control_newpts(this->xine, 0, 0);
/* send init info to decoders */
buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
@@ -511,7 +485,6 @@ static int demux_roq_seek (demux_plugin_t *this_gen,
static void demux_roq_stop (demux_plugin_t *this_gen) {
demux_roq_t *this = (demux_roq_t *) this_gen;
- buf_element_t *buf;
void *p;
pthread_mutex_lock( &this->mutex );
@@ -527,19 +500,9 @@ static void demux_roq_stop (demux_plugin_t *this_gen) {
pthread_mutex_unlock( &this->mutex );
pthread_join (this->thread, &p);
- xine_flush_engine(this->xine);
-
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER; /* user finished */
- this->video_fifo->put (this->video_fifo, buf);
+ xine_demux_flush_engine(this->xine);
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER; /* user finished */
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_end(this->xine, BUF_FLAG_END_USER);
}
static void demux_roq_close (demux_plugin_t *this) {
@@ -569,7 +532,7 @@ static char *demux_roq_get_mimetypes(void) {
demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_roq_t *this;
- if (iface != 8) {
+ if (iface != 9) {
printf ("demux_roq: plugin doesn't support plugin API version %d.\n"
" this means there's a version mismatch between xine and this "
" demuxer plugin.\nInstalling current demux plugins should help.\n",
diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c
index 38db2e205..b775d3d4e 100644
--- a/src/demuxers/demux_ts.c
+++ b/src/demuxers/demux_ts.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_ts.c,v 1.48 2002/05/30 18:20:30 miguelfreitas Exp $
+ * $Id: demux_ts.c,v 1.49 2002/06/07 02:40:47 miguelfreitas Exp $
*
* Demultiplexer for MPEG2 Transport Streams.
*
@@ -248,19 +248,7 @@ static void check_newpts( demux_ts *this, int64_t pts )
{
if( this->send_newpts && pts ) {
- buf_element_t *buf;
-
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = pts;
- this->video_fifo->put (this->video_fifo, buf);
-
- if (this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_NEWPTS;
- buf->disc_off = pts;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_newpts(this->xine, pts, 0);
this->send_newpts = 0;
this->ignore_scr_discont = 1;
}
@@ -1325,7 +1313,6 @@ static void demux_ts_parse_packet (demux_ts *this) {
static void *demux_ts_loop(void *gen_this) {
demux_ts *this = (demux_ts *)gen_this;
- buf_element_t *buf;
int i;
pthread_mutex_lock( &this->mutex );
@@ -1366,17 +1353,7 @@ static void *demux_ts_loop(void *gen_this) {
this->status = DEMUX_FINISHED;
if (this->send_end_buffers) {
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM; /* stream finished */
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_STREAM; /* stream finished */
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_end(this->xine, BUF_FLAG_END_STREAM);
}
this->thread_running = 0;
@@ -1531,7 +1508,6 @@ static int demux_ts_start(demux_plugin_t *this_gen,
off_t start_pos, int start_time) {
demux_ts *this = (demux_ts *)this_gen;
- buf_element_t *buf;
int err;
int status;
@@ -1548,15 +1524,7 @@ static int demux_ts_start(demux_plugin_t *this_gen,
* send start buffer
*/
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_START;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_START;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_start(this->xine);
}
if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) {
@@ -1582,7 +1550,7 @@ static int demux_ts_start(demux_plugin_t *this_gen,
this->thread_running = 1;
this->scrambled_npids = 0;
- if (err = pthread_create(&this->thread, NULL, demux_ts_loop, this)) {
+ if ((err = pthread_create(&this->thread, NULL, demux_ts_loop, this)) != 0) {
LOG_MSG_STDERR(this->xine,
_("demux_ts: can't create new thread (%s)\n"),
strerror(err));
@@ -1590,7 +1558,7 @@ static int demux_ts_start(demux_plugin_t *this_gen,
}
}
else {
- xine_flush_engine(this->xine);
+ xine_demux_flush_engine(this->xine);
}
/* this->status is saved because we can be interrupted between
@@ -1612,7 +1580,6 @@ static int demux_ts_seek (demux_plugin_t *this_gen,
static void demux_ts_stop(demux_plugin_t *this_gen)
{
demux_ts *this = (demux_ts *)this_gen;
- buf_element_t *buf;
void *p;
#ifdef TS_READ_STATS
@@ -1654,19 +1621,9 @@ static void demux_ts_stop(demux_plugin_t *this_gen)
pthread_mutex_unlock( &this->mutex );
pthread_join (this->thread, &p);
- xine_flush_engine(this->xine);
+ xine_demux_flush_engine(this->xine);
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER; /* user finished */
- this->video_fifo->put (this->video_fifo, buf);
-
- if (this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- buf->decoder_flags = BUF_FLAG_END_USER; /* user finished */
- this->audio_fifo->put (this->audio_fifo, buf);
- }
+ xine_demux_control_end(this->xine, BUF_FLAG_END_USER);
}
static int demux_ts_get_stream_length (demux_plugin_t *this_gen) {
@@ -1682,7 +1639,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, xine_t *xine) {
demux_ts *this;
int i;
- if (iface != 8) {
+ if (iface != 9) {
LOG_MSG (xine,
_("demux_ts: plugin doesn't support plugin API version %d.\n"
" This means there's a version mismatch between xine "
diff --git a/src/libffmpeg/xine_decoder.c b/src/libffmpeg/xine_decoder.c
index 6077f449e..b5a5ace70 100644
--- a/src/libffmpeg/xine_decoder.c
+++ b/src/libffmpeg/xine_decoder.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine_decoder.c,v 1.39 2002/06/04 15:31:08 miguelfreitas Exp $
+ * $Id: xine_decoder.c,v 1.40 2002/06/07 02:40:46 miguelfreitas Exp $
*
* xine decoder plugin using ffmpeg
*
@@ -46,12 +46,6 @@
#define LOG
*/
-#ifndef mmioFOURCC
-#define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
- ( (long)(unsigned char)(ch0) | ( (long)(unsigned char)(ch1) << 8 ) | \
- ( (long)(unsigned char)(ch2) << 16 ) | ( (long)(unsigned char)(ch3) << 24 ) )
-#endif
-
typedef struct ff_decoder_s {
video_decoder_t video_decoder;
@@ -71,25 +65,6 @@ typedef struct ff_decoder_s {
#define VIDEOBUFSIZE 128*1024
-/*
-#define IMGFMT_YUY2 mmioFOURCC('Y','U','Y','2')
-#define IMGFMT_YV12 mmioFOURCC('Y','V','1','2')
-*/
-
-static unsigned long str2ulong(void *data)
-{
- unsigned char *str = data;
- return ( str[0] | (str[1]<<8) | (str[2]<<16) | (str[3]<<24) );
-}
-
-/*
-static unsigned short str2ushort(void *data)
-{
- unsigned char *str = data;
- return ( str[0] | (str[1]<<8) );
-}
-*/
-
static int ff_can_handle (video_decoder_t *this_gen, int buf_type) {
buf_type &= 0xFFFF0000;
diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am
index 49744095e..e492330ca 100644
--- a/src/xine-engine/Makefile.am
+++ b/src/xine-engine/Makefile.am
@@ -10,7 +10,7 @@ lib_LTLIBRARIES = libxine.la
libxine_la_SOURCES = xine.c metronom.c configfile.c buffer.c \
load_plugins.c video_decoder.c buffer_types.c \
audio_decoder.c video_out.c audio_out.c resample.c events.c lrb.c \
- video_overlay.c osd.c scratch.c locale.c
+ video_overlay.c osd.c scratch.c locale.c demux.c
libxine_la_DEPENDENCIES = @INTLLIBS@
libxine_la_LIBADD = $(THREAD_LIBS) $(DYNAMIC_LD_LIBS) @INTLLIBS@ $(ZLIB_LIBS) -lm
diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h
index 5a49f02db..50e8dad98 100644
--- a/src/xine-engine/buffer.h
+++ b/src/xine-engine/buffer.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: buffer.h,v 1.47 2002/06/03 16:20:36 miguelfreitas Exp $
+ * $Id: buffer.h,v 1.48 2002/06/07 02:40:47 miguelfreitas Exp $
*
*
* contents:
@@ -246,8 +246,11 @@ struct fifo_buffer_s
fifo_buffer_t *fifo_buffer_new (int num_buffers, uint32_t buf_size);
-/* return BUF_VIDEO_xxx given the fourcc */
-uint32_t fourcc_to_buf_video( void * fourcc );
+/* return BUF_VIDEO_xxx given the fourcc
+ * fourcc_int must be read in machine endianness
+ * example: fourcc_int = *(uint32_t *)fourcc_char;
+ */
+uint32_t fourcc_to_buf_video( uint32_t fourcc_int );
/* return codec name given BUF_VIDEO_xxx */
char * buf_video_name( uint32_t buf_type );
@@ -270,7 +273,7 @@ typedef struct {
int32_t biHeight;
int16_t biPlanes;
int16_t biBitCount;
- int32_t biCompression;
+ uint32_t biCompression;
int32_t biSizeImage;
int32_t biXPelsPerMeter;
int32_t biYPelsPerMeter;
@@ -281,6 +284,21 @@ typedef struct {
/* convert xine_bmiheader struct from little endian */
void xine_bmiheader_le2me( xine_bmiheader *bih );
+/* this is xine version of WAVEFORMATEX
+ * (the same comments from xine_bmiheader)
+ */
+typedef struct {
+ int16_t wFormatTag;
+ int16_t nChannels;
+ int32_t nSamplesPerSec;
+ int32_t nAvgBytesPerSec;
+ int16_t nBlockAlign;
+ int16_t wBitsPerSample;
+ int16_t cbSize;
+} xine_waveformatex;
+
+/* convert xine_waveformatex struct from little endian */
+void xine_waveformatex_le2me( xine_waveformatex *wavex );
#ifdef __cplusplus
}
diff --git a/src/xine-engine/buffer_types.c b/src/xine-engine/buffer_types.c
index f27cdf3cd..f6f4a9902 100644
--- a/src/xine-engine/buffer_types.c
+++ b/src/xine-engine/buffer_types.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: buffer_types.c,v 1.22 2002/06/05 22:44:52 tmattern Exp $
+ * $Id: buffer_types.c,v 1.23 2002/06/07 02:40:47 miguelfreitas Exp $
*
*
* contents:
@@ -38,10 +38,19 @@
#include "buffer.h"
#include "bswap.h"
-#ifndef mmioFOURCC
-#define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
- ( (long)(unsigned char)(ch0) | ( (long)(unsigned char)(ch1) << 8 ) | \
- ( (long)(unsigned char)(ch2) << 16 ) | ( (long)(unsigned char)(ch3) << 24 ) )
+/* FOURCC will be manipulated using machine endian */
+#ifdef WORDS_BIGENDIAN
+#define meFOURCC( ch0, ch1, ch2, ch3 ) \
+ ( (uint32_t)(unsigned char)(ch3) | \
+ ( (uint32_t)(unsigned char)(ch2) << 8 ) | \
+ ( (uint32_t)(unsigned char)(ch1) << 16 ) | \
+ ( (uint32_t)(unsigned char)(ch0) << 24 ) )
+#else
+#define meFOURCC( ch0, ch1, ch2, ch3 ) \
+ ( (uint32_t)(unsigned char)(ch0) | \
+ ( (uint32_t)(unsigned char)(ch1) << 8 ) | \
+ ( (uint32_t)(unsigned char)(ch2) << 16 ) | \
+ ( (uint32_t)(unsigned char)(ch3) << 24 ) )
#endif
@@ -61,7 +70,7 @@ typedef struct audio_db_s {
static video_db_t video_db[] = {
{
{
- mmioFOURCC('m', 'p', 'e', 'g'),
+ meFOURCC('m', 'p', 'e', 'g'),
0
},
BUF_VIDEO_MPEG,
@@ -69,12 +78,12 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('D', 'I', 'V', 'X'),
- mmioFOURCC('d', 'i', 'v', 'x'),
- mmioFOURCC('D', 'i', 'v', 'x'),
- mmioFOURCC('D', 'i', 'v', 'X'),
- mmioFOURCC('M', 'P', '4', 'S'),
- mmioFOURCC('m', 'p', '4', 'v'),
+ meFOURCC('D', 'I', 'V', 'X'),
+ meFOURCC('d', 'i', 'v', 'x'),
+ meFOURCC('D', 'i', 'v', 'x'),
+ meFOURCC('D', 'i', 'v', 'X'),
+ meFOURCC('M', 'P', '4', 'S'),
+ meFOURCC('m', 'p', '4', 'v'),
0
},
BUF_VIDEO_MPEG4,
@@ -82,7 +91,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('X', 'V', 'I', 'D'),
+ meFOURCC('X', 'V', 'I', 'D'),
0
},
BUF_VIDEO_XVID,
@@ -90,7 +99,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('D', 'X', '5', '0'),
+ meFOURCC('D', 'X', '5', '0'),
0
},
BUF_VIDEO_DIVX5,
@@ -98,7 +107,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('c', 'v', 'i', 'd'),
+ meFOURCC('c', 'v', 'i', 'd'),
0
},
BUF_VIDEO_CINEPAK,
@@ -106,9 +115,9 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('S', 'V', 'Q', '1'),
- mmioFOURCC('s', 'v', 'q', '1'),
- mmioFOURCC('s', 'v', 'q', 'i'),
+ meFOURCC('S', 'V', 'Q', '1'),
+ meFOURCC('s', 'v', 'q', '1'),
+ meFOURCC('s', 'v', 'q', 'i'),
0
},
BUF_VIDEO_SORENSON_V1,
@@ -116,8 +125,8 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('S', 'V', 'Q', '3'),
- mmioFOURCC('s', 'v', 'q', '3'),
+ meFOURCC('S', 'V', 'Q', '3'),
+ meFOURCC('s', 'v', 'q', '3'),
0
},
BUF_VIDEO_SORENSON_V3,
@@ -125,14 +134,14 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('M', 'P', '4', '1'),
- mmioFOURCC('m', 'p', '4', '1'),
- mmioFOURCC('M', 'P', '4', '2'),
- mmioFOURCC('m', 'p', '4', '2'),
- mmioFOURCC('D', 'I', 'V', '2'),
- mmioFOURCC('d', 'i', 'v', '2'),
- mmioFOURCC('M', 'P', 'G', '4'),
- mmioFOURCC('m', 'p', 'g', '4'),
+ meFOURCC('M', 'P', '4', '1'),
+ meFOURCC('m', 'p', '4', '1'),
+ meFOURCC('M', 'P', '4', '2'),
+ meFOURCC('m', 'p', '4', '2'),
+ meFOURCC('D', 'I', 'V', '2'),
+ meFOURCC('d', 'i', 'v', '2'),
+ meFOURCC('M', 'P', 'G', '4'),
+ meFOURCC('m', 'p', 'g', '4'),
0
},
BUF_VIDEO_MSMPEG4_V12,
@@ -140,18 +149,18 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('M', 'P', '4', '3'),
- mmioFOURCC('m', 'p', '4', '3'),
- mmioFOURCC('D', 'I', 'V', '3'),
- mmioFOURCC('d', 'i', 'v', '3'),
- mmioFOURCC('D', 'I', 'V', '4'),
- mmioFOURCC('d', 'i', 'v', '4'),
- mmioFOURCC('D', 'I', 'V', '5'),
- mmioFOURCC('d', 'i', 'v', '5'),
- mmioFOURCC('D', 'I', 'V', '6'),
- mmioFOURCC('d', 'i', 'v', '6'),
- mmioFOURCC('A', 'P', '4', '1'),
- mmioFOURCC('M', 'P', 'G', '3'),
+ meFOURCC('M', 'P', '4', '3'),
+ meFOURCC('m', 'p', '4', '3'),
+ meFOURCC('D', 'I', 'V', '3'),
+ meFOURCC('d', 'i', 'v', '3'),
+ meFOURCC('D', 'I', 'V', '4'),
+ meFOURCC('d', 'i', 'v', '4'),
+ meFOURCC('D', 'I', 'V', '5'),
+ meFOURCC('d', 'i', 'v', '5'),
+ meFOURCC('D', 'I', 'V', '6'),
+ meFOURCC('d', 'i', 'v', '6'),
+ meFOURCC('A', 'P', '4', '1'),
+ meFOURCC('M', 'P', 'G', '3'),
0
},
BUF_VIDEO_MSMPEG4_V3,
@@ -159,7 +168,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('3', 'I', 'V', '1'),
+ meFOURCC('3', 'I', 'V', '1'),
0
},
BUF_VIDEO_3IVX,
@@ -167,10 +176,10 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('d', 'm', 'b', '1'),
- mmioFOURCC('M', 'J', 'P', 'G'),
- mmioFOURCC('m', 'j', 'p', 'a'),
- mmioFOURCC('m', 'j', 'p', 'b'),
+ meFOURCC('d', 'm', 'b', '1'),
+ meFOURCC('M', 'J', 'P', 'G'),
+ meFOURCC('m', 'j', 'p', 'a'),
+ meFOURCC('m', 'j', 'p', 'b'),
0
},
BUF_VIDEO_MJPEG,
@@ -178,8 +187,8 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('I', 'V', '5', '0'),
- mmioFOURCC('i', 'v', '5', '0'),
+ meFOURCC('I', 'V', '5', '0'),
+ meFOURCC('i', 'v', '5', '0'),
0
},
BUF_VIDEO_IV50,
@@ -187,8 +196,8 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('I', 'V', '4', '1'),
- mmioFOURCC('i', 'v', '4', '1'),
+ meFOURCC('I', 'V', '4', '1'),
+ meFOURCC('i', 'v', '4', '1'),
0
},
BUF_VIDEO_IV41,
@@ -196,8 +205,8 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('I', 'V', '3', '2'),
- mmioFOURCC('i', 'v', '3', '2'),
+ meFOURCC('I', 'V', '3', '2'),
+ meFOURCC('i', 'v', '3', '2'),
0
},
BUF_VIDEO_IV32,
@@ -205,8 +214,8 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('I', 'V', '3', '1'),
- mmioFOURCC('i', 'v', '3', '1'),
+ meFOURCC('I', 'V', '3', '1'),
+ meFOURCC('i', 'v', '3', '1'),
0
},
BUF_VIDEO_IV31,
@@ -214,7 +223,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('V', 'C', 'R', '1'),
+ meFOURCC('V', 'C', 'R', '1'),
0
},
BUF_VIDEO_ATIVCR1,
@@ -222,7 +231,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('V', 'C', 'R', '2'),
+ meFOURCC('V', 'C', 'R', '2'),
0
},
BUF_VIDEO_ATIVCR2,
@@ -230,11 +239,11 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('I', '2', '6', '3'),
- mmioFOURCC('i', '2', '6', '3'),
- mmioFOURCC('V', 'I', 'V', 'O'),
- mmioFOURCC('v', 'i', 'v', 'o'),
- mmioFOURCC('v', 'i', 'v', '1'),
+ meFOURCC('I', '2', '6', '3'),
+ meFOURCC('i', '2', '6', '3'),
+ meFOURCC('V', 'I', 'V', 'O'),
+ meFOURCC('v', 'i', 'v', 'o'),
+ meFOURCC('v', 'i', 'v', '1'),
0
},
BUF_VIDEO_I263,
@@ -249,7 +258,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('r','a','w',' '),
+ meFOURCC('r','a','w',' '),
0
},
BUF_VIDEO_RGB,
@@ -261,7 +270,7 @@ static video_db_t video_db[] = {
else if (!strncasecmp (video, "yuv2", 4))
this->video_type = BUF_VIDEO_YUY2;
*/
- mmioFOURCC('y','u','v','2'),
+ meFOURCC('y','u','v','2'),
0
},
BUF_VIDEO_YUY2,
@@ -269,7 +278,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('j','p','e','g'),
+ meFOURCC('j','p','e','g'),
0
},
BUF_VIDEO_JPEG,
@@ -277,7 +286,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('W','M','V','1'),
+ meFOURCC('W','M','V','1'),
0
},
BUF_VIDEO_WMV7,
@@ -285,7 +294,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('W','M','V','2'),
+ meFOURCC('W','M','V','2'),
0
},
BUF_VIDEO_WMV8,
@@ -293,12 +302,12 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('c','r','a','m'),
- mmioFOURCC('C','R','A','M'),
- mmioFOURCC('M','S','V','C'),
- mmioFOURCC('m','s','v','c'),
- mmioFOURCC('W','H','A','M'),
- mmioFOURCC('w','h','a','m'),
+ meFOURCC('c','r','a','m'),
+ meFOURCC('C','R','A','M'),
+ meFOURCC('M','S','V','C'),
+ meFOURCC('m','s','v','c'),
+ meFOURCC('W','H','A','M'),
+ meFOURCC('w','h','a','m'),
0
},
BUF_VIDEO_MSVC,
@@ -306,9 +315,9 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('D','V','S','D'),
- mmioFOURCC('d','v','s','d'),
- mmioFOURCC('d','v','c','p'),
+ meFOURCC('D','V','S','D'),
+ meFOURCC('d','v','s','d'),
+ meFOURCC('d','v','c','p'),
0
},
BUF_VIDEO_DV,
@@ -316,10 +325,10 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('V','P','3','0'),
- mmioFOURCC('v','p','3','0'),
- mmioFOURCC('V','P','3','1'),
- mmioFOURCC('v','p','3','1'),
+ meFOURCC('V','P','3','0'),
+ meFOURCC('v','p','3','0'),
+ meFOURCC('V','P','3','1'),
+ meFOURCC('v','p','3','1'),
0
},
BUF_VIDEO_VP31,
@@ -327,9 +336,9 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('H', '2', '6', '3'),
- mmioFOURCC('h', '2', '6', '3'),
- mmioFOURCC('U', '2', '6', '3'),
+ meFOURCC('H', '2', '6', '3'),
+ meFOURCC('h', '2', '6', '3'),
+ meFOURCC('U', '2', '6', '3'),
0
},
BUF_VIDEO_H263,
@@ -337,8 +346,8 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('c', 'y', 'u', 'v'),
- mmioFOURCC('C', 'Y', 'U', 'V'),
+ meFOURCC('c', 'y', 'u', 'v'),
+ meFOURCC('C', 'Y', 'U', 'V'),
0
},
BUF_VIDEO_CYUV,
@@ -346,7 +355,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('s', 'm', 'c', ' '),
+ meFOURCC('s', 'm', 'c', ' '),
0
},
BUF_VIDEO_SMC,
@@ -354,8 +363,8 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('r', 'p', 'z', 'a'),
- mmioFOURCC('a', 'z', 'p', 'r'),
+ meFOURCC('r', 'p', 'z', 'a'),
+ meFOURCC('a', 'z', 'p', 'r'),
0
},
BUF_VIDEO_RPZA,
@@ -363,7 +372,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('r', 'l', 'e', ' '),
+ meFOURCC('r', 'l', 'e', ' '),
0
},
BUF_VIDEO_QTRLE,
@@ -378,7 +387,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('D', 'U', 'C', 'K'),
+ meFOURCC('D', 'U', 'C', 'K'),
0
},
BUF_VIDEO_DUCKTM1,
@@ -399,7 +408,7 @@ static audio_db_t audio_db[] = {
{
{
0x50, 0x55,
- mmioFOURCC('.','m','p','3'), 0
+ meFOURCC('.','m','p','3'), 0
},
BUF_AUDIO_MPEG,
"MPEG layer 2/3"
@@ -414,7 +423,7 @@ static audio_db_t audio_db[] = {
{
{
0x01,
- mmioFOURCC('r','a','w',' '),
+ meFOURCC('r','a','w',' '),
0
},
BUF_AUDIO_LPCM_LE,
@@ -460,7 +469,7 @@ static audio_db_t audio_db[] = {
/* these formattags are used by Vorbis ACM encoder and
supported by NanDub, a variant of VirtualDub. */
0x674f, 0x676f, 0x6750, 0x6770, 0x6751, 0x6771,
- mmioFOURCC('O','g','g','S'),
+ meFOURCC('O','g','g','S'),
0
},
BUF_AUDIO_VORBIS,
@@ -517,7 +526,7 @@ static audio_db_t audio_db[] = {
},
{
{
- mmioFOURCC('i', 'm', 'a', '4'),
+ meFOURCC('i', 'm', 'a', '4'),
0
},
BUF_AUDIO_QTIMAADPCM,
@@ -525,7 +534,7 @@ static audio_db_t audio_db[] = {
},
{
{
- mmioFOURCC('m', 'a', 'c', '3'),
+ meFOURCC('m', 'a', 'c', '3'),
0
},
BUF_AUDIO_MAC3,
@@ -533,7 +542,7 @@ static audio_db_t audio_db[] = {
},
{
{
- mmioFOURCC('m', 'a', 'c', '6'),
+ meFOURCC('m', 'a', 'c', '6'),
0
},
BUF_AUDIO_MAC6,
@@ -541,7 +550,7 @@ static audio_db_t audio_db[] = {
},
{
{
- mmioFOURCC('Q', 'D', 'M', 'C'),
+ meFOURCC('Q', 'D', 'M', 'C'),
0
},
BUF_AUDIO_QDESIGN1,
@@ -549,7 +558,7 @@ static audio_db_t audio_db[] = {
},
{
{
- mmioFOURCC('Q', 'D', 'M', '2'),
+ meFOURCC('Q', 'D', 'M', '2'),
0
},
BUF_AUDIO_QDESIGN2,
@@ -559,19 +568,11 @@ static audio_db_t audio_db[] = {
};
-static unsigned long str2ulong(unsigned char *str)
-{
- return ( str[0] | (str[1]<<8) | (str[2]<<16) | (str[3]<<24) );
-}
-
-uint32_t fourcc_to_buf_video( void * fourcc ) {
+uint32_t fourcc_to_buf_video( uint32_t fourcc_int ) {
int i, j;
-uint32_t fourcc_int;
static uint32_t cached_fourcc=0;
static uint32_t cached_buf_type=0;
- fourcc_int = str2ulong(fourcc);
-
if( fourcc_int == cached_fourcc )
return cached_buf_type;
@@ -636,17 +637,29 @@ int i;
}
void xine_bmiheader_le2me( xine_bmiheader *bih ) {
+ /* OBS: fourcc must be read using machine endianness
+ * so don't play with biCompression here!
+ */
bih->biSize = le2me_32(bih->biSize);
bih->biWidth = le2me_32(bih->biWidth);
bih->biHeight = le2me_32(bih->biHeight);
bih->biPlanes = le2me_16(bih->biPlanes);
bih->biBitCount = le2me_16(bih->biBitCount);
- /* do not change byte order of fourcc */
- /* bih->biCompression = le2me_32(bih->biCompression); */
bih->biSizeImage = le2me_32(bih->biSizeImage);
bih->biXPelsPerMeter = le2me_32(bih->biXPelsPerMeter);
bih->biYPelsPerMeter = le2me_32(bih->biYPelsPerMeter);
bih->biClrUsed = le2me_32(bih->biClrUsed);
bih->biClrImportant = le2me_32(bih->biClrImportant);
}
+
+void xine_waveformatex_le2me( xine_waveformatex *wavex ) {
+
+ wavex->wFormatTag = le2me_16(wavex->wFormatTag);
+ wavex->nChannels = le2me_16(wavex->nChannels);
+ wavex->nSamplesPerSec = le2me_32(wavex->nSamplesPerSec);
+ wavex->nAvgBytesPerSec = le2me_32(wavex->nAvgBytesPerSec);
+ wavex->nBlockAlign = le2me_16(wavex->nBlockAlign);
+ wavex->wBitsPerSample = le2me_16(wavex->wBitsPerSample);
+ wavex->cbSize = le2me_16(wavex->cbSize);
+}
diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c
new file mode 100644
index 000000000..631fce7f2
--- /dev/null
+++ b/src/xine-engine/demux.c
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2000-2002 the xine project
+ *
+ * This file is part of xine, a unix video player.
+ *
+ * xine is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ *
+ * Demuxer helper functions
+ * hide some xine engine details from demuxers and reduce code duplication
+ *
+ * $id$
+ */
+
+#include "xine_internal.h"
+#include "demuxers/demux.h"
+#include "buffer.h"
+
+
+/* internal use only - called from demuxers on seek/stop
+ * warning: after clearing decoders fifos an absolute discontinuity
+ * indication must be sent. relative discontinuities are likely
+ * to cause "jumps" on metronom.
+ */
+void xine_demux_flush_engine (xine_t *this) {
+
+ buf_element_t *buf;
+
+ this->video_fifo->clear(this->video_fifo);
+ if( this->audio_fifo )
+ this->audio_fifo->clear(this->audio_fifo);
+
+ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+ buf->type = BUF_CONTROL_RESET_DECODER;
+ this->video_fifo->put (this->video_fifo, buf);
+
+ if(this->audio_fifo) {
+ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
+ buf->type = BUF_CONTROL_RESET_DECODER;
+ this->audio_fifo->put (this->audio_fifo, buf);
+ }
+
+ this->metronom->adjust_clock(this->metronom,
+ this->metronom->get_current_time(this->metronom) + 30 * 90000 );
+
+ if (this->audio_out)
+ this->audio_out->control(this->audio_out, AO_CTRL_FLUSH_BUFFERS);
+}
+
+
+void xine_demux_control_newpts( xine_t *this, int64_t pts, uint32_t flags ) {
+
+ buf_element_t *buf;
+
+ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+ buf->type = BUF_CONTROL_NEWPTS;
+ buf->decoder_flags = flags;
+ buf->disc_off = pts;
+ this->video_fifo->put (this->video_fifo, buf);
+
+ if (this->audio_fifo) {
+ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
+ buf->type = BUF_CONTROL_NEWPTS;
+ buf->decoder_flags = flags;
+ buf->disc_off = pts;
+ this->audio_fifo->put (this->audio_fifo, buf);
+ }
+}
+
+void xine_demux_control_start( xine_t *this ) {
+
+ buf_element_t *buf;
+
+ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+ buf->type = BUF_CONTROL_START;
+ this->video_fifo->put (this->video_fifo, buf);
+
+ if (this->audio_fifo) {
+ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
+ buf->type = BUF_CONTROL_START;
+ this->audio_fifo->put (this->audio_fifo, buf);
+ }
+}
+
+void xine_demux_control_end( xine_t *this, uint32_t flags ) {
+
+ buf_element_t *buf;
+
+ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_flags = flags;
+ this->video_fifo->put (this->video_fifo, buf);
+
+ if (this->audio_fifo) {
+ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_flags = flags;
+ this->audio_fifo->put (this->audio_fifo, buf);
+ }
+}
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 9efe619ff..21dd8ce7a 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine.c,v 1.134 2002/06/01 16:36:13 mroi Exp $
+ * $Id: xine.c,v 1.135 2002/06/07 02:40:47 miguelfreitas Exp $
*
* top-level xine functions
*
@@ -139,36 +139,6 @@ void xine_notify_stream_finished (xine_t *this) {
}
}
-/* internal use only - called from demuxers on seek/stop
- * warning: after clearing decoders fifos an absolute discontinuity
- * indication must be sent. relative discontinuities are likely
- * to cause "jumps" on metronom.
- */
-void xine_flush_engine (xine_t *this) {
-
- buf_element_t *buf;
-
- this->video_fifo->clear(this->video_fifo);
- if( this->audio_fifo )
- this->audio_fifo->clear(this->audio_fifo);
-
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_RESET_DECODER;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_RESET_DECODER;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
-
- this->metronom->adjust_clock(this->metronom,
- this->metronom->get_current_time(this->metronom) + 30 * 90000 );
-
- if (this->audio_out)
- this->audio_out->control(this->audio_out, AO_CTRL_FLUSH_BUFFERS);
-}
-
static void xine_internal_osd (xine_t *this, char *str,
uint32_t start_time, uint32_t duration) {
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index d19841cc9..f5def8794 100644
--- a/src/xine-engine/xine_internal.h
+++ b/src/xine-engine/xine_internal.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine_internal.h,v 1.85 2002/05/25 19:19:19 siggi Exp $
+ * $Id: xine_internal.h,v 1.86 2002/06/07 02:40:47 miguelfreitas Exp $
*
*/
@@ -428,7 +428,6 @@ char **xine_get_autoplay_mrls (xine_t *this, char *plugin_id, int *num_mrls);
*/
void xine_notify_stream_finished (xine_t *this);
-void xine_flush_engine (xine_t *this);
/*
* video decoder stuff
@@ -632,6 +631,19 @@ int xine_get_log_section_count (xine_t *this);
int xine_get_error (xine_t *this);
+
+/*
+ * demuxer helper functions from demux.c
+ */
+
+void xine_demux_flush_engine(xine_t *this);
+
+void xine_demux_control_newpts( xine_t *this, int64_t pts, uint32_t flags );
+
+void xine_demux_control_start( xine_t *this );
+
+void xine_demux_control_end( xine_t *this, uint32_t flags );
+
#ifdef __cplusplus
}
#endif