changeset 36461:ed153683310d

Get rid of guiInfo member afilter. This also eliminates GUI_SET_AFILTER. Add mpctx_get_afilter() to provide this information and call it when needed.
author ib
date Tue, 17 Dec 2013 22:57:00 +0000
parents d66bfbf37cd2
children b72daec4e223
files access_mpcontext.h gui/interface.c gui/interface.h gui/win32/interface.c mplayer.c
diffstat 5 files changed, 16 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/access_mpcontext.h	Tue Dec 17 22:41:24 2013 +0000
+++ b/access_mpcontext.h	Tue Dec 17 22:57:00 2013 +0000
@@ -29,5 +29,6 @@
 int mpctx_get_global_sub_pos(struct MPContext *mpctx);
 int mpctx_get_osd_function(struct MPContext *mpctx);
 void *mpctx_get_stream(struct MPContext *mpctx);
+void *mpctx_get_afilter(struct MPContext *mpctx);
 
 #endif /* MPLAYER_ACCESS_MPCONTEXT_H */
--- a/gui/interface.c	Tue Dec 17 22:41:24 2013 +0000
+++ b/gui/interface.c	Tue Dec 17 22:57:00 2013 +0000
@@ -656,11 +656,6 @@
 
         break;
 
-    case GUI_SET_AFILTER:
-
-        guiInfo.afilter = data;
-        break;
-
     case GUI_SET_VIDEO:
 
         /* video */
@@ -947,6 +942,7 @@
 
 void mplayer(int what, float value, void *data)
 {
+    af_stream_t *afilter;
     equalizer_t *eq = (equalizer_t *)data;
 
     switch (what) {
@@ -995,8 +991,9 @@
 
     case MPLAYER_SET_EXTRA_STEREO:
         gtkAOExtraStereoMul = value;
-        if (guiInfo.afilter)
-            af_control_any_rev(guiInfo.afilter, AF_CONTROL_ES_MUL | AF_CONTROL_SET, &gtkAOExtraStereoMul);
+        afilter = mpctx_get_afilter(guiInfo.mpcontext);
+        if (afilter)
+            af_control_any_rev(afilter, AF_CONTROL_ES_MUL | AF_CONTROL_SET, &gtkAOExtraStereoMul);
         break;
 
     case MPLAYER_SET_PANSCAN:
@@ -1042,23 +1039,25 @@
     {
         af_control_ext_t tmp;
 
+        afilter = mpctx_get_afilter(guiInfo.mpcontext);
+
         if (eq) {
             gtkEquChannels[eq->channel][eq->band] = eq->gain;
             tmp.ch  = eq->channel;
             tmp.arg = gtkEquChannels[eq->channel];
 
-            if (guiInfo.afilter)
-                af_control_any_rev(guiInfo.afilter, AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);
+            if (afilter)
+                af_control_any_rev(afilter, AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);
         } else {
             unsigned int i;
 
             memset(gtkEquChannels, 0, sizeof(gtkEquChannels));
 
-            if (guiInfo.afilter) {
+            if (afilter) {
                 for (i = 0; i < FF_ARRAY_ELEMS(gtkEquChannels); i++) {
                     tmp.ch  = i;
                     tmp.arg = gtkEquChannels[i];
-                    af_control_any_rev(guiInfo.afilter, AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);
+                    af_control_any_rev(afilter, AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);
                 }
             }
         }
--- a/gui/interface.h	Tue Dec 17 22:41:24 2013 +0000
+++ b/gui/interface.h	Tue Dec 17 22:57:00 2013 +0000
@@ -46,7 +46,6 @@
     GUI_RUN_COMMAND,
     GUI_RUN_MESSAGE,
     GUI_SETUP_VIDEO_WINDOW,
-    GUI_SET_AFILTER,
     GUI_SET_AUDIO,
     GUI_SET_CONTEXT,
     GUI_SET_MIXER,
@@ -98,7 +97,6 @@
 typedef struct {
     MPContext *mpcontext;
     sh_video_t *sh_video;
-    af_stream_t *afilter;
 
     int VideoWindow;
     int VideoWidth;
--- a/gui/win32/interface.c	Tue Dec 17 22:41:24 2013 +0000
+++ b/gui/win32/interface.c	Tue Dec 17 22:57:00 2013 +0000
@@ -683,9 +683,6 @@
         case GUI_REDRAW:
             mygui->updatedisplay(mygui, mygui->mainwindow);
             break;
-        case GUI_SET_AFILTER:
-            guiInfo.afilter = data;
-            break;
         case GUI_SET_STATE:
         {
             guiInfo.Playing = (int) data;
--- a/mplayer.c	Tue Dec 17 22:41:24 2013 +0000
+++ b/mplayer.c	Tue Dec 17 22:57:00 2013 +0000
@@ -380,6 +380,11 @@
     return mpctx->stream;
 }
 
+void *mpctx_get_afilter(MPContext *mpctx)
+{
+    return mpctx->sh_audio ? mpctx->sh_audio->afilter : NULL;
+}
+
 static int is_valid_metadata_type(metadata_t type)
 {
     switch (type) {
@@ -578,10 +583,6 @@
         current_module     = "uninit_acodec";
         if (mpctx->sh_audio)
             uninit_audio(mpctx->sh_audio);
-#ifdef CONFIG_GUI
-        if (use_gui)
-            gui(GUI_SET_AFILTER, NULL);
-#endif
         mpctx->sh_audio      = NULL;
         mpctx->mixer.afilter = NULL;
     }
@@ -1337,10 +1338,6 @@
     int new_srate;
     int result;
     if (!sh_audio) {
-#ifdef CONFIG_GUI
-        if (use_gui)
-            gui(GUI_SET_AFILTER, NULL);
-#endif
         mpctx->mixer.afilter = NULL;
         return 0;
     }
@@ -1362,10 +1359,6 @@
     result = init_audio_filters(sh_audio, new_srate,
                                 &ao_data->samplerate, &ao_data->channels, &ao_data->format);
     mpctx->mixer.afilter = sh_audio->afilter;
-#ifdef CONFIG_GUI
-    if (use_gui)
-        gui(GUI_SET_AFILTER, sh_audio->afilter);
-#endif
     return result;
 }