27 #include <SDL_thread.h>
121 texture_rect->w = codecpar->
width;
124 texture_rect->h = codecpar->
height;
131 texture_rect->x = (sdl->
window_width - texture_rect->w) / 2;
132 texture_rect->y = (sdl->
window_height - texture_rect->h) / 2;
140 SDL_DestroyTexture(sdl->
texture);
148 SDL_DestroyWindow(sdl->
window);
157 #define SDL_BASE_FLAGS (SDL_SWSURFACE|SDL_WINDOW_RESIZABLE)
170 if (SDL_WasInit(SDL_INIT_VIDEO)) {
172 "SDL video subsystem was already inited, you could have multiple SDL outputs. This may cause unknown behaviour.\n");
192 "Unsupported pixel format '%s'.\n",
203 if (SDL_Init(SDL_INIT_VIDEO) != 0) {
215 av_log(sdl,
AV_LOG_ERROR,
"Couldn't create window and renderer: %s\n", SDL_GetError());
250 if (SDL_PollEvent(&event)){
251 switch (event.type) {
253 switch (event.key.keysym.sym) {
265 case SDL_WINDOWEVENT:
266 switch(event.window.event){
267 case SDL_WINDOWEVENT_RESIZED:
268 case SDL_WINDOWEVENT_SIZE_CHANGED:
299 case SDL_PIXELFORMAT_IYUV:
300 case SDL_PIXELFORMAT_YUY2:
301 case SDL_PIXELFORMAT_UYVY:
303 data[0], linesize[0],
304 data[1], linesize[1],
305 data[2], linesize[2]);
307 case SDL_PIXELFORMAT_RGB332:
308 case SDL_PIXELFORMAT_RGB444:
309 case SDL_PIXELFORMAT_RGB555:
310 case SDL_PIXELFORMAT_BGR555:
311 case SDL_PIXELFORMAT_RGB565:
312 case SDL_PIXELFORMAT_BGR565:
313 case SDL_PIXELFORMAT_RGB24:
314 case SDL_PIXELFORMAT_BGR24:
315 case SDL_PIXELFORMAT_RGB888:
316 case SDL_PIXELFORMAT_RGBX8888:
317 case SDL_PIXELFORMAT_BGR888:
318 case SDL_PIXELFORMAT_BGRX8888:
319 case SDL_PIXELFORMAT_ARGB8888:
320 case SDL_PIXELFORMAT_RGBA8888:
321 case SDL_PIXELFORMAT_ABGR8888:
322 case SDL_PIXELFORMAT_BGRA8888:
323 ret = SDL_UpdateTexture(sdl->
texture,
NULL, data[0], linesize[0]);
336 #define OFFSET(x) offsetof(SDLContext,x)
364 .priv_class = &sdl2_class,
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
ptrdiff_t const GLvoid * data
#define AV_LOG_WARNING
Something somehow does not look correct.
#define LIBAVUTIL_VERSION_INT
packed RGB 8:8:8, 24bpp, RGBRGB...
static int sdl2_write_packet(AVFormatContext *s, AVPacket *pkt)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
static int sdl2_write_header(AVFormatContext *s)
int av_image_fill_arrays(uint8_t *dst_data[4], int dst_linesize[4], const uint8_t *src, enum AVPixelFormat pix_fmt, int width, int height, int align)
Setup the data pointers and linesizes based on the specified image parameters and the provided array...
static int sdl2_write_trailer(AVFormatContext *s)
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
#define AV_PIX_FMT_RGB444
This struct describes the properties of an encoded stream.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
AVStream ** streams
A list of all streams in the file.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
Main libavdevice API header.
static void compute_texture_rect(AVFormatContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_PIX_FMT_BGR32_1
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static const AVOption options[]
enum AVMediaType codec_type
General type of the encoded data.
#define AV_PIX_FMT_0BGR32
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
enum AVPixelFormat format
char filename[1024]
input or output filename
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
static int write_trailer(AVFormatContext *s1)
int window_height
size of the window
packed RGB 8:8:8, 24bpp, BGRBGR...
static const AVClass sdl2_class
AVOutputFormat ff_sdl2_muxer
#define AV_PIX_FMT_BGR555
char * av_strdup(const char *s)
Duplicate a string.
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
static const char * window_title
static const char * format
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
offset must point to two consecutive integers
#define AV_PIX_FMT_BGR565
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
#define AV_PIX_FMT_RGB555
#define AV_PIX_FMT_RGB32_1
void * priv_data
Format private data.
static void write_header(FFV1Context *f)
#define AV_PIX_FMT_RGB565
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
static const struct sdl_texture_format_entry sdl_texture_format_map[]
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
AVCodecParameters * codecpar
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
AVPixelFormat
Pixel format.
This structure stores compressed data.
#define AV_PIX_FMT_0RGB32