From patchwork Fri Jan 31 14:26:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan Doshi X-Patchwork-Id: 17629 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id B7B8F44B85F for ; Fri, 31 Jan 2020 16:26:39 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 96B5568AE4C; Fri, 31 Jan 2020 16:26:39 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8A79D689EFB for ; Fri, 31 Jan 2020 16:26:31 +0200 (EET) Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 488KKL6JMPzKmcN for ; Fri, 31 Jan 2020 15:26:30 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id lPdEH95svGbq for ; Fri, 31 Jan 2020 15:26:28 +0100 (CET) From: Gyan Doshi To: ffmpeg-devel@ffmpeg.org Date: Fri, 31 Jan 2020 19:56:03 +0530 Message-Id: <20200131142608.42729-1-ffmpeg@gyani.pro> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/6] avformat/format: add av_demuxer_find_by_ext X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" Allows selecting demuxer by extension which are more widely recognized by users. Conditional cast added since this function will usually be called after av_find_input_format, and so matches its return type. --- libavformat/avformat.h | 5 +++++ libavformat/format.c | 15 +++++++++++++++ libavformat/version.h | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 9b9b634ec3..9172ddbc8a 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -2237,6 +2237,11 @@ int avformat_alloc_output_context2(AVFormatContext **ctx, ff_const59 AVOutputFor */ ff_const59 AVInputFormat *av_find_input_format(const char *short_name); +/** + * Find AVInputFormat based on an extension. + */ +const AVInputFormat *av_demuxer_find_by_ext(const char *extension); + /** * Guess the file format. * diff --git a/libavformat/format.c b/libavformat/format.c index c47490c8eb..9dda6df676 100644 --- a/libavformat/format.c +++ b/libavformat/format.c @@ -125,6 +125,21 @@ ff_const59 AVInputFormat *av_find_input_format(const char *short_name) return NULL; } +const AVInputFormat *av_demuxer_find_by_ext(const char *extension) +{ + const AVInputFormat *fmt = NULL; + void *i = 0; + while ((fmt = av_demuxer_iterate(&i))) + if (fmt->extensions && av_match_name(extension, fmt->extensions)) +#if FF_API_AVIOFORMAT + return (AVInputFormat*)fmt; +#else + return fmt; +#endif + + return NULL; +} + ff_const59 AVInputFormat *av_probe_input_format3(ff_const59 AVProbeData *pd, int is_opened, int *score_ret) { diff --git a/libavformat/version.h b/libavformat/version.h index 15fdb73e3e..be22abc010 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -32,7 +32,7 @@ // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) // Also please add any ticket numbers that you believe might be affected here #define LIBAVFORMAT_VERSION_MAJOR 58 -#define LIBAVFORMAT_VERSION_MINOR 37 +#define LIBAVFORMAT_VERSION_MINOR 38 #define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ From patchwork Fri Jan 31 14:26:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan Doshi X-Patchwork-Id: 17630 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id B5B4044B85F for ; Fri, 31 Jan 2020 16:26:40 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A14D568ADDD; Fri, 31 Jan 2020 16:26:40 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8CBC668A7E1 for ; Fri, 31 Jan 2020 16:26:32 +0200 (EET) Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 488KKM5qN2zKmbm for ; Fri, 31 Jan 2020 15:26:31 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id JItrnsTXeuZS for ; Fri, 31 Jan 2020 15:26:29 +0100 (CET) From: Gyan Doshi To: ffmpeg-devel@ffmpeg.org Date: Fri, 31 Jan 2020 19:56:04 +0530 Message-Id: <20200131142608.42729-2-ffmpeg@gyani.pro> In-Reply-To: <20200131142608.42729-1-ffmpeg@gyani.pro> References: <20200131142608.42729-1-ffmpeg@gyani.pro> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/6] doc/APIchanges: add entry for av_demuxer_find_by_ext X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" --- doc/APIchanges | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index 2494a3901b..e3db90d5fd 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2017-10-21 API changes, most recent first: +2020-01-31 - xxxxxxxxxx - lavf 58.38.100 - avformat.h + Add av_demuxer_find_by_ext(). + 2020-01-30 - xxxxxxxxxx - lavf 58.37.100 - avio.h Add avio_protocol_get_class(). From patchwork Fri Jan 31 14:26:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan Doshi X-Patchwork-Id: 17631 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id A226C44B85F for ; Fri, 31 Jan 2020 16:26:41 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 90A1268AE35; Fri, 31 Jan 2020 16:26:41 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 17BBE689EFB for ; Fri, 31 Jan 2020 16:26:33 +0200 (EET) Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 488KKN52s6zKmcK for ; Fri, 31 Jan 2020 15:26:32 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id Q1nzH-8zi_Ut for ; Fri, 31 Jan 2020 15:26:29 +0100 (CET) From: Gyan Doshi To: ffmpeg-devel@ffmpeg.org Date: Fri, 31 Jan 2020 19:56:05 +0530 Message-Id: <20200131142608.42729-3-ffmpeg@gyani.pro> In-Reply-To: <20200131142608.42729-1-ffmpeg@gyani.pro> References: <20200131142608.42729-1-ffmpeg@gyani.pro> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/6] fftools/ffmpeg: search for demuxer by extension as well X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" Identifies demuxer based on extension if short name search fails. --- fftools/ffmpeg_opt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 12d44886ee..ecc7d8f1c5 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -1026,7 +1026,8 @@ static int open_input_file(OptionsContext *o, const char *filename) } if (o->format) { - if (!(file_iformat = av_find_input_format(o->format))) { + if (!(file_iformat = av_find_input_format(o->format)) && + !(file_iformat = av_demuxer_find_by_ext(o->format))) { av_log(NULL, AV_LOG_FATAL, "Unknown input format: '%s'\n", o->format); exit_program(1); } From patchwork Fri Jan 31 14:26:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan Doshi X-Patchwork-Id: 17632 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id D97BD44B85F for ; Fri, 31 Jan 2020 16:26:43 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C302E68AF2D; Fri, 31 Jan 2020 16:26:43 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DC10668A7E1 for ; Fri, 31 Jan 2020 16:26:33 +0200 (EET) Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 488KKP2wPSzQlB9 for ; Fri, 31 Jan 2020 15:26:33 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id T7zfTS79PkVB for ; Fri, 31 Jan 2020 15:26:30 +0100 (CET) From: Gyan Doshi To: ffmpeg-devel@ffmpeg.org Date: Fri, 31 Jan 2020 19:56:06 +0530 Message-Id: <20200131142608.42729-4-ffmpeg@gyani.pro> In-Reply-To: <20200131142608.42729-1-ffmpeg@gyani.pro> References: <20200131142608.42729-1-ffmpeg@gyani.pro> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/6] fftools/ffprobe: search for demuxer by extension as well X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" Identifies demuxer based on extension if short name search fails. --- fftools/ffprobe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index b619c1f34e..a2886ec976 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -3166,8 +3166,8 @@ static void ffprobe_show_pixel_formats(WriterContext *w) static int opt_format(void *optctx, const char *opt, const char *arg) { - iformat = av_find_input_format(arg); - if (!iformat) { + if (!(iformat = av_find_input_format(arg)) && + !(iformat = av_demuxer_find_by_ext(arg))) { av_log(NULL, AV_LOG_ERROR, "Unknown input format: %s\n", arg); return AVERROR(EINVAL); } From patchwork Fri Jan 31 14:26:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan Doshi X-Patchwork-Id: 17633 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id A9AF744B85F for ; Fri, 31 Jan 2020 16:26:44 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9A5DF68AF57; Fri, 31 Jan 2020 16:26:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7123968A7E1 for ; Fri, 31 Jan 2020 16:26:34 +0200 (EET) Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 488KKQ0kLlzKmgs for ; Fri, 31 Jan 2020 15:26:34 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id pP2jj5tyv-oZ for ; Fri, 31 Jan 2020 15:26:31 +0100 (CET) From: Gyan Doshi To: ffmpeg-devel@ffmpeg.org Date: Fri, 31 Jan 2020 19:56:07 +0530 Message-Id: <20200131142608.42729-5-ffmpeg@gyani.pro> In-Reply-To: <20200131142608.42729-1-ffmpeg@gyani.pro> References: <20200131142608.42729-1-ffmpeg@gyani.pro> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/6] fftools/ffplay: search for demuxer by extension as well X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" Identifies demuxer based on extension if short name search fails. --- fftools/ffplay.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fftools/ffplay.c b/fftools/ffplay.c index fee0619f7c..4b5f46949c 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -3477,8 +3477,8 @@ static int opt_height(void *optctx, const char *opt, const char *arg) static int opt_format(void *optctx, const char *opt, const char *arg) { - file_iformat = av_find_input_format(arg); - if (!file_iformat) { + if (!(file_iformat = av_find_input_format(arg)) && + !(file_iformat = av_demuxer_find_by_ext(arg))) { av_log(NULL, AV_LOG_FATAL, "Unknown input format: %s\n", arg); return AVERROR(EINVAL); } From patchwork Fri Jan 31 14:26:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan Doshi X-Patchwork-Id: 17634 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 766BA44B85F for ; Fri, 31 Jan 2020 16:26:45 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 65A9E68AF2B; Fri, 31 Jan 2020 16:26:45 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B8CDD68AE7C for ; Fri, 31 Jan 2020 16:26:34 +0200 (EET) Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 488KKQ2pfhzKmh4 for ; Fri, 31 Jan 2020 15:26:34 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id jxNaLNYJ1fgj for ; Fri, 31 Jan 2020 15:26:32 +0100 (CET) From: Gyan Doshi To: ffmpeg-devel@ffmpeg.org Date: Fri, 31 Jan 2020 19:56:08 +0530 Message-Id: <20200131142608.42729-6-ffmpeg@gyani.pro> In-Reply-To: <20200131142608.42729-1-ffmpeg@gyani.pro> References: <20200131142608.42729-1-ffmpeg@gyani.pro> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/6] fftools/cmdutils: search for demuxer by extension as well X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" Identifies demuxer based on extension if short name search fails. --- fftools/cmdutils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index f0f2b4fde4..855a78e15f 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -1854,9 +1854,10 @@ static void show_help_codec(const char *name, int encoder) static void show_help_demuxer(const char *name) { - const AVInputFormat *fmt = av_find_input_format(name); + const AVInputFormat *fmt; - if (!fmt) { + if (!(fmt = av_find_input_format(name)) && + !(fmt = av_demuxer_find_by_ext(name))) { av_log(NULL, AV_LOG_ERROR, "Unknown format '%s'.\n", name); return; }