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:
Víctor Manuel Jáquez Leal 2016-02-03 11:04:15 +01:00
parent 28d01c0857
commit 4b5be5973e
6 changed files with 25 additions and 22 deletions

View file

@ -134,6 +134,7 @@ static gboolean
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))
@ -149,8 +150,8 @@ context_create_surfaces (GstVaapiContext * 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;

View file

@ -236,9 +236,8 @@ vaapi_fill_ref_frames (GstVaapiDecoderVp9 * decoder, GstVaapiPicture * picture,
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;
}
}

View file

@ -464,10 +464,10 @@ static GstVaapiTexture *
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

View file

@ -330,9 +330,9 @@ static GstVaapiWindow *
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

View file

@ -880,17 +880,18 @@ static struct
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;

View file

@ -188,12 +188,13 @@ gboolean
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)
@ -264,12 +265,13 @@ gboolean
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);