> -----Original Message----- > From: ffmpeg-devel <ffmpeg-devel-boun...@ffmpeg.org> On Behalf Of Zane > van Iperen > Sent: Thursday, July 30, 2020 8:17 PM > To: ffmpeg-devel@ffmpeg.org > Subject: Re: [FFmpeg-devel] [PATCH] avfilter/vf_xcam: add xcam video filter > > On Fri, 31 Jul 2020 00:55:56 +0800 > "zongwave" <wei.z...@intel.com> wrote: > > > ++static int xcam_query_formats(AVFilterContext *ctx) { > > ++ XCAMContext *s = ctx->priv; > > ++ AVFilterFormats *formats = NULL; > > ++ > > ++ static const enum AVPixelFormat nv12_fmts[] = {AV_PIX_FMT_NV12, > AV_PIX_FMT_NONE}; > > ++ static const enum AVPixelFormat yuv420_fmts[] = > {AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE}; > > ++ static const enum AVPixelFormat auto_fmts[] = {AV_PIX_FMT_NV12, > > ++ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE}; > > Would these be better above the function instead of inside it? >
I noticed many vf implementation in libavfilter defined "static const" variables inside a function, I just think this is a common style for libavfilter. > > ++static av_cold int xcam_init(AVFilterContext *ctx) { > > ++ XCAMContext *s = ctx->priv; > > ++ int ret = 0; > > ++ > > ++ s->handle = xcam_create_handle(s->name); > > ++ if (!s->handle) { > > Style nitpick, I'd tend to prefer inlining the assignment: > > if (!(s->handle = xcam_create_handle(s->name))) > > but I guess that's personal preference. > > > Overall looks fine, but someone more familiar with libavfilter should probably > double-check. > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org > with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".