[vlc-commits] audiobargraph_v: simplify callback

Rafaël Carré git at videolan.org
Wed Apr 16 22:32:50 CEST 2014


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Wed Apr 16 16:21:46 2014 +0200| [d9bf34849af51af6b24e647257ee9b7195d25aab] | committer: Rafaël Carré

audiobargraph_v: simplify callback

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d9bf34849af51af6b24e647257ee9b7195d25aab
---

 modules/video_filter/audiobargraph_v.c |   16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/modules/video_filter/audiobargraph_v.c b/modules/video_filter/audiobargraph_v.c
index a84a538..5ae03f1 100644
--- a/modules/video_filter/audiobargraph_v.c
+++ b/modules/video_filter/audiobargraph_v.c
@@ -559,6 +559,9 @@ static picture_t *LoadImage(vlc_object_t *p_this, int nbChannels, int* i_values,
  *****************************************************************************/
 static void LoadBarGraph(vlc_object_t *p_this, BarGraph_t *p_BarGraph)
 {
+    if (p_BarGraph->p_pic)
+        picture_Release(p_BarGraph->p_pic);
+
     p_BarGraph->p_pic = LoadImage(p_this, p_BarGraph->nbChannels, p_BarGraph->i_values, p_BarGraph->scale, p_BarGraph->alarm, p_BarGraph->barWidth);
     if (!p_BarGraph->p_pic)
         msg_Warn(p_this, "error while creating picture");
@@ -585,11 +588,6 @@ static int BarGraphCallback(vlc_object_t *p_this, char const *psz_var,
     else if (!strcmp(psz_var, "audiobargraph_v-transparency"))
         p_BarGraph->i_alpha = VLC_CLIP(newval.i_int, 0, 255);
     else if (!strcmp(psz_var, "audiobargraph_v-i_values")) {
-        if (p_BarGraph->p_pic) {
-            picture_Release(p_BarGraph->p_pic);
-            p_BarGraph->p_pic = NULL;
-        }
-
         char *psz = xstrdup(newval.psz_string ? newval.psz_string : "");
         free(p_BarGraph->i_values);
         // in case many answer are received at the same time, only keep one
@@ -600,17 +598,9 @@ static int BarGraphCallback(vlc_object_t *p_this, char const *psz_var,
         free(psz);
         LoadBarGraph(p_this,p_BarGraph);
     } else if (!strcmp(psz_var, "audiobargraph_v-alarm")) {
-        if (p_BarGraph->p_pic) {
-            picture_Release(p_BarGraph->p_pic);
-            p_BarGraph->p_pic = NULL;
-        }
         p_BarGraph->alarm = newval.b_bool;
         LoadBarGraph(p_this,p_BarGraph);
     } else if (!strcmp(psz_var, "audiobargraph_v-barWidth")) {
-        if (p_BarGraph->p_pic) {
-            picture_Release(p_BarGraph->p_pic);
-            p_BarGraph->p_pic = NULL;
-        }
         p_BarGraph->barWidth = newval.i_int;
         LoadBarGraph(p_this,p_BarGraph);
     }



More information about the vlc-commits mailing list