diff options
Diffstat (limited to 'filters/f_decoder_wrapper.c')
-rw-r--r-- | filters/f_decoder_wrapper.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/filters/f_decoder_wrapper.c b/filters/f_decoder_wrapper.c index 3253eea95b..397c3a0a98 100644 --- a/filters/f_decoder_wrapper.c +++ b/filters/f_decoder_wrapper.c @@ -226,6 +226,7 @@ struct priv { char *cur_hwdec; char *decoder_desc; bool try_spdif; + bool attached_picture; bool pts_reset; int attempt_framedrops; // try dropping this many frames int dropped_frames; // total frames _probably_ dropped @@ -524,6 +525,14 @@ void mp_decoder_wrapper_set_spdif_flag(struct mp_decoder_wrapper *d, bool spdif) pthread_mutex_unlock(&p->cache_lock); } +void mp_decoder_wrapper_set_coverart_flag(struct mp_decoder_wrapper *d, bool c) +{ + struct priv *p = d->f->priv; + pthread_mutex_lock(&p->cache_lock); + p->attached_picture = c; + pthread_mutex_unlock(&p->cache_lock); +} + bool mp_decoder_wrapper_get_pts_reset(struct mp_decoder_wrapper *d) { struct priv *p = d->f->priv; @@ -974,13 +983,9 @@ static void read_frame(struct priv *p) if (!frame.type) return; - if (p->header->attached_picture && frame.type == MP_FRAME_VIDEO) { - p->decoded_coverart = frame; - mp_filter_internal_mark_progress(p->decf); - return; - } - pthread_mutex_lock(&p->cache_lock); + if (p->attached_picture && frame.type == MP_FRAME_VIDEO) + p->decoded_coverart = frame; if (p->attempt_framedrops) { int dropped = MPMAX(0, p->packets_without_output - 1); p->attempt_framedrops = MPMAX(0, p->attempt_framedrops - dropped); @@ -988,6 +993,11 @@ static void read_frame(struct priv *p) } pthread_mutex_unlock(&p->cache_lock); + if (p->decoded_coverart.type) { + mp_filter_internal_mark_progress(p->decf); + return; + } + p->packets_without_output = 0; if (p->preroll_discard && frame.type != MP_FRAME_EOF) { |