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 345B9412CD for ; Sun, 19 Jun 2022 00:39:52 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C0BDE68ABD9; Sun, 19 Jun 2022 03:39:49 +0300 (EEST) Received: from sonic309-26.consmr.mail.ir2.yahoo.com (sonic309-26.consmr.mail.ir2.yahoo.com [77.238.179.84]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7E96668ABD9 for ; Sun, 19 Jun 2022 03:39:42 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.it; s=s2048; t=1655599181; bh=YzJhwZ2zToT3UAWr1Jhe6Z4f5spxxosXfY86HNeisrY=; h=Date:From:To:In-Reply-To:References:Subject:From:Subject:Reply-To; b=KmbCAbmemYhxv6AJPMJ7fxiLOViMjTv17i7v4cHVXFVJ9DIS5rTCvZiiM9P0pSVHHbJNj8cAja0kbVLpX/rMDYa5whNtEWweRZTyPP7aNJ3uaJd43SdWtTFCHTNJi+GX06dam+umYKCDsfR6ibMDMSrx044+9hcWq+cJ/WNMiLzPwBz1+aDs+OWN/C6gOcWch7O2uRkecvPKHClcTUcEeZOspprrK2WFzF/qiHkXTaDzCPG3iCgFqHGp61NTegGrLK9+vSpa4LsHyQAQYNM0a+6o/Q7E8OLxVxGZf3GwfQx8jCNMMRQncHxbW1u5tCW2vA8+QZxdx01Q7kc8oDnEAw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1655599181; bh=3PDzG9QS8VZodDppt82UuVl6/vg1YLPvq2CjiBUKa+V=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=kwOAIyrBMjqocUlOGUiaO2Wes3jQenaZLhj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o6DBdvtA b7z.wVh8CVYdy.kMpcGYFRvdnI_MXwLAY4JShxqZyl_wbeYdYjc2og5sKC.HxAfB2_diIWR2s4y8 7gK2zvuBMhqWIgKJ5F3ZAALULD0dMHUOM9IUZm9JlurbNXsfgg2rtK2aLAtmMYCcpRaCV9IeJoWW q.E7DwtER6xq_dXoTRjrgc3M5EArMie7DGnejDfJR99oOgH1BvFZjf6LCAd9oF8tnXFZxRklx03I SNGtDLrUrQ1Tb9TNDhOlIldiFUYXc0IJkHcKmLCMNnfXq1fh8gVFdhkKlWh.Azq7dcqo9FliDtGM A_K48DUnpOrGsL0PZDr1SAtlMduFZnmWw94C5yighhE95yF6Br8nqjgzegXFrBIV4ich.zkFdiiE sBmLXPQ5LSWgyibTgd.ljxDvaOMrFrbGyC1C5JPgCVsmTe15h5GgvGas2.IxjT.CA4zJtXh.gMa3 R0YuKAxjDY1ju5ZVEydgEVttQsdQli8HUl2d7lROfy1Az5YMhvw-- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.ir2.yahoo.com with HTTP; Sun, 19 Jun 2022 00:39:41 +0000 Date: Sun, 19 Jun 2022 00:39:29 +0000 (UTC) From: Paolo Prete To: "ffmpeg-devel@ffmpeg.org" Message-ID: <1543866037.9352387.1655599169159@mail.yahoo.com> In-Reply-To: References: <122266341.9130638.1655553986479.ref@mail.yahoo.com> <122266341.9130638.1655553986479@mail.yahoo.com> MIME-Version: 1.0 X-Mailer: WebService/1.1.20280 YMailNorrin X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH] doc/examples/muxing: code rewrite with improved readability and fixed issues 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: Il sabato 18 giugno 2022, 19:07:11 CEST, Andreas Rheinhardt ha scritto: >>Paolo Prete: >> Please review this. It's a code rewrite of doc/examples/muxing.c which improves readability and fixes issues. >> More specifically: >> *) Original functions of muxing.c have generic/unclear/ambiguous names and they don't group logically relatedblocks of >>code: this makes the code hard to read.See for example open_audio/video() and add_stream(), which mix initialization of >>the encoders' and muxers' stuff.A redundant structure with an ambiguous name ("struct OutputStream"), which is not part of >>API, is widely used too.The patch uses functions with clearer names and with blocks of code strictly logically related, such >>as: init_encoder(), init_avframe(), init_muxer(), convert_frame(), encode_frame(), mux_encoded_pkt()... >Using a structure for the user's data is actually intentional, because >users will probably use one, too. And given that it is the user's >structure it is of course not part of the public API. This is not what I meant. The API already has all the needed structures for managing, by the user, all the flow of an A/V pipeline. There's no need of another struct (which is therefore redundant and with a meaningless name) for exchanging data between functions. Please consider the code of the patch in a different perspective. It explicitly, in the main() function, creates an encoder, a converter and a muxer and the required input/output frames: nothing more, nothing else. And it simply calls fill_frame(), convert_frame(), encode_frame(), mux_encoded_pkt(). This is what I suggest as a readable code which represents an A/V pipeline. These function have names that represent exactly what they do, instead of using generic/misleading names such as "open_audio()" or "write_frame()" etc. For doing that I had to rewrite the code from scratch, then it's not possible to split the patch into small pieces, as you ask. > There is just one thing that I immediately noticed: > > > sizeof(AVCodecParameters) is not public, you must not put > AVCodecParameters on the stack. i just fixed this, thanks. See the attached patch in response to Leo Izen _______________________________________________ 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".