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");
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:
324 ret = SDL_UpdateTexture(sdl->
texture,
NULL, data[0], linesize[0]);
337 #define OFFSET(x) offsetof(SDLContext,x)
368 .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)
static const char * format[]
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...
const char * av_default_item_name(void *ptr)
Return the context name.
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. ...
char * url
input or output URL.
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
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.
int window_y
position of the window
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
static const char * window_title
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
#define flags(name, subs,...)
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
Codec parameters associated with this stream.
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