From patchwork Sun Mar 18 17:22:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Dekker X-Patchwork-Id: 8027 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.1.70 with SMTP id c67csp1800909jad; Sun, 18 Mar 2018 10:22:40 -0700 (PDT) X-Google-Smtp-Source: AG47ELtr/HbirZC6DMY6/0S+miEzeyI1jZAdC2lrSbRfU0OqaVWXndUWao1arKN2cMTA/OFHGutU X-Received: by 10.28.215.200 with SMTP id o191mr6424908wmg.84.1521393760272; Sun, 18 Mar 2018 10:22:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521393760; cv=none; d=google.com; s=arc-20160816; b=Wsh7fDYIKvgoOFrv3F/pvt3hhBy/uuCb8Sz4JY0TAN+7wQp1SiMIUN8NdBGI/50PjQ OxH2zEb46LL8vF0gYOgj0GsYXI7dUKoKSAWQqD5SLnDLJiweCVaNBYpEoogytQCoeOp8 WiwZPjH33aomXF/udWu2dLAgRryinPjD/ZmkYN4723lU/RhNSq9UVwVf5GnYEuBvlcCP eps9p/2PkKh70yE/AFpdkoPNEhVxtMXTKxRcCkNKdY3OTRhJVgpdaUljT1A4IAkLStas ZIACsolVUU2n1iOpPkueeMUaTdr1PYpNF0intJb9ygn26rWXkfU+vjg64B13jAuHsAw9 I80w== 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:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:dkim-signature:delivered-to :arc-authentication-results; bh=W3gDmcB9TNDt9XdJyXFJL7dLCNl5lDi/qzypyKbS6ys=; b=c56y1/ClAhfW2rZTTUcajMpbMne6wfWAQ88M0XQppxkHdZOe6U8Ja2KOoOUvMtu2kK uFE1CMm+Zq9eNNQ7lcHV0rVbK4As6+q04+iJexyhs/wmZHeGrphXZAt25Kq8zJd0xV/9 0FLQSRdjgcuMxzH1hY3hbwljjFQYEnqZOyKtvedkVVAxTlkiYbkF8qQLfF4wgAzAjt5+ tE0OPX4eOLTZrRCIzi0h4odTHlYHKbP12IOGOk3ADLS5ZvesRqvZmsSF++z3Eg5m09Wk 2pznXgXm5DM8h9tB9uGYnyHsD4KvVHZ4KRJ4hd8OCQ1zLids6JUlPxgsMmpGSAm0sXH5 5RBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm1 header.b=BoBWET6j; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm2 header.b=CUV1oYeX; 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 p18si13290wmh.204.2018.03.18.10.22.39; Sun, 18 Mar 2018 10:22:40 -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=@itanimul.li header.s=fm1 header.b=BoBWET6j; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm2 header.b=CUV1oYeX; 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 8ACA1689CE0; Sun, 18 Mar 2018 19:22:18 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8D089680C89 for ; Sun, 18 Mar 2018 19:22:09 +0200 (EET) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 006E320DC1 for ; Sun, 18 Mar 2018 13:22:21 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Sun, 18 Mar 2018 13:22:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=itanimul.li; h= date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=i09pFxxAqRQvoN9Tg OPog6e+4wHxzZ9dR5hcjGJZkdQ=; b=BoBWET6j0RDrNm+xWDAUp6CumrwmH6891 DtH70YhF8YTw0lXaGEYxi31SGSSyHe+PWhZ47UE0CGqi6fzNUQUIQHhcmk0C3/8h qpeONMXoWTjAgzNheNFtEvTij3swn2gjd3MnDyyHe2sTeUStf1W5BxMMv1Hv6Yp/ hkWsDAzjOTod+2EjGGaTNPznnb4yt4HLRzfnOzLujpAC9WFEMlNEovTbXrM6kdpH 1gYXFzOWgTNcfNarVOgQP3WYGm+C1LORw5mpAGAbRUqFMDsQmBYn480iJrJYBr2L 6lYBBtB7sB4rmCiqSxLbi/VUTDP3PnNBIwlpJ2SHLVFzqgLgUA4+Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=i09pFxxAqRQvoN9TgOPog6e+4wHxzZ9dR5hcjGJZkdQ=; b=CUV1oYeX mJvl0JEBZ6BsrXVUAHD1ZsMR6TcLRZqsf80suqiu/rzDpugUmqcGu66Z9vok6DRA mZVMU4d/UQfpmBLMBcV30Xm5O8Khn6eE3KjtVKQ9sT4kOYVqgV9B9Vs/eS6h32SK D9UxKeEySA8n5SEAsW0t3rDBHe8tpDo8Bjs2mngDTml32r0jDVTNlNakSGJLALCh C7fVhV/QLCYO38577BZp9tFFkv7U5XdvlxFuQA2S6E8NQJFvXKYYaBqxM/4fh+jf V/QUEME8OwOQtnZqmS6o6anT6hueyuP5BJ3OYCf+DaT3qAH5x60L4oFKF1TdOK55 fe8Ond1hngmI/w== X-ME-Sender: Received: from localhost.localdomain (cpc75394-sotn16-2-0-cust168.15-1.cable.virginm.net [82.22.8.169]) by mail.messagingengine.com (Postfix) with ESMTPA id 534BB2407F for ; Sun, 18 Mar 2018 13:22:19 -0400 (EDT) From: Josh de Kock To: ffmpeg-devel@ffmpeg.org Date: Sun, 18 Mar 2018 17:22:10 +0000 Message-Id: <20180318172211.38849-1-josh@itanimul.li> X-Mailer: git-send-email 2.14.3 (Apple Git-98) In-Reply-To: <20180318134018.62605-4-josh@itanimul.li> References: <20180318134018.62605-4-josh@itanimul.li> Subject: [FFmpeg-devel] [PATCH v2 1/2] lav*, tests: remove several register_all() calls 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Because lavf and lavd being separated incrementally, some of the hacky behaviour in how options are found/parsed is being exposed. Basically, finding options works on some behaviour with iterating AVClasses, and making lavd not a hack-of-a-library incrementally (i.e. by separating iteration) messed this up because the 'child_class_next' wants to iterate formats when it gets an avdevice. Essentially a way to fix it would be to have avdevices have a different child_class_next function. Removing avdevice_register_all() in ffmpeg.c breaks searching of options, because it activates the old API which allows iteration of devices within the format iteration function. Essentially, we need a avdevice_get_class() function, but I think the best way to do it would just to take the plunge and make an struct AVDevice. --- doc/examples/filter_audio.c | 2 -- doc/examples/filtering_audio.c | 2 -- doc/examples/filtering_video.c | 2 -- doc/examples/transcoding.c | 2 -- fftools/ffmpeg.c | 3 --- fftools/ffplay.c | 4 ---- fftools/ffprobe.c | 1 - libavcodec/tests/utils.c | 1 - libavdevice/lavfi.c | 2 -- libavfilter/lavfutils.c | 2 -- libavfilter/src_movie.c | 2 -- libavfilter/tests/filtfmts.c | 2 -- libavformat/tests/movenc.c | 2 -- libavformat/tests/seek.c | 3 --- tests/api/api-band-test.c | 2 -- tests/api/api-codec-param-test.c | 2 -- tests/api/api-flac-test.c | 2 -- tests/api/api-h264-test.c | 2 -- tests/api/api-seek-test.c | 2 -- tools/aviocat.c | 1 - tools/enum_options.c | 2 -- tools/graph2dot.c | 2 -- tools/ismindex.c | 2 -- tools/pktdumper.c | 3 --- tools/probetest.c | 3 --- tools/seek_print.c | 1 - tools/sidxindex.c | 2 -- tools/uncoded_frame.c | 4 ---- 28 files changed, 60 deletions(-) diff --git a/doc/examples/filter_audio.c b/doc/examples/filter_audio.c index 7467c21c30..1611e3d952 100644 --- a/doc/examples/filter_audio.c +++ b/doc/examples/filter_audio.c @@ -289,8 +289,6 @@ int main(int argc, char *argv[]) return 1; } - avfilter_register_all(); - /* Allocate the frame we will be using to store the data. */ frame = av_frame_alloc(); if (!frame) { diff --git a/doc/examples/filtering_audio.c b/doc/examples/filtering_audio.c index 73a00e814c..b109dbcb96 100644 --- a/doc/examples/filtering_audio.c +++ b/doc/examples/filtering_audio.c @@ -228,8 +228,6 @@ int main(int argc, char **argv) exit(1); } - avfilter_register_all(); - if ((ret = open_input_file(argv[1])) < 0) goto end; if ((ret = init_filters(filter_descr)) < 0) diff --git a/doc/examples/filtering_video.c b/doc/examples/filtering_video.c index 01d6644620..ed4e7bbd81 100644 --- a/doc/examples/filtering_video.c +++ b/doc/examples/filtering_video.c @@ -222,8 +222,6 @@ int main(int argc, char **argv) exit(1); } - avfilter_register_all(); - if ((ret = open_input_file(argv[1])) < 0) goto end; if ((ret = init_filters(filter_descr)) < 0) diff --git a/doc/examples/transcoding.c b/doc/examples/transcoding.c index ed1fd6411b..a83fa3a185 100644 --- a/doc/examples/transcoding.c +++ b/doc/examples/transcoding.c @@ -517,8 +517,6 @@ int main(int argc, char **argv) return 1; } - avfilter_register_all(); - if ((ret = open_input_file(argv[1])) < 0) goto end; if ((ret = open_output_file(argv[2])) < 0) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index ee7258fcd1..7d1747c14a 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -4803,12 +4803,9 @@ int main(int argc, char **argv) argv++; } - avcodec_register_all(); #if CONFIG_AVDEVICE avdevice_register_all(); #endif - avfilter_register_all(); - av_register_all(); avformat_network_init(); show_banner(argc, argv, options); diff --git a/fftools/ffplay.c b/fftools/ffplay.c index f2028d4b13..bc9ddb8885 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -3655,10 +3655,6 @@ int main(int argc, char **argv) #if CONFIG_AVDEVICE avdevice_register_all(); #endif -#if CONFIG_AVFILTER - avfilter_register_all(); -#endif - av_register_all(); avformat_network_init(); init_opts(); diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index a4ac6972a2..2582649fd3 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -3567,7 +3567,6 @@ int main(int argc, char **argv) options = real_options; parse_loglevel(argc, argv, options); - av_register_all(); avformat_network_init(); init_opts(); #if CONFIG_AVDEVICE diff --git a/libavcodec/tests/utils.c b/libavcodec/tests/utils.c index e2891fb389..f6ba7fe66e 100644 --- a/libavcodec/tests/utils.c +++ b/libavcodec/tests/utils.c @@ -21,7 +21,6 @@ int main(void){ AVCodec *codec = NULL; int ret = 0; - avcodec_register_all(); while (codec = av_codec_next(codec)) { if (av_codec_is_encoder(codec)) { diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c index 6f2ae958dc..ca8f05f3f7 100644 --- a/libavdevice/lavfi.c +++ b/libavdevice/lavfi.c @@ -130,8 +130,6 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx) if (!pix_fmts) FAIL(AVERROR(ENOMEM)); - avfilter_register_all(); - buffersink = avfilter_get_by_name("buffersink"); abuffersink = avfilter_get_by_name("abuffersink"); diff --git a/libavfilter/lavfutils.c b/libavfilter/lavfutils.c index b6319cf027..db4b69b9f3 100644 --- a/libavfilter/lavfutils.c +++ b/libavfilter/lavfutils.c @@ -37,8 +37,6 @@ int ff_load_image(uint8_t *data[4], int linesize[4], av_init_packet(&pkt); - av_register_all(); - iformat = av_find_input_format("image2pipe"); if ((ret = avformat_open_input(&format_ctx, filename, iformat, NULL)) < 0) { av_log(log_ctx, AV_LOG_ERROR, diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c index 258ba504a5..bcabfcc4c2 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -239,8 +239,6 @@ static av_cold int movie_common_init(AVFilterContext *ctx) return AVERROR_PATCHWELCOME; } - av_register_all(); - // Try to find the movie format (container) iformat = movie->format_name ? av_find_input_format(movie->format_name) : NULL; diff --git a/libavfilter/tests/filtfmts.c b/libavfilter/tests/filtfmts.c index 72b860ae5b..a958621f1c 100644 --- a/libavfilter/tests/filtfmts.c +++ b/libavfilter/tests/filtfmts.c @@ -97,8 +97,6 @@ int main(int argc, char **argv) if (!graph_ctx) return 1; - avfilter_register_all(); - /* get a corresponding filter and open it */ if (!(filter = avfilter_get_by_name(filter_name))) { fprintf(stderr, "Unrecognized filter with name '%s'\n", filter_name); diff --git a/libavformat/tests/movenc.c b/libavformat/tests/movenc.c index ad6c92a94c..1d15d97ad9 100644 --- a/libavformat/tests/movenc.c +++ b/libavformat/tests/movenc.c @@ -379,8 +379,6 @@ int main(int argc, char **argv) } } - av_register_all(); - md5 = av_md5_alloc(); if (!md5) return 1; diff --git a/libavformat/tests/seek.c b/libavformat/tests/seek.c index 7ed56ba4ef..e0067a64fc 100644 --- a/libavformat/tests/seek.c +++ b/libavformat/tests/seek.c @@ -91,9 +91,6 @@ int main(int argc, char **argv) av_dict_set(&format_opts, "channels", "1", 0); av_dict_set(&format_opts, "sample_rate", "22050", 0); - /* initialize libavcodec, and register all codecs and formats */ - av_register_all(); - if (argc < 2) { printf("usage: %s input_file\n" "\n", argv[0]); diff --git a/tests/api/api-band-test.c b/tests/api/api-band-test.c index 5ccba4f766..a84f6b7e55 100644 --- a/tests/api/api-band-test.c +++ b/tests/api/api-band-test.c @@ -214,8 +214,6 @@ int main(int argc, char **argv) return 1; } - av_register_all(); - if (video_decode(argv[1]) != 0) return 1; diff --git a/tests/api/api-codec-param-test.c b/tests/api/api-codec-param-test.c index 377a5e9c79..0868322cb4 100644 --- a/tests/api/api-codec-param-test.c +++ b/tests/api/api-codec-param-test.c @@ -231,8 +231,6 @@ int main(int argc, char* argv[]) AVFormatContext *fmt_ctx = NULL; AVFormatContext *fmt_ctx_no_decode = NULL; - av_register_all(); - if (argc < 2) { av_log(NULL, AV_LOG_ERROR, "Usage: %s \n", argv[0]); return -1; diff --git a/tests/api/api-flac-test.c b/tests/api/api-flac-test.c index c5a37f03e1..2e9081266f 100644 --- a/tests/api/api-flac-test.c +++ b/tests/api/api-flac-test.c @@ -245,8 +245,6 @@ int main(void) int sample_rates[] = {8000, 44100, 48000, 192000}; int cl, sr; - avcodec_register_all(); - enc = avcodec_find_encoder(AV_CODEC_ID_FLAC); if (!enc) { av_log(NULL, AV_LOG_ERROR, "Can't find encoder\n"); diff --git a/tests/api/api-h264-test.c b/tests/api/api-h264-test.c index 52282e0007..66669fa0c3 100644 --- a/tests/api/api-h264-test.c +++ b/tests/api/api-h264-test.c @@ -158,8 +158,6 @@ int main(int argc, char **argv) return 1; } - av_register_all(); - if (video_decode_example(argv[1]) != 0) return 1; diff --git a/tests/api/api-seek-test.c b/tests/api/api-seek-test.c index 2b32cb9e4f..d0531a2f73 100644 --- a/tests/api/api-seek-test.c +++ b/tests/api/api-seek-test.c @@ -279,8 +279,6 @@ int main(int argc, char **argv) return 1; } - av_register_all(); - if (seek_test(argv[1], argv[2], argv[3]) != 0) return 1; diff --git a/tools/aviocat.c b/tools/aviocat.c index 28529b06d6..2aa08b92ed 100644 --- a/tools/aviocat.c +++ b/tools/aviocat.c @@ -42,7 +42,6 @@ int main(int argc, char **argv) AVDictionary *in_opts = NULL; AVDictionary *out_opts = NULL; - av_register_all(); avformat_network_init(); for (i = 1; i < argc; i++) { diff --git a/tools/enum_options.c b/tools/enum_options.c index c2a295cad6..77e1f9f799 100644 --- a/tools/enum_options.c +++ b/tools/enum_options.c @@ -130,8 +130,6 @@ int main(int argc, char **argv) if (argc < 2) print_usage(); - av_register_all(); - if (!strcmp(argv[1], "format")) show_format_opts(); else if (!strcmp(argv[1], "codec")) diff --git a/tools/graph2dot.c b/tools/graph2dot.c index 21d0795e88..d5c1e4e3c7 100644 --- a/tools/graph2dot.c +++ b/tools/graph2dot.c @@ -189,8 +189,6 @@ int main(int argc, char **argv) *p = '\0'; } - avfilter_register_all(); - if (avfilter_graph_parse(graph, graph_string, NULL, NULL, NULL) < 0) { fprintf(stderr, "Failed to parse the graph description\n"); return 1; diff --git a/tools/ismindex.c b/tools/ismindex.c index 0254a98ff7..7601f62e06 100644 --- a/tools/ismindex.c +++ b/tools/ismindex.c @@ -791,8 +791,6 @@ int main(int argc, char **argv) int split = 0, ismf = 0, i; struct Tracks tracks = { 0, .video_track = -1, .audio_track = -1 }; - av_register_all(); - for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-n")) { basename = argv[i + 1]; diff --git a/tools/pktdumper.c b/tools/pktdumper.c index 6516ad3a22..16a965b756 100644 --- a/tools/pktdumper.c +++ b/tools/pktdumper.c @@ -89,9 +89,6 @@ int main(int argc, char **argv) strcat(fntemplate, PKTFILESUFF); printf("FNTEMPLATE: '%s'\n", fntemplate); - // register all file formats - av_register_all(); - err = avformat_open_input(&fctx, argv[1], NULL, NULL); if (err < 0) { fprintf(stderr, "cannot open input: error %d\n", err); diff --git a/tools/probetest.c b/tools/probetest.c index 74045eb498..2c6c1de246 100644 --- a/tools/probetest.c +++ b/tools/probetest.c @@ -124,9 +124,6 @@ int main(int argc, char **argv) return 1; } - avcodec_register_all(); - av_register_all(); - av_lfg_init(&state, 0xdeadbeef); pd.buf = NULL; diff --git a/tools/seek_print.c b/tools/seek_print.c index de876b487c..9280421741 100644 --- a/tools/seek_print.c +++ b/tools/seek_print.c @@ -65,7 +65,6 @@ int main(int argc, char **argv) argv++; argc--; - av_register_all(); if ((ret = avformat_open_input(&avf, filename, NULL, NULL)) < 0) { fprintf(stderr, "%s: %s\n", filename, av_err2str(ret)); return 1; diff --git a/tools/sidxindex.c b/tools/sidxindex.c index be284610d5..a4f95515e4 100644 --- a/tools/sidxindex.c +++ b/tools/sidxindex.c @@ -363,8 +363,6 @@ int main(int argc, char **argv) struct Tracks tracks = { 0 }; int i; - av_register_all(); - for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-out")) { out = argv[i + 1]; diff --git a/tools/uncoded_frame.c b/tools/uncoded_frame.c index 3aaa4b6897..efea445b5f 100644 --- a/tools/uncoded_frame.c +++ b/tools/uncoded_frame.c @@ -62,10 +62,6 @@ int main(int argc, char **argv) out_dev_name = argv + 2; nb_out_dev = argc - 2; - av_register_all(); - avdevice_register_all(); - avfilter_register_all(); - /* Create input graph */ if (!(in_graph = avfilter_graph_alloc())) { ret = AVERROR(ENOMEM);