diff mbox series

[FFmpeg-devel,2/3] avformat/flv: add support for vp8 and vp9 streams

Message ID 20210701141528.776-2-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/3] avformat/flv: add support for h265 streams
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

James Almer July 1, 2021, 2:15 p.m. UTC
From: Matthieu Patou <mpatou@fb.com>

Suggested-by: ffmpeg@fb.com
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/flv.h    |  2 ++
 libavformat/flvdec.c | 17 +++++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)
diff mbox series

Patch

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) {