summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
Diffstat (limited to 'libvo')
-rw-r--r--libvo/font_load_ft.c2
-rw-r--r--libvo/geometry.c4
-rw-r--r--libvo/vo_corevideo.m16
-rw-r--r--libvo/vo_fbdev.c71
4 files changed, 43 insertions, 50 deletions
diff --git a/libvo/font_load_ft.c b/libvo/font_load_ft.c
index d116d6cf11..f44c2c5796 100644
--- a/libvo/font_load_ft.c
+++ b/libvo/font_load_ft.c
@@ -71,7 +71,7 @@ int vo_image_height = 0;
int force_load_font;
int using_freetype = 0;
-int font_fontconfig = 0;
+int font_fontconfig = 1;
//// constants
static unsigned int const colors = 256;
diff --git a/libvo/geometry.c b/libvo/geometry.c
index 189c351fc5..e8f0826bf9 100644
--- a/libvo/geometry.c
+++ b/libvo/geometry.c
@@ -30,7 +30,7 @@ char *vo_geometry = NULL;
int geometry_wh_changed = 0;
int geometry_xy_changed = 0;
-#define RESET_GEOMETRY width = height = xoff = yoff = xper = yper = -1;
+#define RESET_GEOMETRY width = height = xoff = yoff = xper = yper = INT_MIN;
// xpos,ypos: position of the left upper corner
// widw,widh: width and height of the window
@@ -39,7 +39,7 @@ int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh)
{
int width, height, xoff, yoff, xper, yper;
- width = height = xoff = yoff = xper = yper = INT_MIN;
+ RESET_GEOMETRY
if(vo_geometry != NULL) {
if(sscanf(vo_geometry, "%ix%i+%i+%i", &width, &height, &xoff, &yoff) != 4 )
diff --git a/libvo/vo_corevideo.m b/libvo/vo_corevideo.m
index a9667fa4ed..7967921467 100644
--- a/libvo/vo_corevideo.m
+++ b/libvo/vo_corevideo.m
@@ -229,7 +229,8 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
static void check_events(void)
{
- [mpGLView check_events];
+ if (mpGLView)
+ [mpGLView check_events];
}
static void draw_osd(void)
@@ -239,9 +240,11 @@ static void draw_osd(void)
static void flip_page(void)
{
- if(shared_buffer)
+ if(shared_buffer) {
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
[mplayerosxProto render];
- else {
+ [pool release];
+ } else {
[mpGLView setCurrentTexture];
[mpGLView render];
if (vo_doublebuffering) {
@@ -367,10 +370,7 @@ static int preinit(const char *arg)
return -1;
}
- NSApplicationLoad();
autoreleasepool = [[NSAutoreleasePool alloc] init];
- NSApp = [NSApplication sharedApplication];
- isLeopardOrLater = floor(NSAppKitVersionNumber) > 824;
if (!buffer_name)
buffer_name = strdup(DEFAULT_BUFFER_NAME);
@@ -379,6 +379,10 @@ static int preinit(const char *arg)
if(!shared_buffer)
{
+ NSApplicationLoad();
+ NSApp = [NSApplication sharedApplication];
+ isLeopardOrLater = floor(NSAppKitVersionNumber) > 824;
+
#if !defined (CONFIG_MACOSX_FINDER) || !defined (CONFIG_SDL)
//this chunk of code is heavily based off SDL_macosx.m from SDL
ProcessSerialNumber myProc, frProc;
diff --git a/libvo/vo_fbdev.c b/libvo/vo_fbdev.c
index a5e51c31f0..12700108aa 100644
--- a/libvo/vo_fbdev.c
+++ b/libvo/vo_fbdev.c
@@ -46,6 +46,7 @@
#endif
#include "aspect.h"
#include "mp_msg.h"
+#include "libavutil/common.h"
static const vo_info_t info = {
"Framebuffer Device",
@@ -185,7 +186,7 @@ static int parse_fbmode_cfg(char *cfgfile)
return -1;
}
- if ((line = (char *) malloc(MAX_LINE_LEN + 1)) == NULL) {
+ if ((line = malloc(MAX_LINE_LEN + 1)) == NULL) {
mp_msg(MSGT_VO, MSGL_V, "can't get memory for 'line': %s\n", strerror(errno));
return -2;
}
@@ -212,7 +213,7 @@ static int parse_fbmode_cfg(char *cfgfile)
if (!validate_mode(mode))
goto err_out_not_valid;
loop_enter:
- if (!(fb_modes = (fb_mode_t *)
+ if (!(fb_modes =
realloc(fb_modes, sizeof(fb_mode_t) * (nr_modes + 1)))) {
mp_msg(MSGT_VO, MSGL_V, "can't realloc 'fb_modes' (nr_modes = %d):"
" %s\n", nr_modes, strerror(errno));
@@ -491,7 +492,7 @@ static fb_mode_t *find_best_mode(int xres, int yres, range_t *hfreq,
static void set_bpp(struct fb_var_screeninfo *p, int bpp)
{
- p->bits_per_pixel = (bpp + 1) & ~1;
+ p->bits_per_pixel = FFALIGN(bpp, 2);
p->red.msb_right = p->green.msb_right = p->blue.msb_right = p->transp.msb_right = 0;
p->transp.offset = p->transp.length = 0;
p->blue.offset = 0;
@@ -555,7 +556,6 @@ static fb_mode_t *fb_mode = NULL;
/* vt related variables */
static FILE *vt_fp = NULL;
-static int vt_doit = 1;
/* vo_fbdev related variables */
static int fb_dev_fd;
@@ -610,8 +610,7 @@ static struct fb_cmap *make_directcolor_cmap(struct fb_var_screeninfo *var)
bcols = 1 << var->blue.length;
/* Make our palette the length of the deepest color */
- cols = (rcols > gcols ? rcols : gcols);
- cols = (cols > bcols ? cols : bcols);
+ cols = FFMAX3(rcols, gcols, bcols);
red = malloc(cols * sizeof(red[0]));
if (!red) {
@@ -673,6 +672,8 @@ static int fb_preinit(int reset)
if (fb_preinit_done)
return fb_works;
+ fb_dev_fd = fb_tty_fd = -1;
+
if (!fb_dev_name && !(fb_dev_name = getenv("FRAMEBUFFER")))
fb_dev_name = strdup("/dev/fb0");
mp_msg(MSGT_VO, MSGL_V, "using %s\n", fb_dev_name);
@@ -683,7 +684,7 @@ static int fb_preinit(int reset)
}
if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo)) {
mp_msg(MSGT_VO, MSGL_ERR, "Can't get VSCREENINFO: %s\n", strerror(errno));
- goto err_out_fd;
+ goto err_out;
}
fb_orig_vinfo = fb_vinfo;
@@ -696,13 +697,13 @@ static int fb_preinit(int reset)
if (fb_bpp == 8 && !vo_dbpp) {
mp_msg(MSGT_VO, MSGL_ERR, "8 bpp output is not supported.\n");
- goto err_out_tty_fd;
+ goto err_out;
}
if (vo_dbpp) {
if (vo_dbpp != 15 && vo_dbpp != 16 && vo_dbpp != 24 && vo_dbpp != 32) {
mp_msg(MSGT_VO, MSGL_ERR, "can't switch to %d bpp\n", vo_dbpp);
- goto err_out_fd;
+ goto err_out;
}
fb_bpp = vo_dbpp;
}
@@ -713,13 +714,13 @@ static int fb_preinit(int reset)
fb_preinit_done = 1;
fb_works = 1;
return 1;
-err_out_tty_fd:
+err_out:
+ if (fb_tty_fd != -1)
close(fb_tty_fd);
fb_tty_fd = -1;
-err_out_fd:
+ if (fb_dev_fd != -1)
close(fb_dev_fd);
fb_dev_fd = -1;
-err_out:
fb_preinit_done = 1;
fb_works = 0;
return 0;
@@ -747,7 +748,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
struct fb_cmap *cmap;
int vm = flags & VOFLAG_MODESWITCHING;
int zoom = flags & VOFLAG_SWSCALE;
- int vt_fd;
fs = flags & VOFLAG_FULLSCREEN;
@@ -763,7 +763,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
mp_msg(MSGT_VO, MSGL_ERR, "-fbmode can only be used with -vm\n");
return 1;
}
- if (vm && (parse_fbmode_cfg(fb_mode_cfgfile) < 0))
+ if (vm && parse_fbmode_cfg(fb_mode_cfgfile) < 0)
return 1;
if (d_width && (fs || vm)) {
out_width = d_width;
@@ -949,8 +949,8 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
int x_offset = 0, y_offset = 0;
geometry(&x_offset, &y_offset, &out_width, &out_height, fb_xres, fb_yres);
- frame_buffer = (uint8_t *) mmap(0, fb_size, PROT_READ | PROT_WRITE,
- MAP_SHARED, fb_dev_fd, 0);
+ frame_buffer = mmap(0, fb_size, PROT_READ | PROT_WRITE,
+ MAP_SHARED, fb_dev_fd, 0);
if (frame_buffer == (uint8_t *) -1) {
mp_msg(MSGT_VO, MSGL_ERR, "Can't mmap %s: %s\n", fb_dev_name, strerror(errno));
return 1;
@@ -968,17 +968,11 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
if (fs || vm)
memset(frame_buffer, '\0', fb_line_len * fb_yres);
}
- if (vt_doit && (vt_fd = open("/dev/tty", O_WRONLY)) == -1) {
- mp_msg(MSGT_VO, MSGL_ERR, "can't open /dev/tty: %s\n", strerror(errno));
- vt_doit = 0;
- }
- if (vt_doit && !(vt_fp = fdopen(vt_fd, "w"))) {
- mp_msg(MSGT_VO, MSGL_ERR, "can't fdopen /dev/tty: %s\n", strerror(errno));
- vt_doit = 0;
+ if (!(vt_fp = fopen("/dev/tty", "w"))) {
+ mp_msg(MSGT_VO, MSGL_ERR, "can't fopen /dev/tty: %s\n", strerror(errno));
}
- if (vt_doit)
- vt_set_textarea(last_row, fb_yres);
+ vt_set_textarea(last_row, fb_yres);
return 0;
}
@@ -1017,17 +1011,11 @@ static int draw_frame(uint8_t *src[])
static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y)
{
- uint8_t *d, *s;
+ uint8_t *d;
d = center + fb_line_len * y + fb_pixel_size * x;
- s = src[0];
- while (h) {
- fast_memcpy(d, s, w * fb_pixel_size);
- d += fb_line_len;
- s += stride[0];
- h--;
- }
+ memcpy_pic2(d, src[0], w * fb_pixel_size, h, fb_line_len, stride[0], 1);
return 0;
}
@@ -1062,8 +1050,9 @@ static void uninit(void)
if (ioctl(fb_tty_fd, KDSETMODE, KD_TEXT) < 0)
mp_msg(MSGT_VO, MSGL_WARN, "Can't restore text mode: %s\n", strerror(errno));
}
- if (vt_doit)
- vt_set_textarea(0, fb_orig_vinfo.yres);
+ vt_set_textarea(0, fb_orig_vinfo.yres);
+ if (vt_fp)
+ fclose(vt_fp);
close(fb_tty_fd);
close(fb_dev_fd);
if (frame_buffer)
@@ -1096,19 +1085,19 @@ static int preinit(const char *vo_subdevice)
}
}
if (!pre_init_err)
- return pre_init_err = (fb_preinit(0) ? 0 : -1);
+ return pre_init_err = fb_preinit(0) ? 0 : -1;
return -1;
}
static uint32_t get_image(mp_image_t *mpi)
{
if (!IMGFMT_IS_BGR(mpi->imgfmt) ||
- (IMGFMT_BGR_DEPTH(mpi->imgfmt) != fb_bpp) ||
- ((mpi->type != MP_IMGTYPE_STATIC) && (mpi->type != MP_IMGTYPE_TEMP)) ||
+ IMGFMT_BGR_DEPTH(mpi->imgfmt) != fb_bpp ||
+ (mpi->type != MP_IMGTYPE_STATIC && mpi->type != MP_IMGTYPE_TEMP) ||
(mpi->flags & MP_IMGFLAG_PLANAR) ||
(mpi->flags & MP_IMGFLAG_YUV) ||
- (mpi->width != in_width) ||
- (mpi->height != in_height)
+ mpi->width != in_width ||
+ mpi->height != in_height
)
return VO_FALSE;
@@ -1124,7 +1113,7 @@ static int control(uint32_t request, void *data)
case VOCTRL_GET_IMAGE:
return get_image(data);
case VOCTRL_QUERY_FORMAT:
- return query_format(*((uint32_t*)data));
+ return query_format(*(uint32_t*)data);
}
#ifdef CONFIG_VIDIX