diff options
author | Daniel Caujolle-Bert <f1rmb@users.sourceforge.net> | 2001-05-30 02:09:24 +0000 |
---|---|---|
committer | Daniel Caujolle-Bert <f1rmb@users.sourceforge.net> | 2001-05-30 02:09:24 +0000 |
commit | e15e6e8d897798fc20041e032b0a30d7374953e0 (patch) | |
tree | 46645855d82d0996b3ca8b646ba230bdb7763aca /src/input | |
parent | d0ca54350cfff5d52b7d7e835082062c46fce353 (diff) | |
download | xine-lib-e15e6e8d897798fc20041e032b0a30d7374953e0.tar.gz xine-lib-e15e6e8d897798fc20041e032b0a30d7374953e0.tar.bz2 |
Fixed demux* get current position calls.
Fixed stdin/fifo input plugin, new mrl style: fifo://[mpeg1|mpeg2]/location
Fixed dvd input plugin.
xine core, update cur_input_pos position.
call the gui status callback now.
CVS patchset: 102
CVS date: 2001/05/30 02:09:24
Diffstat (limited to 'src/input')
-rw-r--r-- | src/input/input_dvd.c | 16 | ||||
-rw-r--r-- | src/input/input_file.c | 3 | ||||
-rw-r--r-- | src/input/input_stdin_fifo.c | 71 |
3 files changed, 64 insertions, 26 deletions
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; |