#include <stdio.h>
extern "C"
{
#include "sdl/SDL.h";
#include "sdl/SDL_thread.h";
};
int screen_w = 500, screen_h = 500;
const int pixel_w = 320, pixel_h = 180;
const int bpp = 12;
unsigned char buffer[pixel_w*pixel_h*bpp/8];
// refresh event
#define REFRESH_EVENT (SDL_USEREVENT+1)
int thread_exit = 0;
int refresh_video(void *opaque)
{
while (thread_exit==0)
{
SDL_Event event;
event.type = REFRESH_EVENT;
SDL_PushEvent(&event);
SDL_Delay(40);
}
return 0;
}
int main()
{
if(SDL_Init(SDL_INIT_VIDEO))
{
printf( "Could not initialize SDL - %s\n", SDL_GetError());
return -1;
}
//create window
SDL_Window *screen;
screen = SDL_CreateWindow("Video player by SDL2", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
screen_w, screen_h, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
if (!screen)
{