From b0b5de306387f03f7f79a34ecc7d2aaf223f180a Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 28 Feb 2020 21:17:55 +0100 Subject: f_decoder_wrapper: replace most public fields with setters/getters I may (optionally) move decoding to a separate thread in a future change. It's a bit attractive to move the entire decoder wrapper to there, so if the demuxer has a new packet, it doesn't have to wake up the main thread, and can directly wake up the decoder. (Although that's bullshit, since there's a queue in between, and libavcodec's multi-threaded decoding plays cross-threads ping pong with packets anyway. On the other hand, the main thread would still have to shuffle the packets around, so whatever, just seems like better design.) As preparation, there shouldn't be any mutable state exposed by the wrapper. But there's still a large number of corner-caseish crap, so just use setters/getters for them. This recorder thing will inherently not work, so it'll have to be disabled if threads are used. This is a bit painful, but probably still the right thing. Like speculatively pulling teeth. --- player/video.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'player/video.c') diff --git a/player/video.c b/player/video.c index d1e1554ef0..2e0c8f6460 100644 --- a/player/video.c +++ b/player/video.c @@ -101,7 +101,7 @@ void reset_video_state(struct MPContext *mpctx) vo_chain_reset_state(mpctx->vo_chain); struct track *t = mpctx->vo_chain->track; if (t && t->dec) - t->dec->play_dir = mpctx->play_dir; + mp_decoder_wrapper_set_play_dir(t->dec, mpctx->play_dir); } for (int n = 0; n < mpctx->num_next_frames; n++) @@ -259,7 +259,8 @@ void reinit_video_chain_src(struct MPContext *mpctx, struct track *track) goto err_out; vo_c->dec_src = track->dec->f->pins[0]; - vo_c->filter->container_fps = track->dec->fps; + vo_c->filter->container_fps = + mp_decoder_wrapper_get_container_fps(track->dec); vo_c->is_coverart = !!track->stream->attached_picture; vo_c->is_sparse = track->stream->still_image || vo_c->is_coverart; @@ -323,8 +324,8 @@ static void check_framedrop(struct MPContext *mpctx, struct vo_chain *vo_c) return; double frame_time = 1.0 / fps; // try to drop as many frames as we appear to be behind - vo_c->track->dec->attempt_framedrops = - MPCLAMP((mpctx->last_av_difference - 0.010) / frame_time, 0, 100); + mp_decoder_wrapper_set_frame_drops(vo_c->track->dec, + MPCLAMP((mpctx->last_av_difference - 0.010) / frame_time, 0, 100)); } } -- cgit v1.2.3