[FFmpeg-devel] [PATCH] lavfi: declare arrays that never change as static const
Paul B Mahol
onemda at gmail.com
Fri Dec 21 23:41:14 CET 2012
Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
libavfilter/af_atempo.c | 2 +-
libavfilter/af_earwax.c | 2 +-
libavfilter/af_silencedetect.c | 2 +-
libavfilter/af_volumedetect.c | 2 +-
libavfilter/asrc_aevalsrc.c | 2 +-
libavfilter/vf_alphaextract.c | 4 ++--
libavfilter/vf_alphamerge.c | 4 ++--
libavfilter/vf_boxblur.c | 2 +-
libavfilter/vf_delogo.c | 2 +-
libavfilter/vf_deshake.c | 2 +-
libavfilter/vf_drawbox.c | 2 +-
libavfilter/vf_overlay.c | 8 ++++----
libavfilter/vf_removelogo.c | 2 +-
libavfilter/vf_transpose.c | 2 +-
libavfilter/vf_unsharp.c | 2 +-
15 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c
index 74bf9cc..d186aaf 100644
--- a/libavfilter/af_atempo.c
+++ b/libavfilter/af_atempo.c
@@ -978,7 +978,7 @@ static int query_formats(AVFilterContext *ctx)
// Planar sample formats are too cumbersome to store in a ring buffer,
// therefore planar sample formats are not supported.
//
- enum AVSampleFormat sample_fmts[] = {
+ static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_U8,
AV_SAMPLE_FMT_S16,
AV_SAMPLE_FMT_S32,
diff --git a/libavfilter/af_earwax.c b/libavfilter/af_earwax.c
index 4a2b8b7..eaf6b05 100644
--- a/libavfilter/af_earwax.c
+++ b/libavfilter/af_earwax.c
@@ -77,7 +77,7 @@ typedef struct {
static int query_formats(AVFilterContext *ctx)
{
- int sample_rates[] = { 44100, -1 };
+ static const int sample_rates[] = { 44100, -1 };
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layout = NULL;
diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c
index ef014f6..8a60176 100644
--- a/libavfilter/af_silencedetect.c
+++ b/libavfilter/af_silencedetect.c
@@ -131,7 +131,7 @@ static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
- enum AVSampleFormat sample_fmts[] = {
+ static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBL,
AV_SAMPLE_FMT_NONE
};
diff --git a/libavfilter/af_volumedetect.c b/libavfilter/af_volumedetect.c
index 01f30a6..39265c0 100644
--- a/libavfilter/af_volumedetect.c
+++ b/libavfilter/af_volumedetect.c
@@ -35,7 +35,7 @@ typedef struct {
static int query_formats(AVFilterContext *ctx)
{
- enum AVSampleFormat sample_fmts[] = {
+ static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_S16,
AV_SAMPLE_FMT_S16P,
AV_SAMPLE_FMT_NONE
diff --git a/libavfilter/asrc_aevalsrc.c b/libavfilter/asrc_aevalsrc.c
index eaf7975..3315f1f 100644
--- a/libavfilter/asrc_aevalsrc.c
+++ b/libavfilter/asrc_aevalsrc.c
@@ -198,7 +198,7 @@ static int config_props(AVFilterLink *outlink)
static int query_formats(AVFilterContext *ctx)
{
EvalContext *eval = ctx->priv;
- enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE };
+ static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE };
int64_t chlayouts[] = { eval->chlayout, -1 };
int sample_rates[] = { eval->sample_rate, -1 };
diff --git a/libavfilter/vf_alphaextract.c b/libavfilter/vf_alphaextract.c
index 8c0209e..45d3dd4 100644
--- a/libavfilter/vf_alphaextract.c
+++ b/libavfilter/vf_alphaextract.c
@@ -41,12 +41,12 @@ typedef struct {
static int query_formats(AVFilterContext *ctx)
{
- enum AVPixelFormat in_fmts[] = {
+ static const enum AVPixelFormat in_fmts[] = {
AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA420P,
AV_PIX_FMT_RGBA, AV_PIX_FMT_BGRA, AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR,
AV_PIX_FMT_NONE
};
- enum AVPixelFormat out_fmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE };
+ static const enum AVPixelFormat out_fmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE };
ff_formats_ref(ff_make_format_list(in_fmts), &ctx->inputs[0]->out_formats);
ff_formats_ref(ff_make_format_list(out_fmts), &ctx->outputs[0]->in_formats);
return 0;
diff --git a/libavfilter/vf_alphamerge.c b/libavfilter/vf_alphamerge.c
index f3800db..99fd61e 100644
--- a/libavfilter/vf_alphamerge.c
+++ b/libavfilter/vf_alphamerge.c
@@ -52,12 +52,12 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
- enum AVPixelFormat main_fmts[] = {
+ static const enum AVPixelFormat main_fmts[] = {
AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA420P,
AV_PIX_FMT_RGBA, AV_PIX_FMT_BGRA, AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR,
AV_PIX_FMT_NONE
};
- enum AVPixelFormat alpha_fmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE };
+ static const enum AVPixelFormat alpha_fmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE };
AVFilterFormats *main_formats = ff_make_format_list(main_fmts);
AVFilterFormats *alpha_formats = ff_make_format_list(alpha_fmts);
ff_formats_ref(main_formats, &ctx->inputs[0]->out_formats);
diff --git a/libavfilter/vf_boxblur.c b/libavfilter/vf_boxblur.c
index df250c8..9ee3ea5 100644
--- a/libavfilter/vf_boxblur.c
+++ b/libavfilter/vf_boxblur.c
@@ -124,7 +124,7 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
- enum AVPixelFormat pix_fmts[] = {
+ static const enum AVPixelFormat pix_fmts[] = {
AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUVA420P,
AV_PIX_FMT_YUV440P, AV_PIX_FMT_GRAY8,
diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
index d6b88d9..9a22a63 100644
--- a/libavfilter/vf_delogo.c
+++ b/libavfilter/vf_delogo.c
@@ -157,7 +157,7 @@ AVFILTER_DEFINE_CLASS(delogo);
static int query_formats(AVFilterContext *ctx)
{
- enum AVPixelFormat pix_fmts[] = {
+ static const enum AVPixelFormat pix_fmts[] = {
AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV440P,
AV_PIX_FMT_YUVA420P, AV_PIX_FMT_GRAY8,
diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c
index 236c0d4..867041b 100644
--- a/libavfilter/vf_deshake.c
+++ b/libavfilter/vf_deshake.c
@@ -387,7 +387,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
static int query_formats(AVFilterContext *ctx)
{
- enum AVPixelFormat pix_fmts[] = {
+ static const enum AVPixelFormat pix_fmts[] = {
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV410P,
AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P,
AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_NONE
diff --git a/libavfilter/vf_drawbox.c b/libavfilter/vf_drawbox.c
index 5046e7e..af8eca4 100644
--- a/libavfilter/vf_drawbox.c
+++ b/libavfilter/vf_drawbox.c
@@ -100,7 +100,7 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
- enum AVPixelFormat pix_fmts[] = {
+ static const enum AVPixelFormat pix_fmts[] = {
AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P,
AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P,
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 33db9ef..d7579aa 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -157,15 +157,15 @@ static int query_formats(AVFilterContext *ctx)
OverlayContext *over = ctx->priv;
/* overlay formats contains alpha, for avoiding conversion with alpha information loss */
- const enum AVPixelFormat main_pix_fmts_yuv[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE };
- const enum AVPixelFormat overlay_pix_fmts_yuv[] = { AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE };
- const enum AVPixelFormat main_pix_fmts_rgb[] = {
+ static const enum AVPixelFormat main_pix_fmts_yuv[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE };
+ static const enum AVPixelFormat overlay_pix_fmts_yuv[] = { AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE };
+ static const enum AVPixelFormat main_pix_fmts_rgb[] = {
AV_PIX_FMT_ARGB, AV_PIX_FMT_RGBA,
AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA,
AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
AV_PIX_FMT_NONE
};
- const enum AVPixelFormat overlay_pix_fmts_rgb[] = {
+ static const enum AVPixelFormat overlay_pix_fmts_rgb[] = {
AV_PIX_FMT_ARGB, AV_PIX_FMT_RGBA,
AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA,
AV_PIX_FMT_NONE
diff --git a/libavfilter/vf_removelogo.c b/libavfilter/vf_removelogo.c
index f3d8d7b..ddaf9ef 100644
--- a/libavfilter/vf_removelogo.c
+++ b/libavfilter/vf_removelogo.c
@@ -192,7 +192,7 @@ static void convert_mask_to_strength_mask(uint8_t *data, int linesize,
static int query_formats(AVFilterContext *ctx)
{
- enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE };
+ static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE };
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c
index 6026caa..c381ecc 100644
--- a/libavfilter/vf_transpose.c
+++ b/libavfilter/vf_transpose.c
@@ -86,7 +86,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
static int query_formats(AVFilterContext *ctx)
{
- enum AVPixelFormat pix_fmts[] = {
+ static const enum AVPixelFormat pix_fmts[] = {
AV_PIX_FMT_ARGB, AV_PIX_FMT_RGBA,
AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA,
AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c
index 1e1b009..3a9b0b6 100644
--- a/libavfilter/vf_unsharp.c
+++ b/libavfilter/vf_unsharp.c
@@ -159,7 +159,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
static int query_formats(AVFilterContext *ctx)
{
- enum AVPixelFormat pix_fmts[] = {
+ static const enum AVPixelFormat pix_fmts[] = {
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV410P,
AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P,
AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_NONE
--
1.7.11.4
More information about the ffmpeg-devel
mailing list