FFmpeg
Data Structures | Macros | Functions | Variables
sdl2.c File Reference

libSDL2 output device More...

#include <SDL.h>
#include <SDL_thread.h>
#include "libavutil/avstring.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/time.h"
#include "avdevice.h"

Go to the source code of this file.

Data Structures

struct  SDLContext
 
struct  sdl_texture_format_entry
 

Macros

#define OFFSET(x)   offsetof(SDLContext,x)
 

Functions

static void compute_texture_rect (AVFormatContext *s)
 
static int sdl2_write_trailer (AVFormatContext *s)
 
static int sdl2_write_header (AVFormatContext *s)
 
static int sdl2_write_packet (AVFormatContext *s, AVPacket *pkt)
 

Variables

static const struct sdl_texture_format_entry sdl_texture_format_map []
 
static const AVOption options []
 
static const AVClass sdl2_class
 
AVOutputFormat ff_sdl2_muxer
 

Detailed Description

libSDL2 output device

Definition in file sdl2.c.

Macro Definition Documentation

#define OFFSET (   x)    offsetof(SDLContext,x)

Definition at line 337 of file sdl2.c.

Function Documentation

static void compute_texture_rect ( AVFormatContext s)
static

Definition at line 97 of file sdl2.c.

Referenced by sdl2_write_header(), and sdl2_write_packet().

static int sdl2_write_trailer ( AVFormatContext s)
static

Definition at line 137 of file sdl2.c.

Referenced by sdl2_write_header(), and sdl2_write_packet().

static int sdl2_write_header ( AVFormatContext s)
static

Definition at line 159 of file sdl2.c.

static int sdl2_write_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 242 of file sdl2.c.

Variable Documentation

const struct sdl_texture_format_entry sdl_texture_format_map[]
static
Initial value:
= {
{ AV_PIX_FMT_RGB8, SDL_PIXELFORMAT_RGB332 },
{ AV_PIX_FMT_RGB444, SDL_PIXELFORMAT_RGB444 },
{ AV_PIX_FMT_RGB555, SDL_PIXELFORMAT_RGB555 },
{ AV_PIX_FMT_BGR555, SDL_PIXELFORMAT_BGR555 },
{ AV_PIX_FMT_RGB565, SDL_PIXELFORMAT_RGB565 },
{ AV_PIX_FMT_BGR565, SDL_PIXELFORMAT_BGR565 },
{ AV_PIX_FMT_RGB24, SDL_PIXELFORMAT_RGB24 },
{ AV_PIX_FMT_BGR24, SDL_PIXELFORMAT_BGR24 },
{ AV_PIX_FMT_0RGB32, SDL_PIXELFORMAT_RGB888 },
{ AV_PIX_FMT_0BGR32, SDL_PIXELFORMAT_BGR888 },
{ AV_PIX_FMT_0BGR, SDL_PIXELFORMAT_RGBX8888 },
{ AV_PIX_FMT_0RGB, SDL_PIXELFORMAT_BGRX8888 },
{ AV_PIX_FMT_RGB32, SDL_PIXELFORMAT_ARGB8888 },
{ AV_PIX_FMT_RGB32_1, SDL_PIXELFORMAT_RGBA8888 },
{ AV_PIX_FMT_BGR32, SDL_PIXELFORMAT_ABGR8888 },
{ AV_PIX_FMT_BGR32_1, SDL_PIXELFORMAT_BGRA8888 },
{ AV_PIX_FMT_YUV420P, SDL_PIXELFORMAT_IYUV },
{ AV_PIX_FMT_YUYV422, SDL_PIXELFORMAT_YUY2 },
{ AV_PIX_FMT_UYVY422, SDL_PIXELFORMAT_UYVY },
}
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:81
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:68
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
Definition: pixfmt.h:239
#define AV_PIX_FMT_RGB444
Definition: pixfmt.h:386
#define AV_PIX_FMT_BGR32_1
Definition: pixfmt.h:373
#define AV_PIX_FMT_0BGR32
Definition: pixfmt.h:375
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:69
#define AV_PIX_FMT_BGR555
Definition: pixfmt.h:390
#define AV_PIX_FMT_BGR32
Definition: pixfmt.h:372
#define AV_PIX_FMT_RGB32
Definition: pixfmt.h:370
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:67
#define AV_PIX_FMT_BGR565
Definition: pixfmt.h:389
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
Definition: pixfmt.h:86
#define AV_PIX_FMT_RGB555
Definition: pixfmt.h:385
#define AV_PIX_FMT_RGB32_1
Definition: pixfmt.h:371
#define AV_PIX_FMT_RGB565
Definition: pixfmt.h:384
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
Definition: pixfmt.h:237
#define AV_PIX_FMT_0RGB32
Definition: pixfmt.h:374

Referenced by sdl2_write_header().

const AVOption options[]
static
Initial value:
= {
{ "window_title", "set SDL window title", OFFSET(window_title), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
{ "window_size", "set SDL window forced size", OFFSET(window_width), AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
{ "window_x", "set SDL window x position", OFFSET(window_x), AV_OPT_TYPE_INT, { .i64 = SDL_WINDOWPOS_CENTERED }, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
{ "window_y", "set SDL window y position", OFFSET(window_y), AV_OPT_TYPE_INT, { .i64 = SDL_WINDOWPOS_CENTERED }, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
{ "window_fullscreen", "set SDL window fullscreen", OFFSET(window_fullscreen), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM },
{ "window_borderless", "set SDL window border off", OFFSET(window_borderless), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM },
{ "window_enable_quit", "set if quit action is available", OFFSET(enable_quit_action), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM },
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
Definition: opt.h:276
#define OFFSET(x)
Definition: sdl2.c:337
static const char * window_title
Definition: ffplay.c:313
offset must point to two consecutive integers
Definition: opt.h:233

Definition at line 339 of file sdl2.c.

const AVClass sdl2_class
static
Initial value:
= {
.class_name = "sdl2 outdev",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:235
static const AVOption options[]
Definition: sdl2.c:339

Definition at line 350 of file sdl2.c.

AVOutputFormat ff_sdl2_muxer
Initial value:
= {
.name = "sdl,sdl2",
.long_name = NULL_IF_CONFIG_SMALL("SDL2 output device"),
.priv_data_size = sizeof(SDLContext),
.audio_codec = AV_CODEC_ID_NONE,
.video_codec = AV_CODEC_ID_RAWVIDEO,
.priv_class = &sdl2_class,
}
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
Definition: ffmpeg.c:698
static int sdl2_write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: sdl2.c:242
static int sdl2_write_header(AVFormatContext *s)
Definition: sdl2.c:159
static int sdl2_write_trailer(AVFormatContext *s)
Definition: sdl2.c:137
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static int write_trailer(AVFormatContext *s1)
Definition: v4l2enc.c:94
static const AVClass sdl2_class
Definition: sdl2.c:350
#define AVFMT_NOTIMESTAMPS
Format does not need / have any timestamps.
Definition: avformat.h:462
#define flags(name, subs,...)
Definition: cbs_av1.c:564
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:458
#define AVFMT_VARIABLE_FPS
Format allows variable fps.
Definition: avformat.h:465
static void write_header(FFV1Context *f)
Definition: ffv1enc.c:346

Definition at line 358 of file sdl2.c.