]> git.sesse.net Git - ffmpeg/commitdiff
avformat/avidec: add support for recognizing HEVC fourcc when demuxing
authorMarton Balint <cus@passwd.hu>
Fri, 23 Aug 2019 23:39:33 +0000 (01:39 +0200)
committerMarton Balint <cus@passwd.hu>
Sat, 31 Aug 2019 15:38:25 +0000 (17:38 +0200)
Some security cams generate this, as well as some versions of VirtualDub and
VLC so support for _reading_ such files is justified.

Fixes ticket #7110.

See also this discussion: https://patchwork.ffmpeg.org/patch/8744/

Signed-off-by: Marton Balint <cus@passwd.hu>
libavformat/avidec.c
libavformat/riff.c
libavformat/riff.h

index 1d887b1cc9814a386ec93f9dc7f5ced67f501bd0..df78925d55423a07d2756c26e75209db716994d2 100644 (file)
@@ -815,6 +815,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
                                   "mov tag found in avi (fourcc %s)\n",
                                   av_fourcc2str(tag1));
                     }
+                    if (!st->codecpar->codec_id)
+                        st->codecpar->codec_id = ff_codec_get_id(ff_codec_bmp_tags_unofficial, tag1);
+
                     /* This is needed to get the pict type which is necessary
                      * for generating correct pts. */
                     st->need_parsing = AVSTREAM_PARSE_HEADERS;
index 610974ebf0f1f19eb62840c8735e6093646c51a8..f2c04f8d95155ed9113f16e00cbfbd188105b1c0 100644 (file)
@@ -492,6 +492,11 @@ const AVCodecTag ff_codec_bmp_tags[] = {
     { AV_CODEC_ID_NONE,         0 }
 };
 
+const AVCodecTag ff_codec_bmp_tags_unofficial[] = {
+    { AV_CODEC_ID_HEVC,         MKTAG('H', 'E', 'V', 'C') },
+    { AV_CODEC_ID_NONE,         0 }
+};
+
 const AVCodecTag ff_codec_wav_tags[] = {
     { AV_CODEC_ID_PCM_S16LE,       0x0001 },
     /* must come after s16le in this list */
index 323aa38b4d78260105f4800157b7abfbdff83af7..21078b77c8edf4a94a4f2686758f56c35e0a0940 100644 (file)
@@ -73,6 +73,8 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *pa
 extern const AVCodecTag ff_codec_bmp_tags[]; // exposed through avformat_get_riff_video_tags()
 extern const AVCodecTag ff_codec_wav_tags[];
 
+extern const AVCodecTag ff_codec_bmp_tags_unofficial[];
+
 void ff_parse_specific_params(AVStream *st, int *au_rate, int *au_ssize, int *au_scale);
 
 int ff_read_riff_info(AVFormatContext *s, int64_t size);