summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/demuxers/demux_avi.c4
-rw-r--r--src/demuxers/demux_elem.c4
-rw-r--r--src/demuxers/demux_mpeg.c15
-rw-r--r--src/demuxers/demux_mpeg_block.c13
-rw-r--r--src/demuxers/demux_mpgaudio.c4
-rw-r--r--src/input/input_dvd.c16
-rw-r--r--src/input/input_file.c3
-rw-r--r--src/input/input_stdin_fifo.c71
-rw-r--r--src/xine-engine/audio_decoder.c4
-rw-r--r--src/xine-engine/video_decoder.c8
10 files changed, 92 insertions, 50 deletions
diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c
index c22a0c2b7..729a301b8 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.10 2001/05/28 12:08:20 f1rmb Exp $
+ * $Id: demux_avi.c,v 1.11 2001/05/30 02:09:24 f1rmb Exp $
*
* demultiplexer for avi streams
*
@@ -732,7 +732,7 @@ static int demux_avi_next (demux_avi_t *this) {
return 0;
}
- buf->input_pos = this->input->seek (this->input, 0, SEEK_CUR);
+ buf->input_pos = this->input->get_current_pos(this->input);
switch (this->avi->a_fmt) {
case 0x01:
diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c
index 265ba20e5..e342b482c 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.8 2001/05/28 12:08:20 f1rmb Exp $
+ * $Id: demux_elem.c,v 1.9 2001/05/30 02:09:24 f1rmb Exp $
*
* demultiplexer for elementary mpeg streams
*
@@ -73,7 +73,7 @@ static int demux_mpeg_elem_next (demux_mpeg_elem_t *this) {
buf->DTS = 0;
buf->PTS = 0;
- buf->input_pos = this->input->seek(this->input, 0, SEEK_CUR);
+ buf->input_pos = this->input->get_current_pos(this->input);
buf->type = BUF_VIDEO_MPEG;
this->video_fifo->put(this->video_fifo, buf);
diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c
index c1919494c..29cfcee05 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.12 2001/05/28 12:08:20 f1rmb Exp $
+ * $Id: demux_mpeg.c,v 1.13 2001/05/30 02:09:24 f1rmb Exp $
*
* demultiplexer for mpeg 1/2 program streams
* reads streams of variable blocksizes
@@ -67,6 +67,7 @@ static uint32_t read_bytes (demux_mpeg_t *this, int n) {
buf[4]=0;
+
i = this->input->read (this->input, buf, n);
if (i != n) {
@@ -200,7 +201,7 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int nID) {
buf->type = BUF_AUDIO_MPEG + track;
buf->PTS = pts;
buf->DTS = 0; /* FIXME */
- buf->input_pos = this->input->seek (this->input, 0, SEEK_CUR);
+ buf->input_pos = this->input->get_current_pos(this->input);
if(this->audio_fifo)
this->audio_fifo->put (this->audio_fifo, buf);
@@ -246,6 +247,7 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int nID) {
buf->type = BUF_VIDEO_MPEG;
buf->PTS = pts;
buf->DTS = 0;
+ buf->input_pos = this->input->get_current_pos(this->input);
this->video_fifo->put (this->video_fifo, buf);
@@ -359,7 +361,7 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int nID)
buf->type = BUF_AUDIO_MPEG + track ;
buf->PTS = pts;
buf->DTS = 0; /* FIXME */
- buf->input_pos = this->input->seek (this->input, 0, SEEK_CUR);
+ buf->input_pos = this->input->get_current_pos(this->input);
if(this->audio_fifo)
this->audio_fifo->put (this->audio_fifo, buf);
@@ -368,7 +370,8 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int nID)
xprintf (VERBOSE|DEMUX|VIDEO, ", video #%d", nID & 0x0f);
- buf = this->input->read_block (this->input, this->video_fifo, nLen);
+ if(this->input->read_block)
+ buf = this->input->read_block (this->input, this->video_fifo, nLen);
if (buf == NULL) {
this->status = DEMUX_FINISHED;
@@ -377,6 +380,7 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int nID)
buf->type = BUF_VIDEO_MPEG;
buf->PTS = pts;
buf->DTS = 0; /* FIXME */
+ buf->input_pos = this->input->get_current_pos(this->input);
this->video_fifo->put (this->video_fifo, buf);
@@ -611,8 +615,7 @@ static int demux_mpeg_open(demux_plugin_t *this_gen,
if(media) {
if((!(strncasecmp(MRL, "stdin", 5)))
|| (!(strncasecmp(MRL, "fifo", 4)))) {
- if(!(strncasecmp((media+3), "mpeg1", 5))) {
- perr("%s(%d)mpeg\n", __FUNCTION__, stage);
+ if(!(strncasecmp(media+3, "mpeg1", 5))) {
this->input = input;
return DEMUX_CAN_HANDLE;
}
diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c
index 2c23f5d3a..2abc7119d 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.8 2001/05/28 12:08:20 f1rmb Exp $
+ * $Id: demux_mpeg_block.c,v 1.9 2001/05/30 02:09:24 f1rmb Exp $
*
* demultiplexer for mpeg 1/2 program streams
*
@@ -223,7 +223,7 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this) {
buf->type = BUF_SPU_PACKAGE + nSPUID;
buf->PTS = nPTS;
buf->DTS = nDTS ;
- buf->input_pos = this->input->seek (this->input, 0, SEEK_CUR);
+ buf->input_pos = this->input->get_current_pos(this->input);
this->spu_fifo->put (this->spu_fifo, buf);
@@ -240,7 +240,7 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this) {
buf->type = BUF_AUDIO_AC3 + nTrack;
buf->PTS = nPTS;
buf->DTS = nDTS ;
- buf->input_pos = this->input->seek (this->input, 0, SEEK_CUR);
+ buf->input_pos = this->input->get_current_pos(this->input);
if(this->audio_fifo)
this->audio_fifo->put (this->audio_fifo, buf);
@@ -264,7 +264,7 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this) {
buf->type = BUF_AUDIO_LPCM + nTrack;
buf->PTS = nPTS;
buf->DTS = nDTS ;
- buf->input_pos = this->input->seek (this->input, 0, SEEK_CUR);
+ buf->input_pos = this->input->get_current_pos(this->input);
if(this->audio_fifo)
this->audio_fifo->put (this->audio_fifo, buf);
@@ -281,7 +281,7 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this) {
buf->type = BUF_VIDEO_MPEG;
buf->PTS = nPTS;
buf->DTS = nDTS;
- buf->input_pos = this->input->seek (this->input, 0, SEEK_CUR);
+ buf->input_pos = this->input->get_current_pos(this->input);
this->video_fifo->put (this->video_fifo, buf);
@@ -299,7 +299,7 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this) {
buf->type = BUF_AUDIO_MPEG + nTrack;
buf->PTS = nPTS;
buf->DTS = nDTS;
- buf->input_pos = this->input->seek (this->input, 0, SEEK_CUR);
+ buf->input_pos = this->input->get_current_pos(this->input);
if(this->audio_fifo)
this->audio_fifo->put (this->audio_fifo, buf);
@@ -461,7 +461,6 @@ static int demux_mpeg_block_open(demux_plugin_t *this_gen,
media = strstr(MRL, "://");
if(media) {
if(!strncmp(MRL, "dvd", 3)
- || !strncmp(MRL, "fifo", 4)
|| (((!strncmp(MRL, "stdin", 5) || !strncmp(MRL, "fifo", 4))
&& (!strncmp((media+3), "mpeg2", 5) )))
) {
diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c
index e362b5332..9ddaa8d11 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.7 2001/05/28 12:08:20 f1rmb Exp $
+ * $Id: demux_mpgaudio.c,v 1.8 2001/05/30 02:09:24 f1rmb Exp $
*
* demultiplexer for mpeg audio (i.e. mp3) streams
*
@@ -240,7 +240,7 @@ static int demux_mpgaudio_next (demux_mpgaudio_t *this) {
buf->DTS = 0;
buf->PTS = 0;
- buf->input_pos = this->input->seek(this->input, 0, SEEK_CUR);
+ buf->input_pos = this->input->get_current_pos(this->input);
buf->type = BUF_AUDIO_AVI;
if(this->audio_fifo)
diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c
index d7fcc6473..2f6ebc0c6 100644
--- a/src/input/input_dvd.c
+++ b/src/input/input_dvd.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: input_dvd.c,v 1.6 2001/05/07 02:25:00 f1rmb Exp $
+ * $Id: input_dvd.c,v 1.7 2001/05/30 02:09:24 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -248,21 +248,25 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen,
*/
fprintf (stderr, "ERROR in input_dvd plugin read: %Ld bytes "
"is not a sector!\n", nlen);
- return NULL;
+ goto read_block_failure;
}
if (this->file_size_left < nlen)
- return NULL;
+ goto read_block_failure;
- if (read (this->raw_fd, buf, DVD_VIDEO_LB_LEN)) {
+ buf->content = buf->mem;
+ if ((buf->size = read (this->raw_fd, buf->mem, DVD_VIDEO_LB_LEN)) > 0) {
this->file_lbcur++;
this->file_size_left -= DVD_VIDEO_LB_LEN;
-
return buf;
} else
fprintf (stderr, "read error in input_dvd plugin\n");
+ read_block_failure:
+
+ buf->free_buffer (buf);
+
return NULL;
}
@@ -309,7 +313,7 @@ static off_t dvd_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin
static off_t dvd_plugin_get_current_pos (input_plugin_t *this_gen){
dvd_input_plugin_t *this = (dvd_input_plugin_t *) this_gen;
- return (this->file_lbcur * DVD_VIDEO_LB_LEN);
+ return ((this->file_lbcur - this->file_lbstart) * DVD_VIDEO_LB_LEN);
}
/*
diff --git a/src/input/input_file.c b/src/input/input_file.c
index 0c56efa7c..8aee06d10 100644
--- a/src/input/input_file.c
+++ b/src/input/input_file.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: input_file.c,v 1.9 2001/05/07 01:31:44 f1rmb Exp $
+ * $Id: input_file.c,v 1.10 2001/05/30 02:09:24 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -114,6 +114,7 @@ static int file_plugin_open (input_plugin_t *this_gen, char *mrl) {
*/
static off_t file_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) {
file_input_plugin_t *this = (file_input_plugin_t *) this_gen;
+
return read (this->fh, buf, len);
}
diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c
index f292c065a..f2dd31528 100644
--- a/src/input/input_stdin_fifo.c
+++ b/src/input/input_stdin_fifo.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: input_stdin_fifo.c,v 1.5 2001/05/07 02:25:00 f1rmb Exp $
+ * $Id: input_stdin_fifo.c,v 1.6 2001/05/30 02:09:24 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -71,14 +71,18 @@ static int stdin_plugin_open(input_plugin_t *this_gen, char *mrl) {
#endif
}
else if(!strncasecmp(mrl, "fifo:", 5)) {
-
if((pfn = strrchr((mrl+5), ':')) != NULL) {
filename = ++pfn;
}
else {
- filename = (char *) &mrl[5];
+ if(!(strncasecmp(mrl+5, "//mpeg1", 7))
+ || (!(strncasecmp(mrl+5, "//mpeg2", 7)))) {
+ filename = (char *) &mrl[12];
+ }
+ else {
+ filename = (char *) &mrl[5];
+ }
}
-
}
else {
/* filename = (char *) mrl; */
@@ -101,28 +105,57 @@ static int stdin_plugin_open(input_plugin_t *this_gen, char *mrl) {
*
*/
static off_t stdin_plugin_read (input_plugin_t *this_gen,
- char *buf, off_t nlen) {
+ char *buf, off_t todo) {
- stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen;
- off_t n, nBytesRead = 0;
+ stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen;
+ off_t num_bytes, total_bytes;
+
+ total_bytes = 0;
- while (nBytesRead < nlen) {
- n = read(this->fh, &buf[nBytesRead], nlen-nBytesRead);
+ while (total_bytes < todo) {
+ num_bytes = read (this->fh, &buf[total_bytes], todo - total_bytes);
- if (n < 0) {
- this->curpos += n;
- return n;
+ if(num_bytes < 0) {
+ this->curpos += num_bytes;
+ return num_bytes;
}
- else if (!n) {
- this->curpos += nBytesRead;
- return nBytesRead;
+ else if (!num_bytes) {
+ this->curpos += total_bytes;
+ return total_bytes;
}
+ total_bytes += num_bytes;
+ }
+
+ this->curpos += total_bytes;
- nBytesRead += n;
+ return total_bytes;
+}
+
+/*
+ *
+ */
+static buf_element_t *stdin_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t todo) {
+
+ off_t num_bytes, total_bytes;
+ stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen;
+ buf_element_t *buf = fifo->buffer_pool_alloc (fifo);
+
+ buf->content = buf->mem;
+ total_bytes = 0;
+
+ while (total_bytes < todo) {
+ num_bytes = read (this->fh, buf->mem + total_bytes, todo-total_bytes);
+ total_bytes += num_bytes;
+ this->curpos += num_bytes;
+ if (!num_bytes) {
+ buf->free_buffer (buf);
+ return NULL;
+ }
}
- this->curpos += nBytesRead;
- return nBytesRead;
+ buf->size = total_bytes;
+
+ return buf;
}
/*
@@ -224,7 +257,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
this->input_plugin.get_capabilities = stdin_plugin_get_capabilities;
this->input_plugin.open = stdin_plugin_open;
this->input_plugin.read = stdin_plugin_read;
- this->input_plugin.read_block = NULL;
+ this->input_plugin.read_block = stdin_plugin_read_block;
this->input_plugin.seek = NULL;
this->input_plugin.get_current_pos = stdin_plugin_get_current_pos;
this->input_plugin.get_length = stdin_plugin_get_length;
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c
index 8b947856b..3131a4e37 100644
--- a/src/xine-engine/audio_decoder.c
+++ b/src/xine-engine/audio_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: audio_decoder.c,v 1.10 2001/05/28 12:08:20 f1rmb Exp $
+ * $Id: audio_decoder.c,v 1.11 2001/05/30 02:09:24 f1rmb Exp $
*
*
* functions that implement audio decoding
@@ -43,7 +43,7 @@ void *audio_decoder_loop (void *this_gen) {
if (this->audio_out) {
- /* FIXME gAD.mnCurPos = pBuf->nInputPos; */
+ this->cur_input_pos = buf->input_pos;
switch (buf->type) {
diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c
index 543d6f20f..fd7dc9220 100644
--- a/src/xine-engine/video_decoder.c
+++ b/src/xine-engine/video_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: video_decoder.c,v 1.14 2001/05/24 23:15:40 f1rmb Exp $
+ * $Id: video_decoder.c,v 1.15 2001/05/30 02:09:24 f1rmb Exp $
*
*/
@@ -38,9 +38,11 @@ void *video_decoder_loop (void *this_gen) {
while (running) {
buf = this->video_fifo->get (this->video_fifo);
+ this->cur_input_pos = buf->input_pos;
- /* gVD.mnCurInputPos = pBuf->nInputPos; */
-
+ if(this->status == XINE_PLAY)
+ this->status_callback (this->status);
+
switch (buf->type) {
case BUF_CONTROL_START: