[vlc-commits] filter: merge audio and video flush

Rémi Denis-Courmont git at videolan.org
Sun Nov 8 12:37:50 CET 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Nov  8 13:37:05 2015 +0200| [d7cb099f49f208fdd3a81293e95c040a924302c4] | committer: Rémi Denis-Courmont

filter: merge audio and video flush

The callbacks return nothing (unlike drain), so they can be treated
identically regardless of the ES category.

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

 include/vlc_filter.h                           |   21 ++++++---------------
 modules/audio_filter/resampler/soxr.c          |    2 +-
 modules/hw/mmal/deinterlace.c                  |    2 +-
 modules/hw/vdpau/chroma.c                      |    2 +-
 modules/video_filter/deinterlace/deinterlace.c |    2 +-
 modules/video_filter/deinterlace/deinterlace.h |    2 +-
 src/audio_output/filters.c                     |    2 +-
 src/misc/filter_chain.c                        |    2 +-
 8 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index 1a086a9..afe0205 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -117,8 +117,6 @@ struct filter_t
      * Flush (i.e. discard) any internal buffer in a video or audio filter.
      */
     void (*pf_flush)( filter_t * );
-#define pf_video_flush pf_flush
-#define pf_audio_flush pf_flush
 
     union
     {
@@ -163,21 +161,14 @@ static inline picture_t *filter_NewPicture( filter_t *p_filter )
 }
 
 /**
- * This function will flush the state of a video filter.
- */
-static inline void filter_FlushPictures( filter_t *p_filter )
-{
-    if( p_filter->pf_video_flush )
-        p_filter->pf_video_flush( p_filter );
-}
-
-/**
- * This function will flush the state of an audio filter.
+ * Flush a filter
+ *
+ * This function will flush the state of a filter (audio or video).
  */
-static inline void filter_FlushAudio( filter_t *p_filter )
+static inline void filter_Flush( filter_t *p_filter )
 {
-    if( p_filter->pf_audio_flush )
-        p_filter->pf_audio_flush( p_filter );
+    if( p_filter->pf_flush != NULL )
+        p_filter->pf_flush( p_filter );
 }
 
 /**
diff --git a/modules/audio_filter/resampler/soxr.c b/modules/audio_filter/resampler/soxr.c
index a1e610f..7a72ee0 100644
--- a/modules/audio_filter/resampler/soxr.c
+++ b/modules/audio_filter/resampler/soxr.c
@@ -192,7 +192,7 @@ Open( vlc_object_t *p_obj, bool b_change_ratio )
 
     p_filter->p_sys = p_sys;
     p_filter->pf_audio_filter = Resample;
-    p_filter->pf_audio_flush = Flush;
+    p_filter->pf_flush = Flush;
     p_filter->pf_audio_drain = Drain;
     return VLC_SUCCESS;
 }
diff --git a/modules/hw/mmal/deinterlace.c b/modules/hw/mmal/deinterlace.c
index 76b8db5..002ce62 100644
--- a/modules/hw/mmal/deinterlace.c
+++ b/modules/hw/mmal/deinterlace.c
@@ -231,7 +231,7 @@ static int Open(filter_t *filter)
     sys->filtered_pictures = mmal_queue_create();
 
     filter->pf_video_filter = deinterlace;
-    filter->pf_video_flush = flush;
+    filter->pf_flush = flush;
     vlc_mutex_init_recursive(&sys->mutex);
     vlc_mutex_init(&sys->buffer_cond_mutex);
     vlc_cond_init(&sys->buffer_cond);
diff --git a/modules/hw/vdpau/chroma.c b/modules/hw/vdpau/chroma.c
index c21d0ef..be0816b 100644
--- a/modules/hw/vdpau/chroma.c
+++ b/modules/hw/vdpau/chroma.c
@@ -764,7 +764,7 @@ static int OutputOpen(vlc_object_t *obj)
     sys->procamp.hue = 0.f;
 
     filter->pf_video_filter = video_filter;
-    filter->pf_video_flush = Flush;
+    filter->pf_flush = Flush;
     return VLC_SUCCESS;
 error:
     free(sys);
diff --git a/modules/video_filter/deinterlace/deinterlace.c b/modules/video_filter/deinterlace/deinterlace.c
index e6a0b0f..b1676a4 100644
--- a/modules/video_filter/deinterlace/deinterlace.c
+++ b/modules/video_filter/deinterlace/deinterlace.c
@@ -757,7 +757,7 @@ notsupp:
     p_filter->fmt_out.video = fmt;
     p_filter->fmt_out.i_codec = fmt.i_chroma;
     p_filter->pf_video_filter = Deinterlace;
-    p_filter->pf_video_flush  = Flush;
+    p_filter->pf_flush = Flush;
     p_filter->pf_video_mouse  = Mouse;
 
     msg_Dbg( p_filter, "deinterlacing" );
diff --git a/modules/video_filter/deinterlace/deinterlace.h b/modules/video_filter/deinterlace/deinterlace.h
index 7fc036d..fd605dc 100644
--- a/modules/video_filter/deinterlace/deinterlace.h
+++ b/modules/video_filter/deinterlace/deinterlace.h
@@ -197,7 +197,7 @@ int Open( vlc_object_t *p_this );
  * Resets the filter state, including resetting all algorithm-specific state
  * and discarding all histories, but does not stop the filter.
  *
- * Open() sets this up as the flush method (pf_video_flush)
+ * Open() sets this up as the flush method (pf_flush)
  * in the filter structure.
  *
  * @param p_filter The filter instance.
diff --git a/src/audio_output/filters.c b/src/audio_output/filters.c
index 8bb8630..e525739 100644
--- a/src/audio_output/filters.c
+++ b/src/audio_output/filters.c
@@ -308,7 +308,7 @@ static void aout_FiltersPipelineFlush(filter_t *const *filters,
                                       unsigned count)
 {
     for (unsigned i = 0; i < count; i++)
-        filter_FlushAudio (filters[i]);
+        filter_Flush (filters[i]);
 }
 
 
diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index ea5a17f..a28a989 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -417,7 +417,7 @@ void filter_chain_VideoFlush( filter_chain_t *p_chain )
         FilterDeletePictures( f->pending );
         f->pending = NULL;
 
-        filter_FlushPictures( p_filter );
+        filter_Flush( p_filter );
     }
 }
 



More information about the vlc-commits mailing list