27 #include <SDL_thread.h>
123 texture_rect->w = codecpar->
width;
126 texture_rect->h = codecpar->
height;
133 texture_rect->x = (sdl->
window_width - texture_rect->w) / 2;
134 texture_rect->y = (sdl->
window_height - texture_rect->h) / 2;
142 SDL_DestroyTexture(sdl->
texture);
150 SDL_DestroyWindow(sdl->
window);
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");
176 if (
s->nb_streams > 1
192 "Unsupported pixel format '%s'.\n",
198 flags = SDL_WINDOW_HIDDEN |
204 if (SDL_Init(SDL_INIT_VIDEO) != 0) {
214 av_log(sdl,
AV_LOG_ERROR,
"Couldn't create window and renderer: %s\n", SDL_GetError());
220 SDL_ShowWindow(sdl->
window);
251 if (SDL_PollEvent(&event)){
252 switch (event.type) {
254 switch (event.key.keysym.sym) {
266 case SDL_WINDOWEVENT:
267 switch(event.window.event){
268 case SDL_WINDOWEVENT_RESIZED:
269 case SDL_WINDOWEVENT_SIZE_CHANGED:
300 case SDL_PIXELFORMAT_IYUV:
301 case SDL_PIXELFORMAT_YUY2:
302 case SDL_PIXELFORMAT_UYVY:
304 data[0], linesize[0],
305 data[1], linesize[1],
306 data[2], linesize[2]);
308 case SDL_PIXELFORMAT_RGB332:
309 case SDL_PIXELFORMAT_RGB444:
310 case SDL_PIXELFORMAT_RGB555:
311 case SDL_PIXELFORMAT_BGR555:
312 case SDL_PIXELFORMAT_RGB565:
313 case SDL_PIXELFORMAT_BGR565:
314 case SDL_PIXELFORMAT_RGB24:
315 case SDL_PIXELFORMAT_BGR24:
316 case SDL_PIXELFORMAT_RGB888:
317 case SDL_PIXELFORMAT_RGBX8888:
318 case SDL_PIXELFORMAT_BGR888:
319 case SDL_PIXELFORMAT_BGRX8888:
320 case SDL_PIXELFORMAT_ARGB8888:
321 case SDL_PIXELFORMAT_RGBA8888:
322 case SDL_PIXELFORMAT_ABGR8888:
323 case SDL_PIXELFORMAT_BGRA8888:
337 #define OFFSET(x) offsetof(SDLContext,x)
static const char *const format[]
Main libavdevice API header.
#define flags(name, subs,...)
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
static const char * window_title
static void write_header(FFV1Context *f)
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
char * av_strdup(const char *s)
Duplicate a string.
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.
#define LIBAVUTIL_VERSION_INT
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
@ AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
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.
#define AV_PIX_FMT_0RGB32
#define AV_PIX_FMT_BGR555
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
@ AV_PIX_FMT_0BGR
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
@ AV_PIX_FMT_0RGB
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
#define AV_PIX_FMT_RGB32_1
#define AV_PIX_FMT_BGR32_1
#define AV_PIX_FMT_BGR565
#define AV_PIX_FMT_RGB565
#define AV_PIX_FMT_RGB444
#define AV_PIX_FMT_0BGR32
#define AV_PIX_FMT_RGB555
static const struct sdl_texture_format_entry sdl_texture_format_map[]
static const AVOption options[]
static int sdl2_write_packet(AVFormatContext *s, AVPacket *pkt)
static void compute_texture_rect(AVFormatContext *s)
AVOutputFormat ff_sdl2_muxer
static const AVClass sdl2_class
static int sdl2_write_header(AVFormatContext *s)
static int sdl2_write_trailer(AVFormatContext *s)
Describe the class of an AVClass context structure.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
This struct describes the properties of an encoded stream.
enum AVMediaType codec_type
General type of the encoded data.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
Rational number (pair of numerator and denominator).
AVCodecParameters * codecpar
Codec parameters associated with this stream.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
int window_height
size of the window
int window_y
position of the window
enum AVPixelFormat format
static int write_trailer(AVFormatContext *s1)