diff options
Diffstat (limited to 'libvo')
82 files changed, 3920 insertions, 3432 deletions
diff --git a/libvo/aclib.c b/libvo/aclib.c index 377dff9fce..7328de794a 100644 --- a/libvo/aclib.c +++ b/libvo/aclib.c @@ -27,7 +27,7 @@ #include <string.h> #include "cpudetect.h" #include "fastmemcpy.h" -#include "libavutil/x86_cpu.h" +#include "ffmpeg_files/x86_cpu.h" #undef memcpy #define BLOCK_SIZE 4096 diff --git a/libvo/aclib_template.c b/libvo/aclib_template.c index ba9ee484db..db3015ae66 100644 --- a/libvo/aclib_template.c +++ b/libvo/aclib_template.c @@ -458,4 +458,3 @@ static void * RENAME(mem2agpcpy)(void * to, const void * from, size_t len) if(len) small_memcpy(to, from, len); return retval; } - diff --git a/libvo/aspect.c b/libvo/aspect.c index 9ddc105aee..1b1e5857f3 100644 --- a/libvo/aspect.c +++ b/libvo/aspect.c @@ -19,9 +19,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 @@ -30,157 +32,147 @@ #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; - -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>fith || *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>fith || *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<=fitw /*&& tmpw>=aspdat.orgw*/){ + if(tmpw<=fitw /*&& tmpw>=aspdat->orgw*/){ *srch = fith; *srcw = tmpw; }else{ #ifndef ASPECT_TEST - mp_msg(MSGT_VO,MSGL_WARN,MSGTR_LIBVO_ASPECT_NoSuitableNewResFound); + mp_tmsg(MSGT_VO,MSGL_WARN,"[ASPECT] Warning: No suitable new res found!\n"); #else - mp_msg(MSGT_VO,MSGL_WARN,MSGTR_LIBVO_ASPECT_NoNewSizeFoundThatFitsIntoRes); + mp_tmsg(MSGT_VO,MSGL_WARN,"[ASPECT] Error: No new size found that fits into res!\n"); #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 } -static void get_max_dims(int *w, int *h, int zoom) +static void get_max_dims(struct vo *vo, int *w, int *h, int zoom) { - *w = zoom ? aspdat.scrw : aspdat.prew; - *h = zoom ? aspdat.scrh : aspdat.preh; + struct aspect_data *aspdat = &vo->aspdat; + *w = zoom ? aspdat->scrw : aspdat->prew; + *h = zoom ? aspdat->scrh : aspdat->preh; if (zoom && WinID >= 0) zoom = A_WINZOOM; if (zoom == A_WINZOOM) { - *w = vo_dwidth; - *h = vo_dheight; + *w = vo->dwidth; + *h = vo->dheight; } } -void aspect(int *srcw, int *srch, int zoom){ +void aspect(struct vo *vo, int *srcw, int *srch, int zoom) +{ int fitw; int fith; - get_max_dims(&fitw, &fith, zoom); + get_max_dims(vo, &fitw, &fith, zoom); 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; } -static void panscan_calc_internal(int zoom) +static void panscan_calc_internal(struct vo *vo, int zoom) { int fwidth,fheight; int vo_panscan_area; int max_w, max_h; - get_max_dims(&max_w, &max_h, zoom); - - if (vo_panscanrange > 0) { - aspect(&fwidth,&fheight,zoom); - vo_panscan_area = max_h - fheight; - if (!vo_panscan_area) - vo_panscan_area = max_w - fwidth; - vo_panscan_area *= vo_panscanrange; - } else - vo_panscan_area = -vo_panscanrange * max_h; - - vo_panscan_amount = vo_fs || zoom == A_WINZOOM ? vo_panscan : 0; - vo_panscan_x = vo_panscan_area * vo_panscan_amount * aspdat.asp; - vo_panscan_y = vo_panscan_area * vo_panscan_amount; + get_max_dims(vo, &max_w, &max_h, zoom); + struct MPOpts *opts = vo->opts; + + if (opts->vo_panscanrange > 0) { + aspect(vo, &fwidth, &fheight, zoom); + vo_panscan_area = max_h - fheight; + if (!vo_panscan_area) + vo_panscan_area = max_w - fwidth; + vo_panscan_area *= opts->vo_panscanrange; + } else + vo_panscan_area = -opts->vo_panscanrange * max_h; + + vo->panscan_amount = vo_fs || zoom == A_WINZOOM ? vo_panscan : 0; + vo->panscan_x = vo_panscan_area * vo->panscan_amount * vo->aspdat.asp; + vo->panscan_y = vo_panscan_area * vo->panscan_amount; } -void panscan_calc(void) +void panscan_calc(struct vo *vo) { - panscan_calc_internal(A_ZOOM); + panscan_calc_internal(vo, A_ZOOM); } /** * vos that set vo_dwidth and v_dheight correctly should call this to update * vo_panscan_x and vo_panscan_y */ -void panscan_calc_windowed(void) +void panscan_calc_windowed(struct vo *vo) { - panscan_calc_internal(A_WINZOOM); + panscan_calc_internal(vo, A_WINZOOM); } diff --git a/libvo/aspect.h b/libvo/aspect.h index 0654d86c9f..07f928a9ff 100644 --- a/libvo/aspect.h +++ b/libvo/aspect.h @@ -20,25 +20,38 @@ #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_calc_windowed(struct vo *vo); -void panscan_init(void); -void panscan_calc(void); -void panscan_calc_windowed(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_WINZOOM 2 ///< zoom to fill window size #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 panscan_calc_windowed() panscan_calc_windowed(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/aspecttest.c b/libvo/aspecttest.c index fcd912bb28..b73e8c589c 100644 --- a/libvo/aspecttest.c +++ b/libvo/aspecttest.c @@ -63,4 +63,3 @@ int main(int argc, char *argv[]) { printf("new size: %dx%d\n",w,h); return 0; } - diff --git a/libvo/font_load.h b/libvo/font_load.h index ebd03c0963..7efe067aaf 100644 --- a/libvo/font_load.h +++ b/libvo/font_load.h @@ -82,7 +82,6 @@ typedef struct font_desc { } font_desc_t; extern font_desc_t* vo_font; -extern font_desc_t* sub_font; extern char *subtitle_font_encoding; extern float text_font_scale_factor; diff --git a/libvo/font_load_ft.c b/libvo/font_load_ft.c index 2b4caad215..1ddd15d268 100644 --- a/libvo/font_load_ft.c +++ b/libvo/font_load_ft.c @@ -84,13 +84,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 @@ -920,7 +920,7 @@ static int load_sub_face(const char *name, int face_index, FT_Face *face) if (err) { err = FT_New_Face(library, MPLAYER_DATADIR "/subfont.ttf", 0, face); if (err) { - mp_msg(MSGT_OSD, MSGL_ERR, MSGTR_LIBVO_FONT_LOAD_FT_NewFaceFailed); + mp_tmsg(MSGT_OSD, MSGL_ERR, "New_Face failed. Maybe the font path is wrong.\nPlease supply the text font file (~/.mplayer/subfont.ttf).\n"); return -1; } } @@ -931,7 +931,7 @@ static int load_sub_face(const char *name, int face_index, FT_Face *face) static int load_osd_face(FT_Face *face) { if ( FT_New_Memory_Face(library, osd_font_pfb, sizeof(osd_font_pfb), 0, face) ) { - mp_msg(MSGT_OSD, MSGL_ERR, MSGTR_LIBVO_FONT_LOAD_FT_NewMemoryFac |