From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 82588467E6 for ; Sun, 18 Jun 2023 23:44:13 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4B1CF68BF5F; Mon, 19 Jun 2023 02:43:56 +0300 (EEST) Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 19F1768BF45 for ; Mon, 19 Jun 2023 02:43:49 +0300 (EEST) Received: by mail-oi1-f175.google.com with SMTP id 5614622812f47-3909756b8b1so1314137b6e.1 for ; Sun, 18 Jun 2023 16:43:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687131827; x=1689723827; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=sZzk8QMHFAcIQqVfqI2xQuVQbSlhUA6AbnOgKsPU2KU=; b=qBif7XlcrPYjL66mc0IusBmBU3LHA8nBepY7XYxGEAU4zN9K2/Wwq+xOBvN5hpcpIR 6iHe4j3pEttvS+D1ej/tEsmH68sGR/olzzgivfPHx7/NwI42Nc0Aqm668XBFVNvJaEZ0 x76Zg4Xd/K+xOeJMoP4I5pTkEUg2Q9U+ILzqNkHHgEqt5MNceKyqBh/IXk0L/aqEnHlY 29QZdH9uBHIgtwBc9rE/Kh+6QlMvCuVcvqyNvqiC2SuUBK9TPOflTBT9bZdSeIglclaF 1pmGsNR6mN/2ThK8FbDtAiIr/cH/gmJZvKlgoNvKPXkyI2tZgEf34gckX9Gfk4jspls7 0H+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687131827; x=1689723827; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sZzk8QMHFAcIQqVfqI2xQuVQbSlhUA6AbnOgKsPU2KU=; b=erMAByr+4xDiGb1rfarIYGjqHWi1a/5zLnVW95LKl95OSPxQhXm4Bp2fAoPWQDZyT7 SZ0ZcwdnfWLfCLZ6PKuTdZh33uFb0NlsWWL8ZH5NZJFvx9Ve3qoHmHj0fAreZ1Jnq2d/ jt0VZsz9/NlRvJPFmSLUYgQK3ge2ABvrQ+I6nLnZusEPDmaalP7Klf9zGKJkSRyKrD52 Kt7MsVp/+pViI6CYJ7pD1SwEcBMoSWhv5uU/OXPRm+5Ruc6BeXN7vEuBEfvT1Ccq5qtT hgvb6lmhI8GIGHqjsYknMEMGXQogdzozQN67DkLzStVYAYBBRc/mznpSWS9sJImaueDp K1zA== X-Gm-Message-State: AC+VfDx2Dlr+39W5t2Xh7RfnRmN0ET9Gkbsu4jihJTsGXkIdhKZNMCyq QcOotxRN8ahfz4aKv9wf04P6xxh+aKs= X-Google-Smtp-Source: ACHHUZ6cosbOErqEi5ocONz87QTKazYjkSPuD1pN8abyVjdyEQ/lJVC0vrrQvSBSxnz7uy/NvN9epw== X-Received: by 2002:a05:6808:a9a:b0:39a:b525:2a2e with SMTP id q26-20020a0568080a9a00b0039ab5252a2emr5785031oij.41.1687131827397; Sun, 18 Jun 2023 16:43:47 -0700 (PDT) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id bk36-20020a0568081a2400b0039eb5f4543csm2069664oib.34.2023.06.18.16.43.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Jun 2023 16:43:47 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sun, 18 Jun 2023 20:43:28 -0300 Message-ID: <20230618234332.1370-3-jamrial@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230617151848.1378-1-jamrial@gmail.com> References: <20230617151848.1378-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 13/17] avformat/evcdec: simplify probe function 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Signed-off-by: James Almer --- libavformat/evcdec.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/libavformat/evcdec.c b/libavformat/evcdec.c index 0f17edd371..7a783e9809 100644 --- a/libavformat/evcdec.c +++ b/libavformat/evcdec.c @@ -34,14 +34,6 @@ #define RAW_PACKET_SIZE 1024 -typedef struct EVCParserContext { - int got_sps; - int got_pps; - int got_idr; - int got_nonidr; - -} EVCParserContext; - typedef struct EVCDemuxContext { const AVClass *class; AVRational framerate; @@ -65,10 +57,11 @@ static const AVClass evc_demuxer_class = { .version = LIBAVUTIL_VERSION_INT, }; -static int parse_nal_units(const AVProbeData *p, EVCParserContext *ev) +static int annexb_probe(const AVProbeData *p) { int nalu_type; size_t nalu_size; + int got_sps = 0, got_pps = 0, got_idr = 0, got_nonidr = 0; unsigned char *bits = (unsigned char *)p->buf; int bytes_to_read = p->buf_size; @@ -85,27 +78,19 @@ static int parse_nal_units(const AVProbeData *p, EVCParserContext *ev) nalu_type = evc_get_nalu_type(bits, bytes_to_read, NULL); if (nalu_type == EVC_SPS_NUT) - ev->got_sps++; + got_sps++; else if (nalu_type == EVC_PPS_NUT) - ev->got_pps++; + got_pps++; else if (nalu_type == EVC_IDR_NUT ) - ev->got_idr++; + got_idr++; else if (nalu_type == EVC_NOIDR_NUT) - ev->got_nonidr++; + got_nonidr++; bits += nalu_size; bytes_to_read -= nalu_size; } - return 0; -} - -static int annexb_probe(const AVProbeData *p) -{ - EVCParserContext ev = {0}; - int ret = parse_nal_units(p, &ev); - - if (ret == 0 && ev.got_sps && ev.got_pps && (ev.got_idr || ev.got_nonidr > 3)) + if (got_sps && got_pps && (got_idr || got_nonidr > 3)) return AVPROBE_SCORE_EXTENSION + 1; // 1 more than .mpg return 0; -- 2.41.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".