changeset 25913:21a1dc062bc5

ao_functions_t should be const, part 1
author reimar
date Fri, 01 Feb 2008 20:11:14 +0000
parents 92db8b8c20d4
children b102c1f10728
files libao2/audio_out.c libao2/audio_out.h mixer.h mp_core.h mplayer.c
diffstat 5 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/audio_out.c	Fri Feb 01 12:22:12 2008 +0000
+++ b/libao2/audio_out.c	Fri Feb 01 20:11:14 2008 +0000
@@ -75,7 +75,7 @@
 extern ao_functions_t audio_out_pcm;
 extern ao_functions_t audio_out_pss;
 
-ao_functions_t* audio_out_drivers[] =
+const ao_functions_t* const audio_out_drivers[] =
 {
 // native:
 #ifdef HAVE_DIRECTX
@@ -154,7 +154,7 @@
       mp_msg(MSGT_GLOBAL, MSGL_INFO,"\n");
 }
 
-ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate,int channels,int format,int flags){
+const ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate,int channels,int format,int flags){
     int i;
     // first try the preferred drivers, with their optional subdevice param:
     if(ao_list && ao_list[0])
@@ -177,7 +177,7 @@
 	else
 	    ao_len = strlen(ao);
 	for(i=0;audio_out_drivers[i];i++){
-	    ao_functions_t* audio_out=audio_out_drivers[i];
+	    const ao_functions_t* audio_out=audio_out_drivers[i];
 	    if(!strncmp(audio_out->info->short_name,ao,ao_len)){
 		// name matches, try it
 		if(audio_out->init(rate,channels,format,flags))
@@ -194,7 +194,7 @@
     }
     // now try the rest...
     for(i=0;audio_out_drivers[i];i++){
-	ao_functions_t* audio_out=audio_out_drivers[i];
+	const ao_functions_t* audio_out=audio_out_drivers[i];
 //	if(audio_out->control(AOCONTROL_QUERY_FORMAT, (int)format) == CONTROL_TRUE)
 	if(audio_out->init(rate,channels,format,flags))
 	    return audio_out; // success!
--- a/libao2/audio_out.h	Fri Feb 01 12:22:12 2008 +0000
+++ b/libao2/audio_out.h	Fri Feb 01 20:11:14 2008 +0000
@@ -45,10 +45,10 @@
 extern ao_data_t ao_data;
 
 void list_audio_out(void);
-ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate,int channels,int format,int flags);
+const ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate,int channels,int format,int flags);
 
 // NULL terminated array of all drivers
-extern ao_functions_t* audio_out_drivers[];
+extern const ao_functions_t* const audio_out_drivers[];
 
 #define CONTROL_OK 1
 #define CONTROL_TRUE 1
--- a/mixer.h	Fri Feb 01 12:22:12 2008 +0000
+++ b/mixer.h	Fri Feb 01 20:11:14 2008 +0000
@@ -10,7 +10,7 @@
 extern float soft_vol_max;
 
 typedef struct mixer_s {
-    ao_functions_t *audio_out;
+    const ao_functions_t *audio_out;
     af_stream_t *afilter;
     int volstep;
     int muted;
--- a/mp_core.h	Fri Feb 01 12:22:12 2008 +0000
+++ b/mp_core.h	Fri Feb 01 20:11:14 2008 +0000
@@ -36,7 +36,7 @@
 typedef struct MPContext {
     int osd_show_percentage;
     int osd_function;
-    ao_functions_t *audio_out;
+    const ao_functions_t *audio_out;
     play_tree_t *playtree;
     play_tree_iter_t *playtree_iter;
     int eof;
@@ -115,7 +115,7 @@
 void reinit_audio_chain(void);
 void init_vo_spudec(void);
 double playing_audio_pts(sh_audio_t *sh_audio, demux_stream_t *d_audio,
-			 ao_functions_t *audio_out);
+			 const ao_functions_t *audio_out);
 void exit_player_with_rc(const char* how, int rc);
 void add_subtitles(char *filename, float fps, int noerr);
 int reinit_video_chain(void);
--- a/mplayer.c	Fri Feb 01 12:22:12 2008 +0000
+++ b/mplayer.c	Fri Feb 01 20:11:14 2008 +0000
@@ -1707,7 +1707,7 @@
 
 // Return pts value corresponding to currently playing audio.
 double playing_audio_pts(sh_audio_t *sh_audio, demux_stream_t *d_audio,
-				ao_functions_t *audio_out)
+				const ao_functions_t *audio_out)
 {
     return written_audio_pts(sh_audio, d_audio) - playback_speed *
 	audio_out->get_delay();