0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00

demux_lavf: add format hack entry for jpeg metadata frames

This commit is contained in:
nanahi 2024-06-13 22:19:27 -04:00 committed by Dudemanguy
parent daa3264d3f
commit 3fa09458da

View File

@ -152,6 +152,7 @@ struct format_hack {
bool no_pcm_seek : 1;
bool no_seek_on_no_duration : 1;
bool readall_on_no_streamseek : 1;
bool first_frame_only : 1;
};
#define BLACKLIST(fmt) {fmt, .ignore = true}
@ -190,6 +191,10 @@ static const struct format_hack format_hacks[] = {
// reset timestamps, which causes all sorts of problems.
{"ogg", .linearize_audio_ts = true, .use_stream_ids = true},
// Ignore additional metadata as frames from some single frame JPEGs
// (e.g. gain map)
{"jpeg_pipe", .first_frame_only = true},
// At some point, FFmpeg lost the ability to read gif from unseekable
// streams.
{"gif", .readall_on_no_streamseek = true},
@ -1255,8 +1260,8 @@ static bool demux_lavf_read_packet(struct demuxer *demux,
struct sh_stream *stream = info->sh;
AVStream *st = priv->avfc->streams[pkt->stream_index];
// Never send additional frames for streams that are a single frame jpeg.
if (stream->image && !strcmp(priv->avif->name, "jpeg_pipe") && pkt->pos != 0) {
// Never send additional frames for streams that are a single frame.
if (stream->image && priv->format_hack.first_frame_only && pkt->pos != 0) {
av_packet_unref(pkt);
return true;
}