From patchwork Thu Jul 1 14:15:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 28730 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5d:965a:0:0:0:0:0 with SMTP id d26csp691259ios; Thu, 1 Jul 2021 07:16:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/+ZYEYMec67hcgCtdxWRzK/QoOBeoYu15xN4oT/NMZgB/J2HydmexKaQPcfdAi8/z66+N X-Received: by 2002:a17:907:d9f:: with SMTP id go31mr29000ejc.165.1625149009171; Thu, 01 Jul 2021 07:16:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625149009; cv=none; d=google.com; s=arc-20160816; b=E0tGRrLurFhdI07WM3V3Fc/113cC08y6WGwCwYmrn/t5vroR5wKT6sz7HqQ+F8/03g XDFpQ9tGwWPNPgObSTMTS4h0/+5yiHFeBkD0FR0IvLd0j6h5TM8xomESFr7t2YayfqHx eX09I8ue6JZqnpRagePGo8GXDOF7gHZ3w0FvVAso8lztS5xTw3z+1pZCFF+XHrb+4Zmz Qiz9qQerGQc+YfSc9rD8eosG+hEQJnxt6Dl9FF2gh9IwfmPM9SwPw26ecyLtcpX5vt/2 eT1S911Yp3hiI0PD0EGjla7gjkCOC6S10GoCLtn3jcDUsyk02GmzyR1UsqPQ9mhzjpAn UzLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=CIp3QYKbIxie6W64dZQsvXBNe8+YHYOpdqK53Ee/vLQ=; b=Hd7ax1qvw7WEmWHu22Eyu0hpOXpBaoTxxVV2A5WCZq2uFreI/XLXgg5cKaZ+fvajuv 8sk5gq1GXWAGevRGOfyvJfs8oqwwhe2LDsX2448kSv+IFdi169AuWOUjH/ewMQIPvHlC /Shc6N+30+6EsbwkjyD5hdZEQ8tJaW2a3OPJ1lru8veHl+yLzJfFs9AY1HZLn3x8WAcZ EctIW6G/rc/hL073fS3TjAHLM8NllY5PxI2TYwTdH79TZSG+e1bDBCE4Xqkk7axNkfp7 6edmXLWsSGwbVn7202TEARG1HUUbfc4w5YPD297t6foJx772TukW+d4alrICzDqtEMY1 +rCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=TChSYSZA; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z2si15953744edb.563.2021.07.01.07.16.28; Thu, 01 Jul 2021 07:16:49 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=TChSYSZA; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6E1FB68A53E; Thu, 1 Jul 2021 17:16:11 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CDE85687F7D for ; Thu, 1 Jul 2021 17:16:03 +0300 (EEST) Received: by mail-pl1-f170.google.com with SMTP id c15so3705917pls.13 for ; Thu, 01 Jul 2021 07:16:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=u82WIX2aNzTSPg886fenXZRPH+XT3P2xhL98TxaO5vk=; b=TChSYSZAx1NDebkof+2V/DjyvKmZCwqEussqVqMZrSfuTXjCajEi0Qg1BmYgWnWEwp 4uiAwkP599ApM1N1ef8xGnxxlUWe0lStEWUu3Uh1MxMNdT8xV4xA3eFOyAGL+XQBqcfA vOxwxXElk2sVbh7+Zc5hq1blZ5L5JPW02bxVGTdFjVBUZWDHIcpZ//two2F+ez8Cp6yA iAMySMsOdkQojMuG+/4JQjBfNI9xdDN3BvidIZ3sRsfGUd1DfK/ZsvBhei/kJwgcvzk9 KyhVfIPY869mUNByX8WoRtkzGDwmBVUwPDuu3S1ceU9Pt4HfMt03hfGDc7mrnnyeL51d UFEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=u82WIX2aNzTSPg886fenXZRPH+XT3P2xhL98TxaO5vk=; b=hR0+toFoHd4ODbMPzF1xj3Ck3+IHEVIjBydRHIkoyWQZXcPoobuFo8PFu1mmsU1QxU Qf4Yhsn0/ezZlHFwtZx2lulWE2R36MvH3Cn5ZuX6yJlSyc6/46fesCcn2gjs8+hkeESG 6M9YY9ZEAQ+KafUhiW7LoEsBwHti9PTxoQ7i+eVQyux9SGrwhf627Z3WqZDouyt19DjI HOPPX8yGD5c+95Y3ark7HzHzqVwTTbWK/KDQv/3MPoqZR1t689fP2pxrYBaoTMHsLG2j +hO0P7vweKD5LtjofxEFY4gVKLCKambEqjTdy4Zm7rmpS4XUmfYy99g4UZgx9g5eChss kdSA== X-Gm-Message-State: AOAM530Tri2Dsi99/c630uan7Iov+XETV3V7X8usKdC3ALapTp/oFeVV LuBq9iah8EuYcq+NQOB8P/FNOQGszX0= X-Received: by 2002:a17:903:31d1:b029:120:2863:cba2 with SMTP id v17-20020a17090331d1b02901202863cba2mr135429ple.28.1625148962082; Thu, 01 Jul 2021 07:16:02 -0700 (PDT) Received: from localhost.localdomain ([191.84.255.70]) by smtp.gmail.com with ESMTPSA id y3sm27226834pga.72.2021.07.01.07.16.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 07:16:01 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 1 Jul 2021 11:15:27 -0300 Message-Id: <20210701141528.776-2-jamrial@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210701141528.776-1-jamrial@gmail.com> References: <20210701141528.776-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] avformat/flv: add support for vp8 and vp9 streams 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: rmaj3zPkBb3B From: Matthieu Patou Suggested-by: ffmpeg@fb.com Signed-off-by: James Almer --- 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) {