Skip to content

Commit

Permalink
small error logging fixes in sink.c
Browse files Browse the repository at this point in the history
  • Loading branch information
mat-hek committed May 10, 2019
1 parent 8a6d0e5 commit 68e84fc
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions c_src/membrane_element_sdl/sink.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
#include "sink.h"

int create(int width, int height, State *state) {
char *err_reason = NULL;
SDL_Window *window = NULL;
SDL_Renderer *renderer = NULL;
SDL_Texture *texture = NULL;

if (SDL_Init(SDL_INIT_VIDEO) < 0) {
err_reason = "init_sdl";
fprintf(stderr, "Error initializing SDL\r\n");
goto exit_create;
}

Expand All @@ -23,23 +22,20 @@ int create(int width, int height, State *state) {
SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);

if (!window) {
fprintf(stderr, "Error creating window: %s", SDL_GetError());
err_reason = "create_window";
fprintf(stderr, "Error creating window: %s\r\n", SDL_GetError());
goto exit_create;
}

renderer = SDL_CreateRenderer(window, -1, 0);
if (!renderer) {
fprintf(stderr, "Error creating renderer: %s", SDL_GetError());
err_reason = "create_renderer";
fprintf(stderr, "Error creating renderer: %s\r\n", SDL_GetError());
goto exit_create;
}

texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_IYUV,
SDL_TEXTUREACCESS_STREAMING, width, height);
if (!texture) {
fprintf(stderr, "Error creating texture: %s", SDL_GetError());
err_reason = "create_texture";
fprintf(stderr, "Error creating texture: %s\r\n", SDL_GetError());
goto exit_create;
}

Expand Down

0 comments on commit 68e84fc

Please sign in to comment.