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
117 FLV_CODECID_H264 = 7,117 FLV_CODECID_H264 = 7,
118 FLV_CODECID_REALH263= 8,118 FLV_CODECID_REALH263= 8,
119 FLV_CODECID_MPEG4 = 9,119 FLV_CODECID_MPEG4 = 9,
120
121 // non-standard protocol extension that is in use in the wild
122 FLV_CODECID_X_HEVC = 12,
120};123};
121 124
122enum {125enum {
libavformat/flvdec.c+4−2
@@ -381,6 +381,7 @@ static int flv_same_video_codec(AVCodecParameters *vpar, uint32_t flv_codecid) · 380 unmodified lines
381 return 1;381 return 1;
382 382
383 switch (flv_codecid) {383 switch (flv_codecid) {
384 case FLV_CODECID_X_HEVC:
384 case MKBETAG('h', 'v', 'c', '1'):385 case MKBETAG('h', 'v', 'c', '1'):
385 return vpar->codec_id == AV_CODEC_ID_HEVC;386 return vpar->codec_id == AV_CODEC_ID_HEVC;
386 case MKBETAG('a', 'v', '0', '1'):387 case MKBETAG('a', 'v', '0', '1'):
@@ -414,6 +415,7 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, · 27 unmodified lines
414 enum AVCodecID old_codec_id = vstream->codecpar->codec_id;415 enum AVCodecID old_codec_id = vstream->codecpar->codec_id;
415 416
416 switch (flv_codecid) {417 switch (flv_codecid) {
418 case FLV_CODECID_X_HEVC:
417 case MKBETAG('h', 'v', 'c', '1'):419 case MKBETAG('h', 'v', 'c', '1'):
418 par->codec_id = AV_CODEC_ID_HEVC;420 par->codec_id = AV_CODEC_ID_HEVC;
419 vstreami->need_parsing = AVSTREAM_PARSE_HEADERS;421 vstreami->need_parsing = AVSTREAM_PARSE_HEADERS;
@@ -1660,8 +1662,8 @@ retry_duration: · 1240 unmodified lines
1660 }1662 }
1661 1663
1662 if (st->codecpar->codec_id == AV_CODEC_ID_MPEG4 ||1664 if (st->codecpar->codec_id == AV_CODEC_ID_MPEG4 ||
1663 (st->codecpar->codec_id == AV_CODEC_ID_H264 && (!enhanced_flv || type == PacketTypeCodedFrames)) ||1665 ((st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_HEVC) &&
1664 (st->codecpar->codec_id == AV_CODEC_ID_HEVC && type == PacketTypeCodedFrames)) {1666 (!enhanced_flv || type == PacketTypeCodedFrames))) {
1665 // sign extension1667 // sign extension
1666 int32_t cts = (avio_rb24(s->pb) + 0xff800000) ^ 0xff800000;1668 int32_t cts = (avio_rb24(s->pb) + 0xff800000) ^ 0xff800000;
1667 pts = av_sat_add64(dts, cts);1669 pts = av_sat_add64(dts, cts);
libavformat/version.h+1−1
@@ -32,7 +32,7 @@ · 31 unmodified lines
32#include "version_major.h"32#include "version_major.h"
33 33
34#define LIBAVFORMAT_VERSION_MINOR 934#define LIBAVFORMAT_VERSION_MINOR 9
35#define LIBAVFORMAT_VERSION_MICRO 10435#define LIBAVFORMAT_VERSION_MICRO 105
36 36
37#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \37#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
38 LIBAVFORMAT_VERSION_MINOR, \38 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