27 #include <SDL_thread.h>
73 SDL_FreeYUVOverlay(sdl->
overlay);
79 SDL_DestroyMutex(sdl->
mutex);
117 overlay_rect->w = encctx->
width;
120 overlay_rect->h = encctx->
height;
127 overlay_rect->x = (sdl->
window_width - overlay_rect->w) / 2;
128 overlay_rect->y = (sdl->
window_height - overlay_rect->h) / 2;
131 #define SDL_BASE_FLAGS (SDL_SWSURFACE|SDL_RESIZABLE)
142 if (SDL_Init(SDL_INIT_VIDEO) != 0) {
161 "SDL does not support an overlay with size of %dx%d pixels\n",
173 SDL_LockMutex(sdl->
mutex);
175 SDL_UnlockMutex(sdl->
mutex);
186 ret = SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_ALLEVENTS);
196 switch (event.type) {
198 switch (event.key.keysym.sym) {
209 case SDL_VIDEORESIZE:
213 SDL_LockMutex(sdl->
mutex);
221 SDL_UnlockMutex(sdl->
mutex);
244 if (SDL_WasInit(SDL_INIT_VIDEO)) {
246 "SDL video subsystem was already inited, aborting\n");
269 "Unsupported pixel format '%s', choose one of yuv420p, yuyv422, or uyvy422\n",
280 av_log(s,
AV_LOG_ERROR,
"Could not create SDL condition variable: %s\n", SDL_GetError());
284 sdl->
mutex = SDL_CreateMutex();
298 SDL_LockMutex(sdl->
mutex);
302 SDL_UnlockMutex(sdl->
mutex);
327 SDL_LockMutex(sdl->
mutex);
329 SDL_MapRGB(sdl->
surface->format, 0, 0, 0));
330 SDL_LockYUVOverlay(sdl->
overlay);
331 for (i = 0; i < 3; i++) {
336 SDL_UnlockYUVOverlay(sdl->
overlay);
341 SDL_UnlockMutex(sdl->
mutex);
346 #define OFFSET(x) offsetof(SDLContext,x)
374 .priv_class = &sdl_class,
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
static enum AVPixelFormat pix_fmt
int linesize[AV_NUM_DATA_POINTERS]
number of bytes per line
#define LIBAVUTIL_VERSION_INT
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
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.
int avpicture_fill(AVPicture *picture, const uint8_t *ptr, enum AVPixelFormat pix_fmt, int width, int height)
Setup the picture fields based on the specified image parameters and the provided image data buffer...
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
uint8_t * data[AV_NUM_DATA_POINTERS]
pointers to the image data planes
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)