[vlc-devel] [PATCH v1 30/33] video_filter: replace unused pf_video_filter by pf_video_filter_into
Steve Lhomme
robux4 at ycbcr.xyz
Fri Sep 25 16:47:06 CEST 2020
---
include/vlc_filter.h | 32 ++++++--------------------------
src/misc/filter_chain.c | 24 +++---------------------
2 files changed, 9 insertions(+), 47 deletions(-)
diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index b84c8374278..7c67432e0de 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -135,7 +135,7 @@ struct filter_t
union
{
/** Filter a picture (video filter) */
- picture_t * (*pf_video_filter)( filter_t *, picture_t * );
+ int (*pf_video_filter_into)( filter_t *, picture_t *, struct vlc_video_sink * );
/** Filter an audio block (audio filter) */
block_t * (*pf_audio_filter)( filter_t *, block_t * );
@@ -160,8 +160,6 @@ struct filter_t
/* TODO: video filter drain */
/** Drain (audio filter) */
block_t *(*pf_audio_drain) ( filter_t * );
-
- int (*pf_video_filter_into)( filter_t *, picture_t *, struct vlc_video_sink * );
};
/** Flush
@@ -198,7 +196,7 @@ struct filter_t
/**
* This function will return a new picture usable by p_filter as an output
* buffer. You have to release it using picture_Release or by returning
- * it to the caller as a pf_video_filter return value.
+ * it to the caller as a pf_video_filter_into return value.
* Provided for convenience.
*
* \param p_filter filter_t object
@@ -229,14 +227,10 @@ static inline int GetSingleResult(struct vlc_video_sink *sink, picture_t *output
static inline picture_t *filter_FilterSingle( filter_t *p_filter, picture_t *pic )
{
- if ( p_filter->pf_video_filter_into != NULL )
- {
- picture_t *result = NULL;
- struct vlc_video_sink sink = { &result, GetSingleResult };
- p_filter->pf_video_filter_into( p_filter, pic, &sink );
- return result;
- }
- return p_filter->pf_video_filter( p_filter, pic );
+ picture_t *result = NULL;
+ struct vlc_video_sink sink = { &result, GetSingleResult };
+ p_filter->pf_video_filter_into( p_filter, pic, &sink );
+ return result;
}
/**
@@ -389,20 +383,6 @@ VLC_API void filter_DeleteBlend( vlc_blender_t * );
*
* Currently used by the chroma video filters
*/
-#define VIDEO_FILTER_WRAPPER( name ) \
- static picture_t *name ## _Filter ( filter_t *p_filter, \
- picture_t *p_pic ) \
- { \
- picture_t *p_outpic = filter_NewPicture( p_filter ); \
- if( p_outpic ) \
- { \
- name( p_filter, p_pic, p_outpic ); \
- picture_CopyProperties( p_outpic, p_pic ); \
- } \
- picture_Release( p_pic ); \
- return p_outpic; \
- }
-
#define VIDEO_FILTER_WRAPPER2( name ) \
static int name ## _Filter ( filter_t *p_filter, \
picture_t *p_pic, \
diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 08ab8ddc835..f33d84265f7 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -474,27 +474,9 @@ int filter_chain_VideoFilterInto(filter_chain_t *p_chain, picture_t *p_pic,
for (front = vlc_picture_chain_PopFront(&src_chain); front != NULL;
front = vlc_picture_chain_PopFront(&src_chain) )
{
- if ( p_filter->pf_video_filter_into != NULL )
- {
- res = p_filter->pf_video_filter_into( p_filter, front, &fsink );
- if (res != VLC_SUCCESS)
- break;
- }
- else
- {
- assert(p_filter->pf_video_filter != NULL);
- picture_t *filtered = p_filter->pf_video_filter( p_filter, front );
- if (filtered != NULL)
- {
- vlc_picture_chain_t chained = picture_GetAndResetChain( filtered );
- fsink.pf_push_picture(fsink.sys, filtered);
- while ( !vlc_picture_chain_IsEmpty( &chained ) )
- {
- picture_t *next = vlc_picture_chain_PopFront( &chained );
- fsink.pf_push_picture(fsink.sys, next);
- }
- }
- }
+ res = p_filter->pf_video_filter( p_filter, front, &fsink );
+ if (res != VLC_SUCCESS)
+ break;
}
// we have filtered pictures in filtered_chain, move them in src_chain
--
2.26.2
More information about the vlc-devel
mailing list