1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-07 06:37:46 +00:00

demux_lavf: use new libavformat semantics for stream resync

I changed avio_flush() and introduced avformat_flush() exactly for this
reason.

Used with DVD/BD only (on seeks and when setting the "angle" property).
Seems to work, but wasn't tested too thoroughly (I don't care about
optical discs, I only want this ugly stuff gone that might even violate
the API/ABI).
This commit is contained in:
wm4 2018-04-16 17:40:00 +02:00 committed by Jan Ekström
parent 3d88e6f4c2
commit 028e51d8af

View File

@ -1148,24 +1148,9 @@ redo:
return CONTROL_OK;
}
case DEMUXER_CTRL_RESYNC:
/* NOTE:
*
* We actually want to call ff_read_frame_flush() here, but it is
* internal.
*
* This function call seems to do the same for now.
*
* Once ff_read_frame_flush() is exported in some way, change this to
* call the new API instead of relying on av_seek_frame() to do this
* for us.
*/
// avio_flush() is designed for write-only streams, and does the wrong
// thing when reading. Flush it manually instead.
stream_drop_buffers(priv->stream);
priv->avfc->pb->buf_ptr = priv->avfc->pb->buf_end = priv->avfc->pb->buffer;
priv->avfc->pb->pos = stream_tell(priv->stream);
av_seek_frame(priv->avfc, 0, stream_tell(priv->stream),
AVSEEK_FLAG_BYTE);
avio_flush(priv->avfc->pb);
avformat_flush(priv->avfc);
return CONTROL_OK;
case DEMUXER_CTRL_REPLACE_STREAM:
if (priv->own_stream)