mirror of
https://github.com/mpv-player/mpv
synced 2025-03-25 04:38:01 +00:00
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.)
This commit is contained in:
parent
69e6e7b17c
commit
ff992e093b
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user