/** * gst_vaapi_image_new_with_image: * @display: a #GstVaapiDisplay * @va_image: a VA image * * Creates a new #GstVaapiImage from a foreign VA image. The image * format and dimensions will be extracted from @va_image. This * function is mainly used by gst_vaapi_surface_derive_image() to bind * a VA image to a #GstVaapiImage object. * * Return value: the newly allocated #GstVaapiImage object */ GstVaapiImage * gst_vaapi_image_new_with_image(GstVaapiDisplay *display, VAImage *va_image) { GstVaapiImage *image; g_return_val_if_fail(GST_VAAPI_IS_DISPLAY(display), NULL); g_return_val_if_fail(va_image, NULL); g_return_val_if_fail(va_image->image_id != VA_INVALID_ID, NULL); g_return_val_if_fail(va_image->buf != VA_INVALID_ID, NULL); GST_DEBUG("VA image 0x%08x, format %" GST_FOURCC_FORMAT ", size %ux%u", va_image->image_id, GST_FOURCC_ARGS(va_image->format.fourcc), va_image->width, va_image->height); image = g_object_new( GST_VAAPI_TYPE_IMAGE, "display", display, "id", GST_VAAPI_ID(va_image->image_id), "image", va_image, NULL ); if (!image) return NULL; if (!image->priv->is_constructed) { g_object_unref(image); return NULL; } return image; }
/** * gst_vaapi_image_new: * @display: a #GstVaapiDisplay * @format: a #GstVaapiImageFormat * @width: the requested image width * @height: the requested image height * * Creates a new #GstVaapiImage with the specified format and * dimensions. * * Return value: the newly allocated #GstVaapiImage object */ GstVaapiImage * gst_vaapi_image_new( GstVaapiDisplay *display, GstVaapiImageFormat format, guint width, guint height ) { GstVaapiImage *image; g_return_val_if_fail(GST_VAAPI_IS_DISPLAY(display), NULL); g_return_val_if_fail(width > 0, NULL); g_return_val_if_fail(height > 0, NULL); GST_DEBUG("format %" GST_FOURCC_FORMAT ", size %ux%u", GST_FOURCC_ARGS(format), width, height); image = g_object_new( GST_VAAPI_TYPE_IMAGE, "display", display, "id", GST_VAAPI_ID(VA_INVALID_ID), "format", format, "width", width, "height", height, NULL ); if (!image) return NULL; if (!image->priv->is_constructed) { g_object_unref(image); return NULL; } return image; }
/** AVCodecContext.release_buffer() implementation */ static void gst_vaapi_decoder_ffmpeg_release_buffer(AVCodecContext *avctx, AVFrame *pic) { GstVaapiID surface_id = GST_VAAPI_ID(GPOINTER_TO_UINT(pic->data[3])); GST_DEBUG("surface %" GST_VAAPI_ID_FORMAT, GST_VAAPI_ID_ARGS(surface_id)); pic->data[0] = NULL; pic->data[1] = NULL; pic->data[2] = NULL; pic->data[3] = NULL; }
/** * gst_vaapi_surface_new: * @display: a #GstVaapiDisplay * @chroma_type: the surface chroma format * @width: the requested surface width * @height: the requested surface height * * Creates a new #GstVaapiSurface with the specified chroma format and * dimensions. * * Return value: the newly allocated #GstVaapiSurface object */ GstVaapiSurface * gst_vaapi_surface_new( GstVaapiDisplay *display, GstVaapiChromaType chroma_type, guint width, guint height ) { GST_DEBUG("size %ux%u, chroma type 0x%x", width, height, chroma_type); return g_object_new(GST_VAAPI_TYPE_SURFACE, "display", display, "id", GST_VAAPI_ID(VA_INVALID_ID), "width", width, "height", height, "chroma-type", chroma_type, NULL); }
/** * gst_vaapi_window_wayland_new: * @display: a #GstVaapiDisplay * @width: the requested window width, in pixels * @height: the requested windo height, in pixels * * Creates a window with the specified @width and @height. The window * will be attached to the @display and remains invisible to the user * until gst_vaapi_window_show() is called. * * Return value: the newly allocated #GstVaapiWindow object */ GstVaapiWindow * gst_vaapi_window_wayland_new( GstVaapiDisplay *display, guint width, guint height ) { GST_DEBUG("new window, size %ux%u", width, height); g_return_val_if_fail(GST_VAAPI_IS_DISPLAY(display), NULL); g_return_val_if_fail(width > 0, NULL); g_return_val_if_fail(height > 0, NULL); return g_object_new(GST_VAAPI_TYPE_WINDOW_WAYLAND, "display", display, "id", GST_VAAPI_ID(0), "width", width, "height", height, NULL); }