static gboolean
gst_vaapi_blend_process_unlocked (GstVaapiBlend * blend,
- GstVaapiSurface * output, GstVaapiBlendSurfaceGenerator * generator)
+ GstVaapiSurface * output, GstVaapiBlendSurfaceNextFunc next,
+ gpointer user_data)
{
VAStatus va_status;
VADisplay va_display;
if (!vaapi_check_status (va_status, "vaBeginPicture()"))
return FALSE;
- current = generator->next (generator);
- for (; current; current = generator->next (generator)) {
+ current = next (user_data);
+ for (; current; current = next (user_data)) {
VAProcPipelineParameterBuffer *param = NULL;
VABufferID id = VA_INVALID_ID;
VARectangle src_rect = { 0, };
gboolean
gst_vaapi_blend_process (GstVaapiBlend * blend, GstVaapiSurface * output,
- GstVaapiBlendSurfaceGenerator * generator)
+ GstVaapiBlendSurfaceNextFunc next, gpointer user_data)
{
gboolean result;
g_return_val_if_fail (blend != NULL, FALSE);
g_return_val_if_fail (output != NULL, FALSE);
- g_return_val_if_fail (generator != NULL, FALSE);
- g_return_val_if_fail (generator->next != NULL, FALSE);
+ g_return_val_if_fail (next != NULL, FALSE);
GST_VAAPI_DISPLAY_LOCK (blend->display);
- result = gst_vaapi_blend_process_unlocked (blend, output, generator);
+ result = gst_vaapi_blend_process_unlocked (blend, output, next, user_data);
GST_VAAPI_DISPLAY_UNLOCK (blend->display);
return result;
typedef struct _GstVaapiBlend GstVaapiBlend;
typedef struct _GstVaapiBlendSurface GstVaapiBlendSurface;
-typedef struct _GstVaapiBlendSurfaceGenerator GstVaapiBlendSurfaceGenerator;
struct _GstVaapiBlendSurface
{
gdouble alpha;
};
-struct _GstVaapiBlendSurfaceGenerator
-{
- GstVaapiBlendSurface* (*next)();
-};
+typedef GstVaapiBlendSurface* (*GstVaapiBlendSurfaceNextFunc)(gpointer data);
GstVaapiBlend *
gst_vaapi_blend_new (GstVaapiDisplay * display);
gboolean
gst_vaapi_blend_process (GstVaapiBlend * blend, GstVaapiSurface * output,
- GstVaapiBlendSurfaceGenerator * generator);
+ GstVaapiBlendSurfaceNextFunc next, gpointer user_data);
GType
gst_vaapi_blend_get_type (void) G_GNUC_CONST;
typedef struct _GstVaapiOverlaySurfaceGenerator GstVaapiOverlaySurfaceGenerator;
struct _GstVaapiOverlaySurfaceGenerator
{
- GstVaapiBlendSurfaceGenerator parent;
GstVaapiOverlay *overlay;
GList *current;
GstVaapiBlendSurface blend_surface;
}
static GstVaapiBlendSurface *
-gst_vaapi_overlay_surface_next (GstVaapiBlendSurfaceGenerator * generator)
+gst_vaapi_overlay_surface_next (gpointer data)
{
- GstVaapiOverlaySurfaceGenerator *ogenerator;
+ GstVaapiOverlaySurfaceGenerator *generator;
GstVideoAggregatorPad *vagg_pad;
GstVaapiOverlaySinkPad *pad;
GstVideoFrame *inframe;
GstVaapiVideoMeta *inbuf_meta;
GstVaapiBlendSurface *blend_surface;
- ogenerator = (GstVaapiOverlaySurfaceGenerator *) generator;
+ generator = (GstVaapiOverlaySurfaceGenerator *) data;
/* at the end of the generator? */
- if (!ogenerator->current)
+ if (!generator->current)
return NULL;
/* get the current video aggregator sinkpad */
- vagg_pad = GST_VIDEO_AGGREGATOR_PAD (ogenerator->current->data);
+ vagg_pad = GST_VIDEO_AGGREGATOR_PAD (generator->current->data);
/* increment list pointer */
- ogenerator->current = ogenerator->current->next;
+ generator->current = generator->current->next;
/* recycle the blend surface from the overlay surface generator */
- blend_surface = &ogenerator->blend_surface;
+ blend_surface = &generator->blend_surface;
blend_surface->surface = NULL;
inframe = gst_video_aggregator_pad_get_prepared_frame (vagg_pad);
pad = GST_VAAPI_OVERLAY_SINK_PAD (vagg_pad);
if (gst_vaapi_plugin_base_pad_get_input_buffer (GST_VAAPI_PLUGIN_BASE
- (ogenerator->overlay), GST_PAD (pad), buf, &inbuf) != GST_FLOW_OK)
+ (generator->overlay), GST_PAD (pad), buf, &inbuf) != GST_FLOW_OK)
return blend_surface;
/* Current sinkpad may have reached EOS */
if (!inframe || !inbuf)
- return generator->next (generator);
+ return gst_vaapi_overlay_surface_next (generator);
inbuf_meta = gst_buffer_get_vaapi_video_meta (inbuf);
outbuf_surface = gst_vaapi_video_meta_get_surface (outbuf_meta);
/* initialize the surface generator */
- generator.parent.next = gst_vaapi_overlay_surface_next;
generator.overlay = overlay;
generator.current = GST_ELEMENT (overlay)->sinkpads;
if (!gst_vaapi_blend_process (overlay->blend, outbuf_surface,
- (GstVaapiBlendSurfaceGenerator *) & generator))
+ gst_vaapi_overlay_surface_next, &generator))
return GST_FLOW_ERROR;
return GST_FLOW_OK;