Commit d7cb099f authored by Rémi Denis-Courmont's avatar 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.
parent bde25912
...@@ -117,8 +117,6 @@ struct filter_t ...@@ -117,8 +117,6 @@ struct filter_t
* Flush (i.e. discard) any internal buffer in a video or audio filter. * Flush (i.e. discard) any internal buffer in a video or audio filter.
*/ */
void (*pf_flush)( filter_t * ); void (*pf_flush)( filter_t * );
#define pf_video_flush pf_flush
#define pf_audio_flush pf_flush
union union
{ {
...@@ -163,21 +161,14 @@ static inline picture_t *filter_NewPicture( filter_t *p_filter ) ...@@ -163,21 +161,14 @@ static inline picture_t *filter_NewPicture( filter_t *p_filter )
} }
/** /**
* This function will flush the state of a video filter. * Flush a filter
*/ *
static inline void filter_FlushPictures( filter_t *p_filter ) * This function will flush the state of a filter (audio or video).
{
if( p_filter->pf_video_flush )
p_filter->pf_video_flush( p_filter );
}
/**
* This function will flush the state of an audio filter.
*/ */
static inline void filter_FlushAudio( filter_t *p_filter ) static inline void filter_Flush( filter_t *p_filter )
{ {
if( p_filter->pf_audio_flush ) if( p_filter->pf_flush != NULL )
p_filter->pf_audio_flush( p_filter ); p_filter->pf_flush( p_filter );
} }
/** /**
......
...@@ -192,7 +192,7 @@ Open( vlc_object_t *p_obj, bool b_change_ratio ) ...@@ -192,7 +192,7 @@ Open( vlc_object_t *p_obj, bool b_change_ratio )
p_filter->p_sys = p_sys; p_filter->p_sys = p_sys;
p_filter->pf_audio_filter = Resample; p_filter->pf_audio_filter = Resample;
p_filter->pf_audio_flush = Flush; p_filter->pf_flush = Flush;
p_filter->pf_audio_drain = Drain; p_filter->pf_audio_drain = Drain;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -231,7 +231,7 @@ static int Open(filter_t *filter) ...@@ -231,7 +231,7 @@ static int Open(filter_t *filter)
sys->filtered_pictures = mmal_queue_create(); sys->filtered_pictures = mmal_queue_create();
filter->pf_video_filter = deinterlace; filter->pf_video_filter = deinterlace;
filter->pf_video_flush = flush; filter->pf_flush = flush;
vlc_mutex_init_recursive(&sys->mutex); vlc_mutex_init_recursive(&sys->mutex);
vlc_mutex_init(&sys->buffer_cond_mutex); vlc_mutex_init(&sys->buffer_cond_mutex);
vlc_cond_init(&sys->buffer_cond); vlc_cond_init(&sys->buffer_cond);
......
...@@ -764,7 +764,7 @@ static int OutputOpen(vlc_object_t *obj) ...@@ -764,7 +764,7 @@ static int OutputOpen(vlc_object_t *obj)
sys->procamp.hue = 0.f; sys->procamp.hue = 0.f;
filter->pf_video_filter = video_filter; filter->pf_video_filter = video_filter;
filter->pf_video_flush = Flush; filter->pf_flush = Flush;
return VLC_SUCCESS; return VLC_SUCCESS;
error: error:
free(sys); free(sys);
......
...@@ -757,7 +757,7 @@ notsupp: ...@@ -757,7 +757,7 @@ notsupp:
p_filter->fmt_out.video = fmt; p_filter->fmt_out.video = fmt;
p_filter->fmt_out.i_codec = fmt.i_chroma; p_filter->fmt_out.i_codec = fmt.i_chroma;
p_filter->pf_video_filter = Deinterlace; p_filter->pf_video_filter = Deinterlace;
p_filter->pf_video_flush = Flush; p_filter->pf_flush = Flush;
p_filter->pf_video_mouse = Mouse; p_filter->pf_video_mouse = Mouse;
msg_Dbg( p_filter, "deinterlacing" ); msg_Dbg( p_filter, "deinterlacing" );
......
...@@ -197,7 +197,7 @@ int Open( vlc_object_t *p_this ); ...@@ -197,7 +197,7 @@ int Open( vlc_object_t *p_this );
* Resets the filter state, including resetting all algorithm-specific state * Resets the filter state, including resetting all algorithm-specific state
* and discarding all histories, but does not stop the filter. * 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. * in the filter structure.
* *
* @param p_filter The filter instance. * @param p_filter The filter instance.
......
...@@ -308,7 +308,7 @@ static void aout_FiltersPipelineFlush(filter_t *const *filters, ...@@ -308,7 +308,7 @@ static void aout_FiltersPipelineFlush(filter_t *const *filters,
unsigned count) unsigned count)
{ {
for (unsigned i = 0; i < count; i++) for (unsigned i = 0; i < count; i++)
filter_FlushAudio (filters[i]); filter_Flush (filters[i]);
} }
......
...@@ -417,7 +417,7 @@ void filter_chain_VideoFlush( filter_chain_t *p_chain ) ...@@ -417,7 +417,7 @@ void filter_chain_VideoFlush( filter_chain_t *p_chain )
FilterDeletePictures( f->pending ); FilterDeletePictures( f->pending );
f->pending = NULL; f->pending = NULL;
filter_FlushPictures( p_filter ); filter_Flush( p_filter );
} }
} }
......
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