diff options
Diffstat (limited to 'audio')
30 files changed, 68 insertions, 68 deletions
diff --git a/audio/chmap.c b/audio/chmap.c index 9a18512e21..316ca35c94 100644 --- a/audio/chmap.c +++ b/audio/chmap.c @@ -23,7 +23,7 @@ // Names taken from libavutil/channel_layout.c (Not accessible by API.) // Use of these names is hard-coded in some places (e.g. ao_alsa.c) -static const char *speaker_names[MP_SPEAKER_ID_COUNT][2] = { +static const char *const speaker_names[MP_SPEAKER_ID_COUNT][2] = { [MP_SPEAKER_ID_FL] = {"fl", "front left"}, [MP_SPEAKER_ID_FR] = {"fr", "front right"}, [MP_SPEAKER_ID_FC] = {"fc", "front center"}, @@ -53,7 +53,7 @@ static const char *speaker_names[MP_SPEAKER_ID_COUNT][2] = { // Names taken from libavutil/channel_layout.c (Not accessible by API.) // Channel order corresponds to lavc/waveex, except for the alsa entries. -static const char *std_layout_names[][2] = { +static const char *const std_layout_names[][2] = { {"empty", ""}, // not in lavc {"mono", "fc"}, {"stereo", "fl-fr"}, @@ -105,7 +105,7 @@ static const struct mp_chmap default_layouts[MP_NUM_CHANNELS + 1] = { // channels. 3 and 7 channels were likely undefined (no ALSA support). // I'm not sure about the 4 channel case: ALSA uses "quad", while the ffmpeg // default layout is "4.0". -static const char *mplayer_layouts[MP_NUM_CHANNELS + 1] = { +static const char *const mplayer_layouts[MP_NUM_CHANNELS + 1] = { [1] = "mono", [2] = "stereo", [4] = "quad", diff --git a/audio/chmap_sel.c b/audio/chmap_sel.c index f71a868674..160f1ce5fa 100644 --- a/audio/chmap_sel.c +++ b/audio/chmap_sel.c @@ -21,7 +21,7 @@ #include "common/common.h" #include "chmap_sel.h" -static struct mp_chmap speaker_replacements[][2] = { +static const struct mp_chmap speaker_replacements[][2] = { // 5.1 <-> 5.1 (side) { MP_CHMAP2(SL, SR), MP_CHMAP2(BL, BR) }, // 7.1 <-> 7.1 (rear ext) @@ -170,7 +170,7 @@ bool mp_chmap_sel_adjust(const struct mp_chmap_sel *s, struct mp_chmap *map) } for (int i = 0; i < MP_ARRAY_SIZE(speaker_replacements); i++) { struct mp_chmap t = *map; - struct mp_chmap *r = speaker_replacements[i]; + struct mp_chmap *r = (struct mp_chmap *)speaker_replacements[i]; if (replace_speakers(&t, r) && test_layout(s, &t)) { *map = t; return true; diff --git a/audio/filter/af.c b/audio/filter/af.c index d2c4bae40e..c69077e93f 100644 --- a/audio/filter/af.c +++ b/audio/filter/af.c @@ -31,34 +31,34 @@ #include "af.h" // Static list of filters -extern struct af_info af_info_dummy; -extern struct af_info af_info_delay; -extern struct af_info af_info_channels; -extern struct af_info af_info_format; -extern struct af_info af_info_force; -extern struct af_info af_info_volume; -extern struct af_info af_info_equalizer; -extern struct af_info af_info_pan; -extern struct af_info af_info_surround; -extern struct af_info af_info_sub; -extern struct af_info af_info_export; -extern struct af_info af_info_drc; -extern struct af_info af_info_extrastereo; -extern struct af_info af_info_lavcac3enc; -extern struct af_info af_info_lavrresample; -extern struct af_info af_info_sweep; -extern struct af_info af_info_hrtf; -extern struct af_info af_info_ladspa; -extern struct af_info af_info_center; -extern struct af_info af_info_sinesuppress; -extern struct af_info af_info_karaoke; -extern struct af_info af_info_scaletempo; -extern struct af_info af_info_bs2b; -extern struct af_info af_info_lavfi; -extern struct af_info af_info_convert24; -extern struct af_info af_info_convertsignendian; - -static struct af_info* filter_list[] = { +extern const struct af_info af_info_dummy; +extern const struct af_info af_info_delay; +extern const struct af_info af_info_channels; +extern const struct af_info af_info_format; +extern const struct af_info af_info_force; +extern const struct af_info af_info_volume; +extern const struct af_info af_info_equalizer; +extern const struct af_info af_info_pan; +extern const struct af_info af_info_surround; +extern const struct af_info af_info_sub; +extern const struct af_info af_info_export; +extern const struct af_info af_info_drc; +extern const struct af_info af_info_extrastereo; +extern const struct af_info af_info_lavcac3enc; +extern const struct af_info af_info_lavrresample; +extern const struct af_info af_info_sweep; +extern const struct af_info af_info_hrtf; +extern const struct af_info af_info_ladspa; +extern const struct af_info af_info_center; +extern const struct af_info af_info_sinesuppress; +extern const struct af_info af_info_karaoke; +extern const struct af_info af_info_scaletempo; +extern const struct af_info af_info_bs2b; +extern const struct af_info af_info_lavfi; +extern const struct af_info af_info_convert24; +extern const struct af_info af_info_convertsignendian; + +static const struct af_info *const filter_list[] = { &af_info_dummy, &af_info_delay, &af_info_channels, @@ -389,7 +389,7 @@ static char *af_find_conversion_filter(int srcfmt, int *dstfmt) } for (int n = 0; filter_list[n]; n++) { - struct af_info *af = filter_list[n]; + const struct af_info *af = filter_list[n]; if (!af->test_conversion) continue; for (int i = 0; af_fmtstr_table[i].format; i++) { @@ -589,7 +589,7 @@ void af_uninit(struct af_stream *s) struct af_stream *af_new(struct mpv_global *global) { struct af_stream *s = talloc_zero(NULL, struct af_stream); - static struct af_info in = { .name = "in" }; + static const struct af_info in = { .name = "in" }; s->first = talloc(s, struct af_instance); *s->first = (struct af_instance) { .info = &in, @@ -599,7 +599,7 @@ struct af_stream *af_new(struct mpv_global *global) .data = &s->input, .mul = 1.0, }; - static struct af_info out = { .name = "out" }; + static const struct af_info out = { .name = "out" }; s->last = talloc(s, struct af_instance); *s->last = (struct af_instance) { .info = &out, diff --git a/audio/filter/af_bs2b.c b/audio/filter/af_bs2b.c index 08d037bf4e..0a2bd8e552 100644 --- a/audio/filter/af_bs2b.c +++ b/audio/filter/af_bs2b.c @@ -189,7 +189,7 @@ static int af_open(struct af_instance *af) #define OPT_BASE_STRUCT struct af_bs2b /// Description of this filter -struct af_info af_info_bs2b = { +const struct af_info af_info_bs2b = { .info = "Bauer stereophonic-to-binaural audio filter", .name = "bs2b", .open = af_open, diff --git a/audio/filter/af_center.c b/audio/filter/af_center.c index 106e08412e..3039e50302 100644 --- a/audio/filter/af_center.c +++ b/audio/filter/af_center.c @@ -86,7 +86,7 @@ static int af_open(struct af_instance* af){ } #define OPT_BASE_STRUCT af_center_t -struct af_info af_info_center = { +const struct af_info af_info_center = { .info = "Audio filter for adding a center channel", .name = "center", .flags = AF_FLAGS_NOT_REENTRANT, diff --git a/audio/filter/af_channels.c b/audio/filter/af_channels.c index 118607b66f..83be68263e 100644 --- a/audio/filter/af_channels.c +++ b/audio/filter/af_channels.c @@ -238,7 +238,7 @@ static int af_open(struct af_instance* af){ } #define OPT_BASE_STRUCT af_channels_t -struct af_info af_info_channels = { +const struct af_info af_info_channels = { .info = "Insert or remove channels", .name = "channels", .open = af_open, diff --git a/audio/filter/af_convert24.c b/audio/filter/af_convert24.c index 6990fbd421..38799bd8fc 100644 --- a/audio/filter/af_convert24.c +++ b/audio/filter/af_convert24.c @@ -108,7 +108,7 @@ static int af_open(struct af_instance *af) return AF_OK; } -struct af_info af_info_convert24 = { +const struct af_info af_info_convert24 = { .info = "Convert between 24 and 32 bit sample format", .name = "convert24", .open = af_open, diff --git a/audio/filter/af_convertsignendian.c b/audio/filter/af_convertsignendian.c index 7bfaf0f978..45b365efd8 100644 --- a/audio/filter/af_convertsignendian.c +++ b/audio/filter/af_convertsignendian.c @@ -123,7 +123,7 @@ static int af_open(struct af_instance *af) return AF_OK; } -struct af_info af_info_convertsignendian = { +const struct af_info af_info_convertsignendian = { .info = "Convert between sample format sign/endian", .name = "convertsignendian", .open = af_open, diff --git a/audio/filter/af_delay.c b/audio/filter/af_delay.c index b16cdc1f63..56013b3270 100644 --- a/audio/filter/af_delay.c +++ b/audio/filter/af_delay.c @@ -178,7 +178,7 @@ static int af_open(struct af_instance* af){ } #define OPT_BASE_STRUCT af_delay_t -struct af_info af_info_delay = { +const struct af_info af_info_delay = { .info = "Delay audio filter", .name = "delay", .open = af_open, diff --git a/audio/filter/af_drc.c b/audio/filter/af_drc.c index 3bcd368d4d..94e161130f 100644 --- a/audio/filter/af_drc.c +++ b/audio/filter/af_drc.c @@ -313,7 +313,7 @@ static int af_open(struct af_instance* af){ } #define OPT_BASE_STRUCT af_drc_t -struct af_info af_info_drc = { +const struct af_info af_info_drc = { .info = "Dynamic range compression filter", .name = "drc", .flags = AF_FLAGS_NOT_REENTRANT, diff --git a/audio/filter/af_dummy.c b/audio/filter/af_dummy.c index d920480e01..61f2207d84 100644 --- a/audio/filter/af_dummy.c +++ b/audio/filter/af_dummy.c @@ -54,7 +54,7 @@ static int af_open(struct af_instance* af){ } // Description of this filter -struct af_info af_info_dummy = { +const struct af_info af_info_dummy = { .info = "dummy", .name = "dummy", .open = af_open, diff --git a/audio/filter/af_equalizer.c b/audio/filter/af_equalizer.c index 83fa80f2b3..4e96223ee7 100644 --- a/audio/filter/af_equalizer.c +++ b/audio/filter/af_equalizer.c @@ -194,7 +194,7 @@ static int af_open(struct af_instance* af){ } #define OPT_BASE_STRUCT af_equalizer_t -struct af_info af_info_equalizer = { +const struct af_info af_info_equalizer = { .info = "Equalizer audio filter", .name = "equalizer", .flags = AF_FLAGS_NOT_REENTRANT, diff --git a/audio/filter/af_export.c b/audio/filter/af_export.c index faa09bf927..9c3bab671a 100644 --- a/audio/filter/af_export.c +++ b/audio/filter/af_export.c @@ -222,7 +222,7 @@ static int af_open( struct af_instance* af ) } #define OPT_BASE_STRUCT af_export_t -struct af_info af_info_export = { +const struct af_info af_info_export = { .info = "Sound export filter", .name = "export", .open = af_open, diff --git a/audio/filter/af_extrastereo.c b/audio/filter/af_extrastereo.c index 05a1ac8e36..4ebe03a228 100644 --- a/audio/filter/af_extrastereo.c +++ b/audio/filter/af_extrastereo.c @@ -118,7 +118,7 @@ static int af_open(struct af_instance* af){ } #define OPT_BASE_STRUCT af_extrastereo_t -struct af_info af_info_extrastereo = { +const struct af_info af_info_extrastereo = { .info = "Increase difference between audio channels", .name = "extrastereo", .flags = AF_FLAGS_NOT_REENTRANT, diff --git a/audio/filter/af_format.c b/audio/filter/af_format.c index a51c543406..9183259bd9 100644 --- a/audio/filter/af_format.c +++ b/audio/filter/af_format.c @@ -114,7 +114,7 @@ static int af_open(struct af_instance *af) #define OPT_BASE_STRUCT struct priv -struct af_info af_info_format = { +const struct af_info af_info_format = { .info = "Force audio format", .name = "format", .open = af_open, diff --git a/audio/filter/af_hrtf.c b/audio/filter/af_hrtf.c index e8ab5fc72d..e01f659772 100644 --- a/audio/filter/af_hrtf.c +++ b/audio/filter/af_hrtf.c @@ -631,7 +631,7 @@ static int af_open(struct af_instance* af) } #define OPT_BASE_STRUCT af_hrtf_t -struct af_info af_info_hrtf = { +const struct af_info af_info_hrtf = { .info = "HRTF Headphone", .name = "hrtf", .open = af_open, diff --git a/audio/filter/af_karaoke.c b/audio/filter/af_karaoke.c index 00c4d16dca..3187a41f2f 100644 --- a/audio/filter/af_karaoke.c +++ b/audio/filter/af_karaoke.c @@ -73,7 +73,7 @@ static int af_open(struct af_instance* af){ } // Description of this filter -struct af_info af_info_karaoke = { +const struct af_info af_info_karaoke = { .info = "Simple karaoke/voice-removal audio filter", .name = "karaoke", .flags = AF_FLAGS_NOT_REENTRANT, diff --git a/audio/filter/af_ladspa.c b/audio/filter/af_ladspa.c index 7beaded3d3..ab76c35fe9 100644 --- a/audio/filter/af_ladspa.c +++ b/audio/filter/af_ladspa.c @@ -104,7 +104,7 @@ static int af_ladspa_malloc_failed(char*); /* ------------------------------------------------------------------------- */ #define OPT_BASE_STRUCT af_ladspa_t -struct af_info af_info_ladspa = { +const struct af_info af_info_ladspa = { .info = "LADSPA plugin loader", .name = "ladspa", .open = af_open, diff --git a/audio/filter/af_lavcac3enc.c b/audio/filter/af_lavcac3enc.c index 705431ca7d..3b3b33b98a 100644 --- a/audio/filter/af_lavcac3enc.c +++ b/audio/filter/af_lavcac3enc.c @@ -305,7 +305,7 @@ static int af_open(struct af_instance* af){ #define OPT_BASE_STRUCT struct af_ac3enc_s -struct af_info af_info_lavcac3enc = { +const struct af_info af_info_lavcac3enc = { .info = "runtime encode to ac3 using libavcodec", .name = "lavcac3enc", .open = af_open, diff --git a/audio/filter/af_lavfi.c b/audio/filter/af_lavfi.c index 5bca39d6dd..a565e202f4 100644 --- a/audio/filter/af_lavfi.c +++ b/audio/filter/af_lavfi.c @@ -299,7 +299,7 @@ static int af_open(struct af_instance *af) #define OPT_BASE_STRUCT struct priv -struct af_info af_info_lavfi = { +const struct af_info af_info_lavfi = { .info = "libavfilter bridge", .name = "lavfi", .open = af_open, diff --git a/audio/filter/af_lavrresample.c b/audio/filter/af_lavrresample.c index 692297bb38..8e33f3b23c 100644 --- a/audio/filter/af_lavrresample.c +++ b/audio/filter/af_lavrresample.c @@ -382,7 +382,7 @@ static int af_open(struct af_instance *af) #define OPT_BASE_STRUCT struct af_resample -struct af_info af_info_lavrresample = { +const struct af_info af_info_lavrresample = { .info = "Sample frequency conversion using libavresample", .name = "lavrresample", .open = af_open, diff --git a/audio/filter/af_pan.c b/audio/filter/af_pan.c index b966deb9b3..65269a86e1 100644 --- a/audio/filter/af_pan.c +++ b/audio/filter/af_pan.c @@ -177,7 +177,7 @@ static int af_open(struct af_instance* af){ } #define OPT_BASE_STRUCT af_pan_t -struct af_info af_info_pan = { +const struct af_info af_info_pan = { .info = "Panning audio filter", .name = "pan", .open = af_open, diff --git a/audio/filter/af_scaletempo.c b/audio/filter/af_scaletempo.c index cd288e9d12..82aa17c802 100644 --- a/audio/filter/af_scaletempo.c +++ b/audio/filter/af_scaletempo.c @@ -467,7 +467,7 @@ static int af_open(struct af_instance *af) #define OPT_BASE_STRUCT af_scaletempo_t -struct af_info af_info_scaletempo = { +const struct af_info af_info_scaletempo = { .info = "Scale audio tempo while maintaining pitch", .name = "scaletempo", .open = af_open, diff --git a/audio/filter/af_sinesuppress.c b/audio/filter/af_sinesuppress.c index 6b1d5da50d..95d2478b7e 100644 --- a/audio/filter/af_sinesuppress.c +++ b/audio/filter/af_sinesuppress.c @@ -136,7 +136,7 @@ static int af_open(struct af_instance* af){ } #define OPT_BASE_STRUCT af_sinesuppress_t -struct af_info af_info_sinesuppress = { +const struct af_info af_info_sinesuppress = { .info = "Sine Suppress", .name = "sinesuppress", .open = af_open, diff --git a/audio/filter/af_sub.c b/audio/filter/af_sub.c index 742d2e7413..5642c4573d 100644 --- a/audio/filter/af_sub.c +++ b/audio/filter/af_sub.c @@ -46,8 +46,8 @@ typedef struct{ } biquad_t; // S-parameters for designing 4th order Butterworth filter -static biquad_t sp[2] = {{{1.0,0.0,0.0},{1.0,0.765367,1.0}}, - {{1.0,0.0,0.0},{1.0,1.847759,1.0}}}; +static const biquad_t sp[2] = {{{1.0,0.0,0.0},{1.0,0.765367,1.0}}, + {{1.0,0.0,0.0},{1.0,1.847759,1.0}}}; // Data for specific instances of this filter typedef struct af_sub_s @@ -128,7 +128,7 @@ static int af_open(struct af_instance* af){ } #define OPT_BASE_STRUCT af_sub_t -struct af_info af_info_sub = { +const struct af_info af_info_sub = { .info = "Audio filter for adding a sub-base channel", .name = "sub", .flags = AF_FLAGS_NOT_REENTRANT, diff --git a/audio/filter/af_surround.c b/audio/filter/af_surround.c index 06a8c4a761..7e04a79ed8 100644 --- a/audio/filter/af_surround.c +++ b/audio/filter/af_surround.c @@ -131,7 +131,7 @@ static int control(struct af_instance* af, int cmd, void* arg) } // The beginnings of an active matrix... -static float steering_matrix[][12] = { +static const float steering_matrix[][12] = { // LL RL LR RR LS RS // LLs RLs LRs RRs LC RC {.707, .0, .0, .707, .5, -.5, @@ -144,7 +144,7 @@ static float steering_matrix[][12] = { // Filter data through filter static int filter(struct af_instance* af, struct mp_audio* data, int flags){ af_surround_t* s = (af_surround_t*)af->priv; - float* m = steering_matrix[0]; + const float* m = steering_matrix[0]; float* in = data->planes[0]; // Input audio data float* out = NULL; // Output audio data float* end = in + data->samples * data->nch; @@ -229,7 +229,7 @@ static int af_open(struct af_instance* af){ } #define OPT_BASE_STRUCT af_surround_t -struct af_info af_info_surround = +const struct af_info af_info_surround = { .info = "Surround decoder filter", .name = "surround", diff --git a/audio/filter/af_sweep.c b/audio/filter/af_sweep.c index af5fc71b78..982cb6210c 100644 --- a/audio/filter/af_sweep.c +++ b/audio/filter/af_sweep.c @@ -74,7 +74,7 @@ static int af_open(struct af_instance* af){ } #define OPT_BASE_STRUCT af_sweept -struct af_info af_info_sweep = { +const struct af_info af_info_sweep = { .info = "sine sweep", .name = "sweep", .open = af_open, diff --git a/audio/filter/af_volume.c b/audio/filter/af_volume.c index 837ce12c86..f07914313b 100644 --- a/audio/filter/af_volume.c +++ b/audio/filter/af_volume.c @@ -140,7 +140,7 @@ static int af_open(struct af_instance *af) #define OPT_BASE_STRUCT struct priv // Description of this filter -struct af_info af_info_volume = { +const struct af_info af_info_volume = { .info = "Volume control audio filter", .name = "volume", .flags = AF_FLAGS_NOT_REENTRANT, diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c index 8bdf5e635c..25a051fee8 100644 --- a/audio/out/ao_alsa.c +++ b/audio/out/ao_alsa.c @@ -244,7 +244,7 @@ static int find_alsa_format(int af_format) // The second item must be resolvable with mp_chmap_from_str(). // Source: http://www.alsa-project.org/main/index.php/DeviceNames // (Speaker names are slightly different from mpv's.) -static const char *device_channel_layouts[][2] = { +static const char *const device_channel_layouts[][2] = { {"default", "fc"}, {"default", "fl-fr"}, {"rear", "bl-br"}, diff --git a/audio/out/ao_oss.c b/audio/out/ao_oss.c index 545ddca3f8..7698af4e0c 100644 --- a/audio/out/ao_oss.c +++ b/audio/out/ao_oss.c @@ -65,7 +65,7 @@ struct priv { char *cfg_oss_mixer_channel; }; -static const char *mixer_channels[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES; +static const char *const mixer_channels[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES; /* like alsa except for 6.1 and 7.1, from pcm/matrix_map.h */ static const struct mp_chmap oss_layouts[MP_NUM_CHANNELS + 1] = { @@ -80,7 +80,7 @@ static const struct mp_chmap oss_layouts[MP_NUM_CHANNELS + 1] = { MP_CHMAP8(FL, FR, BL, BR, FC, LFE, SL, SR), // 7.1 }; -static int format_table[][2] = { +static const int format_table[][2] = { {AFMT_U8, AF_FORMAT_U8}, {AFMT_S8, AF_FORMAT_S8}, {AFMT_U16_LE, AF_FORMAT_U16_LE}, |