summaryrefslogtreecommitdiffstats
path: root/stream/stream_vcd.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-24 14:03:07 +0200
committerwm4 <wm4@nowhere>2014-05-24 16:17:50 +0200
commite3c20bf3505679641f247471603ad298d04036bd (patch)
tree72926a284ecd34a3d1be9de8db8d5af0ed45eba8 /stream/stream_vcd.c
parent3316cf5f9b213dc047aa0515fbc51f12fb27cc58 (diff)
downloadmpv-e3c20bf3505679641f247471603ad298d04036bd.tar.bz2
mpv-e3c20bf3505679641f247471603ad298d04036bd.tar.xz
stream: kill start_pos, remove --sb option
stream.start_pos was needed for optical media only, and (apparently) not for very good reasons. Just get rid of it. For stream_dvd, we don't need to do anything. Byte seeking was already removed from it earlier. For stream_cdda and stream_vcd, emulate the start_pos by offsetting the stream pos as seen by the rest of mpv. The bits in discnav.c and loadfile.c were for dealing with the code seeking back to the start in demux.c. Handle this differently by assuming the demuxer is always initialized with the stream at start position, and instead seek back if initializing the demuxer fails. Remove the --sb option, which worked by modifying stream.start_pos. If someone really wants this option, it could be added back by creating a "slice" stream (actually ffmpeg already has such a thing).
Diffstat (limited to 'stream/stream_vcd.c')
-rw-r--r--stream/stream_vcd.c12
1 files changed, 8 insertions, 4 deletions
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;
}