[vlc-commits] filter_chain: replace GetLength with IsEmpty

Rémi Denis-Courmont git at videolan.org
Wed Jul 26 20:32:32 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jul 26 21:25:15 2017 +0300| [9f74ef90bec7bacbc527ba20f38c33560f8af321] | committer: Rémi Denis-Courmont

filter_chain: replace GetLength with IsEmpty

Nothing cares about the actual length if it is non-zero. Also constify.

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

 include/vlc_filter.h                 | 6 +++---
 modules/stream_out/transcode/video.c | 2 +-
 src/libvlccore.sym                   | 2 +-
 src/misc/filter_chain.c              | 4 ++--
 src/video_output/display.c           | 2 +-
 src/video_output/video_output.c      | 2 +-
 src/video_output/vout_subpictures.c  | 2 +-
 7 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index 8b290c5f66..3b30dbb562 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -395,12 +395,12 @@ VLC_API void filter_chain_DeleteFilter(filter_chain_t *chain,
                                        filter_t *filter);
 
 /**
- * Get the number of filters in the filter chain.
+ * Checks if the filter chain is empty.
  *
  * \param chain pointer to filter chain
- * \return number of filters in this filter chain
+ * \return true if and only if there are no filters in this filter chain
  */
-VLC_API int filter_chain_GetLength(filter_chain_t *chain);
+VLC_API bool filter_chain_IsEmpty(const filter_chain_t *chain);
 
 /**
  * Get last output format of the last element in the filter chain.
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index 3b5c5e25ff..de36922b87 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -706,7 +706,7 @@ static void OutputFrame( sout_stream_t *p_stream, picture_t *p_pic, sout_stream_
         /* Overlay subpicture */
         if( p_subpic )
         {
-            if( picture_IsReferenced( p_pic ) && !filter_chain_GetLength( id->p_f_chain ) )
+            if( picture_IsReferenced( p_pic ) && filter_chain_IsEmpty( id->p_f_chain ) )
             {
                 /* We can't modify the picture, we need to duplicate it,
                  * in this point the picture is already p_encoder->fmt.in format*/
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 8d9bb53d3c..5faf32c2b0 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -108,7 +108,7 @@ filter_chain_AppendFromString
 filter_chain_Delete
 filter_chain_DeleteFilter
 filter_chain_GetFmtOut
-filter_chain_GetLength
+filter_chain_IsEmpty
 filter_chain_MouseFilter
 filter_chain_MouseEvent
 filter_chain_NewVideo
diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 1b93ddce8c..3e7d4fb08f 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -379,9 +379,9 @@ int filter_chain_ForEach( filter_chain_t *chain,
     return VLC_SUCCESS;
 }
 
-int filter_chain_GetLength( filter_chain_t *p_chain )
+bool filter_chain_IsEmpty(const filter_chain_t *chain)
 {
-    return p_chain->length;
+    return chain->length == 0;
 }
 
 const es_format_t *filter_chain_GetFmtOut( filter_chain_t *p_chain )
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 960f08e66e..055bb7d01d 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -1093,7 +1093,7 @@ picture_t *vout_FilterDisplay(vout_display_t *vd, picture_t *picture)
     vout_display_owner_sys_t *osys = vd->owner.sys;
 
     assert(osys->filters);
-    if (filter_chain_GetLength(osys->filters) <= 0) {
+    if (filter_chain_IsEmpty(osys->filters)) {
         picture_Release(picture);
         return NULL;
     }
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index a5cc3ce8b1..63ca06f6ea 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -684,7 +684,7 @@ static picture_t *VoutVideoFilterStaticNewPicture(filter_t *filter)
     vout_thread_t *vout = filter->owner.sys;
 
     vlc_assert_locked(&vout->p->filter.lock);
-    if (filter_chain_GetLength(vout->p->filter.chain_interactive) == 0)
+    if (filter_chain_IsEmpty(vout->p->filter.chain_interactive))
         return VoutVideoFilterInteractiveNewPicture(filter);
 
     return picture_NewFromFormat(&filter->fmt_out.video);
diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index 3a66e0ddd8..0a64bd4e0a 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -1440,7 +1440,7 @@ void spu_PutSubpicture(spu_t *spu, subpicture_t *subpic)
         /* "sub-source"  was formerly "sub-filter", so now the "sub-filter"
         configuration may contain sub-filters or sub-sources configurations.
         if the filters chain was left empty it may indicate that it's a sub-source configuration */
-        is_left_empty = (filter_chain_GetLength(spu->p->filter_chain) == 0);
+        is_left_empty = filter_chain_IsEmpty(spu->p->filter_chain);
     }
     vlc_mutex_unlock(&sys->filter_chain_lock);
 



More information about the vlc-commits mailing list