summaryrefslogtreecommitdiff
path: root/src/demuxers/demux_mpeg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers/demux_mpeg.c')
-rw-r--r--src/demuxers/demux_mpeg.c60
1 files changed, 8 insertions, 52 deletions
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",