summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2009-01-15 05:07:09 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2009-01-15 05:57:31 +0200
commit9bcd12fdf5c6f85e9bb391caa2713021624a957e (patch)
tree375eac533ead90a45e7121e5ab307861b4ef52c8 /libvo
parentd419ecd161634e79dab3ac57d57c4bccba2adcdc (diff)
parente0d66b140e1da7a793bff15003cadab79544b1dd (diff)
downloadmpv-9bcd12fdf5c6f85e9bb391caa2713021624a957e.tar.bz2
mpv-9bcd12fdf5c6f85e9bb391caa2713021624a957e.tar.xz
Merge svn changes up to r28310
The libdvdread4 and libdvdnav directories, which are externals in the svn repository, are at least for now not included in any form. I added configure checks to automatically disable internal libdvdread and libdvdnav if the corresponding directories are not present; if they're added manually then things work the same as in svn.
Diffstat (limited to 'libvo')
-rw-r--r--libvo/font_load.c10
-rw-r--r--libvo/font_load.h11
-rw-r--r--libvo/font_load_ft.c14
-rw-r--r--libvo/gl_common.c2
-rw-r--r--libvo/mga_common.c2
-rw-r--r--libvo/old_vo_wrapper.c11
-rw-r--r--libvo/old_vo_wrapper.h3
-rw-r--r--libvo/sub.c65
-rw-r--r--libvo/sub.h8
-rw-r--r--libvo/vo_gif89a.c2
-rw-r--r--libvo/vo_gl.c3
-rw-r--r--libvo/vo_macosx.m31
-rw-r--r--libvo/vo_s3fb.c10
-rw-r--r--libvo/vo_xv.c22
-rw-r--r--libvo/vo_xvmc.c69
-rw-r--r--libvo/vo_xvr100.c8
-rw-r--r--libvo/w32_common.c10
-rw-r--r--libvo/x11_common.c19
-rw-r--r--libvo/x11_common.h2
19 files changed, 185 insertions, 117 deletions
diff --git a/libvo/font_load.c b/libvo/font_load.c
index 16a82dffc2..ba747dc7dc 100644
--- a/libvo/font_load.c
+++ b/libvo/font_load.c
@@ -336,11 +336,7 @@ fail_out:
return NULL;
}
-#if 0
-int main(void){
-
-read_font_desc("high_arpi.desc",1);
-
-}
+#ifndef CONFIG_FREETYPE
+void render_one_glyph(font_desc_t *desc, int c) {}
+int kerning(font_desc_t *desc, int prevc, int c) { return 0; }
#endif
-
diff --git a/libvo/font_load.h b/libvo/font_load.h
index 38c1e321ec..6bb4a175e3 100644
--- a/libvo/font_load.h
+++ b/libvo/font_load.h
@@ -63,8 +63,6 @@ typedef struct font_desc {
extern font_desc_t* vo_font;
-#ifdef CONFIG_FREETYPE
-
extern char *subtitle_font_encoding;
extern float text_font_scale_factor;
extern float osd_font_scale_factor;
@@ -80,7 +78,7 @@ extern int force_load_font;
int init_freetype(void);
int done_freetype(void);
-font_desc_t* read_font_desc_ft(const char* fname,int movie_width, int movie_height, float font_scale_factor);
+font_desc_t* read_font_desc_ft(const char* fname,int face_index,int movie_width, int movie_height, float font_scale_factor);
void free_font_desc(font_desc_t *desc);
void render_one_glyph(font_desc_t *desc, int c);
@@ -91,13 +89,6 @@ void load_font_ft(int width, int height, font_desc_t **desc, const char *name, f
void blur(unsigned char *buffer, unsigned short *tmp2, int width, int height,
int stride, int *m2, int r, int mwidth);
-#else
-
-static void render_one_glyph(font_desc_t *desc, int c) {}
-static int kerning(font_desc_t *desc, int prevc, int c) { return 0; }
-
-#endif
-
raw_file* load_raw(char *name,int verbose);
font_desc_t* read_font_desc(const char* fname,float factor,int verbose);
diff --git a/libvo/font_load_ft.c b/libvo/font_load_ft.c
index 9d887573da..67707dff7b 100644
--- a/libvo/font_load_ft.c
+++ b/libvo/font_load_ft.c
@@ -893,11 +893,11 @@ void free_font_desc(font_desc_t *desc)
free(desc);
}
-static int load_sub_face(const char *name, FT_Face *face)
+static int load_sub_face(const char *name, int face_index, FT_Face *face)
{
int err = -1;
- if (name) err = FT_New_Face(library, name, 0, face);
+ if (name) err = FT_New_Face(library, name, face_index, face);
if (err) {
char *font_file = get_path("subfont.ttf");
@@ -940,7 +940,7 @@ int kerning(font_desc_t *desc, int prevc, int c)
return f266ToInt(kern.x);
}
-font_desc_t* read_font_desc_ft(const char *fname, int movie_width, int movie_height, float font_scale_factor)
+font_desc_t* read_font_desc_ft(const char *fname, int face_index, int movie_width, int movie_height, float font_scale_factor)
{
font_desc_t *desc = NULL;
@@ -1002,7 +1002,7 @@ font_desc_t* read_font_desc_ft(const char *fname, int movie_width, int movie_hei
// t=GetTimer();
/* generate the subtitle font */
- err = load_sub_face(fname, &face);
+ err = load_sub_face(fname, face_index, &face);
if (err) {
mp_msg(MSGT_OSD, MSGL_WARN, MSGTR_LIBVO_FONT_LOAD_FT_SubFaceFailed);
goto gen_osd;
@@ -1128,6 +1128,7 @@ void load_font_ft(int width, int height, font_desc_t** fontp, const char *font_n
FcPattern *fc_pattern;
FcPattern *fc_pattern2;
FcChar8 *s;
+ int face_index;
FcBool scalable;
#endif
font_desc_t *vo_font = *fontp;
@@ -1163,10 +1164,11 @@ void load_font_ft(int width, int height, font_desc_t** fontp, const char *font_n
}
// s doesn't need to be freed according to fontconfig docs
FcPatternGetString(fc_pattern, FC_FILE, 0, &s);
- *fontp=read_font_desc_ft(s, width, height, font_scale_factor);
+ FcPatternGetInteger(fc_pattern, FC_INDEX, 0, &face_index);
+ *fontp=read_font_desc_ft(s, face_index, width, height, font_scale_factor);
FcPatternDestroy(fc_pattern);
}
else
#endif
- *fontp=read_font_desc_ft(font_name, width, height, font_scale_factor);
+ *fontp=read_font_desc_ft(font_name, 0, width, height, font_scale_factor);
}
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index 7ed22bd8e2..b65023f93e 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -1523,7 +1523,7 @@ void releaseGlContext(int *vinfo, HGLRC *context) {
*context = 0;
}
-void swapGlBuffers() {
+void swapGlBuffers(void) {
HDC vo_hdc = GetDC(vo_w32_window);
SwapBuffers(vo_hdc);
ReleaseDC(vo_w32_window, vo_hdc);
diff --git a/libvo/mga_common.c b/libvo/mga_common.c
index ef2240ac15..14fc47f754 100644
--- a/libvo/mga_common.c
+++ b/libvo/mga_common.c
@@ -209,7 +209,7 @@ query_format(uint32_t format)
}
#ifndef VO_XMGA
-static void mga_fullscreen()
+static void mga_fullscreen(void)
{
uint32_t w,h;
if ( !vo_fs ) {
diff --git a/libvo/old_vo_wrapper.c b/libvo/old_vo_wrapper.c
index 57d1145f53..bdbc8b8349 100644
--- a/libvo/old_vo_wrapper.c
+++ b/libvo/old_vo_wrapper.c
@@ -99,6 +99,17 @@ void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h,
osd_draw_text(global_osd, dxs, dys, draw_alpha_wrapper, draw_alpha);
}
+void vo_draw_text_ext(int dxs, int dys, int left_border, int top_border,
+ int right_border, int bottom_border, int orig_w, int orig_h,
+ void (*draw_alpha)(int x0, int y0, int w,int h,
+ unsigned char* src,
+ unsigned char *srca, int stride))
+{
+ osd_draw_text_ext(global_osd, dxs, dys, left_border, top_border,
+ right_border, bottom_border, orig_w, orig_h,
+ draw_alpha_wrapper, draw_alpha);
+}
+
int vo_update_osd(int dxs, int dys)
{
return osd_update(global_osd, dxs, dys);
diff --git a/libvo/old_vo_wrapper.h b/libvo/old_vo_wrapper.h
index e7e98fdad6..250a1187fe 100644
--- a/libvo/old_vo_wrapper.h
+++ b/libvo/old_vo_wrapper.h
@@ -21,6 +21,9 @@ void old_vo_check_events(struct vo *vo);
void old_vo_uninit(struct vo *vo);
void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride));
+void vo_draw_text_ext(int dxs, int dys, int left_border, int top_border,
+ int right_border, int bottom_border, int orig_w, int orig_h,
+ void (*draw_alpha)(int x0, int y0, int w,int h,unsigned char* src, unsigned char *srca, int stride));
int vo_update_osd(int dxs, int dys);
#endif
diff --git a/libvo/sub.c b/libvo/sub.c
index 423a3f84d9..369d1bbd50 100644
--- a/libvo/sub.c
+++ b/libvo/sub.c
@@ -227,13 +227,32 @@ void osd_set_nav_box (uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey) {
nav_hl.ey = ey;
}
-inline static void vo_update_nav (mp_osd_obj_t *obj, int dxs, int dys) {
+inline static void vo_update_nav (mp_osd_obj_t *obj, int dxs, int dys, int left_border, int top_border,
+ int right_border, int bottom_border, int orig_w, int orig_h) {
int len;
-
- obj->bbox.x1 = obj->x = nav_hl.sx;
- obj->bbox.y1 = obj->y = nav_hl.sy;
- obj->bbox.x2 = nav_hl.ex;
- obj->bbox.y2 = nav_hl.ey;
+ int sx = nav_hl.sx, sy = nav_hl.sy;
+ int ex = nav_hl.ex, ey = nav_hl.ey;
+ int scaled_w = dxs - left_border - right_border;
+ int scaled_h = dys - top_border - bottom_border;
+ if (scaled_w != orig_w) {
+ sx = sx * scaled_w / orig_w;
+ ex = ex * scaled_w / orig_w;
+ }
+ if (scaled_h != orig_h) {
+ sy = sy * scaled_h / orig_h;
+ ey = ey * scaled_h / orig_h;
+ }
+ sx += left_border; ex += left_border;
+ sy += top_border; ey += top_border;
+ sx = FFMIN(FFMAX(sx, 0), dxs);
+ ex = FFMIN(FFMAX(ex, 0), dxs);
+ sy = FFMIN(FFMAX(sy, 0), dys);
+ ey = FFMIN(FFMAX(ey, 0), dys);
+
+ obj->bbox.x1 = obj->x = sx;
+ obj->bbox.y1 = obj->y = sy;
+ obj->bbox.x2 = ex;
+ obj->bbox.y2 = ey;
alloc_buf (obj);
len = obj->stride * (obj->bbox.y2 - obj->bbox.y1);
@@ -1066,7 +1085,9 @@ void osd_free(struct osd_state *osd)
#define FONT_LOAD_DEFER 6
-int osd_update(struct osd_state *osd, int dxs, int dys)
+int osd_update_ext(struct osd_state *osd, int dxs, int dys, int left_border,
+ int top_border, int right_border, int bottom_border,
+ int orig_w, int orig_h)
{
mp_osd_obj_t* obj=vo_osd_list;
int chg=0;
@@ -1122,7 +1143,7 @@ int osd_update(struct osd_state *osd, int dxs, int dys)
switch(obj->type){
#ifdef CONFIG_DVDNAV
case OSDTYPE_DVDNAV:
- vo_update_nav(obj,dxs,dys);
+ vo_update_nav(obj,dxs,dys, left_border, top_border, right_border, bottom_border, orig_w, orig_h);
break;
#endif
case OSDTYPE_SUBTITLE:
@@ -1186,6 +1207,11 @@ int osd_update(struct osd_state *osd, int dxs, int dys)
return chg;
}
+int osd_update(struct osd_state *osd, int dxs, int dys)
+{
+ return osd_update_ext(osd, dxs, dys, 0, 0, 0, 0, dxs, dys);
+}
+
struct osd_state *osd_create(void)
{
struct osd_state *osd = talloc_zero(NULL, struct osd_state);
@@ -1234,14 +1260,18 @@ void osd_remove_text(struct osd_state *osd, int dxs, int dys,
}
}
-void osd_draw_text(struct osd_state *osd, int dxs, int dys,
- void (*draw_alpha)(void *ctx, int x0, int y0, int w, int h,
- unsigned char* src, unsigned char *srca,
- int stride),
+void osd_draw_text_ext(struct osd_state *osd, int dxs, int dys,
+ int left_border, int top_border, int right_border,
+ int bottom_border, int orig_w, int orig_h,
+ void (*draw_alpha)(void *ctx, int x0, int y0, int w,
+ int h, unsigned char* src,
+ unsigned char *srca,
+ int stride),
void *ctx)
{
mp_osd_obj_t* obj=vo_osd_list;
- osd_update(osd, dxs, dys);
+ osd_update_ext(osd, dxs, dys, left_border, top_border, right_border,
+ bottom_border, orig_w, orig_h);
while(obj){
if(obj->flags&OSDFLAG_VISIBLE){
vo_osd_changed_flag=obj->flags&OSDFLAG_CHANGED; // temp hack
@@ -1269,6 +1299,15 @@ void osd_draw_text(struct osd_state *osd, int dxs, int dys,
}
}
+void osd_draw_text(struct osd_state *osd, int dxs, int dys,
+ void (*draw_alpha)(void *ctx, int x0, int y0, int w, int h,
+ unsigned char* src, unsigned char *srca,
+ int stride),
+ void *ctx)
+{
+ osd_draw_text_ext(osd, dxs, dys, 0, 0, 0, 0, dxs, dys, draw_alpha, ctx);
+}
+
static int vo_osd_changed_status = 0;
int vo_osd_changed(int new_value)
diff --git a/libvo/sub.h b/libvo/sub.h
index 879e81e33a..83a2f87dbd 100644
--- a/libvo/sub.h
+++ b/libvo/sub.h
@@ -112,6 +112,14 @@ void osd_draw_text(struct osd_state *osd, int dxs, int dys,
unsigned char* src, unsigned char *srca,
int stride),
void *ctx);
+void osd_draw_text_ext(struct osd_state *osd, int dxs, int dys,
+ int left_border, int top_border, int right_border,
+ int bottom_border, int orig_w, int orig_h,
+ void (*draw_alpha)(void *ctx, int x0, int y0, int w,
+ int h, unsigned char* src,
+ unsigned char *srca,
+ int stride),
+ void *ctx);
void osd_remove_text(struct osd_state *osd, int dxs, int dys,
void (*remove)(int x0, int y0, int w, int h));
diff --git a/libvo/vo_gif89a.c b/libvo/vo_gif89a.c
index fcfe2974cc..c51e303a7b 100644
--- a/libvo/vo_gif89a.c
+++ b/libvo/vo_gif89a.c
@@ -244,7 +244,7 @@ static int config(uint32_t s_width, uint32_t s_height, uint32_t d_width,
}
// we do not draw osd.
-void draw_osd() {}
+void draw_osd(void) {}
// we do not handle events.
static void check_events(void) {}
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index 340b32b5a5..6d9c173f68 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -612,7 +612,8 @@ static void draw_osd(void)
clearOSD();
osd_w = scaled_osd ? image_width : vo_dwidth;
osd_h = scaled_osd ? image_height : vo_dheight;
- vo_draw_text(osd_w, osd_h, create_osd_texture);
+ vo_draw_text_ext(osd_w, osd_h, ass_border_x, ass_border_y, ass_border_x, ass_border_y,
+ image_width, image_height, create_osd_texture);
}
if (vo_doublebuffering) do_render_osd();
}
diff --git a/libvo/vo_macosx.m b/libvo/vo_macosx.m
index 83537e70c6..dcce691354 100644
--- a/libvo/vo_macosx.m
+++ b/libvo/vo_macosx.m
@@ -46,6 +46,8 @@ OSType pixelFormat;
//shared memory
int shm_fd;
BOOL shared_buffer = false;
+#define DEFAULT_BUFFER_NAME "mplayerosx"
+static char *buffer_name;
//Screen
int screen_id;
@@ -163,10 +165,13 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
}
else
{
+ mp_msg(MSGT_VO, MSGL_INFO, "VO: [macosx] writing output to a shared buffer "
+ "named \"%s\".\n",buffer_name);
+
movie_aspect = (float)d_width/(float)d_height;
// create shared memory
- shm_fd = shm_open("mplayerosx", O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
+ shm_fd = shm_open(buffer_name, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
if (shm_fd == -1)
{
mp_msg(MSGT_VO, MSGL_FATAL,
@@ -179,7 +184,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
{
mp_msg(MSGT_VO, MSGL_FATAL,
"vo_macosx: failed to size shared memory, possibly already in use. Error: %s\n", strerror(errno));
- shm_unlink("mplayerosx");
+ shm_unlink(buffer_name);
return 1;
}
@@ -190,12 +195,12 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
{
mp_msg(MSGT_VO, MSGL_FATAL,
"vo_macosx: failed to map shared memory. Error: %s\n", strerror(errno));
- shm_unlink("mplayerosx");
+ shm_unlink(buffer_name);
return 1;
}
//connnect to mplayerosx
- mplayerosxProxy=[NSConnection rootProxyForConnectionWithRegisteredName:@"mplayerosx" host:nil];
+ mplayerosxProxy=[NSConnection rootProxyForConnectionWithRegisteredName:[NSString stringWithCString:buffer_name] host:nil];
if ([mplayerosxProxy conformsToProtocol:@protocol(MPlayerOSXVOProto)]) {
[mplayerosxProxy setProtocolForProxy:@protocol(MPlayerOSXVOProto)];
mplayerosxProto = (id <MPlayerOSXVOProto>)mplayerosxProxy;
@@ -287,7 +292,7 @@ static void uninit(void)
if (munmap(image_data, image_width*image_height*image_bytes) == -1)
mp_msg(MSGT_VO, MSGL_FATAL, "uninit: munmap failed. Error: %s\n", strerror(errno));
- if (shm_unlink("mplayerosx") == -1)
+ if (shm_unlink(buffer_name) == -1)
mp_msg(MSGT_VO, MSGL_FATAL, "uninit: shm_unlink failed. Error: %s\n", strerror(errno));
}
@@ -313,11 +318,15 @@ static void uninit(void)
image_datas[1] = NULL;
image_data = NULL;
}
+
+ if (buffer_name) free(buffer_name);
+ buffer_name = NULL;
}
static opt_t subopts[] = {
{"device_id", OPT_ARG_INT, &screen_id, (opt_test_f)int_non_neg},
{"shared_buffer", OPT_ARG_BOOL, &shared_buffer, NULL},
+{"buffer_name", OPT_ARG_MSTRZ,&buffer_name, NULL},
{NULL}
};
@@ -327,16 +336,21 @@ static int preinit(const char *arg)
// set defaults
screen_id = 0;
shared_buffer = false;
+ buffer_name = NULL;
if (subopt_parse(arg, subopts) != 0) {
mp_msg(MSGT_VO, MSGL_FATAL,
"\n-vo macosx command line help:\n"
- "Example: mplayer -vo macosx:device_id=1:shared_buffer\n"
+ "Example: mplayer -vo macosx:device_id=1:shared_buffer:buffer_name=mybuff\n"
"\nOptions:\n"
" device_id=<0-...>\n"
" Set screen device id for fullscreen.\n"
" shared_buffer\n"
" Write output to a shared memory buffer instead of displaying it.\n"
+ " buffer_name=<name>\n"
+ " Name of the shared buffer created with shm_open() as well as\n"
+ " the name of the NSConnection MPlayer will try to open.\n"
+ " Setting buffer_name implicitly enables shared_buffer.\n"
"\n" );
return -1;
}
@@ -346,6 +360,11 @@ static int preinit(const char *arg)
NSApp = [NSApplication sharedApplication];
isLeopardOrLater = floor(NSAppKitVersionNumber) > 824;
+ if (!buffer_name)
+ buffer_name = strdup(DEFAULT_BUFFER_NAME);
+ else
+ shared_buffer = true;
+
if(!shared_buffer)
{
#if !defined (CONFIG_MACOSX_FINDER) || !defined (CONFIG_SDL)
diff --git a/libvo/vo_s3fb.c b/libvo/vo_s3fb.c
index 7cd36fe762..da2408f146 100644
--- a/libvo/vo_s3fb.c
+++ b/libvo/vo_s3fb.c
@@ -71,7 +71,7 @@ static uint32_t in_width, in_height, in_format, in_depth, in_s3_format,
static char *inpage, *inpage0, *smem = NULL;
static void (*alpha_func)();
-static void clear_screen();
+static void clear_screen(void);
/* streams registers */
#define PSTREAM_CONTROL_REG 0x8180
@@ -116,7 +116,7 @@ void writecrtc(int reg, int value) {
}
// enable S3 registers
-int enable() {
+int enable(void) {
int fd;
if (v)
@@ -148,7 +148,7 @@ int enable() {
return 0;
}
-void disable() {
+void disable(void) {
if (v) {
writecrtc(0x53, v->cr53);
writecrtc(0x39, v->cr39);
@@ -227,7 +227,7 @@ int yuv_on(int format, int src_w, int src_h, int dst_x, int dst_y, int dst_w, in
return offset;
}
-void yuv_off() {
+void yuv_off(void) {
writecrtc(0x67, readcrtc(0x67) & ~0xc);
memset(v->mmio + 0x8180, 0, 0x80);
OUTREG(0x81b8, 0x900);
@@ -328,7 +328,7 @@ static void uninit(void)
}
}
-static void clear_screen()
+static void clear_screen(void)
{
if (inpage0) {
int n;
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index 9c4dd391df..541c6521ca 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -162,24 +162,6 @@ static void draw_alpha_null(void *p, int x0, int y0, int w, int h,
static void deallocate_xvimage(struct vo *vo, int foo);
-static void calc_drwXY(struct vo *vo, uint32_t *drwX, uint32_t *drwY)
-{
- struct MPOpts *opts = vo->opts;
- *drwX = *drwY = 0;
- if (vo_fs) {
- aspect(vo, &vo->dwidth, &vo->dheight, A_ZOOM);
- vo->dwidth = FFMIN(vo->dwidth, opts->vo_screenwidth);
- vo->dheight = FFMIN(vo->dheight, opts->vo_screenheight);
- *drwX = (opts->vo_screenwidth - vo->dwidth) / 2;
- *drwY = (opts->vo_screenheight - vo->dheight) / 2;
- mp_msg(MSGT_VO, MSGL_V, "[xv-fs] dx: %d dy: %d dw: %d dh: %d\n", *drwX,
- *drwY, vo->dwidth, vo->dheight);
- } else if (WinID == 0) {
- *drwX = vo->dx;
- *drwY = vo->dy;
- }
-}
-
/*
* connect to server, create and map window,
* allocate colors and (shared) memory
@@ -307,7 +289,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0)
vo_fs = 1;
- calc_drwXY(vo, &ctx->drwX, &ctx->drwY);
+ vo_calc_drwXY(vo, &ctx->drwX, &ctx->drwY);
panscan_calc(vo);
@@ -429,7 +411,7 @@ static void check_events(struct vo *vo)
int e = vo_x11_check_events(vo);
if (e & VO_EVENT_RESIZE)
- calc_drwXY(vo, &ctx->drwX, &ctx->drwY);
+ vo_calc_drwXY(vo, &ctx->drwX, &ctx->drwY);
if (e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) {
vo_xv_draw_colorkey(vo, ctx->drwX - (vo->panscan_x >> 1),
diff --git a/libvo/vo_xvmc.c b/libvo/vo_xvmc.c
index 89fb2e6fe8..ebc3b6be3d 100644
--- a/libvo/vo_xvmc.c
+++ b/libvo/vo_xvmc.c
@@ -84,13 +84,13 @@ static XvMCMacroBlockArray mv_blocks;
#define MAX_SURFACES 8
static int number_of_surfaces=0;
static XvMCSurface surface_array[MAX_SURFACES];
-static xvmc_render_state_t * surface_render;
+static struct xvmc_render_state * surface_render;
-static xvmc_render_state_t * p_render_surface_to_show=NULL;
-static xvmc_render_state_t * p_render_surface_visible=NULL;
+static struct xvmc_render_state * p_render_surface_to_show=NULL;
+static struct xvmc_render_state * p_render_surface_visible=NULL;
//display queue, kinda render ahead
-static xvmc_render_state_t * show_queue[MAX_SURFACES];
+static struct xvmc_render_state * show_queue[MAX_SURFACES];
static int free_element;
@@ -117,8 +117,8 @@ static const struct{
static void xvmc_free(void);
static void xvmc_clean_surfaces(void);
-static int count_free_surfaces();
-static xvmc_render_state_t * find_free_surface();
+static int count_free_surfaces(void);
+static struct xvmc_render_state * find_free_surface(void);
static const vo_info_t info = {
"XVideo Motion Compensation",
@@ -175,7 +175,7 @@ static void allocate_xvimage(int xvimage_width,int xvimage_height,int xv_format)
return;
}
-static void deallocate_xvimage()
+static void deallocate_xvimage(void)
{
#ifdef HAVE_SHM
if ( Shmem_Flag )
@@ -346,13 +346,13 @@ surface_found:
}
static uint32_t xvmc_draw_image(mp_image_t *mpi){
-xvmc_render_state_t * rndr;
+ struct xvmc_render_state * rndr;
assert(mpi!=NULL);
assert(mpi->flags &MP_IMGFLAG_DIRECT);
// assert(mpi->flags &MP_IMGFLAGS_DRAWBACK);
- rndr = (xvmc_render_state_t*)mpi->priv;//there is copy in plane[2]
+ rndr = (struct xvmc_render_state*)mpi->priv;//there is copy in plane[2]
assert( rndr != NULL );
assert( rndr->magic == MP_XVMC_RENDER_MAGIC );
if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
@@ -431,22 +431,6 @@ opt_t subopts [] =
return 0;
}
-static void calc_drwXY(uint32_t *drwX, uint32_t *drwY) {
- *drwX = *drwY = 0;
- if (vo_fs) {
- aspect(&vo_dwidth, &vo_dheight, A_ZOOM);
- vo_dwidth = FFMIN(vo_dwidth, vo_screenwidth);
- vo_dheight = FFMIN(vo_dheight, vo_screenheight);
- *drwX = (vo_screenwidth - vo_dwidth) / 2;
- *drwY = (vo_screenheight - vo_dheight) / 2;
- mp_msg(MSGT_VO, MSGL_V, "[xvmc-fs] dx: %d dy: %d dw: %d dh: %d\n",
- *drwX, *drwY, vo_dwidth, vo_dheight);
- } else if (WinID == 0) {
- *drwX = vo_dx;
- *drwY = vo_dy;
- }
-}
-
static int config(uint32_t width, uint32_t height,
uint32_t d_width, uint32_t d_height,
uint32_t flags, char *title, uint32_t format){
@@ -520,8 +504,8 @@ int vm = flags & VOFLAG_MODESWITCHING;
printf("vo_xvmc: mv_blocks allocated\n");
if(surface_render==NULL)
- surface_render=malloc(MAX_SURFACES*sizeof(xvmc_render_state_t));//easy mem debug
- memset(surface_render,0,MAX_SURFACES*sizeof(xvmc_render_state_t));
+ surface_render=malloc(MAX_SURFACES*sizeof(struct xvmc_render_state));//easy mem debug
+ memset(surface_render,0,MAX_SURFACES*sizeof(struct xvmc_render_state));
for(i=0; i<MAX_SURFACES; i++){
rez=XvMCCreateSurface(mDisplay,&ctx,&surface_array[i]);
@@ -674,7 +658,7 @@ skip_surface_allocation:
}
if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) vo_fs = 1;
- calc_drwXY(&drwX, &drwY);
+ vo_calc_drwXY(&drwX, &drwY);
panscan_calc();
@@ -699,7 +683,7 @@ static int draw_frame(uint8_t *srcp[]){
assert(0);
}
-static void init_osd_yuv_pal(){
+static void init_osd_yuv_pal(void) {
char * palette;
int rez;
int i,j;
@@ -745,7 +729,7 @@ int rez;
printf("vo_xvmc: XvMCClearSubpicture failed!\n");
}
-static void OSD_init(){
+static void OSD_init(void) {
unsigned short osd_height, osd_width;
int rez;
@@ -850,7 +834,7 @@ int rez;
}
static void draw_osd(void){
-xvmc_render_state_t * osd_rndr;
+struct xvmc_render_state * osd_rndr;
int osd_has_changed;
int have_osd_to_draw;
int rez;
@@ -945,7 +929,8 @@ int status,rez;
XvMCSyncSurface(mDisplay, srf);
}
-static void put_xvmc_image(xvmc_render_state_t * p_render_surface, int draw_ck){
+static void put_xvmc_image(struct xvmc_render_state * p_render_surface,
+ int draw_ck){
int rez;
int clipX,clipY,clipW,clipH;
int i;
@@ -1034,7 +1019,7 @@ int e=vo_x11_check_events(mDisplay);
{
e |= VO_EVENT_EXPOSE;
- calc_drwXY(&drwX, &drwY);
+ vo_calc_drwXY(&drwX, &drwY);
}
if ( e & VO_EVENT_EXPOSE )
{
@@ -1071,7 +1056,7 @@ int i;
surface_render[i].state);
}
- memset(surface_render,0,MAX_SURFACES*sizeof(xvmc_render_state_t));//for debuging
+ memset(surface_render,0,MAX_SURFACES*sizeof(struct xvmc_render_state));//for debuging
free(surface_render);surface_render=NULL;
XvMCDestroyContext(mDisplay,&ctx);
@@ -1127,13 +1112,13 @@ int mode_id;
static int draw_slice(uint8_t *image[], int stride[],
int w, int h, int x, int y){
-xvmc_render_state_t * rndr;
+struct xvmc_render_state * rndr;
int rez;
if( mp_msg_test(MSGT_VO,MSGL_DBG4) )
printf("vo_xvmc: draw_slice y=%d\n",y);
- rndr = (xvmc_render_state_t*)image[2];//this is copy of priv-ate
+ rndr = (struct xvmc_render_state*)image[2];//this is copy of priv-ate
assert( rndr != NULL );
assert( rndr->magic == MP_XVMC_RENDER_MAGIC );
@@ -1187,8 +1172,8 @@ int rez;
//XvMCHide hides the surface on next retrace, so
//check if the surface is not still displaying
-static void check_osd_source(xvmc_render_state_t * src_rndr){
-xvmc_render_state_t * osd_rndr;
+static void check_osd_source(struct xvmc_render_state * src_rndr){
+struct xvmc_render_state * osd_rndr;
int stat;
//If this is source surface, check does the OSD rendering is compleate
if(src_rndr->state & MP_XVMC_STATE_OSD_SOURCE){
@@ -1200,7 +1185,7 @@ int stat;
src_rndr->state &= ~MP_XVMC_STATE_OSD_SOURCE;
}
}
-static int count_free_surfaces(){
+static int count_free_surfaces(void) {
int i,num;
num=0;
for(i=0; i<number_of_surfaces; i++){
@@ -1211,10 +1196,10 @@ int i,num;
return num;
}
-static xvmc_render_state_t * find_free_surface(){
+static struct xvmc_render_state * find_free_surface(void) {
int i,t;
int stat;
-xvmc_render_state_t * visible_rndr;
+struct xvmc_render_state * visible_rndr;
visible_rndr = NULL;
for(i=0; i<number_of_surfaces; i++){
@@ -1264,7 +1249,7 @@ int i;
}
static uint32_t get_image(mp_image_t *mpi){
-xvmc_render_state_t * rndr;
+ struct xvmc_render_state * rndr;
rndr = find_free_surface();
diff --git a/libvo/vo_xvr100.c b/libvo/vo_xvr100.c
index 433c30290a..7a82c436fb 100644
--- a/libvo/vo_xvr100.c
+++ b/libvo/vo_xvr100.c
@@ -135,7 +135,7 @@ static uint32_t pfb_colorkey;
-void pfb_overlay_on() {
+void pfb_overlay_on(void) {
int h_inc, h_step, ecp_div;
pfb_vregs[PFB_CLOCK_CNTL_INDEX] = (pfb_vregs[PFB_CLOCK_CNTL_INDEX] & ~0x0000003f) | 0x00000008;
@@ -192,11 +192,11 @@ void pfb_overlay_on() {
pfb_vregs[PFB_OV0_AUTO_FLIP_CNTL] = PFB_OV0_AUTO_FLIP_BUF0;
}
-void pfb_overlay_off() {
+void pfb_overlay_off(void) {
pfb_vregs[PFB_OV0_SCALE_CNTL] = 0;
}
-void center_overlay() {
+void center_overlay(void) {
if (pfb_xres > pfb_dstwidth) {
pfb_wx0 = (pfb_xres - pfb_dstwidth) / 2;
pfb_wx1 = pfb_wx0 + pfb_dstwidth;
@@ -321,7 +321,7 @@ static void uninit(void)
munmap(pfb_vregs, PFB_REGS_MMAPLEN);
}
-static uint32_t pfb_fullscreen() {
+static uint32_t pfb_fullscreen(void) {
if (!pfb_fs) {
aspect(&pfb_dstwidth,&pfb_dstheight, A_ZOOM);
pfb_fs = 1;
diff --git a/libvo/w32_common.c b/libvo/w32_common.c
index e51fd6d2c0..36fc344576 100644
--- a/libvo/w32_common.c
+++ b/libvo/w32_common.c
@@ -54,6 +54,16 @@ static const struct keymap vk_map[] = {
{VK_INSERT, KEY_INSERT}, {VK_DELETE, KEY_DELETE}, {VK_HOME, KEY_HOME}, {VK_END, KEY_END},
{VK_PRIOR, KEY_PAGE_UP}, {VK_NEXT, KEY_PAGE_DOWN},
+ // F-keys
+ {VK_F1, KEY_F+1}, {VK_F2, KEY_F+2}, {VK_F3, KEY_F+3}, {VK_F4, KEY_F+4},
+ {VK_F5, KEY_F+5}, {VK_F6, KEY_F+6}, {VK_F7, KEY_F+7}, {VK_F8, KEY_F+8},
+ {VK_F9, KEY_F+9}, {VK_F10, KEY_F+10}, {VK_F11, KEY_F+11}, {VK_F1, KEY_F+12},
+ // numpad
+ {VK_NUMPAD0, KEY_KP0}, {VK_NUMPAD1, KEY_KP1}, {VK_NUMPAD2, KEY_KP2},
+ {VK_NUMPAD3, KEY_KP3}, {VK_NUMPAD4, KEY_KP4}, {VK_NUMPAD5, KEY_KP5},
+ {VK_NUMPAD6, KEY_KP6}, {VK_NUMPAD7, KEY_KP7}, {VK_NUMPAD8, KEY_KP8},
+ {VK_NUMPAD9, KEY_KP9}, {VK_DECIMAL, KEY_KPDEC},
+
{0, 0}
};
diff --git a/libvo/x11_common.c b/libvo/x11_common.c
index 2c9677c997..7939adabac 100644
--- a/libvo/x11_common.c
+++ b/libvo/x11_common.c
@@ -9,6 +9,7 @@
#include "options.h"
#include "mp_msg.h"
#include "mp_fifo.h"
+#include "libavutil/common.h"
#include "x11_common.h"
#include "talloc.h"
@@ -1850,6 +1851,24 @@ uint32_t vo_x11_get_equalizer(char *name, int *value)
return VO_TRUE;
}
+void vo_calc_drwXY(struct vo *vo, uint32_t *drwX, uint32_t *drwY)
+{
+ struct MPOpts *opts = vo->opts;
+ *drwX = *drwY = 0;
+ if (vo_fs) {
+ aspect(vo, &vo->dwidth, &vo->dheight, A_ZOOM);
+ vo->dwidth = FFMIN(vo->dwidth, opts->vo_screenwidth);
+ vo->