[vlc-devel] [PATCH 12/15] filters: add an function to create new output pictures with forced callbacks
Steve Lhomme
robux4 at ycbcr.xyz
Fri Jul 19 15:32:16 CEST 2019
This was the filter chain can provide its own callbacks as if it was the regular
callbacks and the same code path is always used.
---
include/vlc_filter.h | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index 849ba67851..0455215e0e 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -157,20 +157,35 @@ struct filter_t
* Provided for convenience.
*
* \param p_filter filter_t object
+ * \param callbacks forced allocation callbacks, may differ from the filter one
* \return new picture on success or NULL on failure
*/
-static inline picture_t *filter_NewPicture( filter_t *p_filter )
+static inline picture_t *filter_NewOwnerPicture( filter_t *p_filter, filter_owner_t *callbacks )
{
picture_t *pic;
- if ( p_filter->owner.video == NULL || p_filter->owner.video->buffer_new == NULL)
- pic = picture_NewFromFormat( &p_filter->fmt_out.video );
+ if ( callbacks != NULL && callbacks->video != NULL && callbacks->video->buffer_new != NULL)
+ pic = callbacks->video->buffer_new( p_filter, callbacks->sys );
else
- pic = p_filter->owner.video->buffer_new( p_filter, p_filter->owner.sys );
+ pic = picture_NewFromFormat( &p_filter->fmt_out.video );
if( pic == NULL )
msg_Warn( p_filter, "can't get output picture" );
return pic;
}
+/**
+ * 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.
+ * Provided for convenience.
+ *
+ * \param p_filter filter_t object
+ * \return new picture on success or NULL on failure
+ */
+static inline picture_t *filter_NewPicture( filter_t *p_filter )
+{
+ return filter_NewOwnerPicture( p_filter, &p_filter->owner );
+}
+
/**
* Flush a filter
*
--
2.17.1
More information about the vlc-devel
mailing list