From patchwork Wed Apr 12 07:31:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Liu X-Patchwork-Id: 41114 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4645:b0:e3:3194:9d20 with SMTP id eb5csp278554pzb; Wed, 12 Apr 2023 00:31:57 -0700 (PDT) X-Google-Smtp-Source: AKy350YWOdQYSkN4WAVCv/TpmBAEymOfXbDhOWAWSb3Iq1EwJIETJj5ntocXMbO1BLm4286jm6US X-Received: by 2002:aa7:c695:0:b0:4fa:785d:121 with SMTP id n21-20020aa7c695000000b004fa785d0121mr1896814edq.16.1681284717391; Wed, 12 Apr 2023 00:31:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681284717; cv=none; d=google.com; s=arc-20160816; b=ofrvfEtH8YK8GJG3UFej7optqzZSxL0vg06iUSH7hb0FbQAlIeLBUkEZuvKGkRXI7b AWbb+tK9WLvKYVL2R31njAwrvW/CQ89ZqN9LGUoG4I50bnxgSFVw1cV1JR/JyB7S2zZ+ JHgUIc6F4nnSfhqVD2+NfLC36S0w2usToOgULyfK9DO2ZeMlHzuKVinpIgehrX17IcPf XPDAuGFWFufp+ZiNkzwqK2undHf4Qra9Z7q1ZiEfMDYwxGGMX6d3vh99hQUO67C0lyIx V4iJGututBf5u0Mjg28widJzum8cgkoFu81kTp3AkUSQOtCLzp72m5ImtU07GwJczzZx JusA== 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=vlRhLZ0vSQLXM/zLY/tHHO3kiF+QnWnfLtGdfoWbWy0=; b=H6alhc+RqQavH9OXVUKsY1DqHRiIKnug+l8odMhumpOzPsfKOLQFPY+88KPVVxX7La b/LkLQE78c/IuusnqHOBAcIGv7dq9BsLNXaff89/RRrYUmCk17XG+hUJ7Uzy2nI3M8fv 8Hb05sCvw3dk0s9BfD25fhkkwGEfl31dAiskEY93ovU8uTevZWGCF6p/F+zGpyI7ho8v CoZaQoyB3IX1CqMwRHM5ZX1rZHtN1xig/nlvH9QeoIDKbbsH6QjfH5z+L8Nty4rTJpbC Qmq0keD4xKXoDr5+7S7jFmrpgSes0Xnf2PxyT7k5gW/M22EIPoJvaC9UsvlfZLulsEiZ 2WKw== 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 x6-20020aa7d6c6000000b0050483173305si11106699edr.75.2023.04.12.00.31.54; Wed, 12 Apr 2023 00:31:57 -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 808EB689F8C; Wed, 12 Apr 2023 10:31:34 +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.154.221.58]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 66B0068AF6B for ; Wed, 12 Apr 2023 10:31:27 +0300 (EEST) X-QQ-mid: bizesmtp64t1681284682tke1snk9 Received: from localhost ( [103.107.217.225]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 12 Apr 2023 15:31:20 +0800 (CST) X-QQ-SSF: 01100000000000Z0Z000000A0000000 X-QQ-FEAT: uGhnJwy6xZI8aacfjd3VBoa46VZM1PdC1uuT2QQoFN+NnO8qiQ8M0TjyUW+5g Hb3ek+4WodmpoK6hThSxICMQL6mxZ8TP5NfXjioheoZXftuSnCScSxXrmFMeBW+vCP3YC9j /p5eo7OwAq+nFZ6EgCI0kVw5+MHEIk8rmz3bZVHQwRCA/CZN3YeZjHScSCzkQxI6iBBg8Hg nHjC9g46pJ4q4jFjgd0LI+HiBBCKgQDHE3/tXBC2AyknoDhuL1h5/g4P4K5Do+0Av7P0nji 0xN8rwwO8B6dBDZEH6aKTN6UH9WW4eGL1sEzDuAK+gj2bJpgkq++hEl0byYfgMPAwMHk+Eh c43xgdlmUDkXtYlNoGUlGEZrokiu/miYa9Hvb82JvPd/sKx0Tfs+6I7L+Cey16cxL4VQTfK X-QQ-GoodBg: 0 X-BIZMAIL-ID: 16471886314569797970 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Apr 2023 15:31:00 +0800 Message-Id: <20230412073100.53743-4-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230412073100.53743-1-lq@chinaffmpeg.org> References: <20230412073100.53743-1-lq@chinaffmpeg.org> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvr:qybglogicsvr2 Subject: [FFmpeg-devel] [PATCH v6 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: vwJOyGgG4+D8 Signed-off-by: Steven Liu --- libavformat/flvdec.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) 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) {