context_create_surfaces (GstVaapiContext * context)
{
const GstVaapiContextInfo *const cip = &context->info;
+ GstVaapiDisplay *const display = GST_VAAPI_OBJECT_DISPLAY (context);
guint num_surfaces;
if (!gst_vaapi_context_overlay_reset (context))
if (!context->surfaces_pool) {
context->surfaces_pool =
- gst_vaapi_surface_pool_new_with_chroma_type (GST_VAAPI_OBJECT_DISPLAY (context),
- cip->chroma_type, cip->width, cip->height);
+ gst_vaapi_surface_pool_new_with_chroma_type (display, cip->chroma_type,
+ cip->width, cip->height);
if (!context->surfaces_pool)
return FALSE;
frame_hdr->ref_frame_sign_bias[GST_VP9_REF_FRAME_ALTREF - 1];
}
for (i = 0; i < G_N_ELEMENTS (priv->ref_frames); i++) {
- pic_param->reference_frames[i] =
- priv->ref_frames[i] ? priv->
- ref_frames[i]->surface_id : VA_INVALID_SURFACE;
+ pic_param->reference_frames[i] = priv->ref_frames[i] ?
+ priv->ref_frames[i]->surface_id : VA_INVALID_SURFACE;
}
}
gst_vaapi_display_egl_create_texture (GstVaapiDisplay * display, GstVaapiID id,
guint target, guint format, guint width, guint height)
{
- return id != GST_VAAPI_ID_INVALID ?
- gst_vaapi_texture_egl_new_wrapped (display, id, target, format,
- width, height) :
- gst_vaapi_texture_egl_new (display, target, format, width, height);
+ if (id != GST_VAAPI_ID_INVALID)
+ return gst_vaapi_texture_egl_new_wrapped (display, id, target, format,
+ width, height);
+ return gst_vaapi_texture_egl_new (display, target, format, width, height);
}
static void
gst_vaapi_display_wayland_create_window (GstVaapiDisplay * display,
GstVaapiID id, guint width, guint height)
{
- return id != GST_VAAPI_ID_INVALID ?
- NULL :
- gst_vaapi_window_wayland_new (display, width, height);
+ if (id != GST_VAAPI_ID_INVALID)
+ return NULL;
+ return gst_vaapi_window_wayland_new (display, width, height);
}
static void
static int
find_frame_rate_code (const VAEncSequenceParameterBufferMPEG2 * seq_param)
{
- unsigned int delta = -1;
+ unsigned int ndelta, delta = -1;
int code = 1, i;
float frame_rate_value = seq_param->frame_rate *
(seq_param->sequence_extension.bits.frame_rate_extension_d + 1) /
(seq_param->sequence_extension.bits.frame_rate_extension_n + 1);
- for (i = 0; i < sizeof (frame_rate_tab) / sizeof (frame_rate_tab[0]); i++) {
+ for (i = 0; i < G_N_ELEMENTS (frame_rate_tab); i++) {
- if (fabsf (1000 * frame_rate_tab[i].value - 1000 * frame_rate_value) < delta) {
+ ndelta = fabsf (1000 * frame_rate_tab[i].value - 1000 * frame_rate_value);
+ if (ndelta < delta) {
code = frame_rate_tab[i].code;
- delta = fabsf (1000 * frame_rate_tab[i].value - 1000 * frame_rate_value);
+ delta = ndelta;
}
}
return code;
gst_video_meta_map_vaapi_memory (GstVideoMeta * meta, guint plane,
GstMapInfo * info, gpointer * data, gint * stride, GstMapFlags flags)
{
+ GstAllocator *allocator;
GstVaapiVideoMemory *const mem =
GST_VAAPI_VIDEO_MEMORY_CAST (gst_buffer_peek_memory (meta->buffer, 0));
-
g_return_val_if_fail (mem, FALSE);
- g_return_val_if_fail (GST_VAAPI_IS_VIDEO_ALLOCATOR (mem->parent_instance.
- allocator), FALSE);
+
+ allocator = GST_MEMORY_CAST (mem)->allocator;
+ g_return_val_if_fail (GST_VAAPI_IS_VIDEO_ALLOCATOR (allocator), FALSE);
g_return_val_if_fail (mem->meta, FALSE);
if (mem->map_type && mem->map_type != GST_VAAPI_VIDEO_MEMORY_MAP_TYPE_PLANAR)
gst_video_meta_unmap_vaapi_memory (GstVideoMeta * meta, guint plane,
GstMapInfo * info)
{
+ GstAllocator *allocator;
GstVaapiVideoMemory *const mem =
GST_VAAPI_VIDEO_MEMORY_CAST (gst_buffer_peek_memory (meta->buffer, 0));
-
g_return_val_if_fail (mem, FALSE);
- g_return_val_if_fail (GST_VAAPI_IS_VIDEO_ALLOCATOR (mem->parent_instance.
- allocator), FALSE);
+
+ allocator = GST_MEMORY_CAST (mem)->allocator;
+ g_return_val_if_fail (GST_VAAPI_IS_VIDEO_ALLOCATOR (allocator), FALSE);
g_return_val_if_fail (mem->meta, FALSE);
g_return_val_if_fail (mem->surface, FALSE);
g_return_val_if_fail (mem->image, FALSE);