ffmpeg/libavdevice/sdl.c

378 lines
12 KiB
C
Raw Normal View History

2011-05-26 23:34:35 +00:00
/*
* Copyright (c) 2011 Stefano Sabatini
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* libSDL output device
*/
#include <SDL.h>
#include <SDL_thread.h>
2011-05-26 23:34:35 +00:00
#include "libavutil/avstring.h"
2016-02-02 01:25:38 +00:00
#include "libavutil/imgutils.h"
2011-05-26 23:34:35 +00:00
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/time.h"
2011-05-26 23:34:35 +00:00
#include "avdevice.h"
typedef struct {
AVClass *class;
SDL_Surface *surface;
SDL_Overlay *overlay;
char *window_title;
char *icon_title;
int window_width, window_height; /**< size of the window */
int window_fullscreen;
SDL_Rect overlay_rect;
2011-05-26 23:34:35 +00:00
int overlay_fmt;
2011-05-26 23:34:35 +00:00
int sdl_was_already_inited;
SDL_Thread *event_thread;
SDL_mutex *mutex;
SDL_cond *init_cond;
int init_ret; /* return code used to signal initialization errors */
int inited;
int quit;
2011-05-26 23:34:35 +00:00
} SDLContext;
static const struct sdl_overlay_pix_fmt_entry {
Merge commit '716d413c13981da15323c7a3821860536eefdbbb' * commit '716d413c13981da15323c7a3821860536eefdbbb': Replace PIX_FMT_* -> AV_PIX_FMT_*, PixelFormat -> AVPixelFormat Conflicts: doc/examples/muxing.c ffmpeg.h ffmpeg_filter.c ffmpeg_opt.c ffplay.c ffprobe.c libavcodec/8bps.c libavcodec/aasc.c libavcodec/aura.c libavcodec/avcodec.h libavcodec/avs.c libavcodec/bfi.c libavcodec/bmp.c libavcodec/bmpenc.c libavcodec/c93.c libavcodec/cscd.c libavcodec/cyuv.c libavcodec/dpx.c libavcodec/dpxenc.c libavcodec/eatgv.c libavcodec/escape124.c libavcodec/ffv1.c libavcodec/flashsv.c libavcodec/fraps.c libavcodec/h264.c libavcodec/huffyuv.c libavcodec/iff.c libavcodec/imgconvert.c libavcodec/indeo3.c libavcodec/kmvc.c libavcodec/libopenjpegdec.c libavcodec/libopenjpegenc.c libavcodec/libx264.c libavcodec/ljpegenc.c libavcodec/mjpegdec.c libavcodec/mjpegenc.c libavcodec/motionpixels.c libavcodec/mpeg12.c libavcodec/mpeg12enc.c libavcodec/mpeg4videodec.c libavcodec/mpegvideo_enc.c libavcodec/pamenc.c libavcodec/pcxenc.c libavcodec/pgssubdec.c libavcodec/pngdec.c libavcodec/pngenc.c libavcodec/pnm.c libavcodec/pnmdec.c libavcodec/pnmenc.c libavcodec/ptx.c libavcodec/qdrw.c libavcodec/qpeg.c libavcodec/qtrleenc.c libavcodec/raw.c libavcodec/rawdec.c libavcodec/rl2.c libavcodec/sgidec.c libavcodec/sgienc.c libavcodec/snowdec.c libavcodec/snowenc.c libavcodec/sunrast.c libavcodec/targa.c libavcodec/targaenc.c libavcodec/tiff.c libavcodec/tiffenc.c libavcodec/tmv.c libavcodec/truemotion2.c libavcodec/utils.c libavcodec/vb.c libavcodec/vp3.c libavcodec/wnv1.c libavcodec/xl.c libavcodec/xwddec.c libavcodec/xwdenc.c libavcodec/yop.c libavdevice/v4l2.c libavdevice/x11grab.c libavfilter/avfilter.c libavfilter/avfilter.h libavfilter/buffersrc.c libavfilter/drawutils.c libavfilter/formats.c libavfilter/src_movie.c libavfilter/vf_ass.c libavfilter/vf_drawtext.c libavfilter/vf_fade.c libavfilter/vf_format.c libavfilter/vf_hflip.c libavfilter/vf_lut.c libavfilter/vf_overlay.c libavfilter/vf_pad.c libavfilter/vf_scale.c libavfilter/vf_transpose.c libavfilter/vf_yadif.c libavfilter/video.c libavfilter/vsrc_testsrc.c libavformat/movenc.c libavformat/mxf.h libavformat/utils.c libavformat/yuv4mpeg.c libavutil/imgutils.c libavutil/pixdesc.c libswscale/input.c libswscale/output.c libswscale/swscale_internal.h libswscale/swscale_unscaled.c libswscale/utils.c libswscale/x86/swscale_template.c libswscale/x86/yuv2rgb.c libswscale/x86/yuv2rgb_template.c libswscale/yuv2rgb.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-08 18:54:00 +00:00
enum AVPixelFormat pix_fmt; int overlay_fmt;
2011-05-26 23:34:35 +00:00
} sdl_overlay_pix_fmt_map[] = {
Merge commit '716d413c13981da15323c7a3821860536eefdbbb' * commit '716d413c13981da15323c7a3821860536eefdbbb': Replace PIX_FMT_* -> AV_PIX_FMT_*, PixelFormat -> AVPixelFormat Conflicts: doc/examples/muxing.c ffmpeg.h ffmpeg_filter.c ffmpeg_opt.c ffplay.c ffprobe.c libavcodec/8bps.c libavcodec/aasc.c libavcodec/aura.c libavcodec/avcodec.h libavcodec/avs.c libavcodec/bfi.c libavcodec/bmp.c libavcodec/bmpenc.c libavcodec/c93.c libavcodec/cscd.c libavcodec/cyuv.c libavcodec/dpx.c libavcodec/dpxenc.c libavcodec/eatgv.c libavcodec/escape124.c libavcodec/ffv1.c libavcodec/flashsv.c libavcodec/fraps.c libavcodec/h264.c libavcodec/huffyuv.c libavcodec/iff.c libavcodec/imgconvert.c libavcodec/indeo3.c libavcodec/kmvc.c libavcodec/libopenjpegdec.c libavcodec/libopenjpegenc.c libavcodec/libx264.c libavcodec/ljpegenc.c libavcodec/mjpegdec.c libavcodec/mjpegenc.c libavcodec/motionpixels.c libavcodec/mpeg12.c libavcodec/mpeg12enc.c libavcodec/mpeg4videodec.c libavcodec/mpegvideo_enc.c libavcodec/pamenc.c libavcodec/pcxenc.c libavcodec/pgssubdec.c libavcodec/pngdec.c libavcodec/pngenc.c libavcodec/pnm.c libavcodec/pnmdec.c libavcodec/pnmenc.c libavcodec/ptx.c libavcodec/qdrw.c libavcodec/qpeg.c libavcodec/qtrleenc.c libavcodec/raw.c libavcodec/rawdec.c libavcodec/rl2.c libavcodec/sgidec.c libavcodec/sgienc.c libavcodec/snowdec.c libavcodec/snowenc.c libavcodec/sunrast.c libavcodec/targa.c libavcodec/targaenc.c libavcodec/tiff.c libavcodec/tiffenc.c libavcodec/tmv.c libavcodec/truemotion2.c libavcodec/utils.c libavcodec/vb.c libavcodec/vp3.c libavcodec/wnv1.c libavcodec/xl.c libavcodec/xwddec.c libavcodec/xwdenc.c libavcodec/yop.c libavdevice/v4l2.c libavdevice/x11grab.c libavfilter/avfilter.c libavfilter/avfilter.h libavfilter/buffersrc.c libavfilter/drawutils.c libavfilter/formats.c libavfilter/src_movie.c libavfilter/vf_ass.c libavfilter/vf_drawtext.c libavfilter/vf_fade.c libavfilter/vf_format.c libavfilter/vf_hflip.c libavfilter/vf_lut.c libavfilter/vf_overlay.c libavfilter/vf_pad.c libavfilter/vf_scale.c libavfilter/vf_transpose.c libavfilter/vf_yadif.c libavfilter/video.c libavfilter/vsrc_testsrc.c libavformat/movenc.c libavformat/mxf.h libavformat/utils.c libavformat/yuv4mpeg.c libavutil/imgutils.c libavutil/pixdesc.c libswscale/input.c libswscale/output.c libswscale/swscale_internal.h libswscale/swscale_unscaled.c libswscale/utils.c libswscale/x86/swscale_template.c libswscale/x86/yuv2rgb.c libswscale/x86/yuv2rgb_template.c libswscale/yuv2rgb.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-08 18:54:00 +00:00
{ AV_PIX_FMT_YUV420P, SDL_IYUV_OVERLAY },
{ AV_PIX_FMT_YUYV422, SDL_YUY2_OVERLAY },
{ AV_PIX_FMT_UYVY422, SDL_UYVY_OVERLAY },
{ AV_PIX_FMT_NONE, 0 },
2011-05-26 23:34:35 +00:00
};
static int sdl_write_trailer(AVFormatContext *s)
{
SDLContext *sdl = s->priv_data;
sdl->quit = 1;
if (sdl->overlay)
2011-05-26 23:34:35 +00:00
SDL_FreeYUVOverlay(sdl->overlay);
sdl->overlay = NULL;
if (sdl->event_thread)
SDL_WaitThread(sdl->event_thread, NULL);
sdl->event_thread = NULL;
if (sdl->mutex)
SDL_DestroyMutex(sdl->mutex);
sdl->mutex = NULL;
if (sdl->init_cond)
SDL_DestroyCond(sdl->init_cond);
sdl->init_cond = NULL;
2011-05-26 23:34:35 +00:00
if (!sdl->sdl_was_already_inited)
SDL_Quit();
return 0;
}
static void compute_overlay_rect(AVFormatContext *s)
{
AVRational sar, dar; /* sample and display aspect ratios */
SDLContext *sdl = s->priv_data;
AVStream *st = s->streams[0];
AVCodecParameters *par = st->codecpar;
SDL_Rect *overlay_rect = &sdl->overlay_rect;
/* compute overlay width and height from the codec context information */
sar = st->sample_aspect_ratio.num ? st->sample_aspect_ratio : (AVRational){ 1, 1 };
dar = av_mul_q(sar, (AVRational){ par->width, par->height });
/* we suppose the screen has a 1/1 sample aspect ratio */
if (sdl->window_width && sdl->window_height) {
/* fit in the window */
if (av_cmp_q(dar, (AVRational){ sdl->window_width, sdl->window_height }) > 0) {
/* fit in width */
overlay_rect->w = sdl->window_width;
overlay_rect->h = av_rescale(overlay_rect->w, dar.den, dar.num);
} else {
/* fit in height */
overlay_rect->h = sdl->window_height;
overlay_rect->w = av_rescale(overlay_rect->h, dar.num, dar.den);
}
} else {
if (sar.num > sar.den) {
overlay_rect->w = par->width;
overlay_rect->h = av_rescale(overlay_rect->w, dar.den, dar.num);
} else {
overlay_rect->h = par->height;
overlay_rect->w = av_rescale(overlay_rect->h, dar.num, dar.den);
}
sdl->window_width = overlay_rect->w;
sdl->window_height = overlay_rect->h;
}
overlay_rect->x = (sdl->window_width - overlay_rect->w) / 2;
overlay_rect->y = (sdl->window_height - overlay_rect->h) / 2;
}
2013-11-25 12:31:06 +00:00
#define SDL_BASE_FLAGS (SDL_SWSURFACE|SDL_RESIZABLE)
static int event_thread(void *arg)
{
AVFormatContext *s = arg;
SDLContext *sdl = s->priv_data;
2013-11-25 12:31:06 +00:00
int flags = SDL_BASE_FLAGS | (sdl->window_fullscreen ? SDL_FULLSCREEN : 0);
AVStream *st = s->streams[0];
AVCodecParameters *par = st->codecpar;
/* initialization */
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
av_log(s, AV_LOG_ERROR, "Unable to initialize SDL: %s\n", SDL_GetError());
sdl->init_ret = AVERROR(EINVAL);
goto init_end;
}
SDL_WM_SetCaption(sdl->window_title, sdl->icon_title);
sdl->surface = SDL_SetVideoMode(sdl->window_width, sdl->window_height,
24, flags);
if (!sdl->surface) {
av_log(sdl, AV_LOG_ERROR, "Unable to set video mode: %s\n", SDL_GetError());
sdl->init_ret = AVERROR(EINVAL);
goto init_end;
}
sdl->overlay = SDL_CreateYUVOverlay(par->width, par->height,
sdl->overlay_fmt, sdl->surface);
if (!sdl->overlay || sdl->overlay->pitches[0] < par->width) {
av_log(s, AV_LOG_ERROR,
"SDL does not support an overlay with size of %dx%d pixels\n",
par->width, par->height);
sdl->init_ret = AVERROR(EINVAL);
goto init_end;
}
sdl->init_ret = 0;
av_log(s, AV_LOG_VERBOSE, "w:%d h:%d fmt:%s -> w:%d h:%d\n",
par->width, par->height, av_get_pix_fmt_name(par->format),
sdl->overlay_rect.w, sdl->overlay_rect.h);
init_end:
SDL_LockMutex(sdl->mutex);
sdl->inited = 1;
SDL_UnlockMutex(sdl->mutex);
SDL_CondSignal(sdl->init_cond);
if (sdl->init_ret < 0)
return sdl->init_ret;
/* event loop */
while (!sdl->quit) {
int ret;
SDL_Event event;
SDL_PumpEvents();
ret = SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_ALLEVENTS);
if (ret < 0) {
av_log(s, AV_LOG_ERROR, "Error when getting SDL event: %s\n", SDL_GetError());
continue;
}
if (ret == 0) {
SDL_Delay(10);
continue;
}
switch (event.type) {
case SDL_KEYDOWN:
switch (event.key.keysym.sym) {
case SDLK_ESCAPE:
case SDLK_q:
sdl->quit = 1;
break;
}
break;
case SDL_QUIT:
sdl->quit = 1;
break;
2013-11-25 12:31:06 +00:00
case SDL_VIDEORESIZE:
sdl->window_width = event.resize.w;
sdl->window_height = event.resize.h;
SDL_LockMutex(sdl->mutex);
sdl->surface = SDL_SetVideoMode(sdl->window_width, sdl->window_height, 24, SDL_BASE_FLAGS);
if (!sdl->surface) {
av_log(s, AV_LOG_ERROR, "Failed to set SDL video mode: %s\n", SDL_GetError());
sdl->quit = 1;
} else {
compute_overlay_rect(s);
}
SDL_UnlockMutex(sdl->mutex);
break;
default:
break;
}
}
return 0;
}
2011-05-26 23:34:35 +00:00
static int sdl_write_header(AVFormatContext *s)
{
SDLContext *sdl = s->priv_data;
AVStream *st = s->streams[0];
AVCodecParameters *par = st->codecpar;
2011-05-26 23:34:35 +00:00
int i, ret;
if (!sdl->window_title)
sdl->window_title = av_strdup(s->filename);
2011-05-26 23:34:35 +00:00
if (!sdl->icon_title)
sdl->icon_title = av_strdup(sdl->window_title);
if (SDL_WasInit(SDL_INIT_VIDEO)) {
av_log(s, AV_LOG_ERROR,
"SDL video subsystem was already inited, aborting\n");
2011-05-26 23:34:35 +00:00
sdl->sdl_was_already_inited = 1;
ret = AVERROR(EINVAL);
goto fail;
}
if ( s->nb_streams > 1
|| par->codec_type != AVMEDIA_TYPE_VIDEO
|| par->codec_id != AV_CODEC_ID_RAWVIDEO) {
2011-05-26 23:34:35 +00:00
av_log(s, AV_LOG_ERROR, "Only supports one rawvideo stream\n");
ret = AVERROR(EINVAL);
goto fail;
}
Merge commit '716d413c13981da15323c7a3821860536eefdbbb' * commit '716d413c13981da15323c7a3821860536eefdbbb': Replace PIX_FMT_* -> AV_PIX_FMT_*, PixelFormat -> AVPixelFormat Conflicts: doc/examples/muxing.c ffmpeg.h ffmpeg_filter.c ffmpeg_opt.c ffplay.c ffprobe.c libavcodec/8bps.c libavcodec/aasc.c libavcodec/aura.c libavcodec/avcodec.h libavcodec/avs.c libavcodec/bfi.c libavcodec/bmp.c libavcodec/bmpenc.c libavcodec/c93.c libavcodec/cscd.c libavcodec/cyuv.c libavcodec/dpx.c libavcodec/dpxenc.c libavcodec/eatgv.c libavcodec/escape124.c libavcodec/ffv1.c libavcodec/flashsv.c libavcodec/fraps.c libavcodec/h264.c libavcodec/huffyuv.c libavcodec/iff.c libavcodec/imgconvert.c libavcodec/indeo3.c libavcodec/kmvc.c libavcodec/libopenjpegdec.c libavcodec/libopenjpegenc.c libavcodec/libx264.c libavcodec/ljpegenc.c libavcodec/mjpegdec.c libavcodec/mjpegenc.c libavcodec/motionpixels.c libavcodec/mpeg12.c libavcodec/mpeg12enc.c libavcodec/mpeg4videodec.c libavcodec/mpegvideo_enc.c libavcodec/pamenc.c libavcodec/pcxenc.c libavcodec/pgssubdec.c libavcodec/pngdec.c libavcodec/pngenc.c libavcodec/pnm.c libavcodec/pnmdec.c libavcodec/pnmenc.c libavcodec/ptx.c libavcodec/qdrw.c libavcodec/qpeg.c libavcodec/qtrleenc.c libavcodec/raw.c libavcodec/rawdec.c libavcodec/rl2.c libavcodec/sgidec.c libavcodec/sgienc.c libavcodec/snowdec.c libavcodec/snowenc.c libavcodec/sunrast.c libavcodec/targa.c libavcodec/targaenc.c libavcodec/tiff.c libavcodec/tiffenc.c libavcodec/tmv.c libavcodec/truemotion2.c libavcodec/utils.c libavcodec/vb.c libavcodec/vp3.c libavcodec/wnv1.c libavcodec/xl.c libavcodec/xwddec.c libavcodec/xwdenc.c libavcodec/yop.c libavdevice/v4l2.c libavdevice/x11grab.c libavfilter/avfilter.c libavfilter/avfilter.h libavfilter/buffersrc.c libavfilter/drawutils.c libavfilter/formats.c libavfilter/src_movie.c libavfilter/vf_ass.c libavfilter/vf_drawtext.c libavfilter/vf_fade.c libavfilter/vf_format.c libavfilter/vf_hflip.c libavfilter/vf_lut.c libavfilter/vf_overlay.c libavfilter/vf_pad.c libavfilter/vf_scale.c libavfilter/vf_transpose.c libavfilter/vf_yadif.c libavfilter/video.c libavfilter/vsrc_testsrc.c libavformat/movenc.c libavformat/mxf.h libavformat/utils.c libavformat/yuv4mpeg.c libavutil/imgutils.c libavutil/pixdesc.c libswscale/input.c libswscale/output.c libswscale/swscale_internal.h libswscale/swscale_unscaled.c libswscale/utils.c libswscale/x86/swscale_template.c libswscale/x86/yuv2rgb.c libswscale/x86/yuv2rgb_template.c libswscale/yuv2rgb.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-08 18:54:00 +00:00
for (i = 0; sdl_overlay_pix_fmt_map[i].pix_fmt != AV_PIX_FMT_NONE; i++) {
if (sdl_overlay_pix_fmt_map[i].pix_fmt == par->format) {
2011-05-26 23:34:35 +00:00
sdl->overlay_fmt = sdl_overlay_pix_fmt_map[i].overlay_fmt;
break;
}
}
if (!sdl->overlay_fmt) {
av_log(s, AV_LOG_ERROR,
"Unsupported pixel format '%s', choose one of yuv420p, yuyv422, or uyvy422\n",
av_get_pix_fmt_name(par->format));
2011-05-26 23:34:35 +00:00
ret = AVERROR(EINVAL);
goto fail;
}
/* compute overlay width and height from the codec context information */
compute_overlay_rect(s);
2011-05-26 23:34:35 +00:00
sdl->init_cond = SDL_CreateCond();
if (!sdl->init_cond) {
av_log(s, AV_LOG_ERROR, "Could not create SDL condition variable: %s\n", SDL_GetError());
ret = AVERROR_EXTERNAL;
2011-05-26 23:34:35 +00:00
goto fail;
}
sdl->mutex = SDL_CreateMutex();
if (!sdl->mutex) {
av_log(s, AV_LOG_ERROR, "Could not create SDL mutex: %s\n", SDL_GetError());
ret = AVERROR_EXTERNAL;
goto fail;
}
sdl->event_thread = SDL_CreateThread(event_thread, s);
if (!sdl->event_thread) {
av_log(s, AV_LOG_ERROR, "Could not create SDL event thread: %s\n", SDL_GetError());
ret = AVERROR_EXTERNAL;
2011-05-26 23:34:35 +00:00
goto fail;
}
/* wait until the video system has been inited */
SDL_LockMutex(sdl->mutex);
while (!sdl->inited) {
SDL_CondWait(sdl->init_cond, sdl->mutex);
}
SDL_UnlockMutex(sdl->mutex);
if (sdl->init_ret < 0) {
ret = sdl->init_ret;
goto fail;
}
2011-05-26 23:34:35 +00:00
return 0;
fail:
sdl_write_trailer(s);
return ret;
}
static int sdl_write_packet(AVFormatContext *s, AVPacket *pkt)
{
SDLContext *sdl = s->priv_data;
AVCodecParameters *par = s->streams[0]->codecpar;
2016-02-02 01:25:38 +00:00
uint8_t *data[4];
int linesize[4];
2011-05-26 23:34:35 +00:00
int i;
2013-11-25 12:31:06 +00:00
if (sdl->quit) {
sdl_write_trailer(s);
return AVERROR(EIO);
2013-11-25 12:31:06 +00:00
}
av_image_fill_arrays(data, linesize, pkt->data, par->format, par->width, par->height, 1);
2011-05-26 23:34:35 +00:00
SDL_LockMutex(sdl->mutex);
2011-05-26 23:34:35 +00:00
SDL_FillRect(sdl->surface, &sdl->surface->clip_rect,
SDL_MapRGB(sdl->surface->format, 0, 0, 0));
SDL_LockYUVOverlay(sdl->overlay);
for (i = 0; i < 3; i++) {
2016-02-02 01:25:38 +00:00
sdl->overlay->pixels [i] = data [i];
sdl->overlay->pitches[i] = linesize[i];
2011-05-26 23:34:35 +00:00
}
SDL_DisplayYUVOverlay(sdl->overlay, &sdl->overlay_rect);
2011-05-26 23:34:35 +00:00
SDL_UnlockYUVOverlay(sdl->overlay);
SDL_UpdateRect(sdl->surface,
sdl->overlay_rect.x, sdl->overlay_rect.y,
sdl->overlay_rect.w, sdl->overlay_rect.h);
2013-11-25 12:31:06 +00:00
SDL_UnlockMutex(sdl->mutex);
2011-05-26 23:34:35 +00:00
return 0;
}
#define OFFSET(x) offsetof(SDLContext,x)
static const AVOption options[] = {
{ "window_title", "set SDL window title", OFFSET(window_title), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
{ "icon_title", "set SDL iconified window title", OFFSET(icon_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_INT, { .i64 = 0 }, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
2011-05-26 23:34:35 +00:00
{ NULL },
};
static const AVClass sdl_class = {
.class_name = "sdl outdev",
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT,
2011-05-26 23:34:35 +00:00
};
AVOutputFormat ff_sdl_muxer = {
.name = "sdl",
.long_name = NULL_IF_CONFIG_SMALL("SDL output device"),
.priv_data_size = sizeof(SDLContext),
Merge commit '36ef5369ee9b336febc2c270f8718cec4476cb85' * commit '36ef5369ee9b336febc2c270f8718cec4476cb85': Replace all CODEC_ID_* with AV_CODEC_ID_* lavc: add AV prefix to codec ids. Conflicts: doc/APIchanges doc/examples/decoding_encoding.c doc/examples/muxing.c ffmpeg.c ffprobe.c ffserver.c libavcodec/8svx.c libavcodec/avcodec.h libavcodec/dnxhd_parser.c libavcodec/dvdsubdec.c libavcodec/error_resilience.c libavcodec/h263dec.c libavcodec/libvorbisenc.c libavcodec/mjpeg_parser.c libavcodec/mjpegenc.c libavcodec/mpeg12.c libavcodec/mpeg4videodec.c libavcodec/mpegvideo.c libavcodec/mpegvideo_enc.c libavcodec/pcm.c libavcodec/r210dec.c libavcodec/utils.c libavcodec/v210dec.c libavcodec/version.h libavdevice/alsa-audio-dec.c libavdevice/bktr.c libavdevice/v4l2.c libavformat/asfdec.c libavformat/asfenc.c libavformat/avformat.h libavformat/avidec.c libavformat/caf.c libavformat/electronicarts.c libavformat/flacdec.c libavformat/flvdec.c libavformat/flvenc.c libavformat/framecrcenc.c libavformat/img2.c libavformat/img2dec.c libavformat/img2enc.c libavformat/ipmovie.c libavformat/isom.c libavformat/matroska.c libavformat/matroskadec.c libavformat/matroskaenc.c libavformat/mov.c libavformat/movenc.c libavformat/mp3dec.c libavformat/mpeg.c libavformat/mpegts.c libavformat/mxf.c libavformat/mxfdec.c libavformat/mxfenc.c libavformat/nsvdec.c libavformat/nut.c libavformat/oggenc.c libavformat/pmpdec.c libavformat/rawdec.c libavformat/rawenc.c libavformat/riff.c libavformat/sdp.c libavformat/utils.c libavformat/vocenc.c libavformat/wtv.c libavformat/xmv.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-07 20:45:46 +00:00
.audio_codec = AV_CODEC_ID_NONE,
.video_codec = AV_CODEC_ID_RAWVIDEO,
2011-05-26 23:34:35 +00:00
.write_header = sdl_write_header,
.write_packet = sdl_write_packet,
.write_trailer = sdl_write_trailer,
.flags = AVFMT_NOFILE | AVFMT_VARIABLE_FPS | AVFMT_NOTIMESTAMPS,
2011-05-26 23:34:35 +00:00
.priv_class = &sdl_class,
};