From: Paolo Prete <p4olo_prete-at-yahoo.it@ffmpeg.org> To: "ffmpeg-devel@ffmpeg.org" <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH] doc/examples/muxing: code rewrite with improved readability and fixed issues Date: Sun, 19 Jun 2022 00:39:29 +0000 (UTC) Message-ID: <1543866037.9352387.1655599169159@mail.yahoo.com> (raw) In-Reply-To: <DB6PR0101MB22141C1A6097CB0E4B921D078FAE9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com> Il sabato 18 giugno 2022, 19:07:11 CEST, Andreas Rheinhardt <andreas.rheinhardt@outlook.com> 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".
prev parent reply other threads:[~2022-06-19 0:39 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <122266341.9130638.1655553986479.ref@mail.yahoo.com> 2022-06-18 12:06 ` Paolo Prete 2022-06-18 15:17 ` Leo Izen 2022-06-19 0:25 ` Paolo Prete [not found] ` <985091997.9345851.1655600194188@mail.yahoo.com> 2022-06-19 1:05 ` Paolo Prete 2022-06-19 21:21 ` Leo Izen 2022-06-18 17:08 ` Andreas Rheinhardt 2022-06-19 0:39 ` Paolo Prete [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1543866037.9352387.1655599169159@mail.yahoo.com \ --to=p4olo_prete-at-yahoo.it@ffmpeg.org \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git