if (!filter->upload) {
filter->upload = gst_gl_upload_new (filter->display);
- gst_gl_upload_init_format (filter->upload,
- GST_VIDEO_FRAME_FORMAT (&in_frame),
- GST_VIDEO_FRAME_WIDTH (&in_frame),
- GST_VIDEO_FRAME_HEIGHT (&in_frame),
- GST_VIDEO_FRAME_WIDTH (&out_frame),
- GST_VIDEO_FRAME_HEIGHT (&out_frame));
+ if (!gst_gl_upload_init_format (filter->upload,
+ GST_VIDEO_FRAME_FORMAT (&in_frame),
+ GST_VIDEO_FRAME_WIDTH (&in_frame),
+ GST_VIDEO_FRAME_HEIGHT (&in_frame),
+ GST_VIDEO_FRAME_WIDTH (&out_frame),
+ GST_VIDEO_FRAME_HEIGHT (&out_frame))) {
+ GST_ELEMENT_ERROR (filter, RESOURCE, NOT_FOUND,
+ ("%s", "Failed to init upload format"), (NULL));
+ return FALSE;
+ }
}
in_tex = filter->in_tex_id;
if (!filter->download) {
filter->download = gst_gl_download_new (filter->display);
- gst_gl_download_init_format (filter->download,
- GST_VIDEO_FRAME_FORMAT (&out_frame),
- GST_VIDEO_FRAME_WIDTH (&out_frame),
- GST_VIDEO_FRAME_HEIGHT (&out_frame));
+ if (!gst_gl_download_init_format (filter->download,
+ GST_VIDEO_FRAME_FORMAT (&out_frame),
+ GST_VIDEO_FRAME_WIDTH (&out_frame),
+ GST_VIDEO_FRAME_HEIGHT (&out_frame))) {
+ GST_ELEMENT_ERROR (filter, RESOURCE, NOT_FOUND,
+ ("%s", "Failed to init download format"), (NULL));
+ return FALSE;
+ }
}
in_tex = *(guint *) in_frame.data[0];
if (!filter->upload) {
filter->upload = gst_gl_upload_new (filter->display);
- gst_gl_upload_init_format (filter->upload,
- GST_VIDEO_FRAME_FORMAT (&in_frame),
- GST_VIDEO_FRAME_WIDTH (&in_frame),
- GST_VIDEO_FRAME_HEIGHT (&in_frame),
- GST_VIDEO_FRAME_WIDTH (&out_frame),
- GST_VIDEO_FRAME_HEIGHT (&out_frame));
+ if (!gst_gl_upload_init_format (filter->upload,
+ GST_VIDEO_FRAME_FORMAT (&in_frame),
+ GST_VIDEO_FRAME_WIDTH (&in_frame),
+ GST_VIDEO_FRAME_HEIGHT (&in_frame),
+ GST_VIDEO_FRAME_WIDTH (&out_frame),
+ GST_VIDEO_FRAME_HEIGHT (&out_frame))) {
+ GST_ELEMENT_ERROR (filter, RESOURCE, NOT_FOUND,
+ ("%s", "Failed to init upload format"), (NULL));
+ return FALSE;
+ }
}
if (!filter->download) {
filter->download = gst_gl_download_new (filter->display);
- gst_gl_download_init_format (filter->download,
- GST_VIDEO_FRAME_FORMAT (&out_frame),
- GST_VIDEO_FRAME_WIDTH (&out_frame),
- GST_VIDEO_FRAME_HEIGHT (&out_frame));
+ if (!gst_gl_download_init_format (filter->download,
+ GST_VIDEO_FRAME_FORMAT (&out_frame),
+ GST_VIDEO_FRAME_WIDTH (&out_frame),
+ GST_VIDEO_FRAME_HEIGHT (&out_frame))) {
+ GST_ELEMENT_ERROR (filter, RESOURCE, NOT_FOUND,
+ ("%s", "Failed to init download format"), (NULL));
+ return FALSE;
+ }
}
- gst_gl_upload_perform_with_data (filter->upload, filter->in_tex_id,
- in_frame.data);
-
out_tex = filter->out_tex_id;
in_tex = filter->in_tex_id;
}
if (in_gl_wrapped) {
- gst_gl_upload_perform_with_data (filter->upload, in_tex, in_frame.data);
+ if (!gst_gl_upload_perform_with_data (filter->upload, in_tex,
+ in_frame.data)) {
+ GST_ELEMENT_ERROR (filter, RESOURCE, NOT_FOUND, ("%s",
+ "Failed to upload video frame"), (NULL));
+ return FALSE;
+ }
}
GST_DEBUG ("calling filter_texture with textures in:%i out:%i", in_tex,
ret = filter_class->filter_texture (filter, in_tex, out_tex);
if (out_gl_wrapped) {
- gst_gl_download_perform_with_data (filter->download, out_tex,
- out_frame.data);
+ if (!gst_gl_download_perform_with_data (filter->download, out_tex,
+ out_frame.data)) {
+ GST_ELEMENT_ERROR (filter, RESOURCE, NOT_FOUND,
+ ("%s", "Failed to download video frame"), (NULL));
+ return FALSE;
+ }
}
gst_video_frame_unmap (&in_frame);
if (GST_GL_MEMORY_FLAG_IS_SET (gl_mem, GST_GL_MEMORY_FLAG_NEED_UPLOAD)) {
if (!GST_GL_MEMORY_FLAG_IS_SET (gl_mem,
GST_GL_MEMORY_FLAG_UPLOAD_INITTED)) {
- gst_gl_upload_init_format (gl_mem->upload, gl_mem->v_format,
- gl_mem->width, gl_mem->height, gl_mem->width, gl_mem->height);
+ if (!gst_gl_upload_init_format (gl_mem->upload, gl_mem->v_format,
+ gl_mem->width, gl_mem->height, gl_mem->width,
+ gl_mem->height)) {
+ goto error;
+ }
GST_GL_MEMORY_FLAG_SET (gl_mem, GST_GL_MEMORY_FLAG_UPLOAD_INITTED);
}
- gst_gl_upload_perform_with_memory (gl_mem->upload, gl_mem);
+ if (!gst_gl_upload_perform_with_memory (gl_mem->upload, gl_mem)) {
+ goto error;
+ }
}
} else {
GST_CAT_TRACE (GST_CAT_GL_MEMORY, "mapping GL texture:%u for writing",
if (GST_GL_MEMORY_FLAG_IS_SET (gl_mem, GST_GL_MEMORY_FLAG_NEED_DOWNLOAD)) {
if (!GST_GL_MEMORY_FLAG_IS_SET (gl_mem,
GST_GL_MEMORY_FLAG_DOWNLOAD_INITTED)) {
- gst_gl_download_init_format (gl_mem->download, gl_mem->v_format,
- gl_mem->width, gl_mem->height);
+ if (!gst_gl_download_init_format (gl_mem->download, gl_mem->v_format,
+ gl_mem->width, gl_mem->height)) {
+ goto error;
+ }
GST_GL_MEMORY_FLAG_SET (gl_mem, GST_GL_MEMORY_FLAG_DOWNLOAD_INITTED);
}
- gst_gl_download_perform_with_memory (gl_mem->download, gl_mem);
+ if (!gst_gl_download_perform_with_memory (gl_mem->download, gl_mem)) {
+ goto error;
+ }
}
} else {
GST_CAT_TRACE (GST_CAT_GL_MEMORY,
gl_mem->map_flags = flags;
return data;
+
+error:
+ {
+ return NULL;
+ }
}
void
if (!mix->download) {
mix->download = gst_gl_download_new (mix->display);
- gst_gl_download_init_format (mix->download,
- GST_VIDEO_FRAME_FORMAT (&out_frame),
- GST_VIDEO_FRAME_WIDTH (&out_frame),
- GST_VIDEO_FRAME_HEIGHT (&out_frame));
+ if (!gst_gl_download_init_format (mix->download,
+ GST_VIDEO_FRAME_FORMAT (&out_frame),
+ GST_VIDEO_FRAME_WIDTH (&out_frame),
+ GST_VIDEO_FRAME_HEIGHT (&out_frame))) {
+ GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND,
+ ("%s", "Failed to init upload format"), (NULL));
+ return FALSE;
+ }
}
out_gl_wrapped = TRUE;
if (!pad->upload) {
pad->upload = gst_gl_upload_new (mix->display);
- gst_gl_upload_init_format (pad->upload, in_format,
- in_width, in_height, in_width, in_height);
+ if (!gst_gl_upload_init_format (pad->upload, in_format,
+ in_width, in_height, in_width, in_height)) {
+ GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND,
+ ("%s", "Failed to init upload format"), (NULL));
+ return FALSE;
+ }
if (!pad->in_tex_id)
gst_gl_display_gen_texture (mix->display, &pad->in_tex_id,
GST_VIDEO_FORMAT_RGBA, out_width, out_height);
}
- gst_gl_upload_perform_with_data (pad->upload, pad->in_tex_id,
- in_frame->data);
+ if (!gst_gl_upload_perform_with_data (pad->upload, pad->in_tex_id,
+ in_frame->data)) {
+ GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND,
+ ("%s", "Failed to upload video frame"), (NULL));
+ return FALSE;
+ }
in_tex = pad->in_tex_id;
pad->mapped = TRUE;
out_tex);
if (out_gl_wrapped) {
- gst_gl_download_perform_with_data (mix->download, out_tex, out_frame.data);
+ if (gst_gl_download_perform_with_data (mix->download, out_tex,
+ out_frame.data)) {
+ GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND, ("%s",
+ "Failed to download video frame"), (NULL));
+ return FALSE;
+ }
}
i = 0;