diff options
author | Veeresh Kadasani <external.vkadasani@jp.adit-jv.com> | 2019-06-04 14:58:58 +0900 |
---|---|---|
committer | Veeresh Kadasani <external.vkadasani@jp.adit-jv.com> | 2019-06-04 14:58:58 +0900 |
commit | d2c69136aab291aaf8351485cc7cac8927f97c8f (patch) | |
tree | 5de2134c2dc29af66c213d25e528cfc2b1840f41 | |
parent | a098f5940c841d583d2cf88ff6f25d679f45773d (diff) |
wth-receiver-gst.c:fix superfluous tab and alignement
Signed-off-by: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
-rw-r--r-- | waltham-receiver/src/wth-receiver-gst.c | 224 |
1 files changed, 112 insertions, 112 deletions
diff --git a/waltham-receiver/src/wth-receiver-gst.c b/waltham-receiver/src/wth-receiver-gst.c index def418d..4eff69b 100644 --- a/waltham-receiver/src/wth-receiver-gst.c +++ b/waltham-receiver/src/wth-receiver-gst.c @@ -387,45 +387,45 @@ gboolean bus_message(GstBus *bus, GstMessage *message, gpointer p) fprintf(stderr, "mesage: %s\n", GST_MESSAGE_TYPE_NAME(message)); switch( GST_MESSAGE_TYPE(message)) { - case GST_MESSAGE_ERROR: - { - GError *err; - gchar *debug; - - gst_message_parse_error(message, &err, &debug); - g_print("ERROR: %s\n", err->message); - - g_error_free(err); - g_free(debug); - g_main_loop_quit(gstctx->loop); - break; - } + case GST_MESSAGE_ERROR: + { + GError *err; + gchar *debug; - case GST_MESSAGE_STATE_CHANGED: - { - GstState oldstate, newstate; - - gst_message_parse_state_changed(message, &oldstate, &newstate, NULL); - fprintf(stderr, "#%s state changed\n", GST_MESSAGE_SRC_NAME(message)); - switch (newstate){ - case GST_STATE_NULL: - fprintf(stderr, "%s: state is NULL\n", GST_MESSAGE_SRC_NAME(message)); - break; - case GST_STATE_READY: - fprintf(stderr, "%s: state is READY\n", GST_MESSAGE_SRC_NAME(message)); - break; - case GST_STATE_PAUSED: - fprintf(stderr, "%s: state is PAUSED\n", GST_MESSAGE_SRC_NAME(message)); - break; - case GST_STATE_PLAYING: - fprintf(stderr, "%s: state is PLAYING\n", GST_MESSAGE_SRC_NAME(message)); - break; - } - break; - } - default: - fprintf(stderr, "Unhandled message\n"); + gst_message_parse_error(message, &err, &debug); + g_print("ERROR: %s\n", err->message); + + g_error_free(err); + g_free(debug); + g_main_loop_quit(gstctx->loop); + break; + } + + case GST_MESSAGE_STATE_CHANGED: + { + GstState oldstate, newstate; + + gst_message_parse_state_changed(message, &oldstate, &newstate, NULL); + fprintf(stderr, "#%s state changed\n", GST_MESSAGE_SRC_NAME(message)); + switch (newstate){ + case GST_STATE_NULL: + fprintf(stderr, "%s: state is NULL\n", GST_MESSAGE_SRC_NAME(message)); break; + case GST_STATE_READY: + fprintf(stderr, "%s: state is READY\n", GST_MESSAGE_SRC_NAME(message)); + break; + case GST_STATE_PAUSED: + fprintf(stderr, "%s: state is PAUSED\n", GST_MESSAGE_SRC_NAME(message)); + break; + case GST_STATE_PLAYING: + fprintf(stderr, "%s: state is PLAYING\n", GST_MESSAGE_SRC_NAME(message)); + break; + } + break; + } + default: + fprintf(stderr, "Unhandled message\n"); + break; } fprintf(stderr, "-----------------\n"); } @@ -434,49 +434,49 @@ EGLImageKHR create_eglImage(GstAppContext* gstctx) { struct display *display = gstctx->display; GstVideoMeta *vmeta=gst_buffer_get_video_meta(gstctx->sample_queue[gstctx->front].gstbuffer); - uint32_t n_planes; - EGLint attribs[30]; - int fourcc; - int atti = 0; - - fourcc = drm_fourcc_from_gst_format(vmeta->format); - - n_planes = GST_VIDEO_INFO_N_PLANES(&(gstctx->info)); - - attribs[atti++] = EGL_WIDTH; - attribs[atti++] = vmeta->width; - attribs[atti++] = EGL_HEIGHT; - attribs[atti++] = vmeta->height; - attribs[atti++] = EGL_LINUX_DRM_FOURCC_EXT; - attribs[atti++] = fourcc; - /* - * Offset value for both the planes i.e Y and UV is "0" - * The omxdec gives the output is 2 different memory blocks, - * One for Y -> dmafd[0] and other for UV -> dmafd[1] - */ - if (n_planes > 0) { - attribs[atti++] = EGL_DMA_BUF_PLANE0_FD_EXT; - attribs[atti++] = gstctx->sample_queue[gstctx->front].dma_fd[0]; - attribs[atti++] = EGL_DMA_BUF_PLANE0_OFFSET_EXT; - attribs[atti++] = 0; - attribs[atti++] = EGL_DMA_BUF_PLANE0_PITCH_EXT; - attribs[atti++] = vmeta->stride[0]; - } + uint32_t n_planes; + EGLint attribs[30]; + int fourcc; + int atti = 0; + + fourcc = drm_fourcc_from_gst_format(vmeta->format); + + n_planes = GST_VIDEO_INFO_N_PLANES(&(gstctx->info)); + + attribs[atti++] = EGL_WIDTH; + attribs[atti++] = vmeta->width; + attribs[atti++] = EGL_HEIGHT; + attribs[atti++] = vmeta->height; + attribs[atti++] = EGL_LINUX_DRM_FOURCC_EXT; + attribs[atti++] = fourcc; + /* + * Offset value for both the planes i.e Y and UV is "0" + * The omxdec gives the output is 2 different memory blocks, + * One for Y -> dmafd[0] and other for UV -> dmafd[1] + */ + if (n_planes > 0) { + attribs[atti++] = EGL_DMA_BUF_PLANE0_FD_EXT; + attribs[atti++] = gstctx->sample_queue[gstctx->front].dma_fd[0]; + attribs[atti++] = EGL_DMA_BUF_PLANE0_OFFSET_EXT; + attribs[atti++] = 0; + attribs[atti++] = EGL_DMA_BUF_PLANE0_PITCH_EXT; + attribs[atti++] = vmeta->stride[0]; + } - if (n_planes > 1) { - attribs[atti++] = EGL_DMA_BUF_PLANE1_FD_EXT; - attribs[atti++] = gstctx->sample_queue[gstctx->front].dma_fd[1];; - attribs[atti++] = EGL_DMA_BUF_PLANE1_OFFSET_EXT; - attribs[atti++] = 0; - attribs[atti++] = EGL_DMA_BUF_PLANE1_PITCH_EXT; - attribs[atti++] = vmeta->stride[1]; - } + if (n_planes > 1) { + attribs[atti++] = EGL_DMA_BUF_PLANE1_FD_EXT; + attribs[atti++] = gstctx->sample_queue[gstctx->front].dma_fd[1];; + attribs[atti++] = EGL_DMA_BUF_PLANE1_OFFSET_EXT; + attribs[atti++] = 0; + attribs[atti++] = EGL_DMA_BUF_PLANE1_PITCH_EXT; + attribs[atti++] = vmeta->stride[1]; + } - attribs[atti++] = EGL_NONE; + attribs[atti++] = EGL_NONE; - return display->egl.create_image(display->egl.dpy, EGL_NO_CONTEXT, - EGL_LINUX_DMA_BUF_EXT, (EGLClientBuffer)NULL, - attribs); + return display->egl.create_image(display->egl.dpy, EGL_NO_CONTEXT, + EGL_LINUX_DMA_BUF_EXT, (EGLClientBuffer)NULL, + attribs); } static int @@ -567,18 +567,18 @@ int sample_enqueue(GstElement *obj, GstAppContext *ctx){ int i; wth_verbose("%s >>> \n",__func__); sample = gst_app_sink_pull_sample((GstAppSink*)((void*)obj)); - if(sample == NULL) { - wth_error("No frame received\n"); - return -1; - } - else { - wth_verbose("Frame received\n"); - } + if(sample == NULL) { + wth_error("No frame received\n"); + return -1; + } + else { + wth_verbose("Frame received\n"); + } gstbuffer = gst_sample_get_buffer(sample); if(!gstbuffer){ - wth_error("Cannot get buffer from sample\n"); - } + wth_error("Cannot get buffer from sample\n"); + } n_mem = gst_buffer_n_memory(gstbuffer); if (n_mem < 1) { @@ -586,48 +586,48 @@ int sample_enqueue(GstElement *obj, GstAppContext *ctx){ } for (i = 0; i < n_mem; i++) { - /* get dmabuf fd from gstbuffer */ - mem = gst_buffer_peek_memory (gstbuffer, i); - if (!gst_is_dmabuf_memory(mem)) { - wth_verbose("Memory is not of dmabuf type \n"); - ctx->no_dma_buf = true; + /* get dmabuf fd from gstbuffer */ + mem = gst_buffer_peek_memory (gstbuffer, i); + if (!gst_is_dmabuf_memory(mem)) { + wth_verbose("Memory is not of dmabuf type \n"); + ctx->no_dma_buf = true; - if(is_sample_queue_full(ctx)){ - wth_error("\nQueue is full\n"); + if(is_sample_queue_full(ctx)){ + wth_error("\nQueue is full\n"); - } + } - else{ + else{ if(ctx->front==-1) ctx->front=0; ctx->rear=(ctx->rear+1)%MAX_SAMPLE; gst_buffer_ref(gstbuffer); ctx->sample_queue[ctx->rear].gstbuffer=gstbuffer; ctx->num_of_sample_in_queue++; - } - gst_sample_unref(sample); - return 0; } - ctx->sample_queue[ctx->rear].dma_fd[i] = gst_dmabuf_memory_get_fd(mem); + gst_sample_unref(sample); + return 0; } + ctx->sample_queue[ctx->rear].dma_fd[i] = gst_dmabuf_memory_get_fd(mem); + } - if (ctx->sample_queue[ctx->rear].dma_fd[0] < 0 || ctx->sample_queue[ctx->rear].dma_fd[1] < 0 ) { - wth_error("dma fd is null \n"); - return -1; - } - if(is_sample_queue_full(ctx)) - wth_error("\nQueue is full\n"); - else{ + if (ctx->sample_queue[ctx->rear].dma_fd[0] < 0 || ctx->sample_queue[ctx->rear].dma_fd[1] < 0 ) { + wth_error("dma fd is null \n"); + return -1; + } + if(is_sample_queue_full(ctx)) + wth_error("\nQueue is full\n"); + else{ if(ctx->front==-1) - ctx->front=0; + ctx->front=0; ctx->rear=(ctx->rear+1)%MAX_SAMPLE; gst_buffer_ref(gstbuffer); ctx->sample_queue[ctx->rear].gstbuffer=gstbuffer; ctx->num_of_sample_in_queue++; - } - gst_sample_unref(sample); - wth_verbose("<<< %s \n",__func__); - return 0; + } + gst_sample_unref(sample); + wth_verbose("<<< %s \n",__func__); + return 0; } static GstFlowReturn @@ -1037,7 +1037,7 @@ wth_receiver_weston_main(struct window *window) long lSize; size_t res; - memset(&gstctx, 0, sizeof(gstctx)); + memset(&gstctx, 0, sizeof(gstctx)); /* Initialization for window creation */ gstctx.display = create_display(); init_egl(gstctx.display); |