Commit 9f74ef90 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

filter_chain: replace GetLength with IsEmpty

Nothing cares about the actual length if it is non-zero. Also constify.
parent 39174627
...@@ -395,12 +395,12 @@ VLC_API void filter_chain_DeleteFilter(filter_chain_t *chain, ...@@ -395,12 +395,12 @@ VLC_API void filter_chain_DeleteFilter(filter_chain_t *chain,
filter_t *filter); 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 * \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. * Get last output format of the last element in the filter chain.
......
...@@ -706,7 +706,7 @@ static void OutputFrame( sout_stream_t *p_stream, picture_t *p_pic, sout_stream_ ...@@ -706,7 +706,7 @@ static void OutputFrame( sout_stream_t *p_stream, picture_t *p_pic, sout_stream_
/* Overlay subpicture */ /* Overlay subpicture */
if( p_subpic ) 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, /* We can't modify the picture, we need to duplicate it,
* in this point the picture is already p_encoder->fmt.in format*/ * in this point the picture is already p_encoder->fmt.in format*/
......
...@@ -108,7 +108,7 @@ filter_chain_AppendFromString ...@@ -108,7 +108,7 @@ filter_chain_AppendFromString
filter_chain_Delete filter_chain_Delete
filter_chain_DeleteFilter filter_chain_DeleteFilter
filter_chain_GetFmtOut filter_chain_GetFmtOut
filter_chain_GetLength filter_chain_IsEmpty
filter_chain_MouseFilter filter_chain_MouseFilter
filter_chain_MouseEvent filter_chain_MouseEvent
filter_chain_NewVideo filter_chain_NewVideo
......
...@@ -379,9 +379,9 @@ int filter_chain_ForEach( filter_chain_t *chain, ...@@ -379,9 +379,9 @@ int filter_chain_ForEach( filter_chain_t *chain,
return VLC_SUCCESS; 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 ) const es_format_t *filter_chain_GetFmtOut( filter_chain_t *p_chain )
......
...@@ -1093,7 +1093,7 @@ picture_t *vout_FilterDisplay(vout_display_t *vd, picture_t *picture) ...@@ -1093,7 +1093,7 @@ picture_t *vout_FilterDisplay(vout_display_t *vd, picture_t *picture)
vout_display_owner_sys_t *osys = vd->owner.sys; vout_display_owner_sys_t *osys = vd->owner.sys;
assert(osys->filters); assert(osys->filters);
if (filter_chain_GetLength(osys->filters) <= 0) { if (filter_chain_IsEmpty(osys->filters)) {
picture_Release(picture); picture_Release(picture);
return NULL; return NULL;
} }
......
...@@ -684,7 +684,7 @@ static picture_t *VoutVideoFilterStaticNewPicture(filter_t *filter) ...@@ -684,7 +684,7 @@ static picture_t *VoutVideoFilterStaticNewPicture(filter_t *filter)
vout_thread_t *vout = filter->owner.sys; vout_thread_t *vout = filter->owner.sys;
vlc_assert_locked(&vout->p->filter.lock); 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 VoutVideoFilterInteractiveNewPicture(filter);
return picture_NewFromFormat(&filter->fmt_out.video); return picture_NewFromFormat(&filter->fmt_out.video);
......
...@@ -1440,7 +1440,7 @@ void spu_PutSubpicture(spu_t *spu, subpicture_t *subpic) ...@@ -1440,7 +1440,7 @@ void spu_PutSubpicture(spu_t *spu, subpicture_t *subpic)
/* "sub-source" was formerly "sub-filter", so now the "sub-filter" /* "sub-source" was formerly "sub-filter", so now the "sub-filter"
configuration may contain sub-filters or sub-sources configurations. 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 */ 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); vlc_mutex_unlock(&sys->filter_chain_lock);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment