[FFmpeg-devel] [PATCH v9 6/6] avformat/flvenc: support demux vp9 in enhanced flv

Steven Liu lq at chinaffmpeg.org
Fri May 12 06:59:01 EEST 2023


Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
---
 libavformat/flvdec.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 98a2231559..bc93c23166 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -320,6 +320,8 @@ static int flv_same_video_codec(AVFormatContext *s, AVCodecParameters *vpar, int
                 return vpar->codec_id == AV_CODEC_ID_HEVC;
             case MKBETAG('a', 'v', '0', '1'):
                 return vpar->codec_id == AV_CODEC_ID_AV1;
+            case MKBETAG('v', 'p', '0', '9'):
+                return vpar->codec_id == AV_CODEC_ID_VP9;
             default:
                 break;
         }
@@ -365,6 +367,10 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream,
                 par->codec_id = AV_CODEC_ID_AV1;
                 vstreami->need_parsing = AVSTREAM_PARSE_HEADERS;
                 return 4;
+            case MKBETAG('v', 'p', '0', '9'):
+                par->codec_id = AV_CODEC_ID_VP9;
+                vstreami->need_parsing = AVSTREAM_PARSE_HEADERS;
+                return 4;
             default:
                 break;
         }
@@ -1285,7 +1291,8 @@ retry_duration:
         st->codecpar->codec_id == AV_CODEC_ID_H264 ||
         st->codecpar->codec_id == AV_CODEC_ID_MPEG4 ||
         st->codecpar->codec_id == AV_CODEC_ID_HEVC ||
-        st->codecpar->codec_id == AV_CODEC_ID_AV1) {
+        st->codecpar->codec_id == AV_CODEC_ID_AV1 ||
+        st->codecpar->codec_id == AV_CODEC_ID_VP9) {
         int type = 0;
         if (flv->exheader) {
             type = flags & 0x0F;
@@ -1317,7 +1324,7 @@ 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_HEVC ||
-            st->codecpar->codec_id == AV_CODEC_ID_AV1)) {
+            st->codecpar->codec_id == AV_CODEC_ID_AV1 || st->codecpar->codec_id == AV_CODEC_ID_VP9)) {
             AVDictionaryEntry *t;
 
             if (st->codecpar->extradata) {
-- 
2.40.0



More information about the ffmpeg-devel mailing list