summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
Diffstat (limited to 'libvo')
-rw-r--r--libvo/aspect.c123
-rw-r--r--libvo/aspect.h34
-rw-r--r--libvo/font_load.h1
-rw-r--r--libvo/font_load_ft.c4
-rw-r--r--libvo/gl_common.c1
-rw-r--r--libvo/gl_common.h8
-rw-r--r--libvo/mga_common.c28
-rw-r--r--libvo/old_vo_defines.h22
-rw-r--r--libvo/old_vo_wrapper.c105
-rw-r--r--libvo/old_vo_wrapper.h26
-rw-r--r--libvo/spuenc.c47
-rw-r--r--libvo/spuenc.h1
-rw-r--r--libvo/sub.c80
-rw-r--r--libvo/sub.h30
-rw-r--r--libvo/vesa_lvo.c12
-rw-r--r--libvo/vesa_lvo.h4
-rw-r--r--libvo/video_out.c323
-rw-r--r--libvo/video_out.h135
-rw-r--r--libvo/video_out_internal.h22
-rw-r--r--libvo/vo_3dfx.c2
-rw-r--r--libvo/vo_aa.c52
-rw-r--r--libvo/vo_bl.c2
-rw-r--r--libvo/vo_caca.c2
-rw-r--r--libvo/vo_cvidix.c22
-rw-r--r--libvo/vo_dfbmga.c22
-rw-r--r--libvo/vo_dga.c2
-rw-r--r--libvo/vo_direct3d.c2
-rw-r--r--libvo/vo_directfb2.c22
-rw-r--r--libvo/vo_directx.c23
-rw-r--r--libvo/vo_dxr2.c17
-rw-r--r--libvo/vo_dxr3.c41
-rw-r--r--libvo/vo_fbdev.c26
-rw-r--r--libvo/vo_fbdev2.c2
-rw-r--r--libvo/vo_ggi.c12
-rw-r--r--libvo/vo_gif89a.c2
-rw-r--r--libvo/vo_gl.c26
-rw-r--r--libvo/vo_gl2.c24
-rw-r--r--libvo/vo_ivtv.c4
-rw-r--r--libvo/vo_jpeg.c14
-rw-r--r--libvo/vo_macosx.m10
-rw-r--r--libvo/vo_md5sum.c8
-rw-r--r--libvo/vo_mpegpes.c11
-rw-r--r--libvo/vo_null.c2
-rw-r--r--libvo/vo_png.c69
-rw-r--r--libvo/vo_pnm.c18
-rw-r--r--libvo/vo_quartz.c6
-rw-r--r--libvo/vo_s3fb.c2
-rw-r--r--libvo/vo_sdl.c2
-rw-r--r--libvo/vo_svga.c31
-rw-r--r--libvo/vo_tdfx_vid.c2
-rw-r--r--libvo/vo_tdfxfb.c2
-rw-r--r--libvo/vo_tga.c2
-rw-r--r--libvo/vo_v4l2.c4
-rw-r--r--libvo/vo_vesa.c32
-rw-r--r--libvo/vo_wii.c2
-rw-r--r--libvo/vo_winvidix.c31
-rw-r--r--libvo/vo_x11.c22
-rw-r--r--libvo/vo_xover.c44
-rw-r--r--libvo/vo_xv.c714
-rw-r--r--libvo/vo_xvidix.c28
-rw-r--r--libvo/vo_xvmc.c22
-rw-r--r--libvo/vo_xvr100.c2
-rw-r--r--libvo/vo_yuv4mpeg.c2
-rw-r--r--libvo/vo_zr.c2
-rw-r--r--libvo/vo_zr2.c2
-rw-r--r--libvo/vosub_vidix.c66
-rw-r--r--libvo/vosub_vidix.h4
-rw-r--r--libvo/w32_common.c17
-rw-r--r--libvo/x11_common.c1094
-rw-r--r--libvo/x11_common.h188
70 files changed, 1917 insertions, 1849 deletions
diff --git a/libvo/aspect.c b/libvo/aspect.c
index dfed30d976..5a2091baba 100644
--- a/libvo/aspect.c
+++ b/libvo/aspect.c
@@ -1,9 +1,11 @@
/* Stuff for correct aspect scaling. */
#include "aspect.h"
#include "geometry.h"
+#include "video_out.h"
//#ifndef ASPECT_TEST
#include "mp_msg.h"
#include "help_mp.h"
+#include "options.h"
//#endif
//#define ASPECT_DEBUG
@@ -12,80 +14,66 @@
#include <stdio.h>
#endif
-int vo_panscan_x = 0;
-int vo_panscan_y = 0;
-float vo_panscan_amount = 0;
-float vo_panscanrange = 1.0;
-
#include "video_out.h"
-float force_monitor_aspect=0;
-float monitor_aspect=0;
-float monitor_pixel_aspect=1;
-extern float movie_aspect;
-
-static struct {
- int orgw; // real width
- int orgh; // real height
- int prew; // prescaled width
- int preh; // prescaled height
- int scrw; // horizontal resolution
- int scrh; // vertical resolution
- float asp;
-} aspdat;
-
-void aspect_save_orig(int orgw, int orgh){
+void aspect_save_orig(struct vo *vo, int orgw, int orgh)
+{
#ifdef ASPECT_DEBUG
printf("aspect_save_orig %dx%d \n",orgw,orgh);
#endif
- aspdat.orgw = orgw;
- aspdat.orgh = orgh;
+ vo->aspdat.orgw = orgw;
+ vo->aspdat.orgh = orgh;
}
-void aspect_save_prescale(int prew, int preh){
+void aspect_save_prescale(struct vo *vo, int prew, int preh)
+{
#ifdef ASPECT_DEBUG
printf("aspect_save_prescale %dx%d \n",prew,preh);
#endif
- aspdat.prew = prew;
- aspdat.preh = preh;
+ vo->aspdat.prew = prew;
+ vo->aspdat.preh = preh;
}
-void aspect_save_screenres(int scrw, int scrh){
+void aspect_save_screenres(struct vo *vo, int scrw, int scrh)
+{
#ifdef ASPECT_DEBUG
printf("aspect_save_screenres %dx%d \n",scrw,scrh);
#endif
- aspdat.scrw = scrw;
- aspdat.scrh = scrh;
- if (force_monitor_aspect)
- monitor_aspect = force_monitor_aspect;
- else
- monitor_aspect = monitor_pixel_aspect * scrw / scrh;
+ struct MPOpts *opts = vo->opts;
+ vo->aspdat.scrw = scrw;
+ vo->aspdat.scrh = scrh;
+ if (opts->force_monitor_aspect)
+ vo->monitor_aspect = opts->force_monitor_aspect;
+ else
+ vo->monitor_aspect = opts->monitor_pixel_aspect * scrw / scrh;
}
/* aspect is called with the source resolution and the
* resolution, that the scaled image should fit into
*/
-void aspect_fit(int *srcw, int *srch, int fitw, int fith){
+void aspect_fit(struct vo *vo, int *srcw, int *srch, int fitw, int fith)
+{
+ struct aspect_data *aspdat = &vo->aspdat;
int tmpw;
#ifdef ASPECT_DEBUG
- printf("aspect(0) fitin: %dx%d screenaspect: %.2f\n",aspdat.scrw,aspdat.scrh,
+ printf("aspect(0) fitin: %dx%d screenaspect: %.2f\n",aspdat->scrw,aspdat->scrh,
monitor_aspect);
- printf("aspect(1) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat.prew,aspdat.preh);
+ printf("aspect(1) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat->prew,aspdat->preh);
#endif
*srcw = fitw;
- *srch = (int)(((float)fitw / (float)aspdat.prew * (float)aspdat.preh)
- * ((float)aspdat.scrh / ((float)aspdat.scrw / monitor_aspect)));
+ *srch = (int)(((float)fitw / (float)aspdat->prew * (float)aspdat->preh)
+ * ((float)aspdat->scrh / ((float)aspdat->scrw / vo->monitor_aspect)));
*srch+= *srch%2; // round
#ifdef ASPECT_DEBUG
- printf("aspect(2) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat.prew,aspdat.preh);
+ printf("aspect(2) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat->prew,aspdat->preh);
#endif
- if(*srch>aspdat.scrh || *srch<aspdat.orgh){
- tmpw = (int)(((float)fith / (float)aspdat.preh * (float)aspdat.prew)
- * ((float)aspdat.scrw / ((float)aspdat.scrh / (1.0/monitor_aspect))));
+ if(*srch>aspdat->scrh || *srch<aspdat->orgh){
+ tmpw = (int)(((float)fith / (float)aspdat->preh * (float)aspdat->prew)
+ * ((float)aspdat->scrw / ((float)aspdat->scrh / (1.0/vo->monitor_aspect))));
tmpw+= tmpw%2; // round
- if(tmpw<=aspdat.scrw /*&& tmpw>=aspdat.orgw*/){
+ if(tmpw<=aspdat->scrw /*&& tmpw>=aspdat->orgw*/){
*srch = fith;
*srcw = tmpw;
}else{
@@ -96,47 +84,48 @@ void aspect_fit(int *srcw, int *srch, int fitw, int fith){
#endif
}
}
- aspdat.asp=*srcw / (float)*srch;
+ aspdat->asp=*srcw / (float)*srch;
#ifdef ASPECT_DEBUG
- printf("aspect(3) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat.prew,aspdat.preh);
+ printf("aspect(3) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat->prew,aspdat->preh);
#endif
}
-void aspect(int *srcw, int *srch, int zoom){
- int fitw = zoom ? aspdat.scrw : aspdat.prew;
- int fith = zoom ? aspdat.scrh : aspdat.preh;
+void aspect(struct vo *vo, int *srcw, int *srch, int zoom){
+ int fitw = zoom ? vo->aspdat.scrw : vo->aspdat.prew;
+ int fith = zoom ? vo->aspdat.scrh : vo->aspdat.preh;
if( !zoom && geometry_wh_changed ) {
#ifdef ASPECT_DEBUG
printf("aspect(0) no aspect forced!\n");
#endif
return; // the user doesn't want to fix aspect
}
- aspect_fit(srcw, srch, fitw, fith);
+ aspect_fit(vo, srcw, srch, fitw, fith);
}
-void panscan_init( void )
+void panscan_init(struct vo *vo)
{
- vo_panscan_x=0;
- vo_panscan_y=0;
- vo_panscan_amount=0.0f;
+ vo->panscan_x = 0;
+ vo->panscan_y = 0;
+ vo->panscan_amount = 0.0f;
}
-void panscan_calc( void )
+void panscan_calc(struct vo *vo)
{
int fwidth,fheight;
int vo_panscan_area;
-
- if (vo_panscanrange > 0) {
- aspect(&fwidth,&fheight,A_ZOOM);
- vo_panscan_area = (aspdat.scrh-fheight);
- if (!vo_panscan_area)
- vo_panscan_area = aspdat.scrw - fwidth;
- vo_panscan_area *= vo_panscanrange;
- } else
- vo_panscan_area = -vo_panscanrange * aspdat.scrh;
-
- vo_panscan_amount = vo_fs ? vo_panscan : 0;
- vo_panscan_x = vo_panscan_area * vo_panscan_amount * aspdat.asp;
- vo_panscan_y = vo_panscan_area * vo_panscan_amount;
+ struct MPOpts *opts = vo->opts;
+
+ if (opts->vo_panscanrange > 0) {
+ aspect(vo, &fwidth, &fheight, A_ZOOM);
+ vo_panscan_area = (vo->aspdat.scrh - fheight);
+ if (!vo_panscan_area)
+ vo_panscan_area = vo->aspdat.scrw - fwidth;
+ vo_panscan_area *= opts->vo_panscanrange;
+ } else
+ vo_panscan_area = -opts->vo_panscanrange * vo->aspdat.scrh;
+
+ vo->panscan_amount = vo_fs ? vo_panscan : 0;
+ vo->panscan_x = vo_panscan_area * vo->panscan_amount * vo->aspdat.asp;
+ vo->panscan_y = vo_panscan_area * vo->panscan_amount;
}
diff --git a/libvo/aspect.h b/libvo/aspect.h
index 952cd01466..5fa313d7ff 100644
--- a/libvo/aspect.h
+++ b/libvo/aspect.h
@@ -2,23 +2,35 @@
#define MPLAYER_ASPECT_H
/* Stuff for correct aspect scaling. */
-extern int vo_panscan_x;
-extern int vo_panscan_y;
-extern float vo_panscan_amount;
+struct vo;
+void panscan_init(struct vo *vo);
+void panscan_calc(struct vo *vo);
-void panscan_init(void);
-void panscan_calc(void);
+void aspect_save_orig(struct vo *vo, int orgw, int orgh);
-void aspect_save_orig(int orgw, int orgh);
+void aspect_save_prescale(struct vo *vo, int prew, int preh);
-void aspect_save_prescale(int prew, int preh);
-
-void aspect_save_screenres(int scrw, int scrh);
+void aspect_save_screenres(struct vo *vo, int scrw, int scrh);
#define A_ZOOM 1
#define A_NOZOOM 0
-void aspect(int *srcw, int *srch, int zoom);
-void aspect_fit(int *srcw, int *srch, int fitw, int fith);
+void aspect(struct vo *vo, int *srcw, int *srch, int zoom);
+void aspect_fit(struct vo *vo, int *srcw, int *srch, int fitw, int fith);
+
+
+#ifdef IS_OLD_VO
+#define vo_panscan_x global_vo->panscan_x
+#define vo_panscan_y global_vo->panscan_y
+#define vo_panscan_amount global_vo->panscan_amount
+#define monitor_aspect global_vo->monitor_aspect
+
+#define panscan_init() panscan_init(global_vo)
+#define panscan_calc() panscan_calc(global_vo)
+#define aspect_save_orig(...) aspect_save_orig(global_vo, __VA_ARGS__)
+#define aspect_save_prescale(...) aspect_save_prescale(global_vo, __VA_ARGS__)
+#define aspect_save_screenres(...) aspect_save_screenres(global_vo, __VA_ARGS__)
+#define aspect(...) aspect(global_vo, __VA_ARGS__)
+#endif
#endif /* MPLAYER_ASPECT_H */
diff --git a/libvo/font_load.h b/libvo/font_load.h
index df3000efb5..38c1e321ec 100644
--- a/libvo/font_load.h
+++ b/libvo/font_load.h
@@ -62,7 +62,6 @@ typedef struct font_desc {
} font_desc_t;
extern font_desc_t* vo_font;
-extern font_desc_t* sub_font;
#ifdef CONFIG_FREETYPE
diff --git a/libvo/font_load_ft.c b/libvo/font_load_ft.c
index f5926ca277..9d887573da 100644
--- a/libvo/font_load_ft.c
+++ b/libvo/font_load_ft.c
@@ -70,13 +70,13 @@ static FT_Library library;
#define OSD_CHARSET_SIZE 15
-static FT_ULong osd_charset[OSD_CHARSET_SIZE] =
+static const FT_ULong osd_charset[OSD_CHARSET_SIZE] =
{
0xe001, 0xe002, 0xe003, 0xe004, 0xe005, 0xe006, 0xe007, 0xe008,
0xe009, 0xe00a, 0xe00b, 0xe010, 0xe011, 0xe012, 0xe013
};
-static FT_ULong osd_charcodes[OSD_CHARSET_SIZE] =
+static const FT_ULong osd_charcodes[OSD_CHARSET_SIZE] =
{
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
0x09,0x0a,0x0b,0x10,0x11,0x12,0x13
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index fd85c3d6bf..7ed22bd8e2 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -32,6 +32,7 @@
#include <string.h>
#include <ctype.h>
#include <math.h>
+#include "old_vo_defines.h"
#include "gl_common.h"
#include "libavutil/common.h"
diff --git a/libvo/gl_common.h b/libvo/gl_common.h
index 31a21a5ff0..2fcb8568ad 100644
--- a/libvo/gl_common.h
+++ b/libvo/gl_common.h
@@ -332,18 +332,18 @@ void glDisableYUVConversion(GLenum target, int type);
/** \} */
#ifdef GL_WIN32
-#define vo_border() vo_w32_border()
+#define vo_gl_border(vo) vo_w32_border()
#define vo_check_events() vo_w32_check_events()
#define vo_fullscreen() vo_w32_fullscreen()
-#define vo_ontop() vo_w32_ontop()
+#define vo_gl_ontop() vo_w32_ontop()
#define vo_uninit() vo_w32_uninit()
int setGlWindow(int *vinfo, HGLRC *context, HWND win);
void releaseGlContext(int *vinfo, HGLRC *context);
#else
-#define vo_border() vo_x11_border()
+#define vo_gl_border(vo) vo_x11_border(vo)
#define vo_check_events() vo_x11_check_events(mDisplay)
#define vo_fullscreen() vo_x11_fullscreen()
-#define vo_ontop() vo_x11_ontop()
+#define vo_gl_ontop() vo_x11_ontop()
#define vo_uninit() vo_x11_uninit()
int setGlWindow(XVisualInfo **vinfo, GLXContext *context, Window win);
void releaseGlContext(XVisualInfo **vinfo, GLXContext *context);
diff --git a/libvo/mga_common.c b/libvo/mga_common.c
index e7705025b5..34eee958e3 100644
--- a/libvo/mga_common.c
+++ b/libvo/mga_common.c
@@ -6,6 +6,7 @@
#include "libmpcodecs/vf_scale.h"
#include "mp_msg.h"
#include "help_mp.h"
+#include "old_vo_wrapper.h"
// mga_vid drawing functions
static void set_window( void ); /* forward declaration to kill warnings */
@@ -229,7 +230,7 @@ static void mga_fullscreen()
}
#endif
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
@@ -240,11 +241,12 @@ static int control(uint32_t request, void *data, ...)
return draw_image(data);
case VOCTRL_SET_EQUALIZER:
{
- va_list ap;
short value;
uint32_t luma,prev;
+ struct voctrl_set_equalizer_args *args = data;
- if ( strcmp( data,"brightness" ) && strcmp( data,"contrast" ) ) return VO_FALSE;
+ if (strcmp(args->name, "brightness") && strcmp(args->name, "contrast"))
+ return VO_FALSE;
if (ioctl(f,MGA_VID_GET_LUMA,&prev)) {
perror("Error in mga_vid_config ioctl()");
@@ -254,15 +256,13 @@ static int control(uint32_t request, void *data, ...)
// printf("GET: 0x%4X 0x%4X \n",(prev>>16),(prev&0xffff));
- va_start(ap, data);
- value = va_arg(ap, int);
- va_end(ap);
+ value = args->value;
// printf("value: %d -> ",value);
value=((value+100)*255)/200-128; // maps -100=>-128 and +100=>127
// printf("%d \n",value);
- if(!strcmp(data,"contrast"))
+ if (!strcmp(args->name, "contrast"))
luma = (prev&0xFFFF0000)|(value&0xFFFF);
else
luma = (prev&0xFFFF)|(value<<16);
@@ -278,12 +278,12 @@ static int control(uint32_t request, void *data, ...)
case VOCTRL_GET_EQUALIZER:
{
- va_list ap;
- int * value;
short val;
uint32_t luma;
+ struct voctrl_get_equalizer_args *args = data;
- if ( strcmp( data,"brightness" ) && strcmp( data,"contrast" ) ) return VO_FALSE;
+ if (strcmp(args->name, "brightness") && strcmp(args->name, "contrast"))
+ return VO_FALSE;
if (ioctl(f,MGA_VID_GET_LUMA,&luma)) {
perror("Error in mga_vid_config ioctl()");
@@ -291,16 +291,12 @@ static int control(uint32_t request, void *data, ...)
return VO_FALSE;
}
- if ( !strcmp( data,"contrast" ) )
+ if (!strcmp(args->name, "contrast"))
val=(luma & 0xFFFF);
else
val=(luma >> 16);
- va_start(ap, data);
- value = va_arg(ap, int*);
- va_end(ap);
-
- *value = (val*200)/255;
+ *args->valueptr = (val*200)/255;
return VO_TRUE;
}
diff --git a/libvo/old_vo_defines.h b/libvo/old_vo_defines.h
new file mode 100644
index 0000000000..fd266c1896
--- /dev/null
+++ b/libvo/old_vo_defines.h
@@ -0,0 +1,22 @@
+#ifndef MPLAYER_OLD_VO_DEFINES_H
+#define MPLAYER_OLD_VO_DEFINES_H
+
+#include "options.h"
+#include "video_out.h"
+#include "old_vo_wrapper.h"
+
+// Triggers more defines in x11_common.h
+#define IS_OLD_VO 1
+
+#define vo_ontop global_vo->opts->vo_ontop
+#define vo_config_count global_vo->config_count
+#define vo_dx global_vo->dx
+#define vo_dy global_vo->dy
+#define vo_dwidth global_vo->dwidth
+#define vo_dheight global_vo->dheight
+#define vo_dbpp global_vo->opts->vo_dbpp
+#define vo_screenwidth global_vo->opts->vo_screenwidth
+#define vo_screenheight global_vo->opts->vo_screenheight
+#define vidmode global_vo->opts->vidmode
+#define movie_aspect global_vo->opts->movie_aspect
+#endif
diff --git a/libvo/old_vo_wrapper.c b/libvo/old_vo_wrapper.c
new file mode 100644
index 0000000000..57d1145f53
--- /dev/null
+++ b/libvo/old_vo_wrapper.c
@@ -0,0 +1,105 @@
+/*
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+
+#include <stdint.h>
+#include "old_vo_wrapper.h"
+#include "video_out.h"
+#include "sub.h"
+
+struct vo *global_vo;
+struct osd_state *global_osd;
+
+int old_vo_preinit(struct vo *vo, const char *arg)
+{
+ global_vo = vo