Go to the documentation of this file.
27 #include <SDL_thread.h>
122 texture_rect->w = codecpar->
width;
125 texture_rect->h = codecpar->
height;
132 texture_rect->x = (sdl->
window_width - texture_rect->w) / 2;
133 texture_rect->y = (sdl->
window_height - texture_rect->h) / 2;
141 SDL_DestroyTexture(sdl->
texture);
149 SDL_DestroyWindow(sdl->
window);
168 "The sdl output device is deprecated due to being fundamentally incompatible with libavformat API. "
169 "For monitoring purposes in ffmpeg you can output to a file or use pipes and a video player.\n"
170 "Example: ffmpeg -i INPUT -f nut -c:v rawvideo - | ffplay -loglevel warning -vf setpts=0 -\n"
178 if (SDL_WasInit(SDL_INIT_VIDEO)) {
180 "SDL video subsystem was already inited, you could have multiple SDL outputs. This may cause unknown behaviour.\n");
184 if (
s->nb_streams > 1
200 "Unsupported pixel format '%s'.\n",
206 flags = SDL_WINDOW_HIDDEN |
212 if (SDL_Init(SDL_INIT_VIDEO) != 0) {
222 av_log(sdl,
AV_LOG_ERROR,
"Couldn't create window and renderer: %s\n", SDL_GetError());
228 SDL_ShowWindow(sdl->
window);
259 if (SDL_PollEvent(&event)){
260 switch (event.type) {
262 switch (event.key.keysym.sym) {
274 case SDL_WINDOWEVENT:
275 switch(event.window.event){
276 case SDL_WINDOWEVENT_RESIZED:
277 case SDL_WINDOWEVENT_SIZE_CHANGED:
308 case SDL_PIXELFORMAT_IYUV:
309 case SDL_PIXELFORMAT_YUY2:
310 case SDL_PIXELFORMAT_UYVY:
312 data[0], linesize[0],
313 data[1], linesize[1],
314 data[2], linesize[2]);
316 case SDL_PIXELFORMAT_RGB332:
317 case SDL_PIXELFORMAT_RGB444:
318 case SDL_PIXELFORMAT_RGB555:
319 case SDL_PIXELFORMAT_BGR555:
320 case SDL_PIXELFORMAT_RGB565:
321 case SDL_PIXELFORMAT_BGR565:
322 case SDL_PIXELFORMAT_RGB24:
323 case SDL_PIXELFORMAT_BGR24:
324 case SDL_PIXELFORMAT_RGB888:
325 case SDL_PIXELFORMAT_RGBX8888:
326 case SDL_PIXELFORMAT_BGR888:
327 case SDL_PIXELFORMAT_BGRX8888:
328 case SDL_PIXELFORMAT_ARGB8888:
329 case SDL_PIXELFORMAT_RGBA8888:
330 case SDL_PIXELFORMAT_ABGR8888:
331 case SDL_PIXELFORMAT_BGRA8888:
345 #define OFFSET(x) offsetof(SDLContext,x)
367 .
p.
name =
"sdl,sdl2",
#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.
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.
@ 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
Underlying C type is 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)3R 3G 2B(lsb)
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
const FFOutputFormat ff_sdl2_muxer
#define AV_OPT_FLAG_ENCODING_PARAM
A generic parameter which can be set by the user for muxing or encoding.
@ 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
#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)
@ AV_OPT_TYPE_INT
Underlying C type is int.
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.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
#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)
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
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