Skip to content

Commit

Permalink
avformat/avidec: add support for recognizing HEVC fourcc when demuxing
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
cus committed Aug 31, 2019
1 parent 765c56b commit 2e31774
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libavformat/avidec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions libavformat/riff.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 2 additions & 0 deletions libavformat/riff.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2e31774

Please sign in to comment.