FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 SDL_BASE_FLAGS   (SDL_SWSURFACE|SDL_WINDOW_RESIZABLE)
 
#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 SDL_BASE_FLAGS   (SDL_SWSURFACE|SDL_WINDOW_RESIZABLE)

Definition at line 157 of file sdl2.c.

Referenced by sdl2_write_header().

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

Definition at line 336 of file sdl2.c.

Function Documentation

static void compute_texture_rect ( AVFormatContext s)
static

Definition at line 95 of file sdl2.c.

Referenced by sdl2_write_packet().

static int sdl2_write_trailer ( AVFormatContext s)
static

Definition at line 135 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 241 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:82
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:64
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
Definition: pixfmt.h:253
#define AV_PIX_FMT_RGB444
Definition: pixfmt.h:340
#define AV_PIX_FMT_BGR32_1
Definition: pixfmt.h:329
#define AV_PIX_FMT_0BGR32
Definition: pixfmt.h:331
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:65
#define AV_PIX_FMT_BGR555
Definition: pixfmt.h:344
#define AV_PIX_FMT_BGR32
Definition: pixfmt.h:328
#define AV_PIX_FMT_RGB32
Definition: pixfmt.h:326
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:63
#define AV_PIX_FMT_BGR565
Definition: pixfmt.h:343
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:62
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
Definition: pixfmt.h:87
#define AV_PIX_FMT_RGB555
Definition: pixfmt.h:339
#define AV_PIX_FMT_RGB32_1
Definition: pixfmt.h:327
#define AV_PIX_FMT_RGB565
Definition: pixfmt.h:338
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
Definition: pixfmt.h:251
#define AV_PIX_FMT_0RGB32
Definition: pixfmt.h:330

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_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 },
{ 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:336
static const char * window_title
Definition: ffplay.c:313
offset must point to two consecutive integers
Definition: opt.h:233

Definition at line 338 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
av_default_item_name
static const AVOption options[]
Definition: sdl2.c:338

Definition at line 346 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:672
static int sdl2_write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: sdl2.c:241
static int sdl2_write_header(AVFormatContext *s)
Definition: sdl2.c:159
static int sdl2_write_trailer(AVFormatContext *s)
Definition: sdl2.c:135
static int flags
Definition: log.c:57
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
static int write_trailer(AVFormatContext *s1)
Definition: v4l2enc.c:94
static const AVClass sdl2_class
Definition: sdl2.c:346
#define AVFMT_NOTIMESTAMPS
Format does not need / have any timestamps.
Definition: avformat.h:486
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:478
#define AVFMT_VARIABLE_FPS
Format allows variable fps.
Definition: avformat.h:489
static void write_header(FFV1Context *f)
Definition: ffv1enc.c:337

Definition at line 354 of file sdl2.c.