[vlc-commits] aout: always create visualization callbacks

Rémi Denis-Courmont git at videolan.org
Fri Jan 18 22:12:52 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Jan 18 21:30:52 2019 +0200| [0ea1fd7f164eb80b59a2e030506bbb6593a8a00c] | committer: Rémi Denis-Courmont

aout: always create visualization callbacks

This provides bug compatibility with the SDI stream output and, on
error, the transcode stream output, which were incorrectly passing
a non-NULL first parameter to aout_FiltersDelete().

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

 modules/stream_out/transcode/audio.c |  2 +-
 src/audio_output/filters.c           | 25 ++++++++-----------------
 2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/modules/stream_out/transcode/audio.c b/modules/stream_out/transcode/audio.c
index 7b3f666102..95f22a6208 100644
--- a/modules/stream_out/transcode/audio.c
+++ b/modules/stream_out/transcode/audio.c
@@ -218,7 +218,7 @@ void transcode_audio_clean( sout_stream_t *p_stream, sout_stream_id_sys_t *id )
 
     /* Close filters */
     if( id->p_af_chain != NULL )
-        aout_FiltersDelete( (vlc_object_t *)NULL, id->p_af_chain );
+        aout_FiltersDelete( p_stream, id->p_af_chain );
 }
 
 static bool transcode_audio_format_IsSimilar( const audio_format_t *a,
diff --git a/src/audio_output/filters.c b/src/audio_output/filters.c
index 9127c99f15..ce21c477a4 100644
--- a/src/audio_output/filters.c
+++ b/src/audio_output/filters.c
@@ -517,8 +517,7 @@ aout_filters_t *aout_FiltersNew (vlc_object_t *obj,
     audio_sample_format_t output_format = *outfmt;
 
     /* Callbacks (before reading values and also before return statement) */
-    if (request_vout != NULL)
-        var_AddCallback (obj, "visual", VisualizationCallback, NULL);
+    var_AddCallback (obj, "visual", VisualizationCallback, NULL);
 
     if (!AOUT_FMT_LINEAR(outfmt))
     {   /* Non-linear output: just convert formats, no filters/visu */
@@ -617,14 +616,11 @@ aout_filters_t *aout_FiltersNew (vlc_object_t *obj,
         free (str);
     }
 
-    if (request_vout != NULL)
-    {
-        char *visual = var_InheritString (obj, "audio-visual");
-        if (visual != NULL && strcasecmp (visual, "none"))
-            AppendFilter(obj, "visualization", visual, filters,
-                         &input_format, &output_format, NULL);
-        free (visual);
-    }
+    char *visual = var_InheritString(obj, "audio-visual");
+    if (visual != NULL && strcasecmp(visual, "none"))
+        AppendFilter(obj, "visualization", visual, filters,
+                     &input_format, &output_format, NULL);
+    free(visual);
 
     /* convert to the output format (minus resampling) if necessary */
     output_format.i_rate = input_format.i_rate;
@@ -653,8 +649,7 @@ aout_filters_t *aout_FiltersNew (vlc_object_t *obj,
 
 error:
     aout_FiltersPipelineDestroy (filters->tab, filters->count);
-    if (request_vout != NULL)
-        var_DelCallback (obj, "visual", VisualizationCallback, NULL);
+    var_DelCallback(obj, "visual", VisualizationCallback, NULL);
     free (filters);
     return NULL;
 }
@@ -664,17 +659,13 @@ error:
  * Destroys a chain of audio filters.
  * \param obj object used with aout_FiltersNew()
  * \param filters chain to be destroyed
- * \bug
- * obj must be NULL iff request_vout was NULL in aout_FiltersNew()
- * (this implies obj is an audio_output_t pointer if non NULL).
  */
 void aout_FiltersDelete (vlc_object_t *obj, aout_filters_t *filters)
 {
     if (filters->resampler != NULL)
         aout_FiltersPipelineDestroy (&filters->resampler, 1);
     aout_FiltersPipelineDestroy (filters->tab, filters->count);
-    if (obj != NULL)
-        var_DelCallback (obj, "visual", VisualizationCallback, NULL);
+    var_DelCallback(obj, "visual", VisualizationCallback, NULL);
     free (filters);
 }
 



More information about the vlc-commits mailing list