mirror of
https://github.com/mpv-player/mpv
synced 2025-02-06 15:11:58 +00:00
Move some code from player to audio/video reset functions
This commit is contained in:
parent
f09b2ff661
commit
1e96f5bcd9
@ -349,8 +349,12 @@ int audio_decode(struct dec_audio *d_audio, struct mp_audio_buffer *outbuf,
|
||||
|
||||
void audio_reset_decoding(struct dec_audio *d_audio)
|
||||
{
|
||||
d_audio->pts = MP_NOPTS_VALUE;
|
||||
d_audio->pts_offset = 0;
|
||||
if (d_audio->ad_driver)
|
||||
d_audio->ad_driver->control(d_audio, ADCTRL_RESET, NULL);
|
||||
if (d_audio->afilter)
|
||||
af_control_all(d_audio->afilter, AF_CONTROL_RESET, NULL);
|
||||
d_audio->pts = MP_NOPTS_VALUE;
|
||||
d_audio->pts_offset = 0;
|
||||
if (d_audio->decode_buffer)
|
||||
mp_audio_buffer_clear(d_audio->decode_buffer);
|
||||
}
|
||||
|
@ -172,12 +172,6 @@ static void seek_reset(struct MPContext *mpctx, bool reset_ao)
|
||||
if (mpctx->d_video) {
|
||||
video_reset_decoding(mpctx->d_video);
|
||||
vo_seek_reset(mpctx->video_out);
|
||||
if (mpctx->d_video->vf_initialized == 1)
|
||||
vf_chain_seek_reset(mpctx->d_video->vfilter);
|
||||
mpctx->d_video->num_buffered_pts = 0;
|
||||
mpctx->d_video->last_pts = MP_NOPTS_VALUE;
|
||||
mpctx->d_video->last_packet_pdts = MP_NOPTS_VALUE;
|
||||
mpctx->d_video->pts = MP_NOPTS_VALUE;
|
||||
mpctx->video_pts = MP_NOPTS_VALUE;
|
||||
mpctx->delay = 0;
|
||||
mpctx->time_frame = 0;
|
||||
@ -185,11 +179,8 @@ static void seek_reset(struct MPContext *mpctx, bool reset_ao)
|
||||
|
||||
if (mpctx->d_audio) {
|
||||
audio_reset_decoding(mpctx->d_audio);
|
||||
if (mpctx->d_audio->afilter)
|
||||
af_control_all(mpctx->d_audio->afilter, AF_CONTROL_RESET, NULL);
|
||||
if (reset_ao)
|
||||
clear_audio_output_buffers(mpctx);
|
||||
clear_audio_decode_buffers(mpctx);
|
||||
}
|
||||
|
||||
reset_subtitles(mpctx);
|
||||
|
@ -118,8 +118,6 @@ int reinit_video_chain(struct MPContext *mpctx)
|
||||
|
||||
struct dec_video *d_video = talloc_zero(NULL, struct dec_video);
|
||||
mpctx->d_video = d_video;
|
||||
d_video->last_pts = MP_NOPTS_VALUE;
|
||||
d_video->last_packet_pdts = MP_NOPTS_VALUE;
|
||||
d_video->opts = mpctx->opts;
|
||||
d_video->header = sh;
|
||||
d_video->fps = sh->video->fps;
|
||||
|
@ -59,8 +59,14 @@ const vd_functions_t * const mpcodecs_vd_drivers[] = {
|
||||
void video_reset_decoding(struct dec_video *d_video)
|
||||
{
|
||||
video_vd_control(d_video, VDCTRL_RESET, NULL);
|
||||
if (d_video->vf_initialized == 1)
|
||||
vf_chain_seek_reset(d_video->vfilter);
|
||||
d_video->prev_codec_reordered_pts = MP_NOPTS_VALUE;
|
||||
d_video->prev_sorted_pts = MP_NOPTS_VALUE;
|
||||
d_video->num_buffered_pts = 0;
|
||||
d_video->last_pts = MP_NOPTS_VALUE;
|
||||
d_video->last_packet_pdts = MP_NOPTS_VALUE;
|
||||
d_video->pts = MP_NOPTS_VALUE;
|
||||
}
|
||||
|
||||
int video_vd_control(struct dec_video *d_video, int cmd, void *arg)
|
||||
@ -165,6 +171,7 @@ static const struct vd_functions *find_driver(const char *name)
|
||||
bool video_init_best_codec(struct dec_video *d_video, char* video_decoders)
|
||||
{
|
||||
assert(!d_video->vd_driver);
|
||||
video_reset_decoding(d_video);
|
||||
|
||||
struct mp_decoder_entry *decoder = NULL;
|
||||
struct mp_decoder_list *list =
|
||||
|
Loading…
Reference in New Issue
Block a user