History

avformat/flvdec: add support for legacy HEVC files

Timo Rothenpieler committed 1 year ago

Commit b76053d1 parent 5cd49e13 files · +8 −3Browse files

Unified · Split

3 files
  1. libavformat/flv.h +3 −0
  2. libavformat/flvdec.c +4 −2
  3. libavformat/version.h +1 −1
libavformat/flv.h+3−0
@@ -117,6 +117,9 @@ enum { · 116 unmodified lines
117117 FLV_CODECID_H264 = 7,
118118 FLV_CODECID_REALH263= 8,
119119 FLV_CODECID_MPEG4 = 9,
120+
121+ // non-standard protocol extension that is in use in the wild
122+ FLV_CODECID_X_HEVC = 12,
120123 };
121124
122125 enum {
libavformat/flvdec.c+4−2
@@ -381,6 +381,7 @@ static int flv_same_video_codec(AVCodecParameters *vpar, uint32_t flv_codecid) · 380 unmodified lines
381381 return 1;
382382
383383 switch (flv_codecid) {
384+ case FLV_CODECID_X_HEVC:
384385 case MKBETAG('h', 'v', 'c', '1'):
385386 return vpar->codec_id == AV_CODEC_ID_HEVC;
386387 case MKBETAG('a', 'v', '0', '1'):
@@ -414,6 +415,7 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, · 27 unmodified lines
414415 enum AVCodecID old_codec_id = vstream->codecpar->codec_id;
415416
416417 switch (flv_codecid) {
418+ case FLV_CODECID_X_HEVC:
417419 case MKBETAG('h', 'v', 'c', '1'):
418420 par->codec_id = AV_CODEC_ID_HEVC;
419421 vstreami->need_parsing = AVSTREAM_PARSE_HEADERS;
@@ -1660,8 +1662,8 @@ retry_duration: · 1240 unmodified lines
16601662 }
16611663
16621664 if (st->codecpar->codec_id == AV_CODEC_ID_MPEG4 ||
1663− (st->codecpar->codec_id == AV_CODEC_ID_H264 && (!enhanced_flv || type == PacketTypeCodedFrames)) ||
1664− (st->codecpar->codec_id == AV_CODEC_ID_HEVC && type == PacketTypeCodedFrames)) {
1665+ ((st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_HEVC) &&
1666+ (!enhanced_flv || type == PacketTypeCodedFrames))) {
16651667 // sign extension
16661668 int32_t cts = (avio_rb24(s->pb) + 0xff800000) ^ 0xff800000;
16671669 pts = av_sat_add64(dts, cts);
libavformat/version.h+1−1
@@ -32,7 +32,7 @@ · 31 unmodified lines
3232 #include "version_major.h"
3333
3434 #define LIBAVFORMAT_VERSION_MINOR 9
35−#define LIBAVFORMAT_VERSION_MICRO 104
35+#define LIBAVFORMAT_VERSION_MICRO 105
3636
3737 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
3838 LIBAVFORMAT_VERSION_MINOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t