From patchwork Wed Apr 12 04:27:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Liu X-Patchwork-Id: 41106 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4645:b0:e3:3194:9d20 with SMTP id eb5csp197384pzb; Tue, 11 Apr 2023 21:28:11 -0700 (PDT) X-Google-Smtp-Source: AKy350a1SUJR3nji9rDbEcbJ8s9My6G19a1Qc0g1dHrsIxC90w4HnBJvL3xnGl6L5XeGcgaMMyHc X-Received: by 2002:a17:906:6447:b0:930:f953:9608 with SMTP id l7-20020a170906644700b00930f9539608mr15057534ejn.0.1681273690839; Tue, 11 Apr 2023 21:28:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681273690; cv=none; d=google.com; s=arc-20160816; b=TjVhdMCv5/KrscgaZ0eT6p0IfSieciiRt9Q9ELeqm7lHR1sD0YI9fJT70qkIKF8vHh caDS1OzCp3Q26kqpt6xBVk97Ypncf4mV0d2pcxIcaTsR3PnFIGuo7eu0hdQ7Hzb3EWMt 3d3cmwCNdTjGJbDiaAQPSRHyHdxFKWBxWD+NW6JzczfhhO/yM4Zk+RjQO6HxUtnC9XjO H5oC2lxqLTCPoCwB9DyqTurxcmXT6fsmIki6UoQ/NwI2/DoNWFMZJx0RbH2jL6c7KK/i WyfQHFkYSv4KIwU2k1ZMrFMhkpFcAmc3n0zIEuqZCXgwz+Q2HG6tfI++2+aZjZPkaqbg pH6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:feedback-id:mime-version:references :in-reply-to:message-id:date:to:from:delivered-to; bh=wScHIIf8zoc/7GQsrPMIVOtsE4Ba/K5DqFZtmfQtXzM=; b=LU+bdwevGOOYWcvAXHb+6oIYkYBh0vxyxGa0IoQcNqPh48B9Wbq5rrZSOTamYCMbcY k2/5yWvBBVO0kXQXERejeRaf1eCZ02h8Z51agpXn+RjOaQKPw8PNOu+0XrmGEekY+pEC eb66xvr7VtsJlaBdwAEt65mBuAS6az1/vd1vsTPJA4KmFrqjf9kcnpg09fHHW3n34qAt HadG6wabbsf+Jx+6Ccf9mf86oJriD+quUKeHz3hbdGU7UwK6YCoBtcNENW38o/GtBiO6 8aXZLT2pO6QdYrMFuySRplEOqM5MV4qoGTA0er7++dLw6Dg4kDTV46oIwAOlBsF0KCr8 6x7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id o6-20020a1709064f8600b009263490cbeasi3534799eju.92.2023.04.11.21.28.10; Tue, 11 Apr 2023 21:28:10 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AF10C68BD38; Wed, 12 Apr 2023 07:27:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9A78C68BCE3 for ; Wed, 12 Apr 2023 07:27:50 +0300 (EEST) X-QQ-mid: bizesmtpipv602t1681273665tua6 Received: from localhost ( [255.142.19.15]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 12 Apr 2023 12:27:44 +0800 (CST) X-QQ-SSF: 01100000000000Z0Z000000A0000000 X-QQ-FEAT: 83ShfzFP0oCyhCLRBYrIO3Ak6qmlXDRPm2Q9ouOjDT8zLVStYCtj8FMBNavxj 2FtVdUEc+S/sWbxthn/YuR4+7qxUEZ23/blcbLivRwPe84B80p5c4+Z9DsUYGGjXhZuKAXn qN9MPRZ5oMf3pwNiXKbpsNze0Ls6QKOqex6eIJb0DE/UOqwddyK77BP8DRDzuNX7t7P6Ykf 44dVzJgp1QbWXDRrY+7rfuxv5qFI3HfR7Ex3zyvujo5qGXDkuH1QP7Osrj3MsxiHpyhN7bi hnX2n34/fw4UulC+/WDMK+Q5BdWTar1Eoy5gXFa1jebRlS7/LB/7TlX5kH0rc90nIGlxNgv hJGySj3da4Cpq1HAoumDlPKQlCAN8bmUzRvKvfjv3OBWzqHQag= X-QQ-GoodBg: 0 X-BIZMAIL-ID: 1807543429436310198 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Apr 2023 12:27:19 +0800 Message-Id: <20230412042719.6173-4-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230412042719.6173-1-lq@chinaffmpeg.org> References: <20230412042719.6173-1-lq@chinaffmpeg.org> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtpipv:chinaffmpeg.org:qybglogicsvr:qybglogicsvr2 Subject: [FFmpeg-devel] [PATCH v4 4/4] avformat/flvdec: support demux av1 in Enhanced FLV X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Steven Liu Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: tCQlO6Q4RDl+ Signed-off-by: Steven Liu --- libavformat/flv.h | 1 + libavformat/flvdec.c | 20 ++++++++++++++++++-- libavformat/flvenc.c | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/libavformat/flv.h b/libavformat/flv.h index 44d3b04ff9..398a958e60 100644 --- a/libavformat/flv.h +++ b/libavformat/flv.h @@ -117,6 +117,7 @@ enum { FLV_CODECID_REALH263= 8, FLV_CODECID_MPEG4 = 9, FLV_CODECID_HEVC = 10, + FLV_CODECID_AV1 = 11, }; enum { diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 8060c43772..525c5b2e97 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -319,6 +319,9 @@ static int flv_same_video_codec(AVFormatContext *s, AVCodecParameters *vpar, int case MKBETAG('h', 'v', 'c', '1'): flv_codecid = FLV_CODECID_HEVC; break; + case MKBETAG('a', 'v', '0', '1'): + flv_codecid = FLV_CODECID_AV1; + break; default: break; } @@ -339,6 +342,8 @@ static int flv_same_video_codec(AVFormatContext *s, AVCodecParameters *vpar, int return vpar->codec_id == AV_CODEC_ID_H264; case FLV_CODECID_HEVC: return vpar->codec_id == AV_CODEC_ID_HEVC; + case FLV_CODECID_AV1: + return vpar->codec_id == AV_CODEC_ID_AV1; default: return vpar->codec_tag == flv_codecid; } @@ -361,6 +366,9 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, case MKBETAG('h', 'v', 'c', '1'): flv_codecid = FLV_CODECID_HEVC; break; + case MKBETAG('a', 'v', '0', '1'): + flv_codecid = FLV_CODECID_AV1; + break; default: break; } @@ -408,6 +416,12 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, vstreami->need_parsing = AVSTREAM_PARSE_HEADERS; ret = 3; break; + case FLV_CODECID_AV1: + par->codec_id = AV_CODEC_ID_AV1; + vstreami->need_parsing = AVSTREAM_PARSE_HEADERS; + ret = 3; + break; + default: avpriv_request_sample(s, "Video codec (%x)", flv_codecid); par->codec_tag = flv_codecid; @@ -1285,7 +1299,8 @@ 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_MPEG4 || - st->codecpar->codec_id == AV_CODEC_ID_HEVC) { + st->codecpar->codec_id == AV_CODEC_ID_HEVC || + st->codecpar->codec_id == AV_CODEC_ID_AV1) { int type = 0; if (flv->exheader) { type = flags & 0x0F; @@ -1316,7 +1331,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_HEVC)) { + st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_HEVC || + st->codecpar->codec_id == AV_CODEC_ID_AV1)) { AVDictionaryEntry *t; if (st->codecpar->extradata) { diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index f58ab7a3b0..36ed55d231 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -29,6 +29,7 @@ #include "avio.h" #include "avc.h" #include "hevc.h" +#include "av1.h" #include "avformat.h" #include "flv.h" #include "internal.h"