[FFmpeg-devel] [RFC] lavc add const, code cleanup

Reimar Döffinger Reimar.Doeffinger
Sun Aug 24 21:10:12 CEST 2008


Hello,
it started out as adding a few consts, but there was some IMO ugly code
I noticed.
I know it should be split, and I will before applying, but after looking
at such a load of code I do not have the motivation.
I would be glad if the respective maintainers would apply whatever they
like.

Greetings,
Reimar D?ffinger
-------------- next part --------------
diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c
index 4a7f5d9..e4a5d84 100644
--- a/libavcodec/8svx.c
+++ b/libavcodec/8svx.c
@@ -35,9 +35,9 @@ typedef struct EightSvxContext {
     int16_t *table;
 } EightSvxContext;
 
-const static int16_t fibonacci[16]   = { -34<<8, -21<<8, -13<<8,  -8<<8, -5<<8, -3<<8, -2<<8, -1<<8,
+static const int16_t fibonacci[16]   = { -34<<8, -21<<8, -13<<8,  -8<<8, -5<<8, -3<<8, -2<<8, -1<<8,
                                           0, 1<<8, 2<<8, 3<<8, 5<<8, 8<<8, 13<<8, 21<<8 };
-const static int16_t exponential[16] = { -128<<8, -64<<8, -32<<8, -16<<8, -8<<8, -4<<8, -2<<8, -1<<8,
+static const int16_t exponential[16] = { -128<<8, -64<<8, -32<<8, -16<<8, -8<<8, -4<<8, -2<<8, -1<<8,
                                           0, 1<<8, 2<<8, 4<<8, 8<<8, 16<<8, 32<<8, 64<<8 };
 
 /** decode a frame */
diff --git a/libavcodec/aac.c b/libavcodec/aac.c
index d122ef9..0bec77a 100644
--- a/libavcodec/aac.c
+++ b/libavcodec/aac.c
@@ -1451,5 +1451,5 @@ AVCodec aac_decoder = {
     aac_decode_close,
     aac_decode_frame,
     .long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
-    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
 };
diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h
index 3c27c38..ab7cfa1 100644
--- a/libavcodec/aacdectab.h
+++ b/libavcodec/aacdectab.h
@@ -198,7 +198,7 @@ static const float tns_tmp2_map_0_4[16] = {
     -0.67369562, -0.52643216, -0.36124167, -0.18374951,
 };
 
-static const float *tns_tmp2_map[4] = {
+static const float * const tns_tmp2_map[4] = {
     tns_tmp2_map_0_3,
     tns_tmp2_map_0_4,
     tns_tmp2_map_1_3,
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index fff6964..76eca90 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -83,7 +83,7 @@ static const uint8_t swb_size_1024_8[] = {
     32, 36, 36, 40, 44, 48, 52, 56, 60, 64, 80
 };
 
-static const uint8_t *swb_size_1024[] = {
+static const uint8_t * const swb_size_1024[] = {
     swb_size_1024_96, swb_size_1024_96, swb_size_1024_64,
     swb_size_1024_48, swb_size_1024_48, swb_size_1024_32,
     swb_size_1024_24, swb_size_1024_24, swb_size_1024_16,
@@ -110,7 +110,7 @@ static const uint8_t swb_size_128_8[] = {
     4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 12, 16, 20, 20
 };
 
-static const uint8_t *swb_size_128[] = {
+static const uint8_t * const swb_size_128[] = {
     /* the last entry on the following row is swb_size_128_64 but is a
        duplicate of swb_size_128_96 */
     swb_size_128_96, swb_size_128_96, swb_size_128_96,
@@ -132,7 +132,7 @@ static const uint8_t run_value_bits_short[16] = {
     3, 3, 3, 3, 3, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 9
 };
 
-static const uint8_t* run_value_bits[2] = {
+static const uint8_t* const run_value_bits[2] = {
     run_value_bits_long, run_value_bits_short
 };
 
@@ -360,6 +360,6 @@ AVCodec aac_encoder = {
     aac_encode_frame,
     aac_encode_end,
     .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY,
-    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
 };
diff --git a/libavcodec/aactab.c b/libavcodec/aactab.c
index 25f8d11..b9f16f1 100644
--- a/libavcodec/aactab.c
+++ b/libavcodec/aactab.c
@@ -387,12 +387,12 @@ static const uint8_t bits11[289] = {
      5,
 };
 
-const uint16_t *ff_aac_spectral_codes[11] = {
+const uint16_t * const ff_aac_spectral_codes[11] = {
     codes1,  codes2,  codes3, codes4, codes5, codes6, codes7, codes8,
     codes9, codes10, codes11,
 };
 
-const uint8_t *ff_aac_spectral_bits[11] = {
+const uint8_t * const ff_aac_spectral_bits[11] = {
     bits1,  bits2,  bits3, bits4, bits5, bits6, bits7, bits8,
     bits9, bits10, bits11,
 };
@@ -888,7 +888,7 @@ static const float codebook_vector10[578] = {
       64.0f,      64.0f,
 };
 
-const float *ff_aac_codebook_vectors[] = {
+const float * const ff_aac_codebook_vectors[] = {
     codebook_vector0, codebook_vector0, codebook_vector2,
     codebook_vector2, codebook_vector4, codebook_vector4,
     codebook_vector6, codebook_vector6, codebook_vector8,
diff --git a/libavcodec/aactab.h b/libavcodec/aactab.h
index 1a3a8df..7892b16 100644
--- a/libavcodec/aactab.h
+++ b/libavcodec/aactab.h
@@ -57,8 +57,8 @@ extern const uint8_t ff_aac_num_swb_128 [];
 extern const uint32_t ff_aac_scalefactor_code[121];
 extern const uint8_t  ff_aac_scalefactor_bits[121];
 
-extern const uint16_t *ff_aac_spectral_codes[11];
-extern const uint8_t  *ff_aac_spectral_bits [11];
+extern const uint16_t * const ff_aac_spectral_codes[11];
+extern const uint8_t  * const ff_aac_spectral_bits [11];
 extern const uint16_t  ff_aac_spectral_sizes[11];
 
 extern const float *ff_aac_codebook_vectors[];
diff --git a/libavcodec/ac3dec_data.c b/libavcodec/ac3dec_data.c
index a04bbc0..b2f0925 100644
--- a/libavcodec/ac3dec_data.c
+++ b/libavcodec/ac3dec_data.c
@@ -1071,7 +1071,7 @@ static const int16_t vq_hebap7[512][6] = {
 {   3231,   -3284,   27336,    4174,   -1683,     497},
 };
 
-const int16_t (*ff_eac3_vq_hebap[8])[6] = {
+const int16_t (* const ff_eac3_vq_hebap[8])[6] = {
     NULL,
     vq_hebap1,
     vq_hebap2,
diff --git a/libavcodec/ac3dec_data.h b/libavcodec/ac3dec_data.h
index 19c5f46..4f05ae8 100644
--- a/libavcodec/ac3dec_data.h
+++ b/libavcodec/ac3dec_data.h
@@ -31,7 +31,7 @@ extern const int16_t ff_eac3_gaq_remap_1[12];
 extern const int16_t ff_eac3_gaq_remap_2_4_a[9][2];
 extern const int16_t ff_eac3_gaq_remap_2_4_b[9][2];
 
-extern const int16_t (*ff_eac3_vq_hebap[8])[6];
+extern const int16_t (* const ff_eac3_vq_hebap[8])[6];
 extern const uint8_t ff_eac3_frm_expstr[32][6];
 extern const uint8_t ff_eac3_default_cpl_band_struct[18];
 
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index e0f17c2..9865a23 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -75,13 +75,7 @@ static int16_t xsin1[128];
 
 static inline int16_t fix15(float a)
 {
-    int v;
-    v = (int)(a * (float)(1 << 15));
-    if (v < -32767)
-        v = -32767;
-    else if (v > 32767)
-        v = 32767;
-    return v;
+    return av_clip((int)(a * (float)(1 << 15)), -32767, 32767);
 }
 
 typedef struct IComplex {
@@ -1364,6 +1358,6 @@ AVCodec ac3_encoder = {
     AC3_encode_frame,
     AC3_encode_close,
     NULL,
-    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52 (AC-3, E-AC-3)"),
 };
diff --git a/libavcodec/adxenc.c b/libavcodec/adxenc.c
index 6bce31a..cc1eff5 100644
--- a/libavcodec/adxenc.c
+++ b/libavcodec/adxenc.c
@@ -190,6 +190,6 @@ AVCodec adpcm_adx_encoder = {
     adx_encode_frame,
     adx_encode_close,
     NULL,
-    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("SEGA CRI ADX"),
 };
diff --git a/libavcodec/apiexample.c b/libavcodec/apiexample.c
index 793cfaa..591cd28 100644
--- a/libavcodec/apiexample.c
+++ b/libavcodec/apiexample.c
@@ -30,9 +30,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <math.h>
-
-#define PI 3.14159265358979323846
+#include "mathematics.h"
 
 #ifdef HAVE_AV_CONFIG_H
 #undef HAVE_AV_CONFIG_H
@@ -91,7 +89,7 @@ void audio_encode_example(const char *filename)
 
     /* encode a single tone sound */
     t = 0;
-    tincr = 2 * PI * 440.0 / c->sample_rate;
+    tincr = 2 * M_PI * 440.0 / c->sample_rate;
     for(i=0;i<200;i++) {
         for(j=0;j<frame_size;j++) {
             samples[2*j] = (int)(sin(t) * 10000);
diff --git a/libavcodec/asv1.c b/libavcodec/asv1.c
index f7ef68e..60eec46 100644
--- a/libavcodec/asv1.c
+++ b/libavcodec/asv1.c
@@ -641,7 +641,7 @@ AVCodec asv1_encoder = {
     encode_init,
     encode_frame,
     //encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("ASUS V1"),
 };
 
@@ -653,7 +653,7 @@ AVCodec asv2_encoder = {
     encode_init,
     encode_frame,
     //encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("ASUS V2"),
 };
 
diff --git a/libavcodec/bitstream_filter.c b/libavcodec/bitstream_filter.c
index aeafd7d..01af8aa 100644
--- a/libavcodec/bitstream_filter.c
+++ b/libavcodec/bitstream_filter.c
@@ -20,9 +20,9 @@
 
 #include "avcodec.h"
 
-AVBitStreamFilter *first_bitstream_filter= NULL;
+const AVBitStreamFilter *first_bitstream_filter= NULL;
 
-AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f){
+const AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f){
     if(f) return f->next;
     else  return first_bitstream_filter;
 }
diff --git a/libavcodec/bmpenc.c b/libavcodec/bmpenc.c
index a54355c..7dc4cdf 100644
--- a/libavcodec/bmpenc.c
+++ b/libavcodec/bmpenc.c
@@ -94,6 +94,6 @@ AVCodec bmp_encoder = {
     bmp_encode_init,
     bmp_encode_frame,
     NULL, //encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("BMP image"),
 };
diff --git a/libavcodec/cyuv.c b/libavcodec/cyuv.c
index d64f6df..2cfe7b3 100644
--- a/libavcodec/cyuv.c
+++ b/libavcodec/cyuv.c
@@ -163,13 +163,6 @@ static int cyuv_decode_frame(AVCodecContext *avctx,
     return buf_size;
 }
 
-static av_cold int cyuv_decode_end(AVCodecContext *avctx)
-{
-/*    CyuvDecodeContext *s = avctx->priv_data;*/
-
-    return 0;
-}
-
 AVCodec cyuv_decoder = {
     "cyuv",
     CODEC_TYPE_VIDEO,
@@ -177,7 +170,7 @@ AVCodec cyuv_decoder = {
     sizeof(CyuvDecodeContext),
     cyuv_decode_init,
     NULL,
-    cyuv_decode_end,
+    NULL,
     cyuv_decode_frame,
     CODEC_CAP_DR1,
     NULL,
diff --git a/libavcodec/dct-test.c b/libavcodec/dct-test.c
index f3f9408..8a4eb44 100644
--- a/libavcodec/dct-test.c
+++ b/libavcodec/dct-test.c
@@ -42,8 +42,6 @@
 #undef printf
 #undef random
 
-void *fast_memcpy(void *a, const void *b, size_t c){return memcpy(a,b,c);};
-
 /* reference fdct/idct */
 extern void fdct(DCTELEM *block);
 extern void idct(DCTELEM *block);
@@ -80,7 +78,7 @@ struct algo {
 
 static int cpu_flags;
 
-struct algo algos[] = {
+static const struct algo algos[] = {
   {"REF-DBL",         0, fdct,               fdct, NO_PERM},
   {"FAAN",            0, ff_faandct,         fdct, FAAN_SCALE},
   {"FAANI",           1, ff_faanidct,        idct, NO_PERM},
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 6b1a214..1adbd9d 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -856,6 +856,6 @@ AVCodec dnxhd_encoder = {
     dnxhd_encode_init,
     dnxhd_encode_picture,
     dnxhd_encode_end,
-    .pix_fmts = (enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_NONE},
+    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
 };
diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index aa7ef71..cab00b7 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -1207,7 +1207,7 @@ AVCodec dvvideo_encoder = {
     sizeof(DVVideoContext),
     dvvideo_init,
     dvvideo_encode_frame,
-    .pix_fmts = (enum PixelFormat[]) {PIX_FMT_YUV411P, PIX_FMT_YUV422P, PIX_FMT_YUV420P, PIX_FMT_NONE},
+    .pix_fmts = (const enum PixelFormat[]) {PIX_FMT_YUV411P, PIX_FMT_YUV422P, PIX_FMT_YUV420P, PIX_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
 };
 #endif // CONFIG_DVVIDEO_ENCODER
diff --git a/libavcodec/fdctref.c b/libavcodec/fdctref.c
index c6a057b..bf6b85c 100644
--- a/libavcodec/fdctref.c
+++ b/libavcodec/fdctref.c
@@ -29,15 +29,7 @@
  * design.
  */
 
-#include <math.h>
-
-#ifndef PI
-# ifdef M_PI
-#  define PI M_PI
-# else
-#  define PI 3.14159265358979323846
-# endif
-#endif
+#include "mathematics.h"
 
 /* global declarations */
 void init_fdct (void);
@@ -56,7 +48,7 @@ void init_fdct()
     s = (i==0) ? sqrt(0.125) : 0.5;
 
     for (j=0; j<8; j++)
-      c[i][j] = s * cos((PI/8.0)*i*(j+0.5));
+      c[i][j] = s * cos((M_PI/8.0)*i*(j+0.5));
   }
 }
 
diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index c1fac10..ece323e 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -1034,7 +1034,7 @@ AVCodec ffv1_encoder = {
     encode_init,
     encode_frame,
     common_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV411P, PIX_FMT_YUV410P, PIX_FMT_RGB32, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV411P, PIX_FMT_YUV410P, PIX_FMT_RGB32, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("FFmpeg codec #1"),
 };
 #endif
diff --git a/libavcodec/g726.c b/libavcodec/g726.c
index 463d993..2e1b79a 100644
--- a/libavcodec/g726.c
+++ b/libavcodec/g726.c
@@ -384,7 +384,7 @@ AVCodec adpcm_g726_encoder = {
     g726_encode_frame,
     g726_close,
     NULL,
-    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"),
 };
 #endif //CONFIG_ENCODERS
diff --git a/libavcodec/gif.c b/libavcodec/gif.c
index 35cd0a0..2e89eaf 100644
--- a/libavcodec/gif.c
+++ b/libavcodec/gif.c
@@ -340,6 +340,6 @@ AVCodec gif_encoder = {
     gif_encode_init,
     gif_encode_frame,
     NULL, //encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_PAL8, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_PAL8, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("GIF (Graphics Interchange Format)"),
 };
diff --git a/libavcodec/h261enc.c b/libavcodec/h261enc.c
index 564113f..d2cbeb8 100644
--- a/libavcodec/h261enc.c
+++ b/libavcodec/h261enc.c
@@ -329,7 +329,7 @@ AVCodec h261_encoder = {
     MPV_encode_init,
     MPV_encode_picture,
     MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("H.261"),
 };
 
diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c
index 83b1053..42e717a 100644
--- a/libavcodec/huffyuv.c
+++ b/libavcodec/huffyuv.c
@@ -1473,7 +1473,7 @@ AVCodec huffyuv_encoder = {
     encode_init,
     encode_frame,
     encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_RGB32, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_RGB32, PIX_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("Huffyuv / HuffYUV"),
 };
 
@@ -1485,7 +1485,7 @@ AVCodec ffvhuff_encoder = {
     encode_init,
     encode_frame,
     encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_RGB32, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_RGB32, PIX_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("Huffyuv FFmpeg variant"),
 };
 
diff --git a/libavcodec/liba52.c b/libavcodec/liba52.c
index ec0a252..9ffedc3 100644
--- a/libavcodec/liba52.c
+++ b/libavcodec/liba52.c
@@ -29,7 +29,7 @@
 
 #ifdef CONFIG_LIBA52BIN
 #include <dlfcn.h>
-static const char* liba52name = "liba52.so.0";
+static const char* const liba52name = "liba52.so.0";
 #endif
 
 /**
diff --git a/libavcodec/libamr.c b/libavcodec/libamr.c
index 4f56e4d..9b1cb68 100644
--- a/libavcodec/libamr.c
+++ b/libavcodec/libamr.c
@@ -97,7 +97,8 @@ typedef struct AMR_bitrates
 static int getBitrateMode(int bitrate)
 {
     /* make the correspondance between bitrate and mode */
-    AMR_bitrates rates[]={ {4750,MR475},
+    static const AMR_bitrates rates[]={
+                           {4750,MR475},
                            {5150,MR515},
                            {5900,MR59},
                            {6700,MR67},
@@ -517,7 +518,7 @@ AVCodec libamr_nb_encoder =
     amr_nb_encode_frame,
     amr_nb_encode_close,
     NULL,
-    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("libamr-nb Adaptive Multi-Rate (AMR) Narrow-Band"),
 };
 
@@ -545,7 +546,8 @@ typedef struct AMRWB_bitrates
 static int getWBBitrateMode(int bitrate)
 {
     /* make the correspondance between bitrate and mode */
-    AMRWB_bitrates rates[]={ {6600,0},
+    static const AMRWB_bitrates rates[]={
+                           {6600,0},
                            {8850,1},
                            {12650,2},
                            {14250,3},
@@ -712,7 +714,7 @@ AVCodec libamr_wb_encoder =
     amr_wb_encode_frame,
     amr_wb_encode_close,
     NULL,
-    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("libamr-wb Adaptive Multi-Rate (AMR) Wide-Band"),
 };
 
diff --git a/libavcodec/libdiracenc.c b/libavcodec/libdiracenc.c
index ee827ce..65c0d62 100644
--- a/libavcodec/libdiracenc.c
+++ b/libavcodec/libdiracenc.c
@@ -415,6 +415,6 @@ AVCodec libdirac_encoder = {
     libdirac_encode_frame,
     libdirac_encode_close,
    .capabilities= CODEC_CAP_DELAY,
-   .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, -1},
+   .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, -1},
    .long_name= NULL_IF_CONFIG_SMALL("libdirac Dirac 2.2"),
 } ;
diff --git a/libavcodec/libfaac.c b/libavcodec/libfaac.c
index 2ed4f76..0dfaa2b 100644
--- a/libavcodec/libfaac.c
+++ b/libavcodec/libfaac.c
@@ -151,6 +151,6 @@ AVCodec libfaac_encoder = {
     Faac_encode_init,
     Faac_encode_frame,
     Faac_encode_close,
-    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("libfaac AAC (Advanced Audio Codec)"),
 };
diff --git a/libavcodec/libfaad.c b/libavcodec/libfaad.c
index 3e7339d..78694fc 100644
--- a/libavcodec/libfaad.c
+++ b/libavcodec/libfaad.c
@@ -42,7 +42,7 @@
 
 #ifdef CONFIG_LIBFAADBIN
 #include <dlfcn.h>
-static const char* libfaadname = "libfaad.so";
+static const char* const libfaadname = "libfaad.so";
 #else
 #define dlopen(a)
 #define dlclose(a)
diff --git a/libavcodec/libgsm.c b/libavcodec/libgsm.c
index 09578b4..b35dcbb 100644
--- a/libavcodec/libgsm.c
+++ b/libavcodec/libgsm.c
@@ -119,7 +119,7 @@ AVCodec libgsm_encoder = {
     libgsm_init,
     libgsm_encode_frame,
     libgsm_close,
-    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM"),
 };
 
@@ -131,7 +131,7 @@ AVCodec libgsm_ms_encoder = {
     libgsm_init,
     libgsm_encode_frame,
     libgsm_close,
-    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM Microsoft variant"),
 };
 
diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c
index bccff00..266d1a2 100644
--- a/libavcodec/libmp3lame.c
+++ b/libavcodec/libmp3lame.c
@@ -221,6 +221,6 @@ AVCodec libmp3lame_encoder = {
     MP3lame_encode_frame,
     MP3lame_encode_close,
     .capabilities= CODEC_CAP_DELAY,
-    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("libmp3lame MP3 (MPEG audio layer 3)"),
 };
diff --git a/libavcodec/libschroedingerenc.c b/libavcodec/libschroedingerenc.c
index 03d9312..0950f44 100644
--- a/libavcodec/libschroedingerenc.c
+++ b/libavcodec/libschroedingerenc.c
@@ -428,6 +428,6 @@ AVCodec libschroedinger_encoder = {
     libschroedinger_encode_frame,
     libschroedinger_encode_close,
    .capabilities= CODEC_CAP_DELAY,
-   .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_NONE},
+   .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_NONE},
    .long_name= NULL_IF_CONFIG_SMALL("libschroedinger Dirac 2.2"),
 };
diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c
index d7f635c..e2f365f 100644
--- a/libavcodec/libtheoraenc.c
+++ b/libavcodec/libtheoraenc.c
@@ -264,8 +264,6 @@ static int encode_close(AVCodecContext* avc_context)
     return -1;
 }
 
-static const enum PixelFormat supported_pixel_formats[] = { PIX_FMT_YUV420P, PIX_FMT_NONE };
-
 /*! AVCodec struct exposed to libavcodec */
 AVCodec libtheora_encoder =
 {
@@ -276,6 +274,6 @@ AVCodec libtheora_encoder =
     .init = encode_init,
     .close = encode_close,
     .encode = encode_frame,
-    .pix_fmts = supported_pixel_formats,
+    .pix_fmts = (const enum PixelFormat[]){ PIX_FMT_YUV420P, PIX_FMT_NONE },
     .long_name = NULL_IF_CONFIG_SMALL("libtheora Theora"),
 };
diff --git a/libavcodec/libvorbis.c b/libavcodec/libvorbis.c
index ce796a0..e9adb42 100644
--- a/libavcodec/libvorbis.c
+++ b/libavcodec/libvorbis.c
@@ -217,6 +217,6 @@ AVCodec libvorbis_encoder = {
     oggvorbis_encode_frame,
     oggvorbis_encode_close,
     .capabilities= CODEC_CAP_DELAY,
-    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("libvorbis Vorbis"),
 } ;
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index e885f07..a3236e7 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -300,6 +300,6 @@ AVCodec libx264_encoder = {
     .encode = X264_frame,
     .close = X264_close,
     .capabilities = CODEC_CAP_DELAY,
-    .pix_fmts = (enum PixelFormat[]) { PIX_FMT_YUV420P, PIX_FMT_NONE },
+    .pix_fmts = (const enum PixelFormat[]) { PIX_FMT_YUV420P, PIX_FMT_NONE },
     .long_name = NULL_IF_CONFIG_SMALL("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
 };
diff --git a/libavcodec/libxvidff.c b/libavcodec/libxvidff.c
index aa55bf3..fa70ec1 100644
--- a/libavcodec/libxvidff.c
+++ b/libavcodec/libxvidff.c
@@ -777,6 +777,6 @@ AVCodec libxvid_encoder = {
     ff_xvid_encode_init,
     ff_xvid_encode_frame,
     ff_xvid_encode_close,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("libxvidcore MPEG-4 part 2"),
 };
diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index 9268af0..b446149 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -454,6 +454,6 @@ AVCodec mjpeg_encoder = {
     MPV_encode_init,
     MPV_encode_picture,
     MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"),
 };
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index f7600be..d08e8c4 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -3749,7 +3749,7 @@ AVCodec h263_encoder = {
     MPV_encode_init,
     MPV_encode_picture,
     MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("H.263"),
 };
 
@@ -3761,7 +3761,7 @@ AVCodec h263p_encoder = {
     MPV_encode_init,
     MPV_encode_picture,
     MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("H.263+ / H.263 version 2"),
 };
 
@@ -3773,7 +3773,7 @@ AVCodec flv_encoder = {
     MPV_encode_init,
     MPV_encode_picture,
     MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("Flash Video"),
 };
 
@@ -3785,7 +3785,7 @@ AVCodec rv10_encoder = {
     MPV_encode_init,
     MPV_encode_picture,
     MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("RealVideo 1.0"),
 };
 
@@ -3797,7 +3797,7 @@ AVCodec rv20_encoder = {
     MPV_encode_init,
     MPV_encode_picture,
     MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("RealVideo 2.0"),
 };
 
@@ -3809,7 +3809,7 @@ AVCodec mpeg4_encoder = {
     MPV_encode_init,
     MPV_encode_picture,
     MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
     .capabilities= CODEC_CAP_DELAY,
     .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
 };
@@ -3822,7 +3822,7 @@ AVCodec msmpeg4v1_encoder = {
     MPV_encode_init,
     MPV_encode_picture,
     MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"),
 };
 
@@ -3834,7 +3834,7 @@ AVCodec msmpeg4v2_encoder = {
     MPV_encode_init,
     MPV_encode_picture,
     MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"),
 };
 
@@ -3846,7 +3846,7 @@ AVCodec msmpeg4v3_encoder = {
     MPV_encode_init,
     MPV_encode_picture,
     MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"),
 };
 
@@ -3858,6 +3858,6 @@ AVCodec wmv1_encoder = {
     MPV_encode_init,
     MPV_encode_picture,
     MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("Windows Media Video 7"),
 };
diff --git a/libavcodec/msmpeg4data.c b/libavcodec/msmpeg4data.c
index c0bb953..2b6e670 100644
--- a/libavcodec/msmpeg4data.c
+++ b/libavcodec/msmpeg4data.c
@@ -1979,7 +1979,7 @@ static const uint32_t table_mb_non_intra4[128][2] = {
 {0x000011,  5}, {0x0001AC,  9}, {0x0000F3,  8}, {0x000439, 11},
 };
 
-const uint32_t (*wmv2_inter_table[WMV2_INTER_CBP_TABLE_COUNT])[2]={
+const uint32_t (* const wmv2_inter_table[WMV2_INTER_CBP_TABLE_COUNT])[2]={
     table_mb_non_intra2,
     table_mb_non_intra3,
     table_mb_non_intra4,
diff --git a/libavcodec/msmpeg4data.h b/libavcodec/msmpeg4data.h
index 0234027..1d36057 100644
--- a/libavcodec/msmpeg4data.h
+++ b/libavcodec/msmpeg4data.h
@@ -91,7 +91,7 @@ extern const uint32_t ff_table0_dc_chroma[120][2];
 extern const uint32_t ff_table1_dc_chroma[120][2];
 
 #define WMV2_INTER_CBP_TABLE_COUNT 4
-extern const uint32_t (*wmv2_inter_table[WMV2_INTER_CBP_TABLE_COUNT])[2];
+extern const uint32_t (* const wmv2_inter_table[WMV2_INTER_CBP_TABLE_COUNT])[2];
 
 extern const uint8_t wmv2_scantableA[64];
 extern const uint8_t wmv2_scantableB[64];
diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index f7a1e86..6e7ea26 100644
--- a/libavcodec/pngenc.c
+++ b/libavcodec/pngenc.c
@@ -444,6 +444,6 @@ AVCodec png_encoder = {
     png_enc_init,
     encode_frame,
     NULL, //encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_PAL8, PIX_FMT_GRAY8, PIX_FMT_MONOBLACK, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_PAL8, PIX_FMT_GRAY8, PIX_FMT_MONOBLACK, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("PNG image"),
 };
diff --git a/libavcodec/pnmenc.c b/libavcodec/pnmenc.c
index b62ea75..9ef950d 100644
--- a/libavcodec/pnmenc.c
+++ b/libavcodec/pnmenc.c
@@ -364,7 +364,7 @@ AVCodec pgm_encoder = {
     pnm_encode_frame,
     NULL, //encode_end,
     pnm_decode_frame,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_GRAY8, PIX_FMT_GRAY16BE, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_GRAY8, PIX_FMT_GRAY16BE, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"),
 };
 #endif // CONFIG_PGM_ENCODER
@@ -379,7 +379,7 @@ AVCodec pgmyuv_encoder = {
     pnm_encode_frame,
     NULL, //encode_end,
     pnm_decode_frame,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"),
 };
 #endif // CONFIG_PGMYUV_ENCODER
@@ -394,7 +394,7 @@ AVCodec ppm_encoder = {
     pnm_encode_frame,
     NULL, //encode_end,
     pnm_decode_frame,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"),
 };
 #endif // CONFIG_PPM_ENCODER
@@ -409,7 +409,7 @@ AVCodec pbm_encoder = {
     pnm_encode_frame,
     NULL, //encode_end,
     pnm_decode_frame,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_MONOWHITE, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_MONOWHITE, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"),
 };
 #endif // CONFIG_PBM_ENCODER
@@ -424,7 +424,7 @@ AVCodec pam_encoder = {
     pam_encode_frame,
     NULL, //encode_end,
     pnm_decode_frame,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"),
 };
 #endif // CONFIG_PAM_ENCODER
diff --git a/libavcodec/qtrleenc.c b/libavcodec/qtrleenc.c
index 6cea662..f5d99f0 100644
--- a/libavcodec/qtrleenc.c
+++ b/libavcodec/qtrleenc.c
@@ -322,6 +322,6 @@ AVCodec qtrle_encoder = {
     qtrle_encode_init,
     qtrle_encode_frame,
     qtrle_encode_end,
-    .pix_fmts = (enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_NONE},
+    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("QuickTime Animation (RLE) video"),
 };
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index e8d1ae8..123e99d 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -94,7 +94,7 @@ int ff_rate_control_init(MpegEncContext *s)
         "avgTex",
         NULL
     };
-    static double (*func1[])(void *, double)={
+    static double (const *func1[])(void *, double)={
         (void *)bits2qp,
         (void *)qp2bits,
         NULL
diff --git a/libavcodec/roqaudioenc.c b/libavcodec/roqaudioenc.c
index df014a4..04d08c4 100644
--- a/libavcodec/roqaudioenc.c
+++ b/libavcodec/roqaudioenc.c
@@ -174,6 +174,6 @@ AVCodec roq_dpcm_encoder = {
     roq_dpcm_encode_frame,
     roq_dpcm_encode_close,
     NULL,
-    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("id RoQ DPCM"),
 };
diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c
index a115e58..1cd920c 100644
--- a/libavcodec/roqvideoenc.c
+++ b/libavcodec/roqvideoenc.c
@@ -1067,6 +1067,6 @@ AVCodec roq_encoder =
     roq_encode_frame,
     roq_encode_end,
     .supported_framerates = (AVRational[]){{30,1}, {0,0}},
-    .pix_fmts = (enum PixelFormat[]){PIX_FMT_YUV444P, PIX_FMT_NONE},
+    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV444P, PIX_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("id RoQ video"),
 };
diff --git a/libavcodec/sgienc.c b/libavcodec/sgienc.c
index f4d651e..69d3bed 100644
--- a/libavcodec/sgienc.c
+++ b/libavcodec/sgienc.c
@@ -151,7 +151,7 @@ AVCodec sgi_encoder = {
     encode_init,
     encode_frame,
     NULL,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGBA, PIX_FMT_PAL8, PIX_FMT_GRAY8, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGBA, PIX_FMT_PAL8, PIX_FMT_GRAY8, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("SGI image"),
 };
 
diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c
index e693fb6..e92978f 100644
--- a/libavcodec/svq1dec.c
+++ b/libavcodec/svq1dec.c
@@ -825,6 +825,6 @@ AVCodec svq1_decoder = {
     svq1_decode_frame,
     CODEC_CAP_DR1,
     .flush= ff_mpeg_flush,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV410P, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV410P, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 1"),
 };
diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c
index 8d0bca5..4f21c7c 100644
--- a/libavcodec/svq1enc.c
+++ b/libavcodec/svq1enc.c
@@ -584,6 +584,6 @@ AVCodec svq1_encoder = {
     svq1_encode_init,
     svq1_encode_frame,
     svq1_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV410P, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV410P, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 1"),
 };
diff --git a/libavcodec/targaenc.c b/libavcodec/targaenc.c
index 958ae50..8c6c0ae 100644
--- a/libavcodec/targaenc.c
+++ b/libavcodec/targaenc.c
@@ -155,6 +155,6 @@ AVCodec targa_encoder = {
     .priv_data_size = sizeof(TargaContext),
     .init = targa_encode_init,
     .encode = targa_encode_frame,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB555, PIX_FMT_GRAY8, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB555, PIX_FMT_GRAY8, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("Truevision Targa image"),
 };
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index c440454..e0048eb 100644
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@ -452,7 +452,7 @@ AVCodec tiff_encoder = {
     0,
     NULL,
     .pix_fmts =
-        (enum PixelFormat[]) {PIX_FMT_RGB24, PIX_FMT_PAL8, PIX_FMT_GRAY8,
+        (const enum PixelFormat[]) {PIX_FMT_RGB24, PIX_FMT_PAL8, PIX_FMT_GRAY8,
                               PIX_FMT_MONOBLACK, PIX_FMT_MONOWHITE,
                               PIX_FMT_YUV420P, PIX_FMT_YUV422P,
                               PIX_FMT_YUV444P, PIX_FMT_YUV410P,
diff --git a/libavcodec/ulti.c b/libavcodec/ulti.c
index d2608d5..986fd09 100644
--- a/libavcodec/ulti.c
+++ b/libavcodec/ulti.c
@@ -393,13 +393,6 @@ static int ulti_decode_frame(AVCodecContext *avctx,
     return buf_size;
 }
 
-static av_cold int ulti_decode_end(AVCodecContext *avctx)
-{
-/*    UltimotionDecodeContext *s = avctx->priv_data;*/
-
-    return 0;
-}
-
 AVCodec ulti_decoder = {
     "ultimotion",
     CODEC_TYPE_VIDEO,
@@ -407,7 +400,7 @@ AVCodec ulti_decoder = {
     sizeof(UltimotionDecodeContext),
     ulti_decode_init,
     NULL,
-    ulti_decode_end,
+    NULL,
     ulti_decode_frame,
     CODEC_CAP_DR1,
     NULL,
diff --git a/libavcodec/vorbis_enc.c b/libavcodec/vorbis_enc.c
index 3d63785..a1fc1e9 100644
--- a/libavcodec/vorbis_enc.c
+++ b/libavcodec/vorbis_enc.c
@@ -1084,6 +1084,6 @@ AVCodec vorbis_encoder = {
     vorbis_encode_frame,
     vorbis_encode_close,
     .capabilities= CODEC_CAP_DELAY,
-    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("Vorbis"),
 };
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 3c06fe4..0d5b7f8 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -354,25 +354,25 @@ static int init_block_mapping(Vp3DecodeContext *s)
     int current_macroblock;
     int c_fragment;
 
-    signed char travel_width[16] = {
+    static const int8_t travel_width[16] = {
          1,  1,  0, -1,
          0,  0,  1,  0,
          1,  0,  1,  0,
          0, -1,  0,  1
     };
 
-    signed char travel_height[16] = {
+    static const int8_t travel_height[16] = {
          0,  0,  1,  0,
          1,  1,  0, -1,
          0,  1,  0, -1,
         -1,  0, -1,  0
     };
 
-    signed char travel_width_mb[4] = {
+    static const int8_t travel_width_mb[4] = {
          1,  0,  1,  0
     };
 
-    signed char travel_height_mb[4] = {
+    static const int8_t travel_height_mb[4] = {
          0,  1,  0, -1
     };
 
@@ -1348,7 +1348,7 @@ static void reverse_dc_prediction(Vp3DecodeContext *s,
      *   2: up-right multiplier
      *   3: left multiplier
      */
-    int predictor_transform[16][4] = {
+    static const int predictor_transform[16][4] = {
         {  0,  0,  0,  0},
         {  0,  0,  0,128},        // PL
         {  0,  0,128,  0},        // PUR
@@ -1373,7 +1373,7 @@ static void reverse_dc_prediction(Vp3DecodeContext *s,
      * from other INTRA blocks. There are 2 golden frame coding types;
      * blocks encoding in these modes can only predict from other blocks
      * that were encoded with these 1 of these 2 modes. */
-    unsigned char compatible_frame[8] = {
+    static const uint8_t compatible_frame[8] = {
         1,    /* MODE_INTER_NO_MV */
         0,    /* MODE_INTRA */
         1,    /* MODE_INTER_PLUS_MV */
diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c
index 4558947..77a4089 100644
--- a/libavcodec/wmaenc.c
+++ b/libavcodec/wmaenc.c
@@ -387,7 +387,7 @@ AVCodec wmav1_encoder =
     encode_init,
     encode_superframe,
     ff_wma_end,
-    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
 };
 
@@ -400,6 +400,6 @@ AVCodec wmav2_encoder =
     encode_init,
     encode_superframe,
     ff_wma_end,
-    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
 };
diff --git a/libavcodec/wmv2enc.c b/libavcodec/wmv2enc.c
index a31a05a..1a35168 100644
--- a/libavcodec/wmv2enc.c
+++ b/libavcodec/wmv2enc.c
@@ -236,6 +236,6 @@ AVCodec wmv2_encoder = {
     wmv2_encode_init,
     MPV_encode_picture,
     MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("Windows Media Video 8"),
 };
diff --git a/libavcodec/zmbvenc.c b/libavcodec/zmbvenc.c
index a6b51ba..534e464 100644
--- a/libavcodec/zmbvenc.c
+++ b/libavcodec/zmbvenc.c
@@ -329,6 +329,6 @@ AVCodec zmbv_encoder = {
     encode_init,
     encode_frame,
     encode_end,
-    .pix_fmts = (enum PixelFormat[]){PIX_FMT_PAL8, PIX_FMT_NONE},
+    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_PAL8, PIX_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("Zip Motion Blocks Video"),
 };



More information about the ffmpeg-devel mailing list