diff options
author | wm4 <wm4@nowhere> | 2015-02-18 21:09:47 +0100 |
---|---|---|
committer | Diogo Franco (Kovensky) <diogomfranco@gmail.com> | 2015-02-19 13:39:39 +0900 |
commit | c22c440c9c03c7273a0d5544c29e67d498e46c3d (patch) | |
tree | 728679fc611cef7e1c38cf2a208f0c98be815111 /demux | |
parent | be42f4c21276dcf574c41fba98232c87c038e029 (diff) | |
download | mpv-c22c440c9c03c7273a0d5544c29e67d498e46c3d.tar.bz2 mpv-c22c440c9c03c7273a0d5544c29e67d498e46c3d.tar.xz |
demux_lavf: set interrupt_callback
Helps with terminating the stream if e.g. HLS streams are stuck. (For
other demuxers, the stream's interrupt callback already takes care of
this.)
(cherry picked from commit ff992e093b93fd8dd0eecd2c592f8608870f0bbe)
Diffstat (limited to 'demux')
-rw-r--r-- | demux/demux_lavf.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index bc5d394eba..0db60f67e9 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -662,6 +662,12 @@ static void update_metadata(demuxer_t *demuxer, AVPacket *pkt) #endif } +static int interrupt_cb(void *ctx) +{ + struct demuxer *demuxer = ctx; + return mp_cancel_test(demuxer->stream->cancel); +} + static int demux_open_lavf(demuxer_t *demuxer, enum demux_check check) { struct MPOpts *opts = demuxer->opts; @@ -750,6 +756,11 @@ static int demux_open_lavf(demuxer_t *demuxer, enum demux_check check) av_dict_set(&dopts, "rtsp_transport", transport, 0); } + avfc->interrupt_callback = (AVIOInterruptCB){ + .callback = interrupt_cb, + .opaque = demuxer, + }; + mp_set_avdict(&dopts, lavfdopts->avopts); if (avformat_open_input(&avfc, priv->filename, priv->avif, &dopts) < 0) { |