summaryrefslogtreecommitdiffstats
path: root/player
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 /player
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 'player')
-rw-r--r--player/command.c14
-rw-r--r--player/discnav.c2
-rw-r--r--player/loadfile.c6
-rw-r--r--player/misc.c4
-rw-r--r--player/playloop.c4
5 files changed, 6 insertions, 24 deletions
diff --git a/player/command.c b/player/command.c
index be5d215300..9c690d38ae 100644
--- a/player/command.c
+++ b/player/command.c
@@ -206,7 +206,7 @@ static int mp_property_file_size(m_option_t *prop, int action, void *arg,
if (!mpctx->stream)
return M_PROPERTY_UNAVAILABLE;
- int64_t size = mpctx->stream->end_pos - mpctx->stream->start_pos;
+ int64_t size = mpctx->stream->end_pos;
switch (action) {
case M_PROPERTY_GET: {
@@ -297,16 +297,6 @@ static int mp_property_stream_pos(m_option_t *prop, int action, void *arg,
return M_PROPERTY_NOT_IMPLEMENTED;
}
-/// Stream start offset (RO)
-static int mp_property_stream_start(m_option_t *prop, int action,
- void *arg, MPContext *mpctx)
-{
- struct stream *stream = mpctx->stream;
- if (!stream)
- return M_PROPERTY_UNAVAILABLE;
- return m_property_int64_ro(prop, action, arg, stream->start_pos);
-}
-
/// Stream end offset (RO)
static int mp_property_stream_end(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
@@ -2345,8 +2335,6 @@ static const m_option_t mp_properties[] = {
0, 0, 0, NULL },
{ "stream-pos", mp_property_stream_pos, CONF_TYPE_INT64,
M_OPT_MIN, 0, 0, NULL },
- { "stream-start", mp_property_stream_start, CONF_TYPE_INT64,
- M_OPT_MIN, 0, 0, NULL },
{ "stream-end", mp_property_stream_end, CONF_TYPE_INT64,
M_OPT_MIN, 0, 0, NULL },
{ "stream-time-pos", mp_property_stream_time_pos, CONF_TYPE_TIME,
diff --git a/player/discnav.c b/player/discnav.c
index 60b83bcd3c..d6d0618a80 100644
--- a/player/discnav.c
+++ b/player/discnav.c
@@ -123,8 +123,6 @@ void mp_nav_reset(struct MPContext *mpctx)
nav->nav_draining = false;
nav->nav_still_frame = 0;
mp_input_disable_section(mpctx->input, "discnav-menu");
- // Prevent demuxer init code to seek to the "start"
- mpctx->stream->start_pos = stream_tell(mpctx->stream);
stream_control(mpctx->stream, STREAM_CTRL_RESUME_CACHE, NULL);
update_state(mpctx);
}
diff --git a/player/loadfile.c b/player/loadfile.c
index ccf4b6e33c..d79e82911c 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -1110,8 +1110,6 @@ static void play_current_file(struct MPContext *mpctx)
}
mpctx->initialized_flags |= INITIALIZED_STREAM;
- mpctx->stream->start_pos += opts->seek_to_byte;
-
if (opts->stream_dump && opts->stream_dump[0]) {
stream_dump(mpctx);
goto terminate_playback;
@@ -1267,10 +1265,8 @@ goto_reopen_demuxer: ;
else
dir = DVB_CHANNEL_LOWER;
- if (dvb_step_channel(mpctx->stream, dir)) {
+ if (dvb_step_channel(mpctx->stream, dir))
mpctx->stop_play = PT_RELOAD_DEMUXER;
- mpctx->stream->start_pos = stream_tell(mpctx->stream);
- }
}
#endif
goto terminate_playback;
diff --git a/player/misc.c b/player/misc.c
index c1b7d98182..e3cf70f81e 100644
--- a/player/misc.c
+++ b/player/misc.c
@@ -173,8 +173,8 @@ void stream_dump(struct MPContext *mpctx)
while (mpctx->stop_play == KEEP_PLAYING && !stream->eof) {
if (!opts->quiet && ((stream->pos / (1024 * 1024)) % 2) == 1) {
- uint64_t pos = stream->pos - stream->start_pos;
- uint64_t end = stream->end_pos - stream->start_pos;
+ uint64_t pos = stream->pos;
+ uint64_t end = stream->end_pos;
MP_MSG(mpctx, MSGL_STATUS, "Dumping %lld/%lld...",
(long long int)pos, (long long int)end);
}
diff --git a/player/playloop.c b/player/playloop.c
index 3488abe9d1..dea78c5571 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -472,11 +472,11 @@ double get_current_pos_ratio(struct MPContext *mpctx, bool use_range)
ans = MPCLAMP((pos - start) / len, 0, 1);
} else {
struct stream *s = demuxer->stream;
- int64_t size = s->end_pos - s->start_pos;
+ int64_t size = s->end_pos;
int64_t fpos = demuxer->filepos >= 0 ?
demuxer->filepos : stream_tell(demuxer->stream);
if (size > 0)
- ans = MPCLAMP((double)(fpos - s->start_pos) / size, 0, 1);
+ ans = MPCLAMP(fpos / (double)size, 0, 1);
}
if (use_range) {
if (mpctx->opts->play_frames > 0)