From patchwork Fri Jun 11 10:41:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 28202 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp328001iol; Fri, 11 Jun 2021 03:42:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdE7mK2Ognms8iUmi2/n+zYTJPrvHuWJ/lNFb7Ubb8XrvhDnJ0vXdthtn1H3DpwxqAhgnD X-Received: by 2002:a17:907:10d8:: with SMTP id rv24mr3017152ejb.542.1623408136712; Fri, 11 Jun 2021 03:42:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623408136; cv=none; d=google.com; s=arc-20160816; b=L3Juvo/6mjJx+xbgaQOYvDSXBl6yyuy1up5rZNFdFE9jrR0Dg8tzzRFF1K4BrDWKsh 56xDhfbN/gHtZmuN9V7VlrQw2ijz6genh6xC4Oo1eaqWI+Y6VPpXS+H8zD5zfUyuTSHj HGWHVcaDR2mFCHy1TNqnPEjUHxCDAqiPNiaJuQR1w37uAb9TSWZuA6p7GId61RAm9AHL HY1Z+oNPWovDwnggHmulku14QFyCLyhlQDuVLu4vKyNlz8tp4cqVzriuJjKMlEfZVrt2 OEkMwp20xcYN3EcZTeLKEGl/UwD6tQTHc4qigs1nlEWhMY5HIJno0SNdaJpDDe4lzjGS LaEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to; bh=I6dMRTWZ96LBSFPnML7fKs4Pw2vj5EqGgHcZvXaZwV8=; b=Xtt3ky1DjFjMZgqxazjqPYIQgwuPZrT845pn3XAb1IuDqPioNOX+J0my0dntU/OlUG 63rsWF+IyTu4acwS/X5xgcBlU2d/UdWOrcS6N8P3urzzX9nib9zP2qA0jwu2BZlJmgVL JsCgZTBO6576hSgq7lULdxmKJafsEBZOahWJFGjO6zcyv0miIHTko3Ci01DJIB6yYFdd l+8cZwHiBYXP1kFXmOMk0t3e27MXWcy2uix1mMLpoZt5E3q9NLHCtwZHqtb6zetMvJuM 2q6K4pRXoPASpiHyXiuasgJXSj2EOus26neb4ANy+37v3KvV425pkyH+saCxOqVOVNMr w7XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b="mshuyl5/"; 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 t26si4458667edf.425.2021.06.11.03.42.12; Fri, 11 Jun 2021 03:42:16 -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="mshuyl5/"; 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 D401C680C0F; Fri, 11 Jun 2021 13:42:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5E4D9680903 for ; Fri, 11 Jun 2021 13:42:02 +0300 (EEST) Received: by mail-pg1-f181.google.com with SMTP id q15so2094158pgg.12 for ; Fri, 11 Jun 2021 03:42:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=hZTXhJR8BvLrnjSI63FLX3trVbuHLcUwcVosKmMeSgg=; b=mshuyl5/hqzpHcB+Pi6+Lbmz1HiQNCbn4QC7oKBea4X/Z++1/M9WCIGgmWcKCH0oMy bXnztJWqeQHhzGvDSUHiQ9T5LS214EMAH31aKqxmy5jmBWoKHpNAijEvjN555O+OhSmZ Na6MlvqHHJH5IjeObKiC0UiK5SA7Mp7T8kA4YOR/UKPuD7KVBwScfd2UFzQj8/OnWki+ AKl9+T1tPBDJmTqqDdICsBeENhc03sdXsfG6z+Ztb6c5nMMCz8Yftc3RJc7vUkgU1EWP B77whlxwgUNEeyiVLlC3QfyTakLDd6PQ/o1qEs1jSUSUG2jXXKrADIgqF0WiWtsOqkuD WsfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hZTXhJR8BvLrnjSI63FLX3trVbuHLcUwcVosKmMeSgg=; b=d9juGqReB9OXQ4Hk1iVNGORgsxAKsnABKJuMu6+pduy57jHjlPQG1Xdp/93AWewmRd /kNgqJ5rOhNoGGAhUyDizuMKvnCnU2mSfPe/ROVC4fGmFRphZAWMQf4zVSYMA5MlssJO UBnbWa73/H9m0k+84APPt1uCfBYTWNQTs5uTo3V+rZdVTHA1M7W1rqFUheuhzQ1HuWmC ywu13D8nVQdu1BuxTyrvcCLH0REWWoS9c0dYKRejPM+UmQ3XrQi/1V+mbijF86z+jhZY hJt5PpIq7rtPI1wW/mmnZiraDqb+yYyqlBq2RjNEHpCwxvNfDk+RvBSEpYtdEA1Wss01 YWxw== X-Gm-Message-State: AOAM5306MsJyhK1PLQJWikIjrWBWSE5M6ZO/E2sAwKk3BIE8P6q8y24S cu3OnltzgLxyrAmxwnE4BuEKpw1FppQ= X-Received: by 2002:aa7:824a:0:b029:2ec:89ee:e798 with SMTP id e10-20020aa7824a0000b02902ec89eee798mr7697401pfn.12.1623408120159; Fri, 11 Jun 2021 03:42:00 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id z6sm400073pgs.24.2021.06.11.03.41.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Jun 2021 03:41:59 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 11 Jun 2021 18:41:55 +0800 Message-Id: <1623408115-16922-1-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 Subject: [FFmpeg-devel] [PATCH] avformat/dashenc: use av_match_ext() 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: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: o3s+QKn/X1K3 From: Limin Wang Signed-off-by: Limin Wang --- libavformat/dashenc.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 8a626c1..b7622bc 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -330,16 +330,6 @@ static int init_segment_types(AVFormatContext *s) return 0; } -static int check_file_extension(const char *filename, const char *extension) { - char *dot; - if (!filename || !extension) - return -1; - dot = strrchr(filename, '.'); - if (dot && !strcmp(dot + 1, extension)) - return 0; - return -1; -} - static void set_vp9_codec_str(AVFormatContext *s, AVCodecParameters *par, AVRational *frame_rate, char *str, int size) { VPCC vpcc; @@ -1530,9 +1520,9 @@ static int dash_init(AVFormatContext *s) } if (os->segment_type == SEGMENT_TYPE_WEBM) { - if ((!c->single_file && check_file_extension(os->init_seg_name, os->format_name) != 0) || - (!c->single_file && check_file_extension(os->media_seg_name, os->format_name) != 0) || - (c->single_file && check_file_extension(os->single_file_name, os->format_name) != 0)) { + if ((!c->single_file && !av_match_ext(os->init_seg_name, os->format_name)) || + (!c->single_file && !av_match_ext(os->media_seg_name, os->format_name)) || + ( c->single_file && !av_match_ext(os->single_file_name, os->format_name))) { av_log(s, AV_LOG_WARNING, "One or many segment file names doesn't end with .webm. " "Override -init_seg_name and/or -media_seg_name and/or "