path: root/player/video.c
diff options
authorwm4 <wm4@nowhere>2020-02-28 21:17:55 +0100
committerwm4 <wm4@nowhere>2020-02-29 01:23:20 +0100
commitb0b5de306387f03f7f79a34ecc7d2aaf223f180a (patch)
tree40fa6a05b16e4e79829e0acc6434edf8100f046e /player/video.c
parenta8f4ca587dba1c1579e20b3361196c78babab7fa (diff)
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.
Diffstat (limited to 'player/video.c')
1 files changed, 5 insertions, 4 deletions
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)
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)
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));