[FFmpeg-devel] [PATCH 2/3] avformat/flv: add support for vp8 and vp9 streams
James Almer
jamrial at gmail.com
Thu Jul 1 17:15:27 EEST 2021
From: Matthieu Patou <mpatou at fb.com>
Suggested-by: ffmpeg at fb.com
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavformat/flv.h | 2 ++
libavformat/flvdec.c | 17 +++++++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/libavformat/flv.h b/libavformat/flv.h
index 7a026d3217..29bb36f7f6 100644
--- a/libavformat/flv.h
+++ b/libavformat/flv.h
@@ -111,6 +111,8 @@ enum {
FLV_CODECID_REALH263= 8,
FLV_CODECID_MPEG4 = 9,
FLV_CODECID_H265 = 10,
+ FLV_CODECID_VP8 = 11,
+ FLV_CODECID_VP9 = 12,
};
enum {
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index ba60d71196..dafedb4770 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -323,6 +323,10 @@ static int flv_same_video_codec(AVCodecParameters *vpar, int flags)
return vpar->codec_id == AV_CODEC_ID_H264;
case FLV_CODECID_H265:
return vpar->codec_id == AV_CODEC_ID_H265;
+ case FLV_CODECID_VP8:
+ return vpar->codec_id == AV_CODEC_ID_VP8;
+ case FLV_CODECID_VP9:
+ return vpar->codec_id == AV_CODEC_ID_VP9;
default:
return vpar->codec_tag == flv_codecid;
}
@@ -377,6 +381,12 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream,
par->codec_id = AV_CODEC_ID_MPEG4;
ret = 3;
break;
+ case FLV_CODECID_VP8:
+ par->codec_id = AV_CODEC_ID_VP8;
+ break;
+ case FLV_CODECID_VP9:
+ par->codec_id = AV_CODEC_ID_VP9;
+ break;
default:
avpriv_request_sample(s, "Video codec (%x)", flv_codecid);
par->codec_tag = flv_codecid;
@@ -1249,7 +1259,9 @@ retry_duration:
if (st->codecpar->codec_id == AV_CODEC_ID_AAC ||
st->codecpar->codec_id == AV_CODEC_ID_H264 ||
st->codecpar->codec_id == AV_CODEC_ID_H265 ||
- st->codecpar->codec_id == AV_CODEC_ID_MPEG4) {
+ st->codecpar->codec_id == AV_CODEC_ID_MPEG4 ||
+ st->codecpar->codec_id == AV_CODEC_ID_VP8 ||
+ st->codecpar->codec_id == AV_CODEC_ID_VP9) {
int type = avio_r8(s->pb);
size--;
@@ -1276,7 +1288,8 @@ retry_duration:
}
}
if (type == 0 && (!st->codecpar->extradata || st->codecpar->codec_id == AV_CODEC_ID_AAC ||
- st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_H265)) {
+ st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_H265 ||
+ st->codecpar->codec_id == AV_CODEC_ID_VP8 || st->codecpar->codec_id == AV_CODEC_ID_VP9)) {
AVDictionaryEntry *t;
if (st->codecpar->extradata) {
--
2.32.0
More information about the ffmpeg-devel
mailing list