主要代码如下:
#include<stdio.h>
#include "libavutil/avutil.h"
#include "libavutil/timestamp.h"
#include "libavdevice/avdevice.h"
#include "libavformat/avformat.h"
#include "libavcodec/avcodec.h"
#include "libswscale/swscale.h"
#include "ff.h"
#include "SDL2/SDL.h"
void sdl(void) {
int quit=1;
SDL_Event event;
SDL_Window *window=NULL;
SDL_Renderer *render=NULL;
SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO);
window=SDL_CreateWindow("SDL2 Window",200,200,640,480,SDL_WINDOW_SHOWN);
if(!window){
printf("Faild to Create window!");
goto __EXIT;
}
render= SDL_CreateRenderer(window,-1,0);
if(!render){
SDL_Log("Faild to create render!");
goto __DWINDOW;
}
SDL_SetRenderDrawColor(render,255,0,0,255);
SDL_RenderClear(render);
SDL_RenderPresent(render);
//SDL_Delay(3000);
do{
SDL_WaitEvent(&event);
switch(event.type){
case SDL_QUIT:
quit=0;
break;
default:
SDL_Log("event type is %d\n",event.type);
}
}while(quit);
__DWINDOW:
SDL_DestroyWindow(window);
__EXIT:
SDL_Quit();
return ;
}