From: "\"zhilizhao(赵志立)\"" <quinkblack@foxmail.com> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH 1/4] lavc/mediacodecenc: Add pix2color_fmt() and color2pix_fmt() Date: Tue, 28 Feb 2023 20:02:23 +0800 Message-ID: <tencent_5A2D1A9A19406A9AC99FD0AB494EA570CE08@qq.com> (raw) In-Reply-To: <fd61547526fef3c8367f249297d3588b9c1fe2e3.camel@haerdin.se> > +static int pix2color_fmt(AVCodecContext *avctx, enum AVPixelFormat pix_fmt) > +{ > + for (int i = 0; i < FF_ARRAY_ELEMS(color_formats); i++) { > + if (pix_fmt == color_formats[i].pix_fmt) { > + return color_formats[i].color_format; > + } > + } > + av_assert0(0); > +} After extracting to a general function, there is no hint that pix_fmt comes from avctx->pix_fmt. So I prefer return error code here. > + > +static enum AVPixelFormat color2pix_fmt(AVCodecContext *avctx, int color_format) > +{ > + for (int i = 0; i < FF_ARRAY_ELEMS(color_formats); i++) { > + if (color_format == color_formats[i].color_format) { > + return color_formats[i].pix_fmt; > + } > + } > + av_assert0(0); > +} _______________________________________________ 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:[~2023-02-28 12:02 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-02-24 8:59 Tomas Härdin 2023-02-24 9:00 ` [FFmpeg-devel] [PATCH 2/4] lavc/mediacodec_wrapper: Refactor ff_AMediaCodecList_getCodecNameByType() Tomas Härdin 2023-02-28 12:13 ` "zhilizhao(赵志立)" 2023-02-24 9:00 ` [FFmpeg-devel] [PATCH 3/4] lavc/mediacodec_wrapper: Add function for probing supported color formats Tomas Härdin 2023-02-28 12:18 ` "zhilizhao(赵志立)" 2023-02-24 9:03 ` [FFmpeg-devel] [PATCH 4/4] lavc/mediacodecenc: List supported pixel formats on configuration error Tomas Härdin 2023-02-28 12:25 ` "zhilizhao(赵志立)" 2023-02-28 12:02 ` "zhilizhao(赵志立)" [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=tencent_5A2D1A9A19406A9AC99FD0AB494EA570CE08@qq.com \ --to=quinkblack@foxmail.com \ --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