mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
libs: small refactors to enhance the code style
As gst-indent generated ugly code in these cases, this patch changes the used idiomatic into other one. No functional changes were introduced. Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
This commit is contained in:
parent
28d01c0857
commit
4b5be5973e
6 changed files with 25 additions and 22 deletions
|
@ -134,6 +134,7 @@ static gboolean
|
||||||
context_create_surfaces (GstVaapiContext * context)
|
context_create_surfaces (GstVaapiContext * context)
|
||||||
{
|
{
|
||||||
const GstVaapiContextInfo *const cip = &context->info;
|
const GstVaapiContextInfo *const cip = &context->info;
|
||||||
|
GstVaapiDisplay *const display = GST_VAAPI_OBJECT_DISPLAY (context);
|
||||||
guint num_surfaces;
|
guint num_surfaces;
|
||||||
|
|
||||||
if (!gst_vaapi_context_overlay_reset (context))
|
if (!gst_vaapi_context_overlay_reset (context))
|
||||||
|
@ -149,8 +150,8 @@ context_create_surfaces (GstVaapiContext * context)
|
||||||
|
|
||||||
if (!context->surfaces_pool) {
|
if (!context->surfaces_pool) {
|
||||||
context->surfaces_pool =
|
context->surfaces_pool =
|
||||||
gst_vaapi_surface_pool_new_with_chroma_type (GST_VAAPI_OBJECT_DISPLAY (context),
|
gst_vaapi_surface_pool_new_with_chroma_type (display, cip->chroma_type,
|
||||||
cip->chroma_type, cip->width, cip->height);
|
cip->width, cip->height);
|
||||||
|
|
||||||
if (!context->surfaces_pool)
|
if (!context->surfaces_pool)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -236,9 +236,8 @@ vaapi_fill_ref_frames (GstVaapiDecoderVp9 * decoder, GstVaapiPicture * picture,
|
||||||
frame_hdr->ref_frame_sign_bias[GST_VP9_REF_FRAME_ALTREF - 1];
|
frame_hdr->ref_frame_sign_bias[GST_VP9_REF_FRAME_ALTREF - 1];
|
||||||
}
|
}
|
||||||
for (i = 0; i < G_N_ELEMENTS (priv->ref_frames); i++) {
|
for (i = 0; i < G_N_ELEMENTS (priv->ref_frames); i++) {
|
||||||
pic_param->reference_frames[i] =
|
pic_param->reference_frames[i] = priv->ref_frames[i] ?
|
||||||
priv->ref_frames[i] ? priv->
|
priv->ref_frames[i]->surface_id : VA_INVALID_SURFACE;
|
||||||
ref_frames[i]->surface_id : VA_INVALID_SURFACE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -464,10 +464,10 @@ static GstVaapiTexture *
|
||||||
gst_vaapi_display_egl_create_texture (GstVaapiDisplay * display, GstVaapiID id,
|
gst_vaapi_display_egl_create_texture (GstVaapiDisplay * display, GstVaapiID id,
|
||||||
guint target, guint format, guint width, guint height)
|
guint target, guint format, guint width, guint height)
|
||||||
{
|
{
|
||||||
return id != GST_VAAPI_ID_INVALID ?
|
if (id != GST_VAAPI_ID_INVALID)
|
||||||
gst_vaapi_texture_egl_new_wrapped (display, id, target, format,
|
return gst_vaapi_texture_egl_new_wrapped (display, id, target, format,
|
||||||
width, height) :
|
width, height);
|
||||||
gst_vaapi_texture_egl_new (display, target, format, width, height);
|
return gst_vaapi_texture_egl_new (display, target, format, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -330,9 +330,9 @@ static GstVaapiWindow *
|
||||||
gst_vaapi_display_wayland_create_window (GstVaapiDisplay * display,
|
gst_vaapi_display_wayland_create_window (GstVaapiDisplay * display,
|
||||||
GstVaapiID id, guint width, guint height)
|
GstVaapiID id, guint width, guint height)
|
||||||
{
|
{
|
||||||
return id != GST_VAAPI_ID_INVALID ?
|
if (id != GST_VAAPI_ID_INVALID)
|
||||||
NULL :
|
return NULL;
|
||||||
gst_vaapi_window_wayland_new (display, width, height);
|
return gst_vaapi_window_wayland_new (display, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -880,17 +880,18 @@ static struct
|
||||||
static int
|
static int
|
||||||
find_frame_rate_code (const VAEncSequenceParameterBufferMPEG2 * seq_param)
|
find_frame_rate_code (const VAEncSequenceParameterBufferMPEG2 * seq_param)
|
||||||
{
|
{
|
||||||
unsigned int delta = -1;
|
unsigned int ndelta, delta = -1;
|
||||||
int code = 1, i;
|
int code = 1, i;
|
||||||
float frame_rate_value = seq_param->frame_rate *
|
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_d + 1) /
|
||||||
(seq_param->sequence_extension.bits.frame_rate_extension_n + 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;
|
code = frame_rate_tab[i].code;
|
||||||
delta = fabsf (1000 * frame_rate_tab[i].value - 1000 * frame_rate_value);
|
delta = ndelta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
|
|
|
@ -188,12 +188,13 @@ gboolean
|
||||||
gst_video_meta_map_vaapi_memory (GstVideoMeta * meta, guint plane,
|
gst_video_meta_map_vaapi_memory (GstVideoMeta * meta, guint plane,
|
||||||
GstMapInfo * info, gpointer * data, gint * stride, GstMapFlags flags)
|
GstMapInfo * info, gpointer * data, gint * stride, GstMapFlags flags)
|
||||||
{
|
{
|
||||||
|
GstAllocator *allocator;
|
||||||
GstVaapiVideoMemory *const mem =
|
GstVaapiVideoMemory *const mem =
|
||||||
GST_VAAPI_VIDEO_MEMORY_CAST (gst_buffer_peek_memory (meta->buffer, 0));
|
GST_VAAPI_VIDEO_MEMORY_CAST (gst_buffer_peek_memory (meta->buffer, 0));
|
||||||
|
|
||||||
g_return_val_if_fail (mem, FALSE);
|
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->meta, FALSE);
|
||||||
|
|
||||||
if (mem->map_type && mem->map_type != GST_VAAPI_VIDEO_MEMORY_MAP_TYPE_PLANAR)
|
if (mem->map_type && mem->map_type != GST_VAAPI_VIDEO_MEMORY_MAP_TYPE_PLANAR)
|
||||||
|
@ -264,12 +265,13 @@ gboolean
|
||||||
gst_video_meta_unmap_vaapi_memory (GstVideoMeta * meta, guint plane,
|
gst_video_meta_unmap_vaapi_memory (GstVideoMeta * meta, guint plane,
|
||||||
GstMapInfo * info)
|
GstMapInfo * info)
|
||||||
{
|
{
|
||||||
|
GstAllocator *allocator;
|
||||||
GstVaapiVideoMemory *const mem =
|
GstVaapiVideoMemory *const mem =
|
||||||
GST_VAAPI_VIDEO_MEMORY_CAST (gst_buffer_peek_memory (meta->buffer, 0));
|
GST_VAAPI_VIDEO_MEMORY_CAST (gst_buffer_peek_memory (meta->buffer, 0));
|
||||||
|
|
||||||
g_return_val_if_fail (mem, FALSE);
|
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->meta, FALSE);
|
||||||
g_return_val_if_fail (mem->surface, FALSE);
|
g_return_val_if_fail (mem->surface, FALSE);
|
||||||
g_return_val_if_fail (mem->image, FALSE);
|
g_return_val_if_fail (mem->image, FALSE);
|
||||||
|
|
Loading…
Reference in a new issue