diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index 160ce6cd97..22e6531f8b 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -647,6 +647,18 @@ static int dict_get_decimal(AVDictionary *dict, const char *entry, int def) return def; } +static bool is_image(AVStream *st, bool attached_picture, const AVInputFormat *avif) +{ + return st->nb_frames <= 1 && ( + attached_picture || + bstr_endswith0(bstr0(avif->name), "_pipe") || + strcmp(avif->name, "alias_pix") == 0 || + strcmp(avif->name, "gif") == 0 || + strcmp(avif->name, "image2pipe") == 0 || + (st->codecpar->codec_id == AV_CODEC_ID_AV1 && st->nb_frames == 1) + ); +} + static void handle_new_stream(demuxer_t *demuxer, int i) { lavf_priv_t *priv = demuxer->priv; @@ -718,14 +730,7 @@ static void handle_new_stream(demuxer_t *demuxer, int i) sh->codec->disp_h = codec->height; if (st->avg_frame_rate.num) sh->codec->fps = av_q2d(st->avg_frame_rate); - if (st->nb_frames <= 1 && ( - sh->attached_picture || - bstr_endswith0(bstr0(priv->avif->name), "_pipe") || - strcmp(priv->avif->name, "alias_pix") == 0 || - strcmp(priv->avif->name, "gif") == 0 || - strcmp(priv->avif->name, "image2pipe") == 0 || - (codec->codec_id == AV_CODEC_ID_AV1 && st->nb_frames == 1) - )) { + if (is_image(st, sh->attached_picture, priv->avif)) { MP_VERBOSE(demuxer, "Assuming this is an image format.\n"); sh->image = true; sh->codec->fps = priv->mf_fps;