[MPlayer-cvslog] r36557 - in trunk: access_mpcontext.h gui/interface.c gui/interface.h gui/win32/interface.c mplayer.c

ib subversion at mplayerhq.hu
Tue Dec 17 23:57:01 CET 2013


Author: ib
Date: Tue Dec 17 23:57:00 2013
New Revision: 36557

Log:
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.

Modified:
   trunk/access_mpcontext.h
   trunk/gui/interface.c
   trunk/gui/interface.h
   trunk/gui/win32/interface.c
   trunk/mplayer.c

Modified: trunk/access_mpcontext.h
==============================================================================
--- trunk/access_mpcontext.h	Tue Dec 17 23:41:24 2013	(r36556)
+++ trunk/access_mpcontext.h	Tue Dec 17 23:57:00 2013	(r36557)
@@ -29,5 +29,6 @@ int mpctx_get_global_sub_size(struct MPC
 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 */

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Tue Dec 17 23:41:24 2013	(r36556)
+++ trunk/gui/interface.c	Tue Dec 17 23:57:00 2013	(r36557)
@@ -656,11 +656,6 @@ int gui(int what, void *data)
 
         break;
 
-    case GUI_SET_AFILTER:
-
-        guiInfo.afilter = data;
-        break;
-
     case GUI_SET_VIDEO:
 
         /* video */
@@ -947,6 +942,7 @@ int guiPlaylist(int what, play_tree_t *p
 
 void mplayer(int what, float value, void *data)
 {
+    af_stream_t *afilter;
     equalizer_t *eq = (equalizer_t *)data;
 
     switch (what) {
@@ -995,8 +991,9 @@ void mplayer(int what, float value, void
 
     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 @@ void mplayer(int what, float value, void
     {
         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);
                 }
             }
         }

Modified: trunk/gui/interface.h
==============================================================================
--- trunk/gui/interface.h	Tue Dec 17 23:41:24 2013	(r36556)
+++ trunk/gui/interface.h	Tue Dec 17 23:57:00 2013	(r36557)
@@ -46,7 +46,6 @@ enum {
     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 @@ enum {
 typedef struct {
     MPContext *mpcontext;
     sh_video_t *sh_video;
-    af_stream_t *afilter;
 
     int VideoWindow;
     int VideoWidth;

Modified: trunk/gui/win32/interface.c
==============================================================================
--- trunk/gui/win32/interface.c	Tue Dec 17 23:41:24 2013	(r36556)
+++ trunk/gui/win32/interface.c	Tue Dec 17 23:57:00 2013	(r36557)
@@ -683,9 +683,6 @@ int gui(int what, void *data)
         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;

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	Tue Dec 17 23:41:24 2013	(r36556)
+++ trunk/mplayer.c	Tue Dec 17 23:57:00 2013	(r36557)
@@ -380,6 +380,11 @@ void *mpctx_get_stream(MPContext *mpctx)
     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 @@ void uninit_player(unsigned int mask)
         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 @@ static int build_afilter_chain(sh_audio_
     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 @@ static int build_afilter_chain(sh_audio_
     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;
 }
 


More information about the MPlayer-cvslog mailing list