diff options
author | wm4 <wm4@nowhere> | 2018-01-27 04:49:02 +0100 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2018-01-26 23:29:42 -0800 |
commit | 20cc22437eeaf378ed6e983cd662edc82c6843c6 (patch) | |
tree | 42a74c190767df187288d0b1c11d41d15fa20fb9 /demux | |
parent | ef324e1316ca35236e065eae4535f9114bb83e5d (diff) |
demux_lavf: work around another aspect of libavformat garbage API
AV_DISPOSITION_ATTACHED_PIC usually means the video track isn't real,
and merely reflects the presence of an embedded image in tag data (such
as ID3v2 tags), with some inconsistent hack to make libavformat return
it as video packet once.
Except it doesn't mean that. It can be randomly set on other streams
that do sort of behave like video streams, such as chapter thumbnail
tracks in mp4 files. AV_DISPOSITION_TIMED_THUMBNAILS is set in these
cases. In theory, there can supposedly be more such cases, but only the
chapter thumbnail one currently exists. So add it as exception.
This restores displaying these thumbnails as video frames, for better or
worse. (Before, only the first thumbnail was displayed.)
Diffstat (limited to 'demux')
-rw-r--r-- | demux/demux_lavf.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index 074c6edc7e..cb6fbbc7c7 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -50,6 +50,9 @@ #include "options/m_option.h" #include "options/path.h" +#ifndef AV_DISPOSITION_TIMED_THUMBNAILS +#define AV_DISPOSITION_TIMED_THUMBNAILS 0 +#endif #define INITIAL_PROBE_SIZE STREAM_BUFFER_SIZE #define PROBE_BUF_SIZE FFMIN(STREAM_MAX_BUFFER_SIZE, 2 * 1024 * 1024) @@ -615,7 +618,9 @@ static void handle_new_stream(demuxer_t *demuxer, int i) case AVMEDIA_TYPE_VIDEO: { sh = demux_alloc_sh_stream(STREAM_VIDEO); - if (st->disposition & AV_DISPOSITION_ATTACHED_PIC) { + if ((st->disposition & AV_DISPOSITION_ATTACHED_PIC) && + !(st->disposition & AV_DISPOSITION_TIMED_THUMBNAILS)) + { sh->attached_picture = new_demux_packet_from_avpacket(&st->attached_pic); if (sh->attached_picture) { |