27 #include <SDL_thread.h>
74 SDL_FreeYUVOverlay(sdl->
overlay);
80 SDL_DestroyMutex(sdl->
mutex);
118 overlay_rect->w = encctx->
width;
121 overlay_rect->h = encctx->
height;
128 overlay_rect->x = (sdl->
window_width - overlay_rect->w) / 2;
129 overlay_rect->y = (sdl->
window_height - overlay_rect->h) / 2;
132 #define SDL_BASE_FLAGS (SDL_SWSURFACE|SDL_RESIZABLE)
143 if (SDL_Init(SDL_INIT_VIDEO) != 0) {
162 "SDL does not support an overlay with size of %dx%d pixels\n",
174 SDL_LockMutex(sdl->
mutex);
176 SDL_UnlockMutex(sdl->
mutex);
187 ret = SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_ALLEVENTS);
197 switch (event.type) {
199 switch (event.key.keysym.sym) {
210 case SDL_VIDEORESIZE:
214 SDL_LockMutex(sdl->
mutex);
222 SDL_UnlockMutex(sdl->
mutex);
245 if (SDL_WasInit(SDL_INIT_VIDEO)) {
247 "SDL video subsystem was already inited, aborting\n");
270 "Unsupported pixel format '%s', choose one of yuv420p, yuyv422, or uyvy422\n",
281 av_log(s,
AV_LOG_ERROR,
"Could not create SDL condition variable: %s\n", SDL_GetError());
285 sdl->
mutex = SDL_CreateMutex();
299 SDL_LockMutex(sdl->
mutex);
303 SDL_UnlockMutex(sdl->
mutex);
329 SDL_LockMutex(sdl->
mutex);
331 SDL_MapRGB(sdl->
surface->format, 0, 0, 0));
332 SDL_LockYUVOverlay(sdl->
overlay);
333 for (i = 0; i < 3; i++) {
334 sdl->
overlay->pixels [i] = data [i];
335 sdl->
overlay->pitches[i] = linesize[i];
338 SDL_UnlockYUVOverlay(sdl->
overlay);
343 SDL_UnlockMutex(sdl->
mutex);
348 #define OFFSET(x) offsetof(SDLContext,x)
376 .priv_class = &sdl_class,
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
static enum AVPixelFormat pix_fmt
ptrdiff_t const GLvoid * data
#define LIBAVUTIL_VERSION_INT
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
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...
static int sdl_write_header(AVFormatContext *s)
enum AVPixelFormat pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
SDL_Thread * event_thread
AVStream ** streams
A list of all streams in the file.
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
#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.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void compute_overlay_rect(AVFormatContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
AVCodecContext * codec
Codec context associated with this stream.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
static int sdl_write_trailer(AVFormatContext *s)
char filename[1024]
input or output filename
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
int width
picture width / height.
static int write_trailer(AVFormatContext *s1)
int sdl_was_already_inited
int window_height
size of the window
enum AVMediaType codec_type
static int event_thread(void *arg)
char * av_strdup(const char *s)
Duplicate the string s.
main external API structure.
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 numerator/denominator
static int sdl_write_packet(AVFormatContext *s, AVPacket *pkt)
static const struct sdl_overlay_pix_fmt_entry sdl_overlay_pix_fmt_map[]
static const AVOption options[]
offset must point to two consecutive integers
AVOutputFormat ff_sdl_muxer
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
void * priv_data
Format private data.
static void write_header(FFV1Context *f)
static const AVClass sdl_class
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 AVERROR_EXTERNAL
Generic error in an external library.
AVPixelFormat
Pixel format.
This structure stores compressed data.
static int write_packet(AVFormatContext *s1, AVPacket *pkt)