# HG changeset patch # User ib # Date 1387321020 0 # Node ID ed153683310d0d16906e3b7f26cf04294d3281e3 # Parent d66bfbf37cd2746bfe74c559761d5a230755afae 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. diff -r d66bfbf37cd2 -r ed153683310d access_mpcontext.h --- 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 */ diff -r d66bfbf37cd2 -r ed153683310d gui/interface.c --- 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, >kAOExtraStereoMul); + afilter = mpctx_get_afilter(guiInfo.mpcontext); + if (afilter) + af_control_any_rev(afilter, AF_CONTROL_ES_MUL | AF_CONTROL_SET, >kAOExtraStereoMul); 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); } } } diff -r d66bfbf37cd2 -r ed153683310d gui/interface.h --- 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; diff -r d66bfbf37cd2 -r ed153683310d gui/win32/interface.c --- 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; diff -r d66bfbf37cd2 -r ed153683310d mplayer.c --- 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; }