summaryrefslogtreecommitdiffstats
path: root/demux/demux_lavf.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-09-13 16:48:34 +0200
committerwm4 <wm4@nowhere>2019-09-13 17:31:59 +0200
commita9d83eac40c94f44d19fab7b6955331f10efe301 (patch)
tree151a76d57c17649b025e262f44fae5fb0eefd889 /demux/demux_lavf.c
parentcf36e3d15b31958927b81b9ec99793c3a99bafc2 (diff)
downloadmpv-a9d83eac40c94f44d19fab7b6955331f10efe301.tar.bz2
mpv-a9d83eac40c94f44d19fab7b6955331f10efe301.tar.xz
Remove optical disc fancification layers
This removes anything related to DVD/BD/CD that negatively affected the core code. It includes trying to rewrite timestamps (since DVDs and Blurays do not set packet stream timestamps to playback time, and can even have resets mid-stream), export of chapters, stream languages, export of title/track lists, and all that. Only basic seeking is supported. It is very much possible that seeking completely fails on some discs (on some parts of the timeline), because timestamp rewriting was removed. Note that I don't give a shit about optical media. If you want to watch them, rip them. Keeping some bare support for DVD/BD is the most I'm going to do to appease the type of lazy, obnoxious users who will care. There are other players which are better at optical discs.
Diffstat (limited to 'demux/demux_lavf.c')
-rw-r--r--demux/demux_lavf.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index 8ec856d0c8..5d6c2725dc 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -213,6 +213,7 @@ typedef struct lavf_priv {
int cur_program;
char *mime_type;
double seek_delay;
+ bool optical_crap_hack;
struct demux_lavf_opts *opts;
double mf_fps;
@@ -1056,6 +1057,13 @@ static int demux_open_lavf(demuxer_t *demuxer, enum demux_check check)
"broken as well.\n");
}
+ double len = -1;
+ if (stream_control(priv->stream, STREAM_CTRL_OPTICAL_CRAP_HACK1, &len) > 0) {
+ priv->optical_crap_hack = true;
+ demuxer->duration = len;
+ demuxer->seekable = true;
+ }
+
return 0;
}
@@ -1120,6 +1128,13 @@ static void demux_seek_lavf(demuxer_t *demuxer, double seek_pts, int flags)
int avsflags = 0;
int64_t seek_pts_av = 0;
+ if (priv->optical_crap_hack) {
+ if (flags & SEEK_FACTOR)
+ seek_pts = seek_pts * demuxer->duration;
+ stream_control(priv->stream, STREAM_CTRL_OPTICAL_CRAP_HACK2, &seek_pts);
+ return;
+ }
+
if (!(flags & SEEK_FORWARD))
avsflags = AVSEEK_FLAG_BACKWARD;
@@ -1234,11 +1249,6 @@ redo:
return CONTROL_OK;
}
- case DEMUXER_CTRL_RESYNC:
- stream_drop_buffers(priv->stream);
- avio_flush(priv->avfc->pb);
- avformat_flush(priv->avfc);
- return CONTROL_OK;
case DEMUXER_CTRL_REPLACE_STREAM:
if (priv->own_stream)
free_stream(priv->stream);