Go to the documentation of this file.
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)
#define AV_LOG_WARNING
Something somehow does not look correct.
AVPixelFormat
Pixel format.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
enum AVMediaType codec_type
General type of the encoded data.
int window_height
size of the window
This struct describes the properties of an encoded stream.
static const struct sdl_texture_format_entry sdl_texture_format_map[]
int window_y
position of the window
#define AV_PIX_FMT_RGB32_1
#define AV_LOG_VERBOSE
Detailed information.
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
static const AVClass sdl2_class
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
AVOutputFormat ff_sdl2_muxer
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
#define AV_PIX_FMT_0BGR32
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define AV_PIX_FMT_BGR32_1
static const char * window_title
AVCodecParameters * codecpar
Codec parameters associated with this stream.
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
static int write_trailer(AVFormatContext *s1)
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Rational number (pair of numerator and denominator).
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
const char * av_default_item_name(void *ptr)
Return the context name.
@ AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
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 AV_PIX_FMT_BGR555
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
static void compute_texture_rect(AVFormatContext *s)
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
#define i(width, name, range_min, range_max)
static const AVOption options[]
#define AV_PIX_FMT_RGB555
#define AV_PIX_FMT_BGR565
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
enum AVPixelFormat format
#define AV_PIX_FMT_RGB565
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
@ AV_PIX_FMT_0BGR
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#define AV_PIX_FMT_0RGB32
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
static int sdl2_write_header(AVFormatContext *s)
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
char * av_strdup(const char *s)
Duplicate a string.
static int sdl2_write_trailer(AVFormatContext *s)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
#define flags(name, subs,...)
@ AV_PIX_FMT_0RGB
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
static int sdl2_write_packet(AVFormatContext *s, AVPacket *pkt)
static void write_header(FFV1Context *f)
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_RGB444