diff options
Diffstat (limited to 'stream')
-rw-r--r-- | stream/stream.c | 1 | ||||
-rw-r--r-- | stream/stream.h | 2 | ||||
-rw-r--r-- | stream/stream_cdda.c | 6 | ||||
-rw-r--r-- | stream/stream_dvd.c | 1 | ||||
-rw-r--r-- | stream/stream_vcd.c | 12 | ||||
-rw-r--r-- | stream/vcd_read.h | 1 | ||||
-rw-r--r-- | stream/vcd_read_darwin.h | 1 | ||||
-rw-r--r-- | stream/vcd_read_fbsd.h | 1 | ||||
-rw-r--r-- | stream/vcd_read_win32.h | 1 |
9 files changed, 17 insertions, 9 deletions
diff --git a/stream/stream.c b/stream/stream.c index b6fec81eb8..0acabe3f52 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -815,7 +815,6 @@ int stream_enable_cache(stream_t **stream, struct mp_cache_opts *opts) cache->safe_origin = orig->safe_origin; cache->opts = orig->opts; cache->global = orig->global; - cache->start_pos = orig->start_pos; cache->end_pos = orig->end_pos; cache->log = mp_log_new(cache, cache->global->log, "cache"); diff --git a/stream/stream.h b/stream/stream.h index 3675ea9732..2182de2526 100644 --- a/stream/stream.h +++ b/stream/stream.h @@ -147,7 +147,7 @@ typedef struct stream { int sector_size; // sector size (seek will be aligned on this size if non 0) int read_chunk; // maximum amount of data to read at once to limit latency unsigned int buf_pos, buf_len; - int64_t pos, start_pos, end_pos; + int64_t pos, end_pos; int eof; int mode; //STREAM_READ or STREAM_WRITE bool streaming; // known to be a network stream if true diff --git a/stream/stream_cdda.c b/stream/stream_cdda.c index 1b81bfc6fb..6f1c747483 100644 --- a/stream/stream_cdda.c +++ b/stream/stream_cdda.c @@ -202,6 +202,8 @@ static int seek(stream_t *s, int64_t newpos) int seek_to_track = 0; int i; + newpos += priv->start_sector * CDIO_CD_FRAMESIZE_RAW; + sec = newpos / CDIO_CD_FRAMESIZE_RAW; if (newpos < 0 || sec > p->end_sector) { p->sector = p->end_sector + 1; @@ -388,8 +390,8 @@ static int open_cdda(stream_t *st, int m) priv->sector = priv->start_sector; st->priv = priv; - st->start_pos = priv->start_sector * CDIO_CD_FRAMESIZE_RAW; - st->end_pos = (priv->end_sector + 1) * CDIO_CD_FRAMESIZE_RAW; + st->end_pos = + (priv->end_sector + 1 - priv->start_sector) * CDIO_CD_FRAMESIZE_RAW; st->sector_size = CDIO_CD_FRAMESIZE_RAW; st->fill_buffer = fill_buffer; diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c index 0394a2640c..c393915ffd 100644 --- a/stream/stream_dvd.c +++ b/stream/stream_dvd.c @@ -918,7 +918,6 @@ static int open_s(stream_t *stream, int mode) stream->fill_buffer = fill_buffer; stream->control = control; stream->close = stream_dvd_close; - stream->start_pos = (int64_t)d->cur_pack*2048; stream->end_pos = (int64_t)(d->cur_pgc->cell_playback[d->last_cell-1].last_sector)*2048; MP_VERBOSE(stream, "DVD start=%d end=%d \n",d->cur_pack,d->cur_pgc->cell_playback[d->last_cell-1].last_sector); stream->priv = (void*)d; diff --git a/stream/stream_vcd.c b/stream/stream_vcd.c index c0da02a324..a61fc04376 100644 --- a/stream/stream_vcd.c +++ b/stream/stream_vcd.c @@ -59,7 +59,7 @@ #include "osdep/io.h" static int fill_buffer(stream_t *s, char* buffer, int max_len){ - if(s->pos > s->end_pos) /// don't past end of current track + if(s->pos > s->end_pos) /// don't read past end of current track return 0; if (max_len < VCD_SECTOR_DATA) return -1; @@ -67,7 +67,9 @@ static int fill_buffer(stream_t *s, char* buffer, int max_len){ } static int seek(stream_t *s,int64_t newpos) { - vcd_set_msf(s->priv,newpos/VCD_SECTOR_DATA); + mp_vcd_priv_t *vcd = s->priv; + newpos += vcd->start; + vcd_set_msf(vcd,newpos/VCD_SECTOR_DATA); return 1; } @@ -162,8 +164,7 @@ static int open_s(stream_t *stream,int mode) #endif stream->sector_size = VCD_SECTOR_DATA; - stream->start_pos=ret; - stream->end_pos=ret2; + stream->end_pos=ret2-ret; stream->priv = vcd; stream->fill_buffer = fill_buffer; @@ -171,6 +172,9 @@ static int open_s(stream_t *stream,int mode) stream->close = close_s; stream->demuxer = "lavf"; // mpegps ( or "vcd"?) + vcd->start = ret; + seek(stream, 0); + return STREAM_OK; } diff --git a/stream/vcd_read.h b/stream/vcd_read.h index ccb176ff97..5a5d033f4b 100644 --- a/stream/vcd_read.h +++ b/stream/vcd_read.h @@ -42,6 +42,7 @@ static int sun_vcd_read(mp_vcd_priv_t*, int*); #endif struct mp_vcd_priv_st { + int start; stream_t *stream; int fd; struct cdrom_tocentry entry; diff --git a/stream/vcd_read_darwin.h b/stream/vcd_read_darwin.h index ecfe596f51..f35717856a 100644 --- a/stream/vcd_read_darwin.h +++ b/stream/vcd_read_darwin.h @@ -50,6 +50,7 @@ typedef struct typedef struct mp_vcd_priv_st { + int start; stream_t *stream; int fd; cdsector_t buf; diff --git a/stream/vcd_read_fbsd.h b/stream/vcd_read_fbsd.h index ffa9ae7f6d..8f7f2a585a 100644 --- a/stream/vcd_read_fbsd.h +++ b/stream/vcd_read_fbsd.h @@ -61,6 +61,7 @@ typedef struct ioc_read_toc_single_entry vcd_tocentry; #endif typedef struct mp_vcd_priv_st { + int start; int fd; vcd_tocentry entry; #ifdef VCD_NETBSD diff --git a/stream/vcd_read_win32.h b/stream/vcd_read_win32.h index ac6466c2a1..a01290eeb9 100644 --- a/stream/vcd_read_win32.h +++ b/stream/vcd_read_win32.h @@ -34,6 +34,7 @@ typedef struct mp_vcd_priv_st mp_vcd_priv_t; we cache the information in mp_vcd_priv_st. */ struct mp_vcd_priv_st { + int start; HANDLE hd; CDROM_TOC toc; unsigned sect; |