aboutsummaryrefslogtreecommitdiffhomepage
path: root/libvo
diff options
context:
space:
mode:
Diffstat (limited to 'libvo')
-rw-r--r--libvo/cocoa_common.m2
-rw-r--r--libvo/gl_common.c76
-rw-r--r--libvo/gl_common.h1
-rw-r--r--libvo/gtf.c304
-rw-r--r--libvo/gtf.h66
-rw-r--r--libvo/matrixview_font.h606
-rw-r--r--libvo/mga_template.c581
-rw-r--r--libvo/sdl_common.c214
-rw-r--r--libvo/sdl_common.h38
-rw-r--r--libvo/spuenc.c237
-rw-r--r--libvo/spuenc.h38
-rw-r--r--libvo/vesa_lvo.c317
-rw-r--r--libvo/vesa_lvo.h34
-rw-r--r--libvo/video_out.c86
-rw-r--r--libvo/video_out.h14
-rw-r--r--libvo/vo_3dfx.c506
-rw-r--r--libvo/vo_aa.c755
-rw-r--r--libvo/vo_bl.c479
-rw-r--r--libvo/vo_dfbmga.c1536
-rw-r--r--libvo/vo_dga.c999
-rw-r--r--libvo/vo_dxr3.c1321
-rw-r--r--libvo/vo_fbdev.c1091
-rw-r--r--libvo/vo_fbdev2.c412
-rw-r--r--libvo/vo_ggi.c591
-rw-r--r--libvo/vo_gl.c8
-rw-r--r--libvo/vo_ivtv.c305
-rw-r--r--libvo/vo_ivtv.h34
-rw-r--r--libvo/vo_mga.c117
-rw-r--r--libvo/vo_mpegpes.c251
-rw-r--r--libvo/vo_s3fb.c560
-rw-r--r--libvo/vo_sdl.c1534
-rw-r--r--libvo/vo_svga.c670
-rw-r--r--libvo/vo_tdfx_vid.c667
-rw-r--r--libvo/vo_tdfxfb.c529
-rw-r--r--libvo/vo_vesa.c1029
-rw-r--r--libvo/vo_wii.c362
-rw-r--r--libvo/vo_xmga.c196
-rw-r--r--libvo/vo_xover.c427
-rw-r--r--libvo/vo_xv.c2
-rw-r--r--libvo/vo_xvr100.c451
-rw-r--r--libvo/x11_common.c3
41 files changed, 4 insertions, 17445 deletions
diff --git a/libvo/cocoa_common.m b/libvo/cocoa_common.m
index 9a822cc4ea..6e2b439a77 100644
--- a/libvo/cocoa_common.m
+++ b/libvo/cocoa_common.m
@@ -376,13 +376,11 @@ int vo_cocoa_check_events(struct vo *vo)
// Without SDL's bootstrap code (include SDL.h in mplayer.c),
// on Leopard, we have trouble to get the play window automatically focused
// when the app is actived. The Following code fix this problem.
-#ifndef CONFIG_SDL
if ([event type] == NSAppKitDefined
&& [event subtype] == NSApplicationActivatedEventType) {
[s->window makeMainWindow];
[s->window makeKeyAndOrderFront:nil];
}
-#endif
return 0;
}
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index 621bfa39a8..1c156277dc 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -2306,59 +2306,6 @@ static void swapGlBuffers_x11(MPGLContext *ctx)
}
#endif
-#ifdef CONFIG_GL_SDL
-#include "sdl_common.h"
-
-static int create_window_sdl(struct MPGLContext *ctx, uint32_t d_width,
- uint32_t d_height, uint32_t flags)
-{
- SDL_WM_SetCaption(vo_get_window_title(ctx->vo), NULL);
- ctx->vo->dwidth = d_width;
- ctx->vo->dheight = d_height;
- return 0;
-}
-
-static void swapGlBuffers_sdl(MPGLContext *ctx)
-{
- SDL_GL_SwapBuffers();
-}
-
-static void *sdlgpa(const GLubyte *name)
-{
- return SDL_GL_GetProcAddress(name);
-}
-
-static int setGlWindow_sdl(MPGLContext *ctx)
-{
- if (sdl_set_mode(0, SDL_OPENGL | SDL_RESIZABLE) < 0)
- return SET_WINDOW_FAILED;
- SDL_GL_LoadLibrary(NULL);
- getFunctions(ctx->gl, sdlgpa, NULL, false);
- return SET_WINDOW_OK;
-}
-
-static void releaseGlContext_sdl(MPGLContext *ctx)
-{
-}
-
-static int sdl_check_events(struct vo *vo)
-{
- int res = 0;
- SDL_Event event;
- while (SDL_PollEvent(&event))
- res |= sdl_default_handle_event(&event);
- // poll "events" from within MPlayer code
- res |= sdl_default_handle_event(NULL);
- if (res & VO_EVENT_RESIZE)
- sdl_set_mode(0, SDL_OPENGL | SDL_RESIZABLE);
- return res;
-}
-
-static void new_sdl_update_xinerama_info(struct vo *vo) { sdl_update_xinerama_info(); }
-static void new_vo_sdl_fullscreen(struct vo *vo) { vo_sdl_fullscreen(); }
-static void new_vo_sdl_uninit(struct vo *vo) { vo_sdl_uninit(); }
-
-#endif
struct backend {
const char *name;
@@ -2370,13 +2317,11 @@ static struct backend backends[] = {
{"cocoa", GLTYPE_COCOA},
{"win", GLTYPE_W32},
{"x11", GLTYPE_X11},
- {"sdl", GLTYPE_SDL},
// mplayer-svn aliases (note that mplayer-svn couples these with the numeric
// values of the internal GLTYPE_* constants)
{"-1", GLTYPE_AUTO},
{ "0", GLTYPE_W32},
{ "1", GLTYPE_X11},
- { "2", GLTYPE_SDL},
{0}
};
@@ -2400,10 +2345,7 @@ MPGLContext *init_mpglcontext(enum MPGLType type, struct vo *vo)
ctx = init_mpglcontext(GLTYPE_W32, vo);
if (ctx)
return ctx;
- ctx = init_mpglcontext(GLTYPE_X11, vo);
- if (ctx)
- return ctx;
- return init_mpglcontext(GLTYPE_SDL, vo);
+ return init_mpglcontext(GLTYPE_X11, vo);
}
ctx = talloc_zero(NULL, MPGLContext);
ctx->gl = talloc_zero(ctx, GL);
@@ -2462,22 +2404,6 @@ MPGLContext *init_mpglcontext(enum MPGLType type, struct vo *vo)
return ctx;
break;
#endif
-#ifdef CONFIG_GL_SDL
- case GLTYPE_SDL:
- ctx->create_window = create_window_sdl;
- ctx->setGlWindow = setGlWindow_sdl;
- ctx->releaseGlContext = releaseGlContext_sdl;
- ctx->swapGlBuffers = swapGlBuffers_sdl;
- ctx->update_xinerama_info = new_sdl_update_xinerama_info;
- ctx->check_events = sdl_check_events;
- ctx->fullscreen = new_vo_sdl_fullscreen;
- ctx->vo_uninit = new_vo_sdl_uninit;
- //the SDL code is hardcoded to use the deprecated vo API
- global_vo = vo;
- if (vo_sdl_init())
- return ctx;
- break;
-#endif
}
talloc_free(ctx);
return NULL;
diff --git a/libvo/gl_common.h b/libvo/gl_common.h
index f0e5912dd9..546127c91f 100644
--- a/libvo/gl_common.h
+++ b/libvo/gl_common.h
@@ -162,7 +162,6 @@ enum MPGLType {
GLTYPE_COCOA,
GLTYPE_W32,
GLTYPE_X11,
- GLTYPE_SDL,
};
enum {
diff --git a/libvo/gtf.c b/libvo/gtf.c
deleted file mode 100644
index 6dd64a57c8..0000000000
--- a/libvo/gtf.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * GTF calculations formulas are taken from GTF_V1R1.xls
- * created by ANDY.MORRISH@NSC.COM
- *
- * copyright (C) 2002 Rudolf Marek <r.marek@assembler.cz>
- *
- * 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.
- */
-
-//Version 0.4
-#include "config.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include "gtf.h"
-
-#undef GTF_DEBUG
-
-#ifdef GTF_DEBUG
-#define DEBUG_PRINTF(a,b) printf(a,b);
-#else
-#define DEBUG_PRINTF(a,b)
-#endif
-
-static GTF_constants GTF_given_constants = { 3.0,550.0,1,8,1.8,8,40,20,128,600 };
-
-static void GetRoundedConstants(GTF_constants *c)
- {
- c->Vsync_need = round(GTF_given_constants.Vsync_need);
- c->min_Vsync_BP = GTF_given_constants.min_Vsync_BP;
- c->min_front_porch = round(GTF_given_constants.min_front_porch);
- c->char_cell_granularity = GTF_given_constants.char_cell_granularity;
- c->margin_width = GTF_given_constants.margin_width;
- c->sync_width = GTF_given_constants.sync_width;
- c->c = ((GTF_given_constants.c - GTF_given_constants.j)*(GTF_given_constants.k / 256)) + GTF_given_constants.j;
- c->j = GTF_given_constants.j;
- c->k = GTF_given_constants.k;
- c->m = (GTF_given_constants.k / 256) * GTF_given_constants.m;
- }
-
-void GTF_calcTimings(double X,double Y,double freq, int type,
- int want_margins, int want_interlace,struct VesaCRTCInfoBlock *result )
-{
- GTF_constants c;
- double RR, margin_top, margin_bottom, margin_left, margin_right;
- double estimated_H_period,sync_plus_BP,BP,interlace,V_total_lines_field;
- double estimated_V_field_rate,actual_H_period,actual_V_field_freq;
- double total_active_pixels, ideal_duty_cycle, blanking_time, H_total_pixels;
- double H_freq, pixel_freq,actual_V_frame_freq;
- double H_sync_start, H_sync_end, H_back_porch, H_front_porch, H_sync_width;
- double V_back_porch, V_front_porch, V_sync_start, V_sync_end,V_sync_width;
- double ideal_H_period;
- GetRoundedConstants(&c);
-
-
- pixel_freq = RR = freq;
-
- /* DETERMINE IF 1/2 LINE INTERLACE IS PRESENT */
-
- interlace = 0;
-
- if (want_interlace) {
- RR = RR * 2;
- Y=Y/2;
- interlace = 0.5;
- }
-
- result->Flags = 0;
-
- if ((Y==300)||(Y==200)||(Y==240))
- {
- Y*=2;
- result->Flags = VESA_CRTC_DOUBLESCAN; /* TODO: check if mode support */
- }
-
- /* DETERMINE NUMBER OF LINES IN V MARGIN */
- /* DETERMINE NUMBER OF PIXELS IN H MARGIN [pixels] */
-
- margin_left = margin_right = 0;
- margin_top = margin_bottom = 0;
-
- if (want_margins) {
- margin_top = margin_bottom = (c.margin_width / 100) * Y;
- margin_left = round(( X* c.margin_width/100)/c.char_cell_granularity) \
- * c.char_cell_granularity;
- margin_right = margin_left;
- DEBUG_PRINTF("margin_left_right : %f\n",margin_right)
- DEBUG_PRINTF("margin_top_bottom : %f\n",margin_top)
- }
-
- /* FIND TOTAL NUMBER OF ACTIVE PIXELS (IMAGE + MARGIN) [pixels] */
-
- total_active_pixels = margin_left + margin_right + X;
- DEBUG_PRINTF("total_active_pixels: %f\n",total_active_pixels)
-
- if (type == GTF_PF)
- {
- ideal_H_period = ((c.c-100)+(sqrt(((100-c.c)*(100-c.c) )+(0.4*c.m*(total_active_pixels + margin_left + margin_right) / freq))))/2/c.m*1000;
-
- DEBUG_PRINTF("ideal_H_period: %f\n",ideal_H_period)
-
- /* FIND IDEAL BLANKING DUTY CYCLE FROM FORMULA [%] */
- ideal_duty_cycle = c.c - (c.m * ideal_H_period /1000);
- DEBUG_PRINTF("ideal_duty_cycle: %f\n",ideal_duty_cycle)
-
- /* FIND BLANKING TIME (TO NEAREST CHAR CELL) [pixels] */
-
- blanking_time = round(total_active_pixels * ideal_duty_cycle \
- / (100-ideal_duty_cycle) / (2*c.char_cell_granularity)) \
- * (2*c.char_cell_granularity);
- DEBUG_PRINTF("blanking_time : %f\n",blanking_time )
-
- /* FIND TOTAL NUMBER OF PIXELS IN A LINE [pixels] */
- H_total_pixels = total_active_pixels + blanking_time ;
- DEBUG_PRINTF("H_total_pixels: %f\n",H_total_pixels)
- H_freq = freq / H_total_pixels * 1000;
- DEBUG_PRINTF("H_freq: %f\n",H_freq)
- actual_H_period = 1000 / H_freq;
- DEBUG_PRINTF("actual_H_period: %f\n",actual_H_period)
- sync_plus_BP = round(H_freq * c.min_Vsync_BP/1000);
-// sync_plus_BP = round( freq / H_total_pixels * c.min_Vsync_BP);
-
- DEBUG_PRINTF("sync_plus_BP: %f\n",sync_plus_BP)
-
- } else if (type == GTF_VF)
- {
-
- /* ESTIMATE HORIZ. PERIOD [us] */
-
- estimated_H_period = (( 1/RR ) - c.min_Vsync_BP/1000000 ) / (Y + (2 * margin_top) + c.min_front_porch + interlace) * 1000000;
-
- DEBUG_PRINTF("estimated_H_period: %f\n",estimated_H_period)
-
- /* FIND NUMBER OF LINES IN (SYNC + BACK PORCH) [lines] */
-
- sync_plus_BP = round( c.min_Vsync_BP / estimated_H_period );
- DEBUG_PRINTF("sync_plus_BP: %f\n",sync_plus_BP)
-
- } else if (type == GTF_HF)
- {
- sync_plus_BP = round(freq * c.min_Vsync_BP/1000);
- DEBUG_PRINTF("sync_plus_BP: %f\n",sync_plus_BP)
- }
-
-
-
- /* FIND TOTAL NUMBER OF LINES IN VERTICAL FIELD */
-
- V_total_lines_field = sync_plus_BP+interlace+margin_bottom+margin_top+Y+c.min_front_porch;
- DEBUG_PRINTF("V_total_lines_field : %f\n",V_total_lines_field )
-
- if (type == GTF_VF)
- {
- /* ESTIMATE VERTICAL FIELD RATE [hz] */
-
- estimated_V_field_rate = 1 / estimated_H_period / V_total_lines_field * 1000000;
- DEBUG_PRINTF(" estimated_V_field_rate: %f\n", estimated_V_field_rate)
- /* FIND ACTUAL HORIZONTAL PERIOD [us] */
-
- actual_H_period = estimated_H_period / (RR / estimated_V_field_rate);
- DEBUG_PRINTF("actual_H_period: %f\n",actual_H_period)
- /* FIND ACTUAL VERTICAL FIELD FREQUENCY [Hz] */
-
- actual_V_field_freq = 1 / actual_H_period / V_total_lines_field * 1000000;
- DEBUG_PRINTF("actual_V_field_freq: %f\n",actual_V_field_freq)
-
- /* FIND IDEAL BLANKING DUTY CYCLE FROM FORMULA [%] */
- ideal_duty_cycle = c.c - (c.m * actual_H_period /1000);
- DEBUG_PRINTF("ideal_duty_cycle: %f\n",ideal_duty_cycle)
- //if (type == GTF_VF)
- //{
- //moved
- //}
- } else if (type == GTF_HF)
- {
- /* FIND IDEAL BLANKING DUTY CYCLE FROM FORMULA [%] */
- ideal_duty_cycle = c.c - (c.m / freq);
- DEBUG_PRINTF("ideal_duty_cycle: %f\n",ideal_duty_cycle)
- }
-
- /* FIND BLANKING TIME (TO NEAREST CHAR CELL) [pixels] */
-
- if (!(type == GTF_PF))
- {
- blanking_time = round(total_active_pixels * ideal_duty_cycle \
- / (100-ideal_duty_cycle) / (2*c.char_cell_granularity)) \
- * (2*c.char_cell_granularity);
- DEBUG_PRINTF("blanking_time : %f\n",blanking_time )
- }
- else
-// if (type == GTF_PF)
- {
- actual_V_field_freq = H_freq / V_total_lines_field * 1000;
- }
-
- if (type == GTF_HF)
- {
- /* Hz */
- actual_V_field_freq = freq / V_total_lines_field * 1000;
- DEBUG_PRINTF("actual_V_field_freq: %f\n",actual_V_field_freq)
- }
-
-
- actual_V_frame_freq = actual_V_field_freq;
-
- /* FIND ACTUAL VERTICAL FRAME FREQUENCY [Hz]*/
-
- if (want_interlace) actual_V_frame_freq = actual_V_field_freq / 2;
- DEBUG_PRINTF("actual_V_frame_freq: %f\n",actual_V_frame_freq)
-
-// V_freq = actual_V_frame_freq;
-// DEBUG_PRINTF("V_freq %f\n",V_freq)
-
-
- if (!(type == GTF_PF))
- {
- /* FIND TOTAL NUMBER OF PIXELS IN A LINE [pixels] */
- H_total_pixels = total_active_pixels + blanking_time ;
- DEBUG_PRINTF("H_total_pixels: %f\n",H_total_pixels)
- if (type == GTF_VF)
- {
- /* FIND PIXEL FREQUENCY [Mhz] */
- pixel_freq = H_total_pixels / actual_H_period ;
- DEBUG_PRINTF("pixel_freq: %f\n",pixel_freq)
- } else if (type == GTF_HF)
- {
- /* FIND PIXEL FREQUENCY [Mhz] */
- pixel_freq = H_total_pixels * freq / 1000 ;
- DEBUG_PRINTF("pixel_freq: %f\n",pixel_freq)
- actual_H_period = 1000/freq;
- }
-
- /* FIND ACTUAL HORIZONTAL FREQUENCY [KHz] */
-
- H_freq = 1000 / actual_H_period;
- DEBUG_PRINTF("H_freq %f\n",H_freq)
-
-
- }
-
- /* FIND NUMBER OF LINES IN BACK PORCH [lines] */
-
- BP = sync_plus_BP - c.Vsync_need;
- DEBUG_PRINTF("BP: %f\n",BP)
-
-/*------------------------------------------------------------------------------------------------*/
- /* FIND H SYNC WIDTH (TO NEAREST CHAR CELL) */
- H_sync_width = round(c.sync_width/100*H_total_pixels/c.char_cell_granularity)*c.char_cell_granularity;
- DEBUG_PRINTF("H_sync_width %f\n",H_sync_width)
-
- /* FIND FRONT H PORCH(TO NEAREST CHAR CELL) */
- H_front_porch = (blanking_time/2) - H_sync_width;
- DEBUG_PRINTF("H_front_porch %f\n",H_front_porch)
- /* FIND BACK H PORCH(TO NEAREST CHAR CELL) */
- H_back_porch = H_sync_width + H_front_porch;
- DEBUG_PRINTF("H_back_porch%f\n",H_back_porch)
-
- H_sync_start = H_total_pixels - (H_sync_width + H_back_porch);
- DEBUG_PRINTF("H_sync_start %f\n",H_sync_start)
- H_sync_end = H_total_pixels - H_back_porch;
- DEBUG_PRINTF("H_sync_end %f\n",H_sync_end)
-
- V_back_porch = interlace + BP;
- DEBUG_PRINTF("V_back_porch%f\n",V_back_porch)
- V_front_porch = interlace + c.min_front_porch;
- DEBUG_PRINTF("V_front_porch%f\n",V_front_porch)
-
- V_sync_width = c.Vsync_need;
- V_sync_start = V_total_lines_field - (V_sync_width + V_back_porch);
- DEBUG_PRINTF("V_sync_start %f\n",V_sync_start)
- V_sync_end = V_total_lines_field - V_back_porch;
- DEBUG_PRINTF("V_sync_end %f\n",V_sync_end)
-
- result->hTotal = H_total_pixels;
- result-> hSyncStart = H_sync_start; /* Horizontal sync start in pixels */
- result-> hSyncEnd = H_sync_end; /* Horizontal sync end in pixels */
- result-> vTotal= V_total_lines_field; /* Vertical total in lines */
- result-> vSyncStart = V_sync_start; /* Vertical sync start in lines */
- result-> vSyncEnd = V_sync_end; /* Vertical sync end in lines */
- result-> Flags = (result->Flags)|VESA_CRTC_HSYNC_NEG; /* Flags (Interlaced, Double Scan etc) */
-
- if (want_interlace)
- {
- result->Flags = (result->Flags) | VESA_CRTC_INTERLACED;
- }
-
- result-> PixelClock = pixel_freq*1000000; /* Pixel clock in units of Hz */
- result-> RefreshRate = actual_V_frame_freq*100;/* Refresh rate in units of 0.01 Hz*/
-
- }
diff --git a/libvo/gtf.h b/libvo/gtf.h
deleted file mode 100644
index 837fc24e69..0000000000
--- a/libvo/gtf.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef MPLAYER_GTF_H
-#define MPLAYER_GTF_H
-
-#include <vbe.h>
-
-#define GTF_VF 0
-#define GTF_HF 1
-#define GTF_PF 2
-
-
-typedef struct {
- double Vsync_need; /* Number of lines for vert sync (default 3) */
- double min_Vsync_BP; /* Minimum vertical sync + back porch (us) (default 550)*/
- double min_front_porch; /* Minimum front porch in lines (default 1) */
- double char_cell_granularity; /* Character cell granularity in pixels (default 8) */
- double margin_width; /* Top/ bottom MARGIN size as % of height (%) (default 1.8) */
- double sync_width; /* Sync width percent of line period ( default 8) */
- double c; /* Blanking formula offset (default 40)*/
- double j; /* Blanking formula scaling factor weight (default 20)*/
- double k; /* Blanking formula scaling factor (default 128)*/
- double m; /* Blanking formula gradient (default 600)*/
- } GTF_constants;
-
-//#ifndef __VESA_VBELIB_INCLUDED__
-// struct VesaCRTCInfoBlock {
-// unsigned short hTotal; /* Horizontal total in pixels */
-// unsigned short hSyncStart; /* Horizontal sync start in pixels */
-// unsigned short hSyncEnd; /* Horizontal sync end in pixels */
-// unsigned short vTotal; /* Vertical total in lines */
-// unsigned short vSyncStart; /* Vertical sync start in lines */
-// unsigned short vSyncEnd; /* Vertical sync end in lines */
-// unsigned char Flags; /* Flags (Interlaced, Double Scan etc) */
-// unsigned long PixelClock; /* Pixel clock in units of Hz */
-// unsigned short RefreshRate;/* Refresh rate in units of 0.01 Hz*/
-// unsigned char Reserved[40];/* remainder of CRTCInfoBlock*/
-//}__attribute__ ((packed));
-
-//#define VESA_CRTC_DOUBLESCAN 0x01
-//#define VESA_CRTC_INTERLACED 0x02
-//#define VESA_CRTC_HSYNC_NEG 0x04
-//#define VESA_CRTC_VSYNC_NEG 0x08
-
-//#endif
-
-void GTF_calcTimings(double X,double Y,double freq, int type,
- int want_margins, int want_interlace,struct VesaCRTCInfoBlock *result);
-
-#endif /* MPLAYER_GTF_H */
diff --git a/libvo/matrixview_font.h b/libvo/matrixview_font.h
deleted file mode 100644
index b12e8bbe8b..0000000000
--- a/libvo/matrixview_font.h
+++ /dev/null
@@ -1,606 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef MPLAYER_MATRIXVIEW_FONT_H
-#define MPLAYER_MATRIXVIEW_FONT_H
-
-#include <stdint.h>
-
-#define FONT_TEXTURE_W 128
-#define FONT_TEXTURE_H 64
-static const uint8_t font_texture[FONT_TEXTURE_H][FONT_TEXTURE_W] = {
- {
- 2, 2, 2, 2, 5, 20, 52, 77, 13, 2, 2, 2, 2, 2, 2, 3,
- 13, 42, 67, 71, 66, 34, 7, 2, 2, 2, 2, 4, 36, 69, 71, 71,
- 71, 71, 70, 35, 4, 3, 2, 2, 2, 2, 2, 3, 2, 29, 70, 71,
- 39, 3, 2, 3, 3, 44, 71, 71, 71, 72, 71, 71, 71, 65, 13, 2,
- 3, 2, 3, 5, 30, 64, 72, 71, 45, 13, 3, 2, 2, 2, 29, 71,
- 71, 71, 71, 71, 71, 71, 71, 47, 2, 2, 2, 2, 2, 5, 26, 58,
- 63, 36, 7, 2, 2, 2, 2, 2, 2, 12, 58, 71, 71, 71, 71, 61,
- 15, 2, 2, 2, 2, 3, 2, 3, 2, 2, 2, 2, 3, 2, 3, 5
- }, {
- 2, 2, 2, 3, 30, 122, 127, 122, 20, 3, 2, 2, 2, 2, 3, 33,
- 110, 125, 85, 54, 64, 111, 80, 8, 3, 3, 3, 20, 92, 63, 50, 50,
- 83, 125, 127, 121, 29, 2, 2, 2, 2, 2, 3, 3, 14, 106, 118, 127,
- 74, 2, 3, 3, 3, 42, 67, 67, 67, 67, 67, 102, 127, 120, 22, 3,
- 2, 3, 8, 79, 125, 115, 73, 103, 127, 107, 28, 3, 2, 2, 21, 50,
- 50, 49, 50, 50, 56, 118, 127, 85, 2, 2, 2, 2, 6, 65, 124, 127,
- 123, 126, 89, 15, 2, 2, 2, 2, 3, 80, 127, 126, 65, 62, 124, 127,
- 86, 5, 3, 2, 3, 3, 4, 12, 13, 7, 7, 12, 12, 4, 3, 6
- }, {
- 2, 2, 2, 3, 12, 59, 125, 123, 20, 3, 2, 2, 2, 2, 7, 102,
- 127, 99, 5, 3, 3, 24, 90, 32, 3, 3, 3, 3, 2, 3, 3, 3,
- 5, 86, 127, 127, 51, 3, 2, 2, 2, 2, 3, 5, 78, 101, 70, 127,
- 74, 3, 3, 3, 2, 3, 3, 3, 3, 3, 2, 71, 127, 120, 23, 2,
- 3, 3, 50, 126, 126, 35, 2, 14, 113, 127, 78, 5, 3, 3, 3, 3,
- 2, 2, 3, 3, 21, 118, 127, 78, 2, 2, 2, 2, 36, 125, 127, 77,
- 35, 106, 127, 76, 2, 2, 2, 2, 2, 93, 127, 109, 12, 35, 123, 127,
- 100, 7, 3, 3, 3, 3, 16, 105, 110, 47, 54, 109, 98, 15, 3, 5
- }, {
- 2, 2, 2, 2, 3, 31, 124, 123, 21, 2, 2, 2, 2, 2, 9, 112,
- 127, 93, 4, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3,
- 2, 64, 127, 127, 51, 3, 2, 2, 2, 2, 3, 47, 116, 33, 62, 127,
- 73, 3, 3, 2, 3, 7, 48, 77, 77, 77, 78, 107, 127, 119, 22, 3,
- 2, 3, 90, 127, 114, 14, 3, 5, 94, 127, 95, 7, 3, 3, 3, 3,
- 3, 3, 3, 4, 64, 127, 123, 29, 2, 2, 2, 2, 45, 127, 126, 56,
- 15, 93, 127, 82, 2, 2, 2, 2, 3, 93, 127, 108, 15, 95, 127, 127,
- 99, 8, 3, 3, 3, 2, 29, 127, 127, 41, 78, 127, 110, 14, 3, 6
- }, {
- 2, 2, 2, 2, 2, 30, 124, 123, 20, 2, 2, 2, 2, 2, 5, 83,
- 127, 113, 11, 2, 3, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3,
- 3, 68, 127, 127, 51, 3, 3, 3, 2, 3, 20, 111, 62, 3, 62, 127,
- 74, 2, 2, 3, 3, 50, 126, 127, 118, 66, 47, 47, 47, 43, 9, 2,
- 2, 3, 98, 127, 125, 23, 3, 11, 110, 127, 87, 5, 3, 2, 2, 2,
- 3, 3, 3, 26, 118, 127, 73, 4, 3, 2, 2, 2, 12, 100, 127, 122,
- 109, 127, 115, 31, 2, 2, 2, 2, 2, 94, 127, 109, 55, 125, 127, 127,
- 99, 7, 2, 3, 3, 3, 42, 127, 124, 32, 92, 127, 100, 7, 3, 5
- }, {
- 2, 2, 2, 2, 2, 30, 124, 122, 20, 2, 2, 2, 2, 2, 2, 14,
- 88, 126, 91, 18, 3, 3, 2, 2, 2, 2, 3, 3, 2, 9, 9, 10,
- 25, 108, 127, 127, 48, 3, 2, 3, 4, 7, 86, 99, 15, 10, 66, 127,
- 73, 2, 2, 2, 2, 65, 127, 127, 61, 4, 3, 3, 2, 2, 2, 2,
- 2, 3, 92, 127, 127, 94, 48, 82, 126, 124, 57, 3, 3, 2, 2, 2,
- 2, 4, 8, 91, 127, 106, 15, 3, 2, 2, 2, 2, 3, 53, 125, 127,
- 127, 127, 74, 6, 2, 2, 2, 2, 2, 93, 127, 115, 115, 98, 121, 127,
- 99, 7, 2, 2, 3, 3, 59, 127, 120, 26, 100, 127, 92, 3, 3, 5
- }, {
- 2, 2, 2, 2, 2, 30, 124, 123, 20, 2, 2, 2, 2, 2, 3, 3,
- 10, 66, 121, 110, 42, 5, 3, 2, 2, 2, 3, 2, 3, 87, 102, 103,
- 114, 119, 118, 91, 15, 3, 3, 3, 3, 54, 126, 114, 102, 102, 115, 127,
- 74, 3, 2, 2, 2, 66, 127, 127, 50, 3, 3, 3, 2, 2, 2, 2,
- 2, 3, 72, 127, 114, 84, 104, 105, 91, 46, 5, 3, 3, 2, 2, 2,
- 2, 3, 51, 126, 126, 47, 3, 3, 2, 2, 2, 2, 29, 120, 127, 107,
- 82, 122, 125, 49, 2, 2, 2, 2, 3, 93, 127, 127, 123, 36, 117, 127,
- 99, 7, 2, 2, 3, 3, 75, 127, 115, 24, 108, 127, 80, 3, 3, 5
- }, {
- 2, 2, 2, 2, 2, 30, 124, 123, 20, 2, 2, 2, 2, 2, 2, 3,
- 3, 4, 35, 107, 122, 66, 10, 3, 2, 2, 3, 3, 3, 34, 86, 120,
- 112, 63, 29, 5, 3, 2, 3, 3, 4, 44, 59, 59, 59, 59, 93, 127,
- 73, 3, 2, 2, 2, 65, 127, 127, 53, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 32, 122, 125, 40, 3, 3, 2, 3, 3, 3, 3, 2, 2, 2,
- 2, 7, 97, 127, 105, 10, 3, 3, 3, 2, 2, 2, 52, 127, 126, 45,
- 5, 88, 127, 78, 2, 2, 2, 2, 3, 93, 127, 127, 83, 9, 117, 127,
- 99, 7, 2, 2, 3, 3, 72, 111, 94, 20, 101, 111, 55, 2, 3, 5
- }, {
- 6, 5, 6, 6, 6, 60, 249, 246, 40, 6, 5, 5, 5, 5, 13, 21,
- 22, 22, 22, 47, 174, 254, 193, 49, 6, 5, 6, 16, 37, 36, 38, 83,
- 183, 249, 209, 116, 23, 5, 6, 6, 6, 6, 7, 6, 5, 5, 123, 255,
- 149, 5, 5, 5, 5, 129, 255, 255, 193, 42, 10, 8, 44, 61, 12, 5,
- 6, 6, 7, 124, 243, 225, 82, 17, 6, 7, 7, 6, 6, 6, 5, 5,
- 6, 20, 208, 255, 192, 6, 6, 5, 6, 5, 6, 5, 51, 237, 255, 199,
- 149, 236, 249, 87, 6, 5, 5, 5, 5, 184, 255, 254, 72, 38, 238, 255,
- 196, 14, 7, 6, 6, 5, 17, 24, 20, 8, 23, 24, 15, 5, 5, 5
- }, {
- 7, 6, 6, 6, 5, 55, 226, 221, 38, 6, 5, 5, 5, 5, 96, 192,
- 191, 192, 192, 191, 197, 234, 234, 151, 7, 6, 6, 74, 209, 209, 209, 210,
- 210, 230, 235, 231, 85, 6, 6, 5, 21, 152, 174, 174, 174, 175, 204, 235,
- 131, 5, 5, 5, 5, 53, 202, 233, 234, 210, 180, 176, 209, 151, 15, 5,
- 6, 6, 6, 7, 63, 169, 215, 184, 148, 128, 14, 6, 6, 6, 6, 6,
- 6, 18, 189, 235, 174, 6, 6, 6, 7, 6, 7, 6, 8, 82, 205, 242,
- 244, 215, 115, 11, 6, 7, 6, 6, 6, 90, 219, 234, 205, 204, 235, 218,
- 100, 7, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
- }, {
- 6, 6, 6, 7, 5, 13, 39, 36, 10, 6, 6, 5, 5, 5, 23, 40,
- 40, 40, 39, 40, 40, 40, 39, 29, 6, 6, 6, 17, 38, 40, 40, 39,
- 40, 41, 39, 41, 17, 6, 6, 6, 11, 50, 58, 49, 39, 38, 39, 38,
- 25, 5, 5, 5, 5, 12, 37, 56, 58, 57, 58, 57, 51, 21, 6, 6,
- 6, 6, 6, 7, 5, 5, 27, 38, 39, 39, 10, 6, 6, 6, 7, 6,
- 5, 7, 33, 40, 30, 6, 6, 7, 6, 5, 6, 6, 18, 25, 36, 68,
- 71, 40, 24, 23, 23, 9, 5, 6, 6, 6, 26, 40, 40, 40, 38, 25,
- 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
- }, {
- 5, 137, 201, 200, 201, 201, 201, 200, 201, 168, 18, 5, 5, 5, 5, 5,
- 5, 6, 18, 25, 36, 44, 59, 51, 10, 7, 5, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 5, 15, 168, 217, 123, 5, 6, 6, 6,
- 6, 6, 5, 5, 5, 76, 192, 194, 195, 195, 194, 210, 217, 158, 6, 5,
- 6, 6, 5, 5, 5, 6, 6, 5, 6, 6, 6, 6, 6, 5, 5, 16,
- 78, 78, 78, 79, 78, 79, 62, 10, 5, 6, 6, 10, 125, 175, 176, 177,
- 175, 182, 216, 218, 183, 33, 6, 6, 6, 7, 6, 6, 6, 6, 5, 6,
- 6, 6, 7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
- }, {
- 5, 173, 247, 178, 168, 170, 169, 169, 169, 140, 15, 5, 5, 5, 61, 172,
- 187, 204, 213, 220, 230, 238, 247, 212, 23, 5, 5, 6, 6, 6, 6, 19,
- 121, 179, 147, 36, 7, 6, 5, 8, 45, 209, 255, 166, 44, 43, 43, 43,
- 42, 28, 5, 5, 5, 18, 36, 37, 37, 37, 74, 235, 255, 183, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 5, 6, 6, 6, 6, 5, 6, 6, 45,
- 249, 248, 254, 255, 251, 248, 192, 16, 6, 6, 7, 7, 16, 22, 22, 22,
- 22, 45, 243, 255, 134, 8, 6, 5, 6, 24, 78, 83, 60, 10, 5, 6,
- 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
- }, {
- 5, 173, 228, 26, 7, 6, 5, 6, 6, 5, 5, 5, 5, 5, 111, 255,
- 251, 246, 232, 226, 210, 202, 190, 147, 17, 6, 6, 7, 6, 6, 62, 196,
- 252, 181, 49, 7, 6, 6, 6, 23, 200, 252, 255, 248, 237, 238, 238, 238,
- 238, 151, 5, 5, 5, 5, 6, 5, 6, 30, 201, 255, 245, 85, 5, 6,
- 6, 6, 6, 7, 6, 6, 6, 6, 7, 6, 6, 7, 6, 7, 5, 12,
- 51, 52, 184, 255, 105, 52, 40, 8, 6, 5, 6, 7, 33, 44, 44, 44,
- 44, 66, 244, 255, 144, 11, 6, 6, 6, 21, 123, 236, 244, 153, 32, 6,
- 6, 7, 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
- }, {
- 5, 173, 228, 27, 6, 6, 6, 5, 5, 6, 5, 5, 5, 5, 28, 70,
- 75, 85, 81, 93, 86, 97, 84, 5, 6, 6, 8, 6, 21, 132, 239, 230,
- 106, 19, 6, 6, 6, 7, 6, 13, 85, 215, 255, 191, 96, 96, 96, 96,
- 96, 62, 5, 5, 5, 6, 6, 6, 17, 175, 255, 249, 114, 8, 5, 7,
- 5, 5, 23, 28, 27, 27, 12, 22, 28, 28, 27, 11, 5, 6, 6, 6,
- 6, 6, 169, 255, 71, 5, 6, 7, 6, 6, 6, 12, 174, 240, 240, 240,
- 239, 241, 255, 255, 230, 43, 6, 6, 6, 7, 7, 53, 183, 253, 214, 83,
- 9, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
- }, {
- 5, 173, 228, 26, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 101,
- 226, 236, 240, 249, 251, 255, 213, 6, 6, 6, 5, 5, 47, 211, 255, 184,
- 36, 6, 6, 6, 5, 7, 6, 6, 6, 158, 255, 179, 7, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 6, 12, 146, 253, 253, 143, 11, 6, 6, 6,
- 6, 13, 193, 227, 227, 225, 47, 199, 226, 227, 216, 39, 5, 6, 6, 7,
- 6, 6, 168, 255, 70, 7, 6, 5, 6, 6, 6, 7, 44, 60, 60, 60,
- 60, 79, 246, 255, 152, 14, 6, 6, 6, 6, 5, 7, 17, 130, 253, 247,
- 132, 10, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
- }, {
- 2, 86, 114, 13, 3, 3, 3, 2, 2, 2, 3, 3, 2, 2, 2, 49,
- 107, 101, 97, 90, 83, 78, 54, 2, 3, 3, 3, 3, 3, 14, 75, 123,
- 110, 45, 5, 2, 3, 3, 2, 3, 4, 42, 127, 114, 16, 3, 3, 3,
- 2, 2, 2, 2, 2, 2, 4, 54, 124, 127, 89, 8, 2, 3, 3, 3,
- 2, 4, 24, 28, 28, 26, 6, 25, 28, 28, 26, 4, 2, 3, 3, 3,
- 3, 3, 83, 127, 35, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3,
- 2, 15, 120, 127, 64, 3, 2, 3, 2, 2, 3, 3, 40, 106, 126, 92,
- 27, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5
- }, {
- 3, 86, 114, 13, 3, 3, 3, 2, 2, 2, 3, 3, 2, 3, 11, 33,
- 47, 45, 52, 58, 67, 79, 83, 80, 9, 4, 3, 3, 3, 3, 5, 37,
- 103, 118, 73, 12, 3, 3, 3, 3, 3, 10, 98, 127, 67, 3, 3, 3,
- 3, 2, 2, 2, 2, 3, 38, 120, 127, 103, 17, 3, 3, 3, 3, 3,
- 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3,
- 3, 3, 83, 127, 35, 2, 3, 3, 2, 3, 3, 2, 3, 3, 3, 3,
- 3, 25, 126, 127, 63, 3, 3, 3, 3, 3, 15, 77, 123, 116, 55, 9,
- 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5
- }, {
- 3, 86, 121, 71, 65, 65, 65, 65, 64, 64, 64, 33, 2, 3, 51, 121,
- 125, 126, 127, 127, 127, 127, 127, 110, 12, 3, 3, 3, 22, 26, 27, 26,
- 34, 43, 42, 23, 3, 3, 3, 3, 3, 3, 29, 114, 122, 51, 5, 3,
- 3, 2, 2, 2, 2, 21, 113, 127, 113, 26, 3, 3, 3, 2, 3, 3,
- 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 5, 61,
- 81, 81, 112, 127, 94, 81, 81, 35, 3, 2, 3, 3, 2, 3, 3, 3,
- 10, 89, 127, 127, 53, 3, 3, 3, 3, 16, 77, 98, 84, 23, 3, 3,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5
- }, {
- 3, 82, 121, 121, 121, 121, 121, 121, 121, 121, 121, 61, 4, 3, 42, 89,
- 84, 76, 71, 57, 52, 40, 31, 19, 4, 3, 2, 3, 98, 115, 115, 115,
- 115, 114, 115, 82, 6, 3, 2, 3, 3, 3, 3, 25, 91, 122, 88, 46,
- 28, 13, 2, 2, 2, 40, 126, 127, 73, 40, 40, 39, 40, 33, 3, 3,
- 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 7, 90,
- 121, 121, 121, 121, 121, 121, 121, 53, 3, 3, 3, 5, 60, 82, 83, 83,
- 107, 127, 127, 109, 18, 3, 3, 3, 3, 4, 7, 8, 5, 3, 3, 3,
- 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5
- }, {
- 2, 12, 17, 17, 16, 17, 17, 16, 16, 17, 16, 9, 2, 2, 4, 5,
- 2, 3, 3, 2, 3, 3, 2, 2, 2, 2, 2, 2, 15, 17, 17, 16,
- 17, 17, 17, 12, 3, 3, 3, 3, 2, 3, 2, 3, 7, 32, 63, 69,
- 58, 20, 3, 3, 2, 26, 82, 83, 82, 81, 82, 82, 81, 67, 2, 3,
- 3, 2, 2, 3, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 13,
- 16, 17, 17, 17, 17, 17, 17, 9, 3, 3, 2, 5, 62, 83, 83, 83,
- 82, 83, 71, 22, 2, 2, 2, 2, 2, 3, 3, 3, 3, 2, 3, 3,
- 3, 3, 3, 2, 3, 3, 2, 3, 3, 2, 3, 3, 2, 3, 2, 5
- }, {
- 2, 2, 2, 3, 3, 3, 14, 28, 29, 10, 3, 2, 2, 2, 3, 3,
- 3, 2, 2, 3, 3, 3, 3, 2, 2, 2, 3, 7, 27, 29, 6, 3,
- 2, 4, 23, 28, 11, 3, 3, 3, 11, 29, 28, 28, 29, 28, 29, 28,
- 29, 24, 4, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 3, 3, 3,
- 3, 3, 3, 3, 3, 2, 2, 2, 3, 23, 28, 26, 4, 3, 3, 3,
- 17, 29, 13, 3, 10, 28, 20, 3, 2, 3, 3, 2, 4, 27, 27, 4,
- 3, 19, 25, 5, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 12, 28,
- 17, 3, 3, 3, 3, 3, 3, 3, 5, 15, 16, 5, 3, 3, 3, 5
- }, {
- 2, 2, 2, 3, 3, 3, 36, 121, 122, 51, 2, 2, 2, 2, 2, 2,
- 3, 3, 3, 3, 4, 3, 2, 2, 2, 2, 3, 24, 114, 122, 18, 3,
- 2, 15, 113, 115, 19, 3, 3, 3, 38, 122, 122, 122, 122, 122, 122, 122,
- 122, 101, 9, 2, 8, 96, 103, 104, 103, 103, 104, 103, 103, 103, 59, 3,
- 3, 15, 43, 42, 43, 43, 43, 43, 45, 103, 122, 113, 7, 3, 3, 2,
- 73, 122, 55, 2, 38, 122, 85, 3, 2, 3, 3, 3, 10, 115, 114, 8,
- 3, 76, 112, 15, 2, 2, 2, 2, 11, 49, 53, 53, 53, 53, 79, 121,
- 84, 23, 3, 3, 3, 3, 14, 30, 44, 115, 115, 48, 30, 18, 3, 5
- }, {
- 2, 2, 2, 2, 3, 3, 18, 116, 127, 84, 4, 2, 2, 2, 2, 3,
- 3, 38, 104, 105, 78, 3, 2, 2, 2, 2, 2, 26, 121, 127, 18, 2,
- 2, 52, 127, 92, 6, 3, 2, 3, 34, 127, 127, 77, 35, 35, 36, 35,
- 35, 28, 4, 3, 10, 120, 127, 103, 80, 80, 80, 80, 80, 80, 47, 2,
- 3, 37, 118, 117, 118, 118, 118, 117, 119, 126, 127, 118, 7, 2, 3, 3,
- 79, 127, 59, 3, 41, 127, 89, 2, 3, 3, 3, 3, 48, 125, 124, 75,
- 73, 107, 123, 60, 2, 2, 2, 2, 22, 119, 112, 93, 93, 93, 114, 127,
- 104, 39, 3, 3, 3, 3, 53, 122, 124, 127, 127, 124, 122, 75, 2, 6
- }, {
- 6, 5, 7, 10, 13, 12, 9, 192, 255, 221, 24, 6, 7, 6, 6, 6,
- 6, 97, 255, 255, 198, 7, 6, 5, 5, 5, 6, 70, 249, 255, 38, 8,
- 11, 182, 253, 103, 6, 7, 6, 6, 48, 255, 255, 120, 58, 146, 70, 6,
- 6, 6, 6, 7, 17, 229, 255, 135, 6, 7, 7, 6, 6, 6, 7, 7,
- 7, 12, 28, 28, 28, 29, 29, 28, 35, 200, 255, 237, 15, 5, 6, 6,
- 174, 255, 99, 6, 83, 255, 177, 5, 6, 7, 7, 10, 104, 251, 250, 164,
- 160, 219, 247, 130, 5, 5, 5, 5, 24, 223, 173, 17, 12, 16, 176, 252,
- 62, 8, 7, 5, 8, 6, 56, 134, 155, 252, 253, 160, 134, 78, 6, 5
- }, {
- 5, 6, 24, 197, 233, 207, 31, 128, 255, 255, 62, 6, 6, 6, 6, 5,
- 6, 48, 130, 131, 97, 6, 5, 5, 5, 5, 5, 53, 242, 255, 39, 6,
- 16, 145, 151, 26, 7, 6, 7, 6, 36, 237, 255, 237, 246, 251, 80, 6,
- 6, 5, 6, 6, 15, 212, 255, 180, 11, 6, 6, 6, 7, 6, 7, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 12, 194, 255, 236, 15, 6, 6, 5,
- 172, 255, 86, 5, 56, 184, 126, 5, 5, 6, 6, 6, 22, 242, 240, 17,
- 5, 115, 166, 24, 5, 5, 5, 5, 6, 135, 232, 48, 8, 11, 203, 247,
- 29, 6, 7, 5, 5, 6, 30, 68, 74, 248, 248, 104, 50, 5, 6, 6
- }, {
- 6, 6, 73, 253, 255, 172, 7, 71, 249, 255, 134, 6, 6, 6, 5, 5,
- 5, 6, 6, 6, 5, 6, 5, 5, 5, 5, 6, 28, 231, 255, 54, 7,
- 6, 6, 7, 6, 6, 7, 6, 9, 126, 248, 255, 241, 145, 57, 12, 7,
- 6, 5, 7, 7, 9, 133, 254, 240, 49, 6, 6, 17, 71, 64, 16, 8,
- 6, 5, 5, 5, 5, 5, 5, 5, 12, 195, 255, 237, 14, 6, 6, 6,
- 144, 255, 103, 5, 8, 12, 12, 5, 6, 6, 6, 6, 17, 223, 240, 21,
- 6, 11, 12, 5, 5, 5, 5, 5, 6, 16, 110, 161, 70, 12, 229, 227,
- 20, 6, 6, 5, 5, 7, 122, 247, 133, 246, 249, 236, 180, 6, 7, 6
- }, {
- 6, 6, 154, 255, 254, 90, 6, 22, 224, 255, 189, 14, 6, 6, 6, 6,
- 7, 39, 100, 102, 75, 6, 5, 5, 5, 5, 6, 8, 191, 255, 117, 6,
- 6, 6, 6, 6, 5, 6, 5, 15, 184, 213, 255, 227, 34, 6, 6, 7,
- 6, 6, 6, 7, 6, 23, 195, 255, 198, 33, 6, 93, 248, 220, 26, 6,
- 5, 5, 5, 5, 5, 5, 5, 5, 16, 219, 255, 237, 15, 5, 5, 6,
- 81, 255, 156, 7, 6, 5, 6, 5, 5, 6, 6, 6, 11, 173, 249, 67,
- 6, 6, 6, 7, 6, 5, 5, 5, 6, 6, 6, 14, 14, 30, 238, 199,
- 15, 7, 6, 6, 6, 6, 156, 252, 115, 247, 248, 193, 199, 14, 5, 5
- }, {
- 7, 26, 217, 255, 246, 110, 43, 17, 176, 255, 239, 31, 6, 5, 6, 5,
- 6, 96, 254, 255, 195, 6, 5, 5, 5, 5, 6, 5, 84, 250, 210, 25,
- 6, 5, 6, 6, 6, 5, 5, 7, 28, 31, 204, 255, 132, 7, 6, 6,
- 6, 5, 5, 5, 5, 5, 33, 176, 252, 211, 79, 162, 255, 185, 6, 5,
- 5, 6, 6, 5, 5, 5, 5, 6, 84, 250, 255, 237, 16, 5, 5, 5,
- 25, 211, 225, 34, 6, 6, 6, 6, 6, 5, 5, 5, 5, 75, 250, 158,
- 9, 6, 6, 5, 5, 5, 5, 5, 5, 6, 5, 5, 6, 57, 246, 173,
- 11, 6, 6, 5, 6, 12, 179, 241, 91, 247, 248, 102, 227, 62, 6, 5
- }, {
- 6, 77, 254, 255, 255, 253, 244, 224, 227, 255, 255, 83, 6, 6, 6, 5,
- 6, 93, 247, 248, 191, 6, 5, 5, 5, 5, 6, 7, 10, 155, 253, 162,
- 25, 7, 6, 5, 6, 6, 6, 5, 5, 5, 60, 227, 245, 113, 18, 7,
- 6, 5, 5, 5, 5, 6, 5, 15, 79, 163, 214, 251, 255, 113, 6, 6,
- 6, 11, 20, 20, 20, 21, 36, 100, 230, 255, 255, 197, 11, 5, 5, 5,
- 5, 72, 236, 171, 24, 7, 6, 7, 5, 5, 5, 5, 6, 11, 147, 245,
- 101, 10, 7, 7, 5, 5, 5, 5, 5, 6, 6, 6, 7, 86, 253, 144,
- 6, 6, 5, 5, 5, 19, 203, 234, 81, 247, 249, 67, 101, 169, 21, 5
- }, {
- 6, 153, 255, 253, 217, 234, 250, 255, 255, 255, 255, 147, 6, 6, 6, 6,
- 5, 12, 26, 26, 20, 5, 5, 5, 5, 5, 6, 6, 6, 17, 120, 231,
- 210, 123, 76, 54, 8, 7, 5, 5, 5, 5, 6, 51, 177, 242, 198, 126,
- 83, 30, 5, 5, 5, 6, 6, 7, 6, 9, 60, 252, 242, 56, 6, 6,
- 5, 79, 241, 240, 240, 241, 244, 251, 255, 254, 225, 62, 5, 5, 5, 5,
- 5, 7, 62, 192, 188, 85, 30, 6, 6, 5, 5, 5, 5, 5, 17, 113,
- 212, 142, 76, 24, 5, 5, 5, 5, 21, 95, 105, 106, 105, 168, 255, 180,
- 104, 45, 7, 6, 7, 21, 206, 247, 226, 249, 249, 223, 218, 214, 35, 6
- }, {
- 8, 85, 114, 104, 31, 25, 58, 105, 114, 114, 114, 70, 6, 5, 5, 5,
- 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 6, 6, 6, 5, 8, 31,
- 102, 137, 122, 59, 6, 5, 5, 5, 9, 11, 11, 11, 19, 49, 96, 118,
- 97, 29, 6, 5, 5, 5, 7, 6, 6, 5, 29, 83, 77, 13, 6, 6,
- 5, 38, 117, 120, 120, 119, 119, 120, 120, 105, 34, 6, 6, 5, 5, 5,
- 5, 5, 6, 14, 61, 101, 58, 6, 6, 5, 5, 5, 5, 6, 6, 8,
- 21, 68, 86, 21, 5, 5, 5, 5, 21, 99, 110, 110, 110, 112, 115, 112,
- 109, 46, 6, 6, 6, 8, 40, 54, 56, 55, 54, 55, 56, 51, 12, 6
- }, {
- 3, 3, 20, 57, 57, 57, 57, 57, 57, 37, 2, 3, 3, 14, 66, 69,
- 69, 69, 69, 69, 69, 69, 69, 69, 38, 3, 2, 2, 2, 2, 3, 7,
- 8, 3, 2, 2, 2, 2, 3, 6, 62, 84, 84, 84, 84, 84, 84, 84,
- 84, 84, 23, 3, 3, 27, 53, 57, 57, 52, 52, 53, 53, 32, 3, 3,
- 3, 3, 50, 83, 84, 84, 84, 84, 84, 81, 26, 3, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 4, 57, 69, 69, 69, 69,
- 69, 68, 69, 69, 67, 19, 3, 3, 2, 2, 2, 2, 3, 10, 6, 3,
- 2, 2, 2, 2, 3, 37, 69, 69, 26, 3, 3, 3, 3, 2, 3, 6
- }, {
- 3, 3, 45, 127, 115, 96, 96, 105, 127, 83, 3, 3, 3, 24, 123, 127,
- 118, 110, 110, 110, 110, 110, 117, 127, 72, 3, 3, 2, 2, 2, 3, 55,
- 79, 5, 2, 2, 2, 2, 3, 7, 96, 127, 127, 123, 120, 120, 120, 120,
- 120, 120, 32, 3, 3, 20, 56, 126, 113, 39, 37, 37, 37, 22, 3, 3,
- 3, 3, 49, 81, 81, 81, 87, 125, 119, 81, 24, 3, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 5, 90, 110, 110, 110, 110,
- 110, 111, 110, 110, 107, 29, 3, 3, 3, 2, 2, 2, 4, 99, 46, 3,
- 2, 2, 2, 2, 3, 65, 127, 127, 58, 3, 3, 4, 5, 3, 3, 6
- }, {
- 2, 2, 46, 127, 74, 6, 6, 38, 125, 83, 3, 3, 3, 24, 123, 127,
- 54, 7, 7, 7, 7, 7, 51, 127, 71, 2, 2, 2, 2, 2, 3, 58,
- 89, 5, 2, 2, 2, 2, 3, 4, 90, 127, 125, 39, 9, 9, 9, 9,
- 9, 9, 5, 3, 3, 16, 49, 126, 113, 31, 29, 29, 29, 18, 3, 3,
- 3, 3, 36, 62, 62, 62, 70, 124, 102, 9, 3, 3, 3, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 4, 59, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 43, 3, 3, 2, 2, 2, 2, 4, 104, 48, 3,
- 2, 2, 2, 2, 3, 48, 127, 127, 73, 14, 42, 77, 34, 3, 3, 6
- }, {
- 3, 3, 46, 127, 72, 2, 3, 35, 125, 83, 3, 3, 3, 24, 123, 127,
- 52, 3, 2, 2, 2, 2, 43, 118, 66, 2, 2, 2, 2, 2, 2, 58,
- 90, 5, 2, 2, 2, 2, 3, 2, 72, 127, 125, 32, 3, 2, 2, 2,
- 2, 2, 3, 3, 3, 62, 125, 127, 127, 126, 124, 123, 123, 74, 3, 3,
- 3, 3, 73, 125, 127, 125, 121, 124, 119, 16, 3, 3, 3, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 7, 118, 127, 127, 125, 124,
- 125, 125, 125, 124, 125, 88, 3, 3, 2, 2, 2, 2, 4, 105, 49, 3,
- 2, 2, 2, 2, 3, 31, 127, 127, 120, 118, 126, 120, 39, 3, 3, 5
- }, {
- 2, 2, 46, 127, 93, 48, 47, 68, 126, 83, 3, 3, 2, 24, 123, 127,
- 52, 3, 3, 2, 2, 2, 4, 8, 5, 2, 2, 2, 2, 2, 4, 40,
- 69, 5, 2, 2, 2, 2, 3, 3, 38, 127, 127, 43, 3, 3, 2, 2,
- 2, 2, 2, 2, 2, 19, 54, 126, 127, 122, 49, 36, 36, 22, 3, 3,
- 3, 3, 14, 75, 127, 87, 22, 42, 118, 70, 10, 4, 3, 3, 3, 18,
- 32, 31, 31, 31, 31, 31, 27, 5, 2, 3, 7, 111, 127, 119, 41, 37,
- 36, 36, 36, 36, 36, 26, 3, 3, 2, 2, 2, 2, 3, 105, 48, 2,
- 2, 2, 2, 2, 22, 105, 127, 127, 126, 101, 57, 19, 4, 2, 2, 5
- }, {
- 2, 2, 46, 127, 113, 91, 91, 102, 127, 83, 3, 3, 3, 18, 121, 127,
- 62, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 28,
- 34, 3, 2, 2, 2, 2, 3, 3, 13, 107, 127, 74, 4, 3, 2, 2,
- 2, 2, 2, 2, 2, 3, 28, 125, 127, 124, 35, 3, 3, 4, 3, 3,
- 3, 3, 3, 53, 127, 86, 4, 3, 30, 86, 81, 16, 3, 3, 3, 56,
- 107, 107, 100, 80, 100, 107, 90, 11, 3, 3, 4, 84, 127, 124, 31, 3,
- 2, 2, 2, 2, 2, 3, 4, 3, 2, 2, 2, 2, 3, 105, 48, 2,
- 2, 2, 2, 2, 34, 123, 117, 127, 119, 24, 3, 2, 2, 2, 2, 5
- }, {
- 2, 2, 45, 127, 74, 4, 5, 37, 126, 83, 3, 3, 2, 6, 94, 127,
- 107, 12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 57,
- 88, 5, 2, 2, 2, 2, 2, 3, 3, 64, 127, 116, 23, 3, 2, 2,
- 2, 2, 2, 2, 2, 2, 27, 125, 127, 127, 64, 3, 3, 3, 3, 2,
- 3, 3, 3, 16, 114, 112, 13, 3, 3, 4, 6, 3, 3, 3, 3, 5,
- 6, 6, 2, 0, 2, 6, 5, 3, 3, 2, 3, 38, 124, 127, 89, 8,
- 3, 2, 2, 2, 2, 3, 3, 3, 2, 2, 2, 2, 3, 105, 48, 2,
- 2, 2, 2, 2, 14, 31, 21, 115, 127, 76, 4, 2, 2, 2, 2, 5
- }, {
- 2, 2, 46, 127, 74, 3, 3, 35, 125, 83, 2, 3, 3, 2, 30, 115,
- 127, 76, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 58,
- 89, 5, 2, 2, 2, 2, 3, 3, 9, 92, 127, 127, 94, 16, 2, 2,
- 2, 2, 2, 2, 2, 2, 27, 125, 119, 114, 111, 15, 3, 3, 3, 3,
- 2, 3, 3, 4, 57, 126, 65, 5, 3, 3, 2, 3, 3, 3, 2, 2,
- 3, 2, 0, 0, 0, 3, 3, 3, 2, 3, 3, 5, 73, 126, 126, 70,
- 8, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 3, 105, 48, 2,
- 2, 2, 2, 2, 3, 3, 3, 52, 124, 122, 52, 5, 2, 2, 2, 5
- }, {
- 6, 6, 91, 255, 191, 104, 106, 146, 253, 166, 6, 5, 5, 5, 6, 53,
- 201, 250, 172, 48, 21, 14, 15, 9, 6, 6, 5, 5, 5, 5, 6, 115,
- 178, 11, 5, 5, 5, 5, 5, 10, 118, 255, 234, 175, 246, 212, 89, 29,
- 21, 27, 9, 6, 6, 6, 56, 251, 215, 66, 225, 178, 33, 6, 5, 5,
- 5, 6, 5, 6, 10, 138, 242, 126, 24, 13, 7, 6, 6, 5, 5, 5,
- 5, 7, 7, 4, 5, 5, 5, 5, 5, 6, 7, 6, 14, 116, 235, 254,
- 189, 67, 22, 15, 16, 14, 6, 5, 7, 6, 7, 6, 7, 164, 76, 6,
- 6, 6, 6, 6, 5, 5, 5, 9, 118, 244, 248, 151, 51, 24, 23, 11
- }, {
- 6, 6, 60, 174, 174, 174, 173, 173, 174, 113, 6, 5, 5, 5, 5, 6,
- 20, 100, 188, 224, 187, 169, 143, 29, 7, 6, 5, 5, 5, 5, 7, 44,
- 79, 8, 5, 5, 5, 5, 5, 41, 220, 235, 117, 9, 70, 165, 226, 208,
- 194, 179, 25, 6, 6, 6, 51, 232, 196, 10, 41, 157, 193, 41, 5, 5,
- 5, 6, 6, 6, 6, 7, 79, 172, 182, 150, 16, 5, 7, 5, 5, 5,
- 5, 7, 5, 6, 5, 5, 5, 5, 5, 6, 5, 6, 6, 7, 38, 118,
- 194, 230, 195, 169, 166, 92, 6, 6, 6, 6, 6, 6, 5, 7, 6, 6,
- 7, 6, 5, 6, 5, 5, 5, 5, 8, 64, 164, 226, 233, 200, 169, 48
- }, {
- 5, 6, 7, 11, 15, 11, 9, 15, 9, 6, 5, 5, 5, 5, 6, 6,
- 6, 6, 5, 12, 31, 27, 6, 6, 5, 6, 6, 5, 5, 5, 6, 7,
- 6, 7, 5, 5, 5, 5, 7, 16, 31, 29, 10, 7, 6, 7, 21, 40,
- 34, 16, 8, 6, 10, 14, 20, 40, 34, 16, 15, 15, 26, 13, 5, 5,
- 5, 7, 15, 15, 15, 16, 15, 14, 21, 16, 6, 6, 6, 5, 5, 5,
- 5, 6, 12, 14, 10, 5, 5, 5, 5, 6, 6, 11, 14, 14, 15, 15,
- 15, 25, 41, 41, 25, 6, 7, 6, 6, 12, 15, 10, 6, 15, 11, 13,
- 14, 6, 6, 6, 5, 5, 5, 5, 6, 10, 24, 25, 29, 25, 8, 5
- }, {
- 6, 6, 6, 120, 192, 118, 64, 192, 63, 6, 5, 5, 5, 5, 5, 5,
- 6, 6, 6, 6, 6, 6, 5, 6, 6, 6, 5, 5, 5, 5, 6, 6,
- 6, 6, 5, 5, 5, 5, 6, 7, 6, 6, 5, 6, 5, 34, 176, 192,
- 191, 192, 52, 6, 93, 193, 192, 192, 192, 191, 191, 191, 191, 68, 5, 5,
- 5, 50, 187, 192, 192, 191, 192, 193, 193, 182, 19, 6, 6, 6, 19, 24,
- 25, 25, 146, 192, 129, 24, 24, 24, 19, 6, 5, 77, 163, 163, 161, 163,
- 162, 164, 184, 192, 163, 18, 7, 5, 6, 119, 192, 83, 36, 181, 108, 153,
- 154, 14, 6, 5, 5, 15, 24, 24, 26, 70, 216, 168, 21, 9, 6, 5
- }, {
- 5, 5, 5, 180, 255, 134, 78, 254, 86, 6, 5, 5, 5, 5, 6, 6,
- 6, 6, 34, 61, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 6, 17, 15, 6, 5, 5, 5, 43, 234, 252,
- 253, 252, 67, 6, 126, 255, 214, 166, 167, 166, 166, 166, 166, 58, 5, 5,
- 5, 70, 252, 255, 219, 167, 167, 166, 212, 249, 56, 6, 6, 11, 153, 218,
- 218, 218, 247, 255, 244, 218, 219, 218, 162, 13, 7, 26, 35, 36, 37, 37,
- 36, 43, 199, 255, 170, 8, 6, 6, 6, 184, 255, 114, 98, 254, 109, 238,
- 159, 9, 6, 6, 6, 116, 219, 218, 219, 229, 255, 248, 192, 27, 6, 6
- }, {
- 5, 5, 14, 200, 255, 103, 64, 249, 85, 5, 6, 5, 5, 5, 6, 6,
- 89, 71, 116, 208, 44, 114, 20, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 7, 90, 83, 6, 5, 5, 5, 16, 69, 76,
- 76, 76, 22, 5, 124, 255, 134, 6, 13, 40, 37, 7, 6, 5, 5, 5,
- 5, 64, 249, 255, 144, 5, 8, 7, 52, 233, 139, 8, 7, 7, 138, 255,
- 255, 201, 162, 162, 163, 162, 162, 162, 120, 11, 7, 145, 245, 245, 244, 244,
- 244, 243, 253, 255, 224, 25, 6, 6, 6, 174, 255, 110, 164, 243, 120, 252,
- 99, 6, 7, 6, 6, 139, 250, 154, 129, 175, 255, 226, 112, 19, 7, 5
- }, {
- 5, 5, 24, 215, 255, 79, 37, 234, 90, 6, 6, 5, 5, 5, 6, 6,
- 104, 236, 237, 247, 234, 172, 18, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 6, 70, 144, 6, 5, 5, 5, 32, 164, 177,
- 177, 176, 50, 6, 115, 255, 140, 8, 59, 243, 218, 8, 6, 5, 5, 5,
- 5, 47, 240, 255, 153, 46, 87, 143, 159, 86, 207, 49, 7, 6, 51, 244,
- 255, 180, 15, 6, 6, 5, 5, 5, 5, 6, 6, 131, 254, 144, 97, 97,
- 97, 102, 214, 255, 183, 13, 6, 6, 6, 153, 255, 91, 202, 175, 140, 222,
- 33, 5, 6, 6, 6, 140, 242, 54, 6, 98, 255, 193, 5, 5, 5, 6
- }, {
- 5, 5, 36, 233, 251, 62, 11, 208, 136, 7, 6, 5, 5, 5, 5, 6,
- 76, 219, 247, 253, 240, 134, 12, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 7, 32, 218, 47, 5, 5, 5, 42, 232, 250,
- 250, 249, 67, 5, 101, 255, 183, 12, 64, 255, 228, 7, 7, 5, 5, 5,
- 5, 16, 219, 255, 245, 249, 255, 238, 185, 17, 37, 35, 7, 5, 9, 128,
- 255, 253, 146, 17, 5, 5, 5, 5, 5, 6, 6, 71, 249, 124, 8, 6,
- 7, 14, 190, 255, 159, 6, 6, 6, 5, 123, 255, 111, 25, 19, 21, 25,
- 8, 5, 6, 6, 6, 141, 242, 53, 6, 73, 255, 195, 8, 6, 7, 5
- }, {
- 2, 2, 25, 124, 120, 23, 3, 73, 93, 6, 3, 2, 2, 2, 3, 3,
- 55, 63, 65, 107, 44, 81, 11, 2, 2, 2, 2, 2, 3, 4, 2, 2,
- 2, 2, 3, 3, 2, 2, 3, 5, 85, 99, 20, 2, 3, 7, 32, 35,
- 35, 34, 10, 3, 28, 122, 121, 29, 32, 127, 117, 14, 3, 2, 2, 2,
- 2, 3, 75, 127, 126, 93, 52, 22, 3, 2, 2, 2, 2, 3, 29, 99,
- 127, 127, 126, 90, 28, 6, 3, 3, 3, 3, 3, 5, 77, 112, 29, 4,
- 3, 7, 96, 127, 80, 2, 2, 3, 3, 35, 125, 76, 3, 2, 3, 3,
- 2, 2, 2, 2, 2, 70, 121, 26, 3, 22, 120, 107, 11, 3, 2, 5
- }, {
- 3, 3, 29, 127, 113, 16, 2, 30, 116, 25, 3, 2, 2, 2, 3, 3,
- 2, 3, 36, 71, 3, 3, 2, 2, 2, 2, 2, 3, 40, 65, 65, 65,
- 65, 65, 65, 47, 4, 3, 3, 2, 32, 121, 110, 56, 22, 11, 10, 10,
- 10, 10, 4, 3, 5, 74, 125, 112, 82, 127, 125, 44, 3, 2, 2, 2,
- 2, 3, 25, 119, 125, 39, 4, 3, 2, 2, 2, 2, 2, 7, 92, 127,
- 122, 77, 106, 127, 120, 92, 62, 38, 9, 3, 3, 3, 8, 57, 83, 37,
- 3, 12, 109, 127, 79, 3, 3, 3, 3, 10, 106, 111, 15, 4, 3, 3,
- 2, 2, 2, 2, 3, 71, 121, 27, 3, 6, 91, 124, 32, 3, 3, 6
- }, {
- 3, 3, 42, 127, 107, 10, 3, 3, 63, 83, 10, 2, 2, 2, 2, 3,
- 3, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 3, 46, 76, 76, 76,
- 76, 76, 75, 54, 4, 2, 3, 3, 4, 58, 123, 127, 119, 106, 104, 104,
- 104, 104, 28, 3, 3, 7, 39, 58, 60, 99, 127, 101, 14, 2, 2, 2,
- 2, 2, 2, 60, 125, 112, 28, 3, 3, 2, 2, 2, 2, 7, 93, 103,
- 36, 3, 94, 127, 93, 36, 55, 58, 14, 3, 3, 3, 3, 3, 3, 3,
- 4, 56, 127, 127, 76, 3, 2, 3, 2, 3, 48, 124, 81, 10, 3, 2,
- 2, 2, 2, 2, 3, 70, 126, 78, 48, 14, 28, 115, 93, 10, 3, 5
- }, {
- 2, 2, 56, 127, 99, 4, 3, 2, 6, 34, 11, 2, 2, 3, 3, 3,
- 2, 3, 2, 3, 3, 3, 2, 2, 2, 2, 3, 3, 2, 3, 2, 2,
- 2, 2, 3, 3, 3, 3, 3, 3, 2, 4, 45, 103, 125, 127, 127, 127,
- 127, 127, 34, 3, 3, 3, 3, 3, 2, 22, 104, 127, 101, 39, 12, 2,
- 2, 2, 3, 5, 55, 117, 115, 58, 22, 11, 6, 2, 2, 6, 46, 28,
- 18, 19, 99, 127, 90, 19, 18, 18, 15, 4, 3, 33, 69, 69, 69, 69,
- 87, 123, 127, 122, 37, 3, 3, 3, 3, 2, 5, 64, 121, 92, 34, 10,
- 10, 4, 2, 3, 3, 47, 120, 124, 120, 31, 3, 35, 108, 89, 21, 7
- }, {
- 3, 3, 58, 108, 75, 2, 3, 3, 3, 3, 2, 3, 2, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2, 2,
- 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 2, 9, 36, 63, 81, 88,
- 89, 88, 24, 3, 3, 3, 2, 2, 2, 3, 15, 57, 91, 98, 56, 3,
- 2, 2, 2, 2, 2, 22, 66, 97, 91, 74, 26, 3, 2, 5, 70, 97,
- 96, 97, 106, 108, 105, 97, 97, 97, 70, 6, 3, 48, 100, 100, 100, 100,
- 100, 100, 95, 46, 3, 2, 2, 2, 2, 2, 2, 4, 30, 72, 91, 79,
- 68, 11, 3, 3, 3, 5, 24, 30, 28, 10, 3, 3, 16, 61, 57, 10
- }, {
- 2, 3, 7, 11, 8, 21, 38, 19, 3, 2, 3, 2, 3, 4, 18, 29,
- 28, 29, 29, 29, 29, 29, 29, 27, 8, 3, 14, 38, 38, 38, 37, 37,
- 37, 37, 38, 38, 37, 11, 2, 2, 2, 2, 3, 3, 3, 2, 3, 2,
- 3, 2, 2, 3, 3, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 2, 2, 2, 3, 3, 2, 2, 2, 3, 3, 3, 3, 9, 11,
- 11, 11, 12, 12, 11, 11, 11, 11, 8, 3, 2, 3, 3, 2, 2, 2,
- 2, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 2,
- 2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 5
- }, {
- 3, 3, 3, 3, 3, 84, 127, 59, 3, 3, 3, 3, 3, 3, 29, 46,
- 45, 47, 102, 120, 62, 46, 45, 43, 11, 3, 41, 123, 123, 123, 123, 123,
- 123, 123, 123, 123, 119, 31, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
- 3, 2, 2, 2, 2, 3, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 3, 3, 3, 2, 2, 2,
- 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5
- }, {
- 2, 12, 89, 103, 102, 121, 127, 112, 103, 102, 64, 3, 3, 4, 74, 118,
- 118, 119, 125, 127, 120, 118, 118, 113, 26, 2, 16, 45, 45, 45, 45, 46,
- 45, 46, 46, 46, 43, 13, 2, 2, 2, 13, 58, 59, 59, 59, 58, 54,
- 10, 2, 2, 3, 3, 2, 2, 2, 2, 35, 38, 3, 2, 3, 2, 2,
- 3, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 2, 3, 3, 3,
- 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2,
- 2, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3,
- 3, 3, 3, 2, 3, 2, 2, 3, 3, 3, 3, 3, 2, 3, 3, 5
- }, {
- 5, 20, 140, 164, 175, 246, 253, 183, 165, 165, 103, 5, 5, 9, 166, 255,
- 156, 65, 65, 65, 64, 74, 217, 249, 60, 5, 80, 238, 238, 239, 237, 240,
- 238, 238, 238, 238, 230, 60, 5, 5, 5, 29, 132, 132, 132, 132, 133, 122,
- 20, 5, 5, 5, 5, 5, 6, 6, 5, 159, 173, 6, 7, 6, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
- }, {
- 5, 6, 5, 7, 39, 234, 236, 41, 6, 7, 7, 5, 6, 9, 163, 255,
- 124, 6, 6, 6, 7, 17, 177, 217, 52, 6, 23, 62, 116, 252, 255, 120,
- 62, 61, 63, 62, 60, 18, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6,
- 5, 6, 5, 5, 5, 5, 6, 68, 123, 204, 213, 123, 76, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
- }, {
- 5, 6, 6, 6, 59, 250, 213, 25, 6, 6, 6, 5, 5, 9, 164, 255,
- 130, 6, 6, 7, 7, 8, 27, 30, 11, 6, 6, 6, 25, 229, 255, 137,
- 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 5,
- 6, 6, 5, 5, 5, 5, 5, 126, 225, 244, 248, 225, 140, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
- }, {
- 6, 14, 81, 96, 141, 255, 216, 99, 97, 97, 61, 5, 5, 8, 148, 255,
- 181, 10, 6, 6, 6, 5, 6, 6, 7, 6, 6, 6, 6, 143, 254, 216,
- 25, 6, 6, 6, 7, 6, 5, 6, 5, 5, 5, 5, 5, 6, 6, 6,
- 6, 5, 5, 5, 5, 5, 5, 19, 30, 168, 183, 31, 21, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
- }, {
- 6, 25, 191, 220, 242, 255, 243, 222, 220, 221, 139, 5, 5, 5, 64, 246,
- 244, 63, 7, 7, 6, 7, 6, 6, 8, 6, 6, 7, 6, 26, 211, 255,
- 145, 13, 6, 6, 5, 6, 5, 6, 6, 154, 221, 221, 221, 221, 221, 221,
- 124, 7, 5, 5, 5, 5, 5, 5, 5, 122, 129, 6, 6, 6, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
- }, {
- 5, 9, 23, 27, 165, 255, 140, 26, 26, 26, 18, 5, 5, 5, 8, 111,
- 245, 219, 57, 6, 6, 6, 5, 7, 7, 6, 6, 6, 6, 6, 52, 211,
- 250, 140, 18, 6, 6, 6, 6, 6, 5, 35, 48, 49, 49, 49, 51, 50,
- 28, 6, 5, 5, 5, 5, 5, 5, 5, 12, 11, 6, 6, 6, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
- }, {
- 6, 6, 6, 6, 186, 255, 95, 5, 5, 5, 5, 5, 5, 5, 5, 8,
- 73, 197, 236, 155, 88, 82, 44, 7, 6, 6, 7, 7, 6, 7, 6, 31,
- 136, 225, 207, 141, 104, 8, 6, 6, 5, 5, 5, 5, 5, 5, 6, 5,
- 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 7, 6, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
- }, {
- 5, 6, 5, 8, 84, 107, 28, 5, 5, 5, 5, 5, 5, 5, 5, 6,
- 5, 17, 52, 99, 103, 90, 35, 6, 5, 5, 6, 5, 6, 6, 6, 5,
- 6, 28, 62, 101, 58, 7, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
- }
-};
-
-#endif /* MPLAYER_MATRIXVIEW_FONT_H */
diff --git a/libvo/mga_template.c b/libvo/mga_template.c
deleted file mode 100644
index 274be76098..0000000000
--- a/libvo/mga_template.c
+++ /dev/null
@@ -1,581 +0,0 @@
-/*
- * 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 "fastmemcpy.h"
-#include "cpudetect.h"
-#include "libswscale/swscale.h"
-#include <libavutil/imgutils.h>
-#include "libmpcodecs/vf_scale.h"
-#include "mp_msg.h"
-#include "old_vo_wrapper.h"
-
-// mga_vid drawing functions
-static void set_window( void ); /* forward declaration to kill warnings */
-#ifdef VO_XMGA
-static void mDrawColorKey( void ); /* forward declaration to kill warnings */
-#endif
-
-static int mga_next_frame=0;
-
-static mga_vid_config_t mga_vid_config;
-static uint8_t *vid_data, *frames[4];
-static int f = -1;
-
-static uint32_t drwX,drwY,drwWidth,drwHeight;
-static uint32_t drwcX,drwcY;
-
-static struct SwsContext *sws_ctx;
-
-static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
- uint32_t bespitch = FFALIGN(mga_vid_config.src_width, 32);
- x0+=mga_vid_config.src_width*(vo_panscan_x>>1)/(vo_dwidth+vo_panscan_x);
- switch(mga_vid_config.format){
- case MGA_VID_FORMAT_YV12:
- case MGA_VID_FORMAT_IYUV:
- case MGA_VID_FORMAT_I420:
- vo_draw_alpha_yv12(w,h,src,srca,stride,vid_data+bespitch*y0+x0,bespitch);
- break;
- case MGA_VID_FORMAT_YUY2:
- vo_draw_alpha_yuy2(w,h,src,srca,stride,vid_data+2*(bespitch*y0+x0),2*bespitch);
- break;
- case MGA_VID_FORMAT_UYVY:
- vo_draw_alpha_yuy2(w,h,src,srca,stride,vid_data+2*(bespitch*y0+x0)+1,2*bespitch);
- break;
- }
-}
-
-static void draw_osd(void)
-{
-// vo_draw_text(mga_vid_config.src_width,mga_vid_config.src_height,draw_alpha);
- vo_draw_text(mga_vid_config.src_width-mga_vid_config.src_width*vo_panscan_x/(vo_dwidth+vo_panscan_x),mga_vid_config.src_height,draw_alpha);
-}
-
-
-static void
-draw_slice_g200(uint8_t *image[], int stride[], int width,int height,int x,int y)
-{
- uint32_t bespitch = FFALIGN(mga_vid_config.src_width, 32);
- int dst_stride[4] = { bespitch, bespitch };
- uint8_t *dst[4];
-
- av_image_fill_pointers(dst, PIX_FMT_NV12, mga_vid_config.src_height,
- vid_data, dst_stride);
-
- sws_scale(sws_ctx, image, stride, y, height, dst, dst_stride);
-}
-
-static void
-draw_slice_g400(uint8_t *image[], int stride[], int w,int h,int x,int y)
-{
- uint8_t *dest;
- uint8_t *dest2;
- uint32_t bespitch,bespitch2;
-
- bespitch = FFALIGN(mga_vid_config.src_width, 32);
- bespitch2 = bespitch/2;
-
- dest = vid_data + bespitch * y + x;
- mem2agpcpy_pic(dest, image[0], w, h, bespitch, stride[0]);
-
- w/=2;h/=2;x/=2;y/=2;
-
- dest = vid_data + bespitch*mga_vid_config.src_height + bespitch2 * y + x;
- dest2= dest + bespitch2*mga_vid_config.src_height / 2;
-
- if(mga_vid_config.format==MGA_VID_FORMAT_YV12){
- // mga_vid's YV12 assumes Y,U,V order (instead of Y,V,U) :(
- mem2agpcpy_pic(dest, image[1], w, h, bespitch2, stride[1]);
- mem2agpcpy_pic(dest2,image[2], w, h, bespitch2, stride[2]);
- } else {
- mem2agpcpy_pic(dest, image[2], w, h, bespitch2, stride[2]);
- mem2agpcpy_pic(dest2,image[1], w, h, bespitch2, stride[1]);
- }
-
-}
-
-static int
-draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y)
-{
-
-#if 0
- printf("vo: %p/%d %p/%d %p/%d %dx%d/%d;%d \n",
- src[0],stride[0],
- src[1],stride[1],
- src[2],stride[2],
- w,h,x,y);
-#endif
-
- if (mga_vid_config.card_type == MGA_G200)
- draw_slice_g200(src,stride,w,h,x,y);
- else
- draw_slice_g400(src,stride,w,h,x,y);
- return 0;
-}
-
-static void
-vo_mga_flip_page(void)
-{
-
-// printf("-- flip to %d --\n",mga_next_frame);
-
- ioctl(f,MGA_VID_FSEL,&mga_next_frame);
- mga_next_frame=(mga_next_frame+1)%mga_vid_config.num_frames;
- vid_data=frames[mga_next_frame];
-
-}
-
-static int
-draw_frame(uint8_t *src[])
-{
- mp_msg(MSGT_VO,MSGL_WARN,"!!! mga::draw_frame() called !!!\n");
- return 0;
-}
-
-static uint32_t get_image(mp_image_t *mpi){
- uint32_t bespitch = FFALIGN(mga_vid_config.src_width, 32);
- uint32_t bespitch2 = bespitch/2;
-// printf("mga: get_image() called\n");
- if(mpi->type==MP_IMGTYPE_STATIC && mga_vid_config.num_frames>1) return VO_FALSE; // it is not static
- if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram
- if(mga_vid_config.card_type == MGA_G200 && mpi->flags&MP_IMGFLAG_PLANAR) return VO_FALSE;
-// printf("width=%d vs. bespitch=%d, flags=0x%X \n",mpi->width,bespitch,mpi->flags);
- if((mpi->width==bespitch) ||
- (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH))){
- // we're lucky or codec accepts stride => ok, let's go!
- if(mpi->flags&MP_IMGFLAG_PLANAR){
- mpi->planes[0]=vid_data;
- if(mpi->flags&MP_IMGFLAG_SWAPPED){
- mpi->planes[1]=vid_data + bespitch*mga_vid_config.src_height;
- mpi->planes[2]=mpi->planes[1] + bespitch2*mga_vid_config.src_height/2;
- } else {
- mpi->planes[2]=vid_data + bespitch*mga_vid_config.src_height;
- mpi->planes[1]=mpi->planes[2] + bespitch2*mga_vid_config.src_height/2;
- }
- mpi->width=mpi->stride[0]=bespitch;
- mpi->stride[1]=mpi->stride[2]=bespitch2;
- } else {
- mpi->planes[0]=vid_data;
- mpi->width=bespitch;
- mpi->stride[0]=mpi->width*(mpi->bpp/8);
- }
- mpi->flags|=MP_IMGFLAG_DIRECT;
-// printf("mga: get_image() SUCCESS -> Direct Rendering ENABLED\n");
- return VO_TRUE;
- }
- return VO_FALSE;
-}
-
-static uint32_t
-draw_image(mp_image_t *mpi){
- uint32_t bespitch = FFALIGN(mga_vid_config.src_width, 32);
-
- // if -dr or -slices then do nothing:
- if(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK)) return VO_TRUE;
-
- if(mpi->flags&MP_IMGFLAG_PLANAR){
- // copy planar:
- draw_slice(mpi->planes,mpi->stride,mpi->w,mpi->h,0,0);
- } else {
- // copy packed:
- mem2agpcpy_pic(vid_data, mpi->planes[0], // dst,src
- mpi->w*(mpi->bpp/8), mpi->h, // w,h
- bespitch*2, mpi->stride[0]); // dstride,sstride
- }
- return VO_TRUE;
-}
-
-static int
-query_format(uint32_t format)
-{
- switch(format){
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_YUY2:
- case IMGFMT_UYVY:
- return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD|VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN|VFCAP_ACCEPT_STRIDE;
- }
- return 0;
-}
-
-#ifndef VO_XMGA
-static void mga_fullscreen(void)
-{
- uint32_t w,h;
- if ( !vo_fs ) {
- vo_fs=VO_TRUE;
- w=vo_screenwidth; h=vo_screenheight;
- aspect(&w,&h,A_ZOOM);
- } else {
- vo_fs=VO_FALSE;
- w=vo_dwidth; h=vo_dheight;
- aspect(&w,&h,A_NOZOOM);
- }
- mga_vid_config.dest_width = w;
- mga_vid_config.dest_height= h;
- mga_vid_config.x_org=(vo_screenwidth-w)/2;
- mga_vid_config.y_org=(vo_screenheight-h)/2;
- if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) )
- mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] error in mga_vid_config ioctl (wrong mga_vid.o version?)" );
-}
-#endif
-
-static int control(uint32_t request, void *data)
-{
- switch (request) {
- case VOCTRL_QUERY_FORMAT:
- return query_format(*((uint32_t*)data));
- case VOCTRL_GET_IMAGE:
- return get_image(data);
- case VOCTRL_DRAW_IMAGE:
- return draw_image(data);
- case VOCTRL_SET_EQUALIZER:
- {
- short value;
- uint32_t luma,prev;
- struct voctrl_set_equalizer_args *args = data;
-
- 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()");
- mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Could not get luma values from the kernel module!\n");
- return VO_FALSE;
- }
-
-// printf("GET: 0x%4X 0x%4X \n",(prev>>16),(prev&0xffff));
-
- 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(args->name, "contrast"))
- luma = (prev&0xFFFF0000)|(value&0xFFFF);
- else
- luma = (prev&0xFFFF)|(value<<16);
-
- if (ioctl(f,MGA_VID_SET_LUMA,luma)) {
- perror("Error in mga_vid_config ioctl()");
- mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Could not set luma values from the kernel module!\n");
- return VO_FALSE;
- }
-
- return VO_TRUE;
- }
-
- case VOCTRL_GET_EQUALIZER:
- {
- short val;
- uint32_t luma;
- struct voctrl_get_equalizer_args *args = data;
-
- 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()");
- mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Could not get luma values from the kernel module!\n");
- return VO_FALSE;
- }
-
- if (!strcmp(args->name, "contrast"))
- val=(luma & 0xFFFF);
- else
- val=(luma >> 16);
-
- *args->valueptr = (val*200)/255;
-
- return VO_TRUE;
- }
-
-#ifndef VO_XMGA
- case VOCTRL_FULLSCREEN:
- if (vo_screenwidth && vo_screenheight)
- mga_fullscreen();
- else
- mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Screen width/height unknown!\n");
- return VO_TRUE;
- case VOCTRL_GET_PANSCAN:
- if ( !vo_fs ) return VO_FALSE;
- return VO_TRUE;
-#endif
-
-#ifdef VO_XMGA
- case VOCTRL_ONTOP:
- vo_x11_ontop();
- return VO_TRUE;
- case VOCTRL_GET_PANSCAN:
- if ( !initialized || !vo_fs ) return VO_FALSE;
- return VO_TRUE;
- case VOCTRL_FULLSCREEN:
- vo_x11_fullscreen();
- vo_panscan_amount=0;
- /* intended, fallthrough to update panscan on fullscreen/windowed switch */
-#endif
- case VOCTRL_SET_PANSCAN:
- if ( vo_fs && ( vo_panscan != vo_panscan_amount ) ) // || ( !vo_fs && vo_panscan_amount ) )
- {
-// int old_y = vo_panscan_y;
- panscan_calc();
-// if ( old_y != vo_panscan_y )
- set_window();
- }
- return VO_TRUE;
- case VOCTRL_UPDATE_SCREENINFO:
-#ifdef VO_XMGA
- update_xinerama_info();
-#else
- aspect_save_screenres(vo_screenwidth, vo_screenheight);
-#endif
- return VO_TRUE;
- }
- return VO_NOTIMPL;
-}
-
-
-static int mga_init(int width,int height,unsigned int format){
-
- uint32_t bespitch = FFALIGN(width, 32);
- switch(format){
- case IMGFMT_YV12:
- width = FFALIGN(width, 2);
- height = FFALIGN(height, 2);
- mga_vid_config.frame_size = bespitch * height + (bespitch * height) / 2;
- mga_vid_config.format=MGA_VID_FORMAT_I420; break;
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- width = FFALIGN(width, 2);
- height = FFALIGN(height, 2);
- mga_vid_config.frame_size = bespitch * height + (bespitch * height) / 2;
- mga_vid_config.format=MGA_VID_FORMAT_YV12; break;
- case IMGFMT_YUY2:
- mga_vid_config.frame_size = bespitch * height * 2;
- mga_vid_config.format=MGA_VID_FORMAT_YUY2; break;
- case IMGFMT_UYVY:
- mga_vid_config.frame_size = bespitch * height * 2;
- mga_vid_config.format=MGA_VID_FORMAT_UYVY; break;
- default:
- mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] invalid output format %0X\n",format);
- return -1;
- }
-
- mga_vid_config.src_width = width;
- mga_vid_config.src_height= height;
- if(!mga_vid_config.dest_width)
- mga_vid_config.dest_width = width;
- if(!mga_vid_config.dest_height)
- mga_vid_config.dest_height= height;
-
- mga_vid_config.colkey_on=0;
-
- mga_vid_config.num_frames=(vo_directrendering && !vo_doublebuffering)?1:3;
- mga_vid_config.version=MGA_VID_VERSION;
-
- if(width > 1024 && height > 1024)
- {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[MGA] Source resolution exceeds 1023x1023 in at least one dimension.\n[MGA] Rescale in software or use -lavdopts lowres=1.\n");
- return -1;
- } else if(height <= 1024)
- {
- // try whether we have a G550
- int ret;
- if ((ret = ioctl(f,MGA_VID_CONFIG,&mga_vid_config)))
- {
- if(mga_vid_config.card_type != MGA_G550)
- {
- // we don't have a G550, so our resolution is too high
- mp_tmsg(MSGT_VO,MSGL_ERR, "[MGA] Source resolution exceeds 1023x1023 in at least one dimension.\n[MGA] Rescale in software or use -lavdopts lowres=1.\n");
- return -1;
- } else {
- // there is a deeper problem
- // we have a G550, but still couldn't configure mga_vid
- perror("Error in mga_vid_config ioctl()");
- mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Your mga_vid driver version is incompatible with this MPlayer version!\n");
- return -1;
- }
- // if we arrived here, then we could successfully configure mga_vid
- // at this high resolution
- }
- } else {
- // configure mga_vid in case resolution is < 1024x1024 too
- if (ioctl(f,MGA_VID_CONFIG,&mga_vid_config))
- {
- perror("Error in mga_vid_config ioctl()");
- mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Your mga_vid driver version is incompatible with this MPlayer version!\n");
- return -1;
- }
- }
- if (mga_vid_config.card_type == MGA_G200) {
- sws_ctx = sws_getContext(width, height, PIX_FMT_YUV420P,
- width, height, PIX_FMT_NV12,
- SWS_BILINEAR, NULL, NULL, NULL);
- if (!sws_ctx) {
- mp_msg(MSGT_VO, MSGL_FATAL,
- "Could not get swscale context to scale for G200.\n");
- return -1;
- }
- mp_msg(MSGT_VO, MSGL_WARN, "G200 cards support is untested. "
- "Please report whether it works.\n");
- }
-
- mp_msg(MSGT_VO,MSGL_V,"[MGA] Using %d buffers.\n",mga_vid_config.num_frames);
-
- frames[0] = mmap(0,mga_vid_config.frame_size*mga_vid_config.num_frames,PROT_WRITE,MAP_SHARED,f,0);
- frames[1] = frames[0] + 1*mga_vid_config.frame_size;
- frames[2] = frames[0] + 2*mga_vid_config.frame_size;
- frames[3] = frames[0] + 3*mga_vid_config.frame_size;
- mga_next_frame = 0;
- vid_data = frames[mga_next_frame];
-
- //clear the buffer
- memset(frames[0],0x80,mga_vid_config.frame_size*mga_vid_config.num_frames);
-
-#ifndef VO_XMGA
- ioctl(f,MGA_VID_ON,0);
-#endif
-
- return 0;
-}
-
-static int mga_uninit(void){
- if(f>=0){
- ioctl( f,MGA_VID_OFF,0 );
- munmap(frames[0],mga_vid_config.frame_size*mga_vid_config.num_frames);
- close(f);
- f = -1;
- }
- if (sws_ctx) {
- sws_freeContext(sws_ctx);
- }
- return 0;
-}
-
-static int preinit(const char *vo_subdevice)
-{
- uint32_t ver;
- const char *devname=vo_subdevice?vo_subdevice:"/dev/mga_vid";
-
- f = open(devname,O_RDWR);
- if(f == -1)
- {
- perror("open");
- mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Couldn't open: %s\n",devname);
- return -1;
- }
-
- // check whether the mga_vid driver has the same
- // version as we expect
-
- ioctl(f,MGA_VID_GET_VERSION,&ver);
- if(MGA_VID_VERSION != ver)
- {
- mp_tmsg(MSGT_VO, MSGL_ERR, "[MGA] mismatch between kernel (%u) and MPlayer (%u) mga_vid driver versions\n", ver, MGA_VID_VERSION);
- return -1;
- }
-
-#ifdef VO_XMGA
- if (!vo_init()) {
- close(f);
- return -1;
- }
-#endif
-
- return 0;
-}
-
-static void set_window( void ){
-
- drwcX = vo_dx;
- drwcY = vo_dy;
- drwWidth = vo_dwidth;
- drwHeight = vo_dheight;
-
- aspect(&drwWidth, &drwHeight, A_WINZOOM);
- panscan_calc_windowed();
- drwWidth += vo_panscan_x;
- drwHeight += vo_panscan_y;
- drwWidth = FFMIN(drwWidth, vo_screenwidth);
- drwHeight = FFMIN(drwHeight, vo_screenheight);
- drwX = (vo_dwidth - drwWidth ) / 2;
- drwY = (vo_dheight - drwHeight) / 2;
- drwcX += drwX;
- drwcY += drwY;
-
-#ifdef VO_XMGA
-#ifdef CONFIG_XINERAMA
- if(XineramaIsActive(mDisplay))
- {
- XineramaScreenInfo *screens;
- int num_screens;
- int i;
-
- screens = XineramaQueryScreens(mDisplay,&num_screens);
-
- /* find the screen we are on */
- i = 0;
- while(i<num_screens &&
- ((screens[i].x_org < drwcX) ||
- (screens[i].y_org < drwcY) ||
- (screens[i].x_org + screens[i].width >= drwcX) ||
- (screens[i].y_org + screens[i].height >= drwcY)))
- {
- i++;
- }
-
- if(i<num_screens)
- {
- /* save the screen we are on */
- xinerama_screen = i;
- } else {
- /* oops.. couldnt find the screen we are on
- * because the upper left corner left the
- * visual range. assume we are still on the
- * same screen
- */
- i = xinerama_screen;
- }
-
- if(xinerama_screen == -1)
- {
- // The default value of the xinerama_screen is
- // still there. Which means we could never
- // figure out on which screen we are.
- // Choose the first screen as default
- xinerama_screen = i = 0;
- }
-
- /* set drwcX and drwcY to the right values */
- drwcX = drwcX - screens[i].x_org;
- drwcY = drwcY - screens[i].y_org;
- XFree(screens);
- }
-
-#endif
-
- mDrawColorKey();
-#endif
-
- mga_vid_config.x_org=drwcX;
- mga_vid_config.y_org=drwcY;
- mga_vid_config.dest_width=drwWidth;
- mga_vid_config.dest_height=drwHeight;
- if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) ) mp_msg(MSGT_VO,MSGL_WARN,"Error in mga_vid_config ioctl (wrong mga_vid.o version?)" );
-}
diff --git a/libvo/sdl_common.c b/libvo/sdl_common.c
deleted file mode 100644
index 5b4c684565..0000000000
--- a/libvo/sdl_common.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * common SDL routines
- *
- * 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 "sdl_common.h"
-#include "old_vo_defines.h"
-#include "mp_msg.h"
-#include "mp_fifo.h"
-#include "input/keycodes.h"
-#include "input/input.h"
-#include "video_out.h"
-#include "aspect.h"
-
-static int old_w;
-static int old_h;
-static int mode_flags;
-static int reinit;
-static int screen_w, screen_h;
-
-int vo_sdl_init(void)
-{
- reinit = 0;
-
- if (!SDL_WasInit(SDL_INIT_VIDEO) &&
- SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE) < 0)
- return 0;
-
- if (screen_w == 0) {
- const SDL_VideoInfo *vi = SDL_GetVideoInfo();
- screen_w = vi->current_w;
- screen_h = vi->current_h;
- }
-
- // Setup Keyrepeats (500/30 are defaults)
- SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 100 /*SDL_DEFAULT_REPEAT_INTERVAL*/);
-
- // Easiest way to get uppercase characters
- SDL_EnableUNICODE(1);
-
- // We don't want those in our event queue.
- SDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE);
- SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE);
- SDL_EventState(SDL_USEREVENT, SDL_IGNORE);
-
- return 1;
-}
-
-void vo_sdl_uninit(void)
-{
- if (SDL_WasInit(SDL_INIT_VIDEO))
- SDL_QuitSubSystem(SDL_INIT_VIDEO);
-}
-
-void sdl_update_xinerama_info(void)
-{
- if (vo_screenwidth <= 0 || vo_screenheight <= 0) {
- vo_screenwidth = screen_w;
- vo_screenheight = screen_h;
- }
- aspect_save_screenres(vo_screenwidth, vo_screenheight);
-}
-
-void vo_sdl_fullscreen(void)
-{
- if (vo_fs) {
- vo_dwidth = old_w;
- vo_dheight = old_h;
- } else {
- old_w = vo_dwidth;
- old_h = vo_dheight;
- vo_dwidth = vo_screenwidth;
- vo_dheight = vo_screenheight;
- }
- vo_fs = !vo_fs;
- sdl_set_mode(0, mode_flags);
- // on OSX at least we now need to do a full reinit.
- // TODO: this should only be set if really necessary.
- reinit = 1;
-}
-
-int sdl_set_mode(int bpp, uint32_t flags)
-{
- SDL_Surface *s;
- mode_flags = flags;
- if (vo_fs) flags |= SDL_FULLSCREEN;
- // doublebuf with opengl creates flickering
- if (vo_doublebuffering && !(flags & SDL_OPENGL))
- flags |= SDL_DOUBLEBUF;
- s = SDL_SetVideoMode(vo_dwidth, vo_dheight, bpp, flags);
- if (!s) {
- mp_msg(MSGT_VO, MSGL_FATAL, "SDL SetVideoMode failed: %s\n", SDL_GetError());
- return -1;
- }
- vo_dwidth = s->w;
- vo_dheight = s->h;
- return 0;
-}
-
-static const struct mp_keymap keysym_map[] = {
- {SDLK_RETURN, KEY_ENTER}, {SDLK_ESCAPE, KEY_ESC},
- {SDLK_F1, KEY_F+1}, {SDLK_F2, KEY_F+2}, {SDLK_F3, KEY_F+3},
- {SDLK_F4, KEY_F+4}, {SDLK_F5, KEY_F+5}, {SDLK_F6, KEY_F+6},
- {SDLK_F7, KEY_F+7}, {SDLK_F8, KEY_F+8}, {SDLK_F9, KEY_F+9},
- {SDLK_F10, KEY_F+10}, {SDLK_F11, KEY_F+11}, {SDLK_F12, KEY_F+12},
- {SDLK_KP_PLUS, '+'}, {SDLK_KP_MINUS, '-'}, {SDLK_TAB, KEY_TAB},
- {SDLK_PAGEUP, KEY_PAGE_UP}, {SDLK_PAGEDOWN, KEY_PAGE_DOWN},
- {SDLK_UP, KEY_UP}, {SDLK_DOWN, KEY_DOWN},
- {SDLK_LEFT, KEY_LEFT}, {SDLK_RIGHT, KEY_RIGHT},
- {SDLK_KP_MULTIPLY, '*'}, {SDLK_KP_DIVIDE, '/'},
- {SDLK_KP0, KEY_KP0}, {SDLK_KP1, KEY_KP1}, {SDLK_KP2, KEY_KP2},
- {SDLK_KP3, KEY_KP3}, {SDLK_KP4, KEY_KP4}, {SDLK_KP5, KEY_KP5},
- {SDLK_KP6, KEY_KP6}, {SDLK_KP7, KEY_KP7}, {SDLK_KP8, KEY_KP8},
- {SDLK_KP9, KEY_KP9},
- {SDLK_KP_PERIOD, KEY_KPDEC}, {SDLK_KP_ENTER, KEY_KPENTER},
- {SDLK_BACKSPACE, KEY_BACKSPACE},
- {SDLK_INSERT, KEY_INSERT}, {SDLK_DELETE, KEY_DEL},
- {SDLK_HOME, KEY_HOME}, {SDLK_END, KEY_END},
- {0, 0}
-};
-
-static int get_mod_state(void)
-{
- SDLMod mod = SDL_GetModState();
- int modifiers = 0;
- if (mod & KMOD_SHIFT)
- modifiers |= KEY_MODIFIER_SHIFT;
- if (mod & KMOD_CTRL)
- modifiers |= KEY_MODIFIER_CTRL;
- if (mod & KMOD_ALT)
- modifiers |= KEY_MODIFIER_ALT;
- if (mod & KMOD_META)
- modifiers |= KEY_MODIFIER_META;
- return modifiers;
-}
-
-int sdl_default_handle_event(SDL_Event *event)
-{
- int mpkey;
- if (!event) {
- int res = reinit ? VO_EVENT_REINIT : 0;
- reinit = 0;
- return res;
- }
- switch (event->type) {
- case SDL_VIDEORESIZE:
- vo_dwidth = event->resize.w;
- vo_dheight = event->resize.h;
- return VO_EVENT_RESIZE;
-
- case SDL_VIDEOEXPOSE:
- return VO_EVENT_EXPOSE;
-
- case SDL_MOUSEMOTION:
- vo_mouse_movement(global_vo, event->motion.x, event->motion.y);
- break;
-
- case SDL_MOUSEBUTTONDOWN:
- if (!vo_nomouse_input)
- mplayer_put_key((MOUSE_BTN0 + event->button.button - 1)
- | MP_KEY_DOWN | get_mod_state());
- break;
-
- case SDL_MOUSEBUTTONUP:
- if (!vo_nomouse_input)
- mplayer_put_key((MOUSE_BTN0 + event->button.button - 1)
- | get_mod_state());
- break;
-
- case SDL_KEYDOWN: {
- int mods = get_mod_state();
- int sym = event->key.keysym.sym;
- mpkey = lookup_keymap_table(keysym_map, sym);
- if (!mpkey) {
- int unicode = event->key.keysym.unicode;
- if (unicode >= 32 && unicode < 128) {
- mpkey = unicode;
- } else {
- // SDL translates CTRL+letter to a control code < 32
- // Compensate for "unexpected" SDL behavior.
- // Note that CTRL combined with any non-letter key works fine.
- if (sym >= SDLK_a && sym <= SDLK_z) {
- mpkey = sym - SDLK_a + 'a';
- if (mods & KEY_MODIFIER_SHIFT)
- mpkey += 'A' - 'a';
- }
- }
- }
- if (mpkey)
- mplayer_put_key(mpkey | mods);
- break;
- }
-
- case SDL_QUIT:
- mplayer_put_key(KEY_CLOSE_WIN);
- break;
- }
- return 0;
-}
diff --git a/libvo/sdl_common.h b/libvo/sdl_common.h
deleted file mode 100644
index a1a5311bfc..0000000000
--- a/libvo/sdl_common.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * common SDL routines
- *
- * 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.
- */
-
-#ifndef MPLAYER_SDL_COMMON_H
-#define MPLAYER_SDL_COMMON_H
-
-#include "config.h"
-#ifdef CONFIG_SDL_SDL_H
-#include <SDL/SDL.h>
-#else
-#include <SDL.h>
-#endif
-
-int vo_sdl_init(void);
-void vo_sdl_uninit(void);
-void sdl_update_xinerama_info(void);
-void vo_sdl_fullscreen(void);
-int sdl_set_mode(int bpp, uint32_t flags);
-int sdl_default_handle_event(SDL_Event *event);
-
-#endif /* MPLAYER_SDL_COMMON_H */
diff --git a/libvo/spuenc.c b/libvo/spuenc.c
deleted file mode 100644
index 10d93b0792..0000000000
--- a/libvo/spuenc.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * encode a pixmap with RLE
- *
- * Copyright (C) 2000 Alejandro J. Cura <alecu@protocultura.net>
- *
- * (modified a bit to work with the dxr3 driver...4/2/2002 cg)
- *
- * Based on the hard work of:
- *
- * Samuel Hocevar <sam@via.ecp.fr> and Michel Lespinasse <walken@via.ecp.fr>
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include "unistd.h"
-#include "spuenc.h"
-
-typedef struct {
- int x, y;
- unsigned int rgb[4];
- unsigned char* pixels;
-} pixbuf;
-
-static void
-encode_do_control(int x,int y, encodedata* ed, pixbuf* pb) {
- int controlstart= ed->count;
- int x1;
- int i;
- unsigned int top, left, bottom, right;
-
- top= 450 - pb->y/2;
- left=(720 / 2) - (pb->x / 2);
- top= 32;//this forces the first bit to be visible on a TV
- left= 32;//you could actually pass in x/y and do some nice
- //calculations for making it look right...
- bottom= top + pb->y - 1;
- right= left + pb->x - 1;
-
-/* the format of this is well described by a page:
- * http://members.aol.com/mpucoder/DVD/spu.html
- *
- * note I changed the layout of commands to turn off the subpic as the
- * first command, and then turn on the new subpic...this is so we can
- * leave the subpic on for an arbitrary ammount of time as controlled by
- * mplayer (ie when we turn on the subpic we don't know how long it should
- * stay on when using mplayer).
- * with this layout we turn off the last subpic as we are turning on the
- * new one.
- * The original hd it turn on the subpic, and delay the turn off command using
- * the durration/delay feature.
- * */
- /* start at x0+2*/
- i= controlstart;
- /* display duration... */
-// ed->data[i++]= 0x00;
-// ed->data[i++]= 0x00; //durration before turn off command occurs
- //in 90000/1024 units
-
- /* x1 */
-// x1=i+4;
-// ed->data[i++]= x1 >> 8;//location of next command block
-// ed->data[i++]= x1 & 0xff;
- /* finish it */
-// ed->data[i++]= 0x02;//turn off command
-// ed->data[i++]= 0xff;//end of command block
- x1= i; //marker for last command block address
-
- /* display duration... */
- ed->data[i++]= 0x00;
- ed->data[i++]= 0x00; //durration before turn on command occurs
- //in 90000/1024 units
- /* x1 */
- ed->data[i++]= x1 >> 8; //since this is the last command block, this
- ed->data[i++]= x1 & 0xff;//points back to itself
-
-
- /* 0x01: start displaying */
- ed->data[i++]= 0x01;
-
- /* 0x03: palette info */
- ed->data[i++]= 0x03;
- ed->data[i++]= 0x08;
- ed->data[i++]= 0x7f;
-/*
- * The palette is a coded index (one of 16) 0 is black, 0xf is white
- * (unless you screw with the default palette)
- * for what I am doing I only use white.
- * 7 is lt grey, and 8 is dk grey...
- * */
- /* 0x04: transparency info (reversed) */
- ed->data[i++]= 0x04;
- ed->data[i++]= 0xFF;//change the opacity values of the color entries
- ed->data[i++]= 0xF0;//say if you wanted white text on a black backround
- //note you will have to work harder, by finding the
- //bounding box of the text, and use a non transparent black palette
- // entry to fill the backround with, (say color 1 instead of 0)
-
- /* 0x05: coordinates */
- ed->data[i++]= 0x05;
- ed->data[i++]= left >> 4;
- ed->data[i++]= ((left&0xf)<<4)+(right>>8);
- ed->data[i++]= (right&0xff);
- ed->data[i++]= top >> 4;
- ed->data[i++]= ((top&0xf)<<4)+(bottom>>8);
- ed->data[i++]= (bottom&0xff);
-
- /* 0x06: both fields' offsets */
- ed->data[i++]= 0x06;
- ed->data[i++]= 0x00;
- ed->data[i++]= 0x04;
- ed->data[i++]= ed->oddstart >> 8;
- ed->data[i++]= ed->oddstart & 0xff;
-
- /* 0xFF: end sequence */
- ed->data[i++]= 0xFF;
- if(! i&1 ) {
- ed->data[i++]= 0xff;
- }
-
- /* x0 */
- ed->data[2]= (controlstart) >> 8;
- ed->data[3]= (controlstart) & 0xff;
-
- /* packet size */
- ed->data[0]= i >> 8;
- ed->data[1]= i & 0xff;
-
- ed->count= i;
-}
-
-static void
-encode_put_nibble( encodedata* ed, unsigned char nibble ) {
- if( ed->nibblewaiting ) {
- ed->data[ed->count++]|= nibble;
- ed->nibblewaiting= 0;
- } else {
- ed->data[ed->count]= nibble<<4;
- ed->nibblewaiting= 1;
- }
-}
-
-static void
-encode_pixels( encodedata* ed, int color, int number ) {
- if(number > 3) {
- if(number > 15) {
- encode_put_nibble( ed, 0 );
- if(number > 63) {
- encode_put_nibble( ed, (number & 0xC0)>>6 );
- }
- }
- encode_put_nibble( ed, (number & 0x3C)>>2 );
- }
- encode_put_nibble( ed, ((number & 0xF)<<2) | color);
-}
-
-static void
-encode_eol( encodedata* ed ) {
- if( ed->nibblewaiting ) {
- ed->count++;
- ed->nibblewaiting= 0;
- }
- ed->data[ed->count++]= 0x00;
- ed->data[ed->count++]= 0x00;
-}
-
-static void
-encode_do_row( encodedata* ed, pixbuf* pb, int row ) {
- int i= 0;
- unsigned char* pix= pb->pixels + row * pb->x;
- int color= *pix;
- int n= 0; /* the number of pixels of this color */
-
- while( i++ < pb->x ) {
- /* FIXME: watch this space for EOL */
- if( *pix != color || n == 255 ) {
- encode_pixels( ed, color, n );
- color= *pix;
- n= 1;
- } else {
- n++;
- }
- pix++;
- }
-
- /* this small optimization: (n>63) can save up to two bytes per line
- * I wonder if this is compatible with all the hardware... */
- if( color == 0 && n > 63 ) {
- encode_eol( ed );
- } else {
- encode_pixels( ed, color, n );
- }
-
- if( ed->nibblewaiting ) {
- ed->count++;
- ed->nibblewaiting= 0;
- }
-}
-
-
-void
-pixbuf_encode_rle(int x, int y, int w, int h, char *inbuf, int stride,encodedata *ed){
- pixbuf pb;
- int i, row;
- pb.x = w;
- pb.y = h;
-
- pb.pixels = inbuf;
- ed->count= 4;
- ed->nibblewaiting= 0;
-
- row= 0;
- for( i= 0; i < pb.y; i++ ) {
- encode_do_row(ed, &pb, row);
- row+= 2;
- if( row > pb.y ) {
- row= 1;
- ed->oddstart= ed->count;
- }
- }
- encode_do_control(x,y, ed, &pb);
-}
diff --git a/libvo/spuenc.h b/libvo/spuenc.h
deleted file mode 100644
index 39b999b2d8..0000000000
--- a/libvo/spuenc.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * encode a pixmap with RLE
- *
- * Copyright (C) 2000 Alejandro J. Cura <alecu@protocultura.net>
- *
- * 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.
- */
-
-#ifndef MPLAYER_SPUENC_H
-#define MPLAYER_SPUENC_H
-
-#include <stdlib.h>
-#define DATASIZE 53220
-
-typedef struct {
- unsigned char data[DATASIZE];
- int count; /* the count of bytes written */
- int oddstart;
- int nibblewaiting;
-} encodedata;
-
-void pixbuf_encode_rle(int x, int y, int w, int h, char *inbuf, int stride, encodedata *ed);
-
-#endif /* MPLAYER_SPUENC_H */
diff --git a/libvo/vesa_lvo.c b/libvo/vesa_lvo.c
deleted file mode 100644
index f5cbab4757..0000000000
--- a/libvo/vesa_lvo.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * vo_vesa interface to Linux Video Overlay
- * (partly based on vo_mga.c)
- *
- * copyright (C) 2001 Nick Kurshev <nickols_k@mail.ru>
- *
- * 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 <inttypes.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "vesa_lvo.h"
-#include "libmpcodecs/img_format.h"
-#include "drivers/mga_vid.h" /* <- should be changed to "linux/'something'.h" */
-#include "fastmemcpy.h"
-#include "osd.h"
-#include "video_out.h"
-#include "sub/sub.h"
-#include "libmpcodecs/vfcap.h"
-
-#define WIDTH_ALIGN 32 /* should be 16 for rage:422 and 32 for rage:420 */
-#define NUM_FRAMES 10
-
-static uint8_t *frames[NUM_FRAMES];
-
-static int lvo_handler = -1;
-static uint8_t *lvo_mem = NULL;
-static uint8_t next_frame;
-static mga_vid_config_t mga_vid_config;
-static unsigned image_bpp,image_height,image_width,src_format;
-int vlvo_control(uint32_t request, void *data);
-
-#define PIXEL_SIZE() ((video_mode_info.BitsPerPixel+7)/8)
-#define SCREEN_LINE_SIZE(pixel_size) (video_mode_info.XResolution*(pixel_size) )
-#define IMAGE_LINE_SIZE(pixel_size) (image_width*(pixel_size))
-
-int vlvo_init(unsigned src_width,unsigned src_height,
- unsigned x_org,unsigned y_org,unsigned dst_width,
- unsigned dst_height,unsigned format,unsigned dest_bpp)
-{
- size_t i,awidth;
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VESA_LVO] This branch is no longer supported.\n[VESA_LVO] Please use -vo vesa:vidix instead.\n");
- return -1;
- if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
- mp_msg(MSGT_VO,MSGL_DBG2, "vesa_lvo: vlvo_init() was called\n");}
- image_width = src_width;
- image_height = src_height;
- mga_vid_config.version=MGA_VID_VERSION;
- src_format = mga_vid_config.format=format;
- awidth = (src_width + (WIDTH_ALIGN-1)) & ~(WIDTH_ALIGN-1);
- switch(format){
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- image_bpp=16;
- mga_vid_config.frame_size = awidth*src_height+(awidth*src_height)/2;
- break;
- case IMGFMT_YUY2:
- case IMGFMT_UYVY:
- image_bpp=16;
- mga_vid_config.frame_size = awidth*src_height*2;
- break;
- case IMGFMT_RGB15:
- case IMGFMT_BGR15:
- case IMGFMT_RGB16:
- case IMGFMT_BGR16:
- image_bpp=16;
- mga_vid_config.frame_size = awidth*src_height*2;
- break;
- case IMGFMT_RGB24:
- case IMGFMT_BGR24:
- image_bpp=24;
- mga_vid_config.frame_size = awidth*src_height*3;
- break;
- case IMGFMT_RGB32:
- case IMGFMT_BGR32:
- image_bpp=32;
- mga_vid_config.frame_size = awidth*src_height*4;
- break;
- default:
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VESA_LVI] Invalid output format: %s(%0X)\n",vo_format_name(format),format);
- return -1;
- }
- mga_vid_config.colkey_on=0;
- mga_vid_config.src_width = src_width;
- mga_vid_config.src_height= src_height;
- mga_vid_config.dest_width = dst_width;
- mga_vid_config.dest_height= dst_height;
- mga_vid_config.x_org=x_org;
- mga_vid_config.y_org=y_org;
- mga_vid_config.num_frames=NUM_FRAMES;
- if (ioctl(lvo_handler,MGA_VID_CONFIG,&mga_vid_config))
- {
- perror("vesa_lvo: Error in mga_vid_config ioctl()");
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VESA_LVO] Your fb_vid driver version is incompatible with this MPlayer version!\n");
- return -1;
- }
- ioctl(lvo_handler,MGA_VID_ON,0);
-
- frames[0] = (char*)mmap(0,mga_vid_config.frame_size*mga_vid_config.num_frames,PROT_WRITE,MAP_SHARED,lvo_handler,0);
- for(i=1;i<NUM_FRAMES;i++)
- frames[i] = frames[i-1] + mga_vid_config.frame_size;
- next_frame = 0;
- lvo_mem = frames[next_frame];
-
- /*clear the buffer*/
- memset(frames[0],0x80,mga_vid_config.frame_size*mga_vid_config.num_frames);
- return 0;
-}
-
-void vlvo_term( void )
-{
- if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
- mp_msg(MSGT_VO,MSGL_DBG2, "vesa_lvo: vlvo_term() was called\n");}
- ioctl( lvo_handler,MGA_VID_OFF,0 );
- munmap(frames[0],mga_vid_config.frame_size*mga_vid_config.num_frames);
- if(lvo_handler != -1) close(lvo_handler);
-}
-
-static int vlvo_draw_slice_420(uint8_t *image[], int stride[],
- int w, int h, int x, int y)
-{
- uint8_t *src;
- uint8_t *dest;
- uint32_t bespitch,bespitch2;
- int i;
-
- bespitch = (mga_vid_config.src_width + (WIDTH_ALIGN-1)) & ~(WIDTH_ALIGN-1);
- bespitch2 = bespitch/2;
-
- dest = lvo_mem + bespitch * y + x;
- src = image[0];
- for(i=0;i<h;i++){
- fast_memcpy(dest,src,w);
- src+=stride[0];
- dest += bespitch;
- }
-
- w/=2;h/=2;x/=2;y/=2;
-
- dest = lvo_mem + bespitch*mga_vid_config.src_height + bespitch2 * y + x;
- src = image[1];
- for(i=0;i<h;i++){
- fast_memcpy(dest,src,w);
- src+=stride[1];
- dest += bespitch2;
- }
-
- dest = lvo_mem + bespitch*mga_vid_config.src_height
- + bespitch*mga_vid_config.src_height / 4
- + bespitch2 * y + x;
- src = image[2];
- for(i=0;i<h;i++){
- fast_memcpy(dest,src,w);
- src+=stride[2];
- dest += bespitch2;
- }
- return 0;
-}
-
-static int vlvo_draw_slice(uint8_t *image[], int stride[],
- int w,int h,int x,int y)
-{
- if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
- mp_msg(MSGT_VO,MSGL_DBG2, "vesa_lvo: vlvo_draw_slice() was called\n");}
- if(src_format == IMGFMT_YV12 || src_format == IMGFMT_I420 || src_format == IMGFMT_IYUV)
- vlvo_draw_slice_420(image,stride,w,h,x,y);
- else
- {
- uint8_t *dst;
- uint8_t bytpp;
- bytpp = (image_bpp+7)/8;
- dst = lvo_mem + (image_width * y + x)*bytpp;
- /* vlvo_draw_slice_422(image,stride,w,h,x,y); just for speed */
- fast_memcpy(dst,image[0],mga_vid_config.frame_size);
- }
- return 0;
-}
-
-static int vlvo_draw_frame(uint8_t *image[])
-{
-/* Note it's very strange but sometime for YUY2 draw_frame is called */
- fast_memcpy(lvo_mem,image[0],mga_vid_config.frame_size);
- if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
- mp_msg(MSGT_VO,MSGL_DBG2, "vesa_lvo: vlvo_flip_page() was called\n");}
- return 0;
-}
-
-static void vlvo_flip_page(void)
-{
- if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
- mp_msg(MSGT_VO,MSGL_DBG2, "vesa_lvo: vlvo_draw_osd() was called\n");}
- if(vo_doublebuffering)
- {
- ioctl(lvo_handler,MGA_VID_FSEL,&next_frame);
- next_frame=(next_frame+1)%mga_vid_config.num_frames;
- lvo_mem=frames[next_frame];
- }
-}
-
-#if 0
-static void draw_alpha_null(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)
-{
-}
-
-static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)
-{
- uint32_t bespitch = /*(*/mga_vid_config.src_width;// + 15) & ~15;
- switch(mga_vid_config.format){
- case IMGFMT_BGR15:
- case IMGFMT_RGB15:
- vo_draw_alpha_rgb15(w,h,src,srca,stride,lvo_mem+2*(y0*bespitch+x0),2*bespitch);
- break;
- case IMGFMT_BGR16:
- case IMGFMT_RGB16:
- vo_draw_alpha_rgb16(w,h,src,srca,stride,lvo_mem+2*(y0*bespitch+x0),2*bespitch);
- break;
- case IMGFMT_BGR24:
- case IMGFMT_RGB24:
- vo_draw_alpha_rgb24(w,h,src,srca,stride,lvo_mem+3*(y0*bespitch+x0),3*bespitch);
- break;
- case IMGFMT_BGR32:
- case IMGFMT_RGB32:
- vo_draw_alpha_rgb32(w,h,src,srca,stride,lvo_mem+4*(y0*bespitch+x0),4*bespitch);
- break;
- case IMGFMT_YV12:
- case IMGFMT_IYUV:
- case IMGFMT_I420:
- vo_draw_alpha_yv12(w,h,src,srca,stride,lvo_mem+bespitch*y0+x0,bespitch);
- break;
- case IMGFMT_YUY2:
- vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+2*(bespitch*y0+x0),bespitch);
- break;
- case IMGFMT_UYVY:
- vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+2*(bespitch*y0+x0)+1,bespitch);
- break;
- default:
- draw_alpha_null(x0,y0,w,h,src,srca,stride);
- }
-}
-#endif
-
-static void vlvo_draw_osd(void)
-{
- if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
- mp_msg(MSGT_VO,MSGL_DBG2,"vesa_lvo: vlvo_draw_osd() was called\n"); }
- /* TODO: hw support */
-#if 0
-/* disable this stuff until new fbvid.h interface will be implemented
- because in different fourcc radeon_vid and rage128_vid have different
- width alignment */
- vo_draw_text(mga_vid_config.src_width,mga_vid_config.src_height,draw_alpha);
-#endif
-}
-
-extern struct vo_old_functions video_out_vesa;
-
-int vlvo_preinit(const char *drvname)
-{
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VESA_LVO] This branch is no longer supported.\n[VESA_LVO] Please use -vo vesa:vidix instead.\n");
- return -1;
- if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
- mp_msg(MSGT_VO,MSGL_DBG2, "vesa_lvo: vlvo_preinit(%s) was called\n",drvname);}
- lvo_handler = open(drvname,O_RDWR);
- if(lvo_handler == -1)
- {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VESA_LVO] Couldn't open: '%s'\n",drvname);
- return -1;
- }
- /* we are able to tune up this stuff depend on fourcc format */
- video_out_vesa.draw_slice=vlvo_draw_slice;
- video_out_vesa.draw_frame=vlvo_draw_frame;
- video_out_vesa.flip_page=vlvo_flip_page;
- video_out_vesa.draw_osd=vlvo_draw_osd;
- video_out_vesa.control=vlvo_control;
- return 0;
-}
-
-static uint32_t vlvo_query_info(uint32_t format)
-{
- if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
- mp_msg(MSGT_VO,MSGL_DBG2, "vesa_lvo: query_format was called: %x (%s)\n",format,vo_format_name(format)); }
- return VFCAP_CSP_SUPPORTED;
-}
-
-int vlvo_control(uint32_t request, void *data)
-{
- switch (request) {
- case VOCTRL_QUERY_FORMAT:
- return vlvo_query_info(*((uint32_t*)data));
- }
- return VO_NOTIMPL;
-}
diff --git a/libvo/vesa_lvo.h b/libvo/vesa_lvo.h
deleted file mode 100644
index beacc0f577..0000000000
--- a/libvo/vesa_lvo.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * vo_vesa interface to Linux Video Overlay
- *
- * copyright (C) 2001 Nick Kurshev <nickols_k@mail.ru>
- *
- * 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.
- */
-
-#ifndef MPLAYER_VESA_LVO_H
-#define MPLAYER_VESA_LVO_H
-
-#include <stdint.h>
-
-int vlvo_preinit(const char *drvname);
-int vlvo_init(unsigned src_width,unsigned src_height,
- unsigned x_org,unsigned y_org,unsigned dst_width,
- unsigned dst_height,unsigned format,unsigned dest_bpp);
-void vlvo_term( void );
-
-#endif /* MPLAYER_VESA_LVO_H */
diff --git a/libvo/video_out.c b/libvo/video_out.c
index b49e5b095f..0adc82c090 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -75,46 +75,23 @@ int vo_colorkey = 0x0000ff00; // default colorkey is green
//
// Externally visible list of all vo drivers
//
-extern struct vo_driver video_out_mga;
-extern struct vo_driver video_out_xmga;
extern struct vo_driver video_out_x11;
-extern struct vo_driver video_out_xover;
extern struct vo_driver video_out_vdpau;
extern struct vo_driver video_out_xv;
extern struct vo_driver video_out_gl_nosw;
extern struct vo_driver video_out_gl;
extern struct vo_driver video_out_gl3;
-extern struct vo_driver video_out_dga;
-extern struct vo_driver video_out_sdl;
-extern struct vo_driver video_out_3dfx;
-extern struct vo_driver video_out_tdfxfb;
-extern struct vo_driver video_out_s3fb;
-extern struct vo_driver video_out_wii;
extern struct vo_driver video_out_null;
-extern struct vo_driver video_out_bl;
-extern struct vo_driver video_out_fbdev;
-extern struct vo_driver video_out_fbdev2;
-extern struct vo_driver video_out_svga;
extern struct vo_driver video_out_png;
-extern struct vo_driver video_out_ggi;
-extern struct vo_driver video_out_aa;
extern struct vo_driver video_out_caca;
-extern struct vo_driver video_out_mpegpes;
extern struct vo_driver video_out_yuv4mpeg;
extern struct vo_driver video_out_direct3d;
extern struct vo_driver video_out_direct3d_shaders;
extern struct vo_driver video_out_directx;
-extern struct vo_driver video_out_kva;
-extern struct vo_driver video_out_dxr3;
-extern struct vo_driver video_out_ivtv;
extern struct vo_driver video_out_v4l2;
extern struct vo_driver video_out_jpeg;
extern struct vo_driver video_out_gif89a;
-extern struct vo_driver video_out_vesa;
extern struct vo_driver video_out_directfb;
-extern struct vo_driver video_out_dfbmga;
-extern struct vo_driver video_out_tdfx_vid;
-extern struct vo_driver video_out_xvr100;
extern struct vo_driver video_out_tga;
extern struct vo_driver video_out_corevideo;
extern struct vo_driver video_out_sharedbuffer;
@@ -123,12 +100,6 @@ extern struct vo_driver video_out_md5sum;
const struct vo_driver *video_out_drivers[] =
{
-#ifdef CONFIG_XVR100
- &video_out_xvr100,
-#endif
-#ifdef CONFIG_TDFX_VID
- &video_out_tdfx_vid,
-#endif
#ifdef CONFIG_DIRECT3D
&video_out_direct3d_shaders,
&video_out_direct3d,
@@ -136,33 +107,12 @@ const struct vo_driver *video_out_drivers[] =
#ifdef CONFIG_DIRECTX
&video_out_directx,
#endif
-#ifdef CONFIG_KVA
- &video_out_kva,
-#endif
#ifdef CONFIG_GL_COCOA
&video_out_gl,
#endif
#ifdef CONFIG_COREVIDEO
&video_out_corevideo,
#endif
-#ifdef CONFIG_XMGA
- &video_out_xmga,
-#endif
-#ifdef CONFIG_MGA
- &video_out_mga,
-#endif
-#ifdef CONFIG_TDFXFB
- &video_out_tdfxfb,
-#endif
-#ifdef CONFIG_S3FB
- &video_out_s3fb,
-#endif
-#ifdef CONFIG_WII
- &video_out_wii,
-#endif
-#ifdef CONFIG_3DFX
- &video_out_3dfx,
-#endif
#if CONFIG_VDPAU
&video_out_vdpau,
#endif
@@ -177,48 +127,13 @@ const struct vo_driver *video_out_drivers[] =
#endif
#ifdef CONFIG_X11
&video_out_x11,
- &video_out_xover,
-#endif
-#ifdef CONFIG_SDL
- &video_out_sdl,
-#endif
-#ifdef CONFIG_DGA
- &video_out_dga,
-#endif
-#ifdef CONFIG_GGI
- &video_out_ggi,
-#endif
-#ifdef CONFIG_FBDEV
- &video_out_fbdev,
- &video_out_fbdev2,
-#endif
-#ifdef CONFIG_SVGALIB
- &video_out_svga,
-#endif
-#ifdef CONFIG_AA
- &video_out_aa,
#endif
#ifdef CONFIG_CACA
&video_out_caca,
#endif
-#ifdef CONFIG_DXR3
- &video_out_dxr3,
-#endif
-#ifdef CONFIG_IVTV
- &video_out_ivtv,
-#endif
#ifdef CONFIG_V4L2_DECODER
&video_out_v4l2,
#endif
-#ifdef CONFIG_BL
- &video_out_bl,
-#endif
-#ifdef CONFIG_VESA
- &video_out_vesa,
-#endif
-#ifdef CONFIG_DIRECTFB
- &video_out_dfbmga,
-#endif
&video_out_null,
// should not be auto-selected
#ifdef CONFIG_SHAREDBUFFER
@@ -228,7 +143,6 @@ const struct vo_driver *video_out_drivers[] =
// vo directfb can call exit() if initialization fails
&video_out_directfb,
#endif
- &video_out_mpegpes,
#ifdef CONFIG_YUV4MPEG
&video_out_yuv4mpeg,
#endif
diff --git a/libvo/video_out.h b/libvo/video_out.h
index df27d373fe..a6bd19643f 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -58,11 +58,6 @@ enum mp_voctrl {
VOCTRL_START_SLICE,
- // Vo can be used by xover
- VOCTRL_XOVERLAY_SUPPORT,
- VOCTRL_XOVERLAY_SET_COLORKEY, // mp_colorkey_t
- VOCTRL_XOVERLAY_SET_WIN,
-
VOCTRL_NEWFRAME,
VOCTRL_SKIPFRAME,
VOCTRL_REDRAW_FRAME,
@@ -96,12 +91,6 @@ struct voctrl_get_equalizer_args {
int *valueptr;
};
-// VOCTRL_XOVERLAY_SET_COLORKEY
-typedef struct {
- uint32_t x11; // The raw x11 color
- uint16_t r,g,b;
-} mp_colorkey_t;
-
// VOCTRL_GET_EOSD_RES
typedef struct mp_eosd_res {
int w, h; // screen dimensions, including black borders
@@ -142,13 +131,12 @@ typedef struct {
#define VOFLAG_FLIPPING 0x08
#define VOFLAG_HIDDEN 0x10 //< Use to create a hidden window
#define VOFLAG_STEREO 0x20 //< Use to create a stereo-capable window
-#define VOFLAG_XOVERLAY_SUB_VO 0x10000
typedef struct vo_info_s
{
/* driver name ("Matrox Millennium G200/G400" */
const char *name;
- /* short name (for config strings) ("mga") */
+ /* short name (for config strings) ("vdpau") */
const char *short_name;
/* author ("Aaron Holtzman <aholtzma@ess.engr.uvic.ca>") */
const char *author;
diff --git a/libvo/vo_3dfx.c b/libvo/vo_3dfx.c
deleted file mode 100644
index 4f7e41e9f8..0000000000
--- a/libvo/vo_3dfx.c
+++ /dev/null
@@ -1,506 +0,0 @@
-/*
- * video_out_3dfx.c
- * Heavily based on video_out_mga.c of Aaron Holtzman's mpeg2dec.
- *
- * Copyright (C) Colin Cross Apr 2000
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "mp_msg.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-#include "x11_common.h"
-
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <errno.h>
-#include <wchar.h>
-#include <signal.h>
-
-#include <X11/Xlib.h>
-#include <X11/extensions/Xxf86dga.h>
-#include <X11/Xutil.h>
-
-//#define LOG(x) syslog(LOG_USER | LOG_DEBUG,x)
-#define LOG(x)
-
-#include "drivers/3dfx.h"
-
-#include "fastmemcpy.h"
-
-static const vo_info_t info =
-{
- "3dfx (/dev/3dfx)",
- "3dfx",
- "Colin Cross <colin@MIT.EDU>",
- ""
-};
-
-const LIBVO_EXTERN(3dfx)
-
-static uint32_t is_fullscreen = 1;
-
-static uint32_t vidwidth;
-static uint32_t vidheight;
-
-static uint32_t screenwidth;
-static uint32_t screenheight;
-static uint32_t screendepth = 2; //Only 16bpp supported right now
-
-static uint32_t dispwidth = 1280; // You can change these to whatever you want
-static uint32_t dispheight = 720; // 16:9 screen ratio??
-static uint32_t dispx;
-static uint32_t dispy;
-
-static uint32_t *vidpage0;
-static uint32_t *vidpage1;
-static uint32_t *vidpage2;
-
-static uint32_t vidpage0offset;
-static uint32_t vidpage1offset;
-static uint32_t vidpage2offset;
-
-// Current pointer into framebuffer where display is located
-static uint32_t targetoffset;
-
-static uint32_t page_space;
-
-static voodoo_io_reg *reg_IO;
-static voodoo_2d_reg *reg_2d;
-static voodoo_yuv_reg *reg_YUV;
-static voodoo_yuv_fb *fb_YUV;
-
-static uint32_t *memBase0, *memBase1;
-static uint32_t baseAddr0, baseAddr1;
-
-
-/* X11 related variables */
-static Display *display;
-static Window mywindow;
-static int bpp;
-static XWindowAttributes attribs;
-
-static int fd=-1;
-
-
-static void
-restore(void)
-{
- //reg_IO->vidDesktopStartAddr = vidpage0offset;
- XF86DGADirectVideo(display,0,0);
-}
-
-static void
-sighup(int foo)
-{
- //reg_IO->vidDesktopStartAddr = vidpage0offset;
- XF86DGADirectVideo(display,0,0);
- exit(0);
-}
-
-static void
-restore_regs(voodoo_2d_reg *regs)
-{
- reg_2d->commandExtra = regs->commandExtra;
- reg_2d->clip0Min = regs->clip0Min;
- reg_2d->clip0Max = regs->clip0Max;
-
- reg_2d->srcBaseAddr = regs->srcBaseAddr;
- reg_2d->srcXY = regs->srcXY;
- reg_2d->srcFormat = regs->srcFormat;
- reg_2d->srcSize = regs->srcSize;
-
- reg_2d->dstBaseAddr = regs->dstBaseAddr;
- reg_2d->dstXY = regs->dstXY;
- reg_2d->dstFormat = regs->dstFormat;
-
- reg_2d->dstSize = regs->dstSize;
- reg_2d->command = 0;
-}
-
-static uint32_t
-create_window(Display *display, char *title)
-{
- int screen;
- unsigned int fg, bg;
- XSizeHints hint;
- XVisualInfo vinfo;
- XEvent xev;
-
- Colormap theCmap;
- XSetWindowAttributes xswa;
- unsigned long xswamask;
-
- screen = DefaultScreen(display);
-
- hint.x = 0;
- hint.y = 10;
- hint.width = dispwidth;
- hint.height = dispheight;
- hint.flags = PPosition | PSize;
-
- bg = WhitePixel(display, screen);
- fg = BlackPixel(display, screen);
-
- XGetWindowAttributes(display, DefaultRootWindow(display), &attribs);
- bpp = attribs.depth;
- if (bpp != 16)
- {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_3DFX] Only 16bpp supported!");
- exit(-1);
- }
-
- XMatchVisualInfo(display,screen,bpp,TrueColor,&vinfo);
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_3DFX] Visual ID is %lx.\n",vinfo.visualid);
-
- theCmap = XCreateColormap(display, RootWindow(display,screen),
- vinfo.visual, AllocNone);
-
- xswa.background_pixel = 0;
- xswa.border_pixel = 1;
- xswa.colormap = theCmap;
- xswamask = CWBackPixel | CWBorderPixel |CWColormap;
-
-
- mywindow = XCreateWindow(display, RootWindow(display,screen),
- hint.x, hint.y, hint.width, hint.height, 4, bpp,CopyFromParent,vinfo.visual,xswamask,&xswa);
- vo_x11_classhint( display,mywindow,"3dfx" );
-
- XSelectInput(display, mywindow, StructureNotifyMask);
-
- /* Tell other applications about this window */
-
- XSetStandardProperties(display, mywindow, title, title, None, NULL, 0, &hint);
-
- /* Map window. */
-
- XMapWindow(display, mywindow);
-
- /* Wait for map. */
- do
- {
- XNextEvent(display, &xev);
- }
- while (xev.type != MapNotify || xev.xmap.event != mywindow);
-
- XSelectInput(display, mywindow, NoEventMask);
-
- XSync(display, False);
-
- return 0;
-}
-
-static void
-dump_yuv_planar(uint32_t *y, uint32_t *u, uint32_t *v, uint32_t to, uint32_t width, uint32_t height)
-{
- // YUV conversion works like this:
- //
- // We write the Y, U, and V planes separately into 3dfx YUV Planar memory
- // region. The nice chip then takes these and packs them into the YUYV
- // format in the regular frame buffer, starting at yuvBaseAddr, page 2 here.
- // Then we tell the 3dfx to do a Screen to Screen Stretch BLT to copy all
- // of the data on page 2 onto page 1, converting it to 16 bpp RGB as it goes.
- // The result is a nice image on page 1 ready for display.
-
- uint32_t j;
- uint32_t y_imax, uv_imax, jmax;
-
- reg_YUV->yuvBaseAddr = to;
- reg_YUV->yuvStride = screenwidth*2;
-
- LOG("video_out_3dfx: starting planar dump\n");
- jmax = height>>1; // vidheight/2, height of U and V planes
- y_imax = width; // Y plane is twice as wide as U and V planes
- uv_imax = width>>1; // vidwidth/2/4, width of U and V planes in 32-bit words
-
- for (j=0;j<jmax;j++)
- {
- //XXX this should be hand-rolled 32 bit memcpy for safeness.
- fast_memcpy(fb_YUV->U + (uint32_t) VOODOO_YUV_STRIDE* j ,((uint8_t*) u) + uv_imax* j , uv_imax);
- fast_memcpy(fb_YUV->V + (uint32_t) VOODOO_YUV_STRIDE* j ,((uint8_t*) v) + uv_imax* j , uv_imax);
- fast_memcpy(fb_YUV->Y + (uint32_t) VOODOO_YUV_STRIDE* (j<<1) ,((uint8_t*) y) + y_imax * (j<<1) , y_imax);
- fast_memcpy(fb_YUV->Y + (uint32_t) VOODOO_YUV_STRIDE*((j<<1)+1),((uint8_t*) y) + y_imax *((j<<1)+1), y_imax);
- }
- LOG("video_out_3dfx: done planar dump\n");
-}
-
-static void
-screen_to_screen_stretch_blt(uint32_t to, uint32_t from, uint32_t width, uint32_t height)
-{
- //FIXME - this function should be called by a show_frame function that
- // uses a series of blts to show only those areas not covered
- // by another window
- voodoo_2d_reg saved_regs;
-
- LOG("video_out_3dfx: saving registers\n");
- // Save VGA regs (so X kinda works when we're done)
- saved_regs = *reg_2d;
-
- /* The following lines set up the screen to screen stretch blt from page2 to
- page 1
- */
-
- LOG("video_out_3dfx: setting blt registers\n");
- reg_2d->commandExtra = 4; //disable colorkeying, enable wait for v-refresh (0100b)
- reg_2d->clip0Min = 0;
- reg_2d->clip0Max = 0xFFFFFFFF; //no clipping
-
- reg_2d->srcBaseAddr = from;
- reg_2d->srcXY = 0;
- reg_2d->srcFormat = screenwidth*2 | VOODOO_BLT_FORMAT_YUYV; // | 1<<21;
- reg_2d->srcSize = vidwidth | (vidheight << 16);
-
- reg_2d->dstBaseAddr = to;
- reg_2d->dstXY = 0;
- reg_2d->dstFormat = screenwidth*2 | VOODOO_BLT_FORMAT_16;
-
- reg_2d->dstSize = width | (height << 16);
-
- LOG("video_out_3dfx: starting blt\n");
- // Executes screen to screen stretch blt
- reg_2d->command = 2 | 1<<8 | 0xCC<<24;
-
- LOG("video_out_3dfx: restoring regs\n");
- restore_regs(&saved_regs);
-
- LOG("video_out_3dfx: done blt\n");
-}
-
-static void
-update_target(void)
-{
- uint32_t xp, yp, w, h, b, d;
- Window root;
-
- XGetGeometry(display,mywindow,&root,&xp,&yp,&w,&h,&b,&d);
- XTranslateCoordinates(display,mywindow,root,0,0,&xp,&yp,&root);
- dispx = (uint32_t) xp;
- dispy = (uint32_t) yp;
- dispwidth = (uint32_t) w;
- dispheight = (uint32_t) h;
-
- if (is_fullscreen)
- targetoffset = vidpage0offset + (screenheight - dispheight)/2*screenwidth*screendepth + (screenwidth-dispwidth)/2*screendepth;
- else
- targetoffset = vidpage0offset + (dispy*screenwidth + dispx)*screendepth;
-}
-
-static int
-config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format)
-{
- char *name = ":0.0";
- pioData data;
- uint32_t retval;
-
-//TODO use x11_common for X and window handling
-
- if(getenv("DISPLAY"))
- name = getenv("DISPLAY");
- display = XOpenDisplay(name);
-
- screenwidth = XDisplayWidth(display,0);
- screenheight = XDisplayHeight(display,0);
-
- page_space = screenwidth*screenheight*screendepth;
- vidpage0offset = 0;
- vidpage1offset = page_space; // Use third and fourth pages
- vidpage2offset = page_space*2;
-
- signal(SIGALRM,sighup);
- //alarm(120);
-
- // Open driver device
- if ( fd == -1 )
- {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_3DFX] Unable to open /dev/3dfx.\n");
- return -1;
- }
-
- // Store sizes for later
- vidwidth = width;
- vidheight = height;
-
- is_fullscreen = fullscreen = 0;
- if (!is_fullscreen)
- create_window(display, title);
-
- // Ask 3dfx driver for base memory address 0
- data.port = 0x10; // PCI_BASE_ADDRESS_0_LINUX;
- data.size = 4;
- data.value = &baseAddr0;
- data.device = 0;
- if ((retval = ioctl(fd,_IOC(_IOC_READ,'3',3,0),&data)) < 0)
- {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_3DFX] Error: %d.\n",retval);
- return -1;
- }
-
- // Ask 3dfx driver for base memory address 1
- data.port = 0x14; // PCI_BASE_ADDRESS_1_LINUX;
- data.size = 4;
- data.value = &baseAddr1;
- data.device = 0;
- if ((retval = ioctl(fd,_IOC(_IOC_READ,'3',3,0),&data)) < 0)
- {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_3DFX] Error: %d.\n",retval);
- return -1;
- }
-
- // Map all 3dfx memory areas
- memBase0 = mmap(0,0x1000000,PROT_READ | PROT_WRITE,MAP_SHARED,fd,baseAddr0);
- memBase1 = mmap(0,3*page_space,PROT_READ | PROT_WRITE,MAP_SHARED,fd,baseAddr1);
- if (memBase0 == (uint32_t *) 0xFFFFFFFF || memBase1 == (uint32_t *) 0xFFFFFFFF)
- {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_3DFX] Couldn't map 3dfx memory areas: %p,%p,%d.\n",
- memBase0,memBase1,errno);
- }
-
- // Set up global pointers
- reg_IO = (void *)memBase0 + VOODOO_IO_REG_OFFSET;
- reg_2d = (void *)memBase0 + VOODOO_2D_REG_OFFSET;
- reg_YUV = (void *)memBase0 + VOODOO_YUV_REG_OFFSET;
- fb_YUV = (void *)memBase0 + VOODOO_YUV_PLANE_OFFSET;
-
- vidpage0 = (void *)memBase1 + (unsigned long int)vidpage0offset;
- vidpage1 = (void *)memBase1 + (unsigned long int)vidpage1offset;
- vidpage2 = (void *)memBase1 + (unsigned long int)vidpage2offset;
-
- // Clear pages 1,2,3
- // leave page 0, that belongs to X.
- // So does part of 1. Oops.
- memset(vidpage1,0x00,page_space);
- memset(vidpage2,0x00,page_space);
-
- if (is_fullscreen)
- memset(vidpage0,0x00,page_space);
-
-
-#ifndef VOODOO_DEBUG
- // Show page 0 (unblanked)
- reg_IO->vidDesktopStartAddr = vidpage0offset;
-
- /* Stop X from messing with my video registers!
- Find a better way to do this?
- Currently I use DGA to tell XF86 to not screw with registers, but I can't really use it
- to do FB stuff because I need to know the absolute FB position and offset FB position
- to feed to BLT command
- */
- //XF86DGADirectVideo(display,0,XF86DGADirectGraphics); //| XF86DGADirectMouse | XF86DGADirectKeyb);
-#endif
-
- atexit(restore);
-
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_3DFX] Initialized: %p.\n",memBase1);
- return 0;
-}
-
-static int
-draw_frame(uint8_t *src[])
-{
- LOG("video_out_3dfx: starting display_frame\n");
-
- // Put packed data onto page 2
- dump_yuv_planar((uint32_t *)src[0],(uint32_t *)src[1],(uint32_t *)src[2],
- vidpage2offset,vidwidth,vidheight);
-
- LOG("video_out_3dfx: done display_frame\n");
- return 0;
-}
-
-static int
-//draw_slice(uint8_t *src[], uint32_t slice_num)
-draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y)
-{
- uint32_t target;
-
- target = vidpage2offset + (screenwidth*2 * y);
- dump_yuv_planar((uint32_t *)src[0],(uint32_t *)src[1],(uint32_t *)src[2],target,vidwidth,h);
- return 0;
-}
-
-static void draw_osd(void)
-{
-}
-
-static void
-flip_page(void)
-{
- //FIXME - update_target() should be called by event handler when window
- // is resized or moved
- update_target();
- LOG("video_out_3dfx: calling blt function\n");
- screen_to_screen_stretch_blt(targetoffset, vidpage2offset, dispwidth, dispheight);
-}
-
-static int
-query_format(uint32_t format)
-{
- /* does this supports scaling? up & down? */
- switch(format){
- case IMGFMT_YV12:
-// case IMGFMT_YUY2:
-// case IMGFMT_RGB|24:
-// case IMGFMT_BGR|24:
- return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW;
- }
- return 0;
-}
-
-static void
-uninit(void)
-{
- if( fd != -1 )
- close(fd);
-}
-
-
-static void check_events(void)
-{
-}
-
-static int preinit(const char *arg)
-{
- if ( (fd = open("/dev/3dfx",O_RDWR) ) == -1)
- {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_3DFX] Unable to open /dev/3dfx.\n");
- return -1;
- }
-
- if(arg)
- {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_3DFX] Unknown subdevice: %s.\n",arg);
- return ENOSYS;
- }
- return 0;
-}
-
-static int control(uint32_t request, void *data)
-{
- switch (request) {
- case VOCTRL_QUERY_FORMAT:
- return query_format(*((uint32_t*)data));
- }
- return VO_NOTIMPL;
-}
diff --git a/libvo/vo_aa.c b/libvo/vo_aa.c
deleted file mode 100644
index 4908e3c899..0000000000
--- a/libvo/vo_aa.c
+++ /dev/null
@@ -1,755 +0,0 @@
-/*
- * video output driver for AAlib
- *
- * copyright (c) 2001 Folke Ashberg <folke@ashberg.de>
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <limits.h>
-#include <math.h>
-#include <stdarg.h>
-#include <time.h>
-#include <string.h>
-#include <errno.h>
-
-#include "config.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-#include "aspect.h"
-#include "libswscale/swscale.h"
-#include "libmpcodecs/vf_scale.h"
-#include "sub/font_load.h"
-#include "sub/sub.h"
-
-#include "input/keycodes.h"
-#include <aalib.h>
-#include "subopt-helper.h"
-#include "mp_msg.h"
-#include "mp_fifo.h"
-
-
-#define MESSAGE_DURATION 3
-#define MESSAGE_SIZE 512
-#define MESSAGE_DEKO " +++ %s +++ "
-
- static const vo_info_t info = {
- "AAlib",
- "aa",
- "Alban Bedel <albeu@free.fr> and Folke Ashberg <folke@ashberg.de>",
- ""
- };
-
-const LIBVO_EXTERN(aa)
-
-/* aa's main context we use */
-aa_context *c;
-aa_renderparams *p;
-static int fast =0;
-/* used for the sws */
-static uint8_t * image[MP_MAX_PLANES];
-static int image_stride[MP_MAX_PLANES];
-
-/* image infos */
-static int image_format;
-static int image_width;
-static int image_height;
-static int image_x, image_y;
-static int screen_x, screen_y;
-static int screen_w, screen_h;
-static int src_width;
-static int src_height;
-
-/* osd stuff */
-time_t stoposd = 0;
-static int showosdmessage = 0;
-char osdmessagetext[MESSAGE_SIZE];
-char posbar[MESSAGE_SIZE];
-static int osdx, osdy;
-static int osd_text_length = 0;
-int aaconfigmode=1;
-font_desc_t* vo_font_save = NULL;
-static struct SwsContext *sws=NULL;
-
-/* configuration */
-int aaopt_osdcolor = AA_SPECIAL;
-int aaopt_subcolor = AA_SPECIAL;
-
-static unsigned char vo_osd_text[64];
-
-static void
-resize(void){
- /*
- * this function is called by aa lib if windows resizes
- * further during init, because here we have to calculate
- * a little bit
- */
-
- aa_resize(c);
-
- aspect_save_screenres(aa_imgwidth(c),aa_imgheight(c));
- image_height = aa_imgheight(c); //src_height;
- image_width = aa_imgwidth(c); //src_width;
-
- aspect(&image_width,&image_height,A_ZOOM);
-
- image_x = (aa_imgwidth(c) - image_width) / 2;
- image_y = (aa_imgheight(c) - image_height) / 2;
- screen_w = image_width * aa_scrwidth(c) / aa_imgwidth(c);
- screen_h = image_height * aa_scrheight(c) / aa_imgheight(c);
- screen_x = (aa_scrwidth(c) - screen_w) / 2;
- screen_y = (aa_scrheight(c) - screen_h) / 2;
-
- if(sws) sws_freeContext(sws);
- sws = sws_getContextFromCmdLine(src_width,src_height,image_format,
- image_width,image_height,IMGFMT_Y8);
-
- memset(image, 0, sizeof(image));
- image[0] = aa_image(c) + image_y * aa_imgwidth(c) + image_x;
-
- memset(image_stride, 0, sizeof(image_stride));
- image_stride[0] = aa_imgwidth(c);
-
- showosdmessage=0;
-
-}
-
-static void
-osdmessage(int duration, int deko, const char *fmt, ...)
-{
- /*
- * for outputting a centered string at the bottom
- * of our window for a while
- */
- va_list ar;
- char m[MESSAGE_SIZE];
- unsigned int old_len = strlen(osdmessagetext);
-
- va_start(ar, fmt);
- vsprintf(m, fmt, ar);
- va_end(ar);
- if (deko==1) sprintf(osdmessagetext, MESSAGE_DEKO , m);
- else strcpy(osdmessagetext, m);
-
- if(old_len > strlen(osdmessagetext)) {
- memset(c->textbuffer + osdy * aa_scrwidth(c) + osdx,' ',old_len);
- memset(c->attrbuffer + osdy * aa_scrwidth(c) + osdx,0,old_len);
- }
- showosdmessage=1;
- stoposd = time(NULL) + duration;
- osdx=(aa_scrwidth(c) / 2) - (strlen(osdmessagetext) / 2 ) ;
- posbar[0]='\0';
-}
-
-static void
-osdpercent(int duration, int deko, int min, int max, int val, const char * desc, const char * unit)
-{
- /*
- * prints a bar for setting values
- */
- float step;
- int where;
- int i;
-
-
- step=(float)aa_scrwidth(c) /(float)(max-min);
- where=(val-min)*step;
- osdmessage(duration,deko,"%s: %i%s",desc, val, unit);
- posbar[0]='|';
- posbar[aa_scrwidth(c)-1]='|';
- for (i=0;i<aa_scrwidth(c);i++){
- if (i==where) posbar[i]='#';
- else posbar[i]='-';
- }
- if (where!=0) posbar[0]='|';
- if (where!=(aa_scrwidth(c)-1) ) posbar[aa_scrwidth(c)-1]='|';
-
- posbar[aa_scrwidth(c)]='\0';
-
-}
-
-static void
-printosdtext(void)
-{
- /*
- * places the mplayer status osd
- */
- if (vo_osd_text[0] != 0) {
- int len;
- if(vo_osd_text[0] < 32) {
- len = strlen(sub_osd_names_short[vo_osd_text[0]]) + strlen(vo_osd_text+1) + 2;
- aa_printf(c, 0, 0 , aaopt_osdcolor, "%s %s ", sub_osd_names_short[vo_osd_text[0]], vo_osd_text+1);
- } else {
- len = strlen(vo_osd_text) + 1;
- aa_printf(c, 0, 0 , aaopt_osdcolor, "%s ",vo_osd_text);
- }
-
- if(len < osd_text_length) {
- memset(c->textbuffer + len,' ',osd_text_length - len);
- memset(c->attrbuffer + len,0,osd_text_length - len);
- }
- osd_text_length = len;
-
- }
-}
-
-static void
-printosdprogbar(void){
- /* print mplayer osd-progbar */
- if (vo_osd_progbar_type!=-1){
- osdpercent(1,1,0,255,vo_osd_progbar_value, sub_osd_names[vo_osd_progbar_type], "");
- }
-}
-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) {
- /*
- * main init
- * called by mplayer
- */
-
- int i;
-
- aspect_save_orig(width,height);
- aspect_save_prescale(d_width,d_height);
-
- src_height = height;
- src_width = width;
- image_format = format;
-
- /* nothing will change its size, be we need some values initialized */
- resize();
-
- /* now init our own 'font' */
- if(!vo_font_save) vo_font_save = vo_font;
- if(vo_font == vo_font_save) {
- vo_font=malloc(sizeof(font_desc_t));//if(!desc) return NULL;
- memset(vo_font,0,sizeof(font_desc_t));
- vo_font->pic_a[0]=malloc(sizeof(raw_file));
- memset(vo_font->pic_a[0],0,sizeof(raw_file));
- vo_font->pic_b[0]=malloc(sizeof(raw_file));
- memset(vo_font->pic_b[0],0,sizeof(raw_file));
-
-#ifdef CONFIG_FREETYPE
- vo_font->dynamic = 0;
-#endif
-
- vo_font->spacewidth=1;
- vo_font->charspace=0;
- vo_font->height=1;
- vo_font->pic_a[0]->bmp=malloc(255);
- vo_font->pic_a[0]->pal=NULL;
- vo_font->pic_b[0]->bmp=malloc(255);
- vo_font->pic_b[0]->pal=NULL;
- vo_font->pic_a[0]->w=1;
- vo_font->pic_a[0]->h=1;
- for (i=0; i<255; i++){
- vo_font->width[i]=1;
- vo_font->font[i]=0;
- vo_font->start[i]=i;
- vo_font->pic_a[0]->bmp[i]=i;
- vo_font->pic_b[0]->bmp[i]=i;
- }
- }
-
- /* say hello */
- osdmessage(5, 1, "Welcome to ASCII ART MPlayer");
-
- mp_msg(MSGT_VO,MSGL_V,"VO: [aa] screendriver: %s\n", c->driver->name);
- mp_msg(MSGT_VO,MSGL_V,"VO: [aa] keyboarddriver: %s\n", c->kbddriver->name);
-
- mp_msg(MSGT_VO,MSGL_INFO,
- "\n"
- "Important suboptions\n"
- "\textended use use all 256 characters\n"
- "\teight use eight bit ascii\n"
- "\tdriver set recommended aalib driver (X11,curses,linux)\n"
- "\thelp to see all options provided by aalib\n"
- "\n"
- "AA-MPlayer Keys\n"
- "\t1 : contrast -\n"
- "\t2 : contrast +\n"
- "\t3 : brightness -\n"
- "\t4 : brightness +\n"
- "\t5 : fast rendering\n"
- "\t6 : dithering\n"
- "\t7 : invert image\n"
- "\ta : toggles between aa and mplayer control\n"
-
- "\n"
- "All other keys are MPlayer defaults.\n"
-
-
- );
-
- return 0;
-}
-
-static int
-query_format(uint32_t format) {
- /*
- * ...are we able to... ?
- * called by mplayer
- * All input format supported by the sws
- */
- switch(format){
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_IYU2:
- case IMGFMT_BGR32:
- case IMGFMT_BGR24:
- case IMGFMT_BGR16:
- case IMGFMT_BGR15:
- case IMGFMT_RGB32:
- case IMGFMT_RGB24:
- case IMGFMT_Y8:
- case IMGFMT_Y800:
- return VFCAP_CSP_SUPPORTED | VFCAP_SWSCALE | VFCAP_OSD;
- }
- return 0;
-}
-
-static int
-draw_frame(uint8_t *src[]) {
- int stride[MP_MAX_PLANES] = {0};
-
- switch(image_format) {
- case IMGFMT_BGR15:
- case IMGFMT_BGR16:
- stride[0] = src_width*2;
- break;
- case IMGFMT_IYU2:
- case IMGFMT_BGR24:
- stride[0] = src_width*3;
- break;
- case IMGFMT_BGR32:
- stride[0] = src_width*4;
- break;
- }
-
- sws_scale(sws,(const uint8_t **)src,stride,0,src_height,image,image_stride);
-
- /* Now 'ASCIInate' the image */
- if (fast)
- aa_fastrender(c, screen_x, screen_y, screen_w + screen_x, screen_h + screen_y );
- else
- aa_render(c, p,screen_x, screen_y, screen_w + screen_x, screen_h + screen_y );
-
- return 0;
-}
-
-static int
-draw_slice(uint8_t *src[], int stride[],
- int w, int h, int x, int y) {
-
- int dx1 = screen_x + (x * screen_w / src_width);
- int dy1 = screen_y + (y * screen_h / src_height);
- int dx2 = screen_x + ((x+w) * screen_w / src_width);
- int dy2 = screen_y + ((y+h) * screen_h / src_height);
-
- sws_scale(sws,(const uint8_t **)src,stride,y,h,image,image_stride);
-
- /* Now 'ASCIInate' the image */
- if (fast)
- aa_fastrender(c, dx1, dy1, dx2, dy2 );
- else
- aa_render(c, p,dx1, dy1, dx2, dy2 );
-
-
- return 0;
-}
-
-static void
-flip_page(void) {
-
- /* do we have to put *our* (messages, progbar) osd to aa's txtbuf ? */
- if (showosdmessage)
- {
- if (time(NULL)>=stoposd ) {
- showosdmessage=0;
- if(*osdmessagetext) {
- memset(c->textbuffer + osdy * aa_scrwidth(c) + osdx,' ',strlen(osdmessagetext));
- memset(c->attrbuffer + osdy * aa_scrwidth(c) + osdx ,0,strlen(osdmessagetext));
- osdmessagetext[0] = '\0';
- }
- if(*posbar) {
- memset(c->textbuffer + (osdy+1) * aa_scrwidth(c),' ',strlen(posbar));
- memset(c->attrbuffer + (osdy+1) * aa_scrwidth(c),0,strlen(posbar));
- }
- } else {
- /* update osd */
- aa_puts(c, osdx, osdy, AA_SPECIAL, osdmessagetext);
- /* posbar? */
- if (posbar[0]!='\0')
- aa_puts(c, 0, osdy + 1, AA_SPECIAL, posbar);
- }
- }
- /* OSD time & playmode , subtitles */
- printosdtext();
-
-
- /* print out */
- aa_flush(c);
-}
-
-static void
-check_events(void) {
- /*
- * any events?
- * called by show_image and mplayer
- */
- int key;
- while ((key=aa_getevent(c,0))!=AA_NONE ){
- if (key>255){
- /* some conversations */
- switch (key) {
- case AA_UP:
- mplayer_put_key(KEY_UP);
- break;
- case AA_DOWN:
- mplayer_put_key(KEY_DOWN);
- break;
- case AA_LEFT:
- mplayer_put_key(KEY_LEFT);
- break;
- case AA_RIGHT:
- mplayer_put_key(KEY_RIGHT);
- break;
- case AA_ESC:
- mplayer_put_key(KEY_ESC);
- break;
- case 65765:
- mplayer_put_key(KEY_PAGE_UP);
- break;
- case 65766:
- mplayer_put_key(KEY_PAGE_DOWN);
- break;
- default:
- continue; /* aa lib special key */
- break;
- }
- }
- if (key=='a' || key=='A'){
- aaconfigmode=!aaconfigmode;
- osdmessage(MESSAGE_DURATION, 1, "aa config mode is now %s",
- aaconfigmode==1 ? "on. use keys 5-7" : "off");
- }
- if (aaconfigmode==1) {
- switch (key) {
- /* AA image controls */
- case '5':
- fast=!fast;
- osdmessage(MESSAGE_DURATION, 1, "Fast mode is now %s", fast==1 ? "on" : "off");
- break;
- case '6':
- if (p->dither==AA_FLOYD_S){
- p->dither=AA_NONE;
- osdmessage(MESSAGE_DURATION, 1, "Dithering: Off");
- }else if (p->dither==AA_NONE){
- p->dither=AA_ERRORDISTRIB;
- osdmessage(MESSAGE_DURATION, 1, "Dithering: Error Distribution");
- }else if (p->dither==AA_ERRORDISTRIB){
- p->dither=AA_FLOYD_S;
- osdmessage(MESSAGE_DURATION, 1, "Dithering: Floyd Steinberg");
- }
- break;
- case '7':
- p->inversion=!p->inversion;
- osdmessage(MESSAGE_DURATION, 1, "Invert mode is now %s",
- p->inversion==1 ? "on" : "off");
- break;
-
- default :
- /* nothing if we're interested in?
- * the mplayer should handle it!
- */
- mplayer_put_key(key);
- break;
- }
- }// aaconfigmode
- else mplayer_put_key(key);
- }
-}
-
-static void
-uninit(void) {
- /*
- * THE END
- */
-
- if (strstr(c->driver->name,"Curses") || strstr(c->driver->name,"Linux")){
- freopen("/dev/tty", "w", stderr);
- }
- if(vo_font_save) {
- free(vo_font->pic_a[0]->bmp);
- free(vo_font->pic_a[0]);
- free(vo_font->pic_b[0]->bmp);
- free(vo_font->pic_b[0]);
- free(vo_font);
- vo_font = vo_font_save;
- vo_font_save = NULL;
- }
- aa_close(c);
-}
-
-static void draw_alpha(int x,int y, int w,int h, unsigned char* src, unsigned char *srca, int stride){
- int i,j;
- for (i = 0; i < h; i++) {
- for (j = 0; j < w; j++) {
- if (src[i*stride+j] > 0) {
- c->textbuffer[x + j + (y+i)*aa_scrwidth(c)] = src[i*stride+j];
- c->attrbuffer[x + j + (y+i)*aa_scrwidth(c)] = aaopt_subcolor;
- }
- }
- }
-}
-
-static void clear_alpha(int x0,int y0, int w,int h) {
- int l;
-
- for(l = 0 ; l < h ; l++) {
- memset(c->textbuffer + (y0 + l) * aa_scrwidth(c) + x0,' ',w);
- memset(c->attrbuffer + (y0 + l) * aa_scrwidth(c) + x0,0,w);
- }
-}
-
-
-static void
-draw_osd(void){
- char vo_osd_text_save;
- int vo_osd_progbar_type_save;
-
- printosdprogbar();
- /* let vo_draw_text only write subtitle */
- vo_osd_text_save = global_osd->osd_text[0];
- global_osd->osd_text[0] = 0;
- vo_osd_progbar_type_save=vo_osd_progbar_type;
- vo_osd_progbar_type=-1;
- vo_remove_text(aa_scrwidth(c), aa_scrheight(c),clear_alpha);
- vo_draw_text(aa_scrwidth(c), aa_scrheight(c), draw_alpha);
- global_osd->osd_text[0] = vo_osd_text_save;
- vo_osd_progbar_type=vo_osd_progbar_type_save;
-}
-
-static int
-getcolor(char * s){
- int i;
- char * rest;
- if (s==NULL) return -1;
- i=strtol(s, &rest, 10);
- if ((rest==NULL || strlen(rest)==0) && i>=0 && i<=5) return i;
- if (!strcasecmp(s, "normal")) return AA_NORMAL;
- else if (!strcasecmp(s, "dim")) return AA_DIM;
- else if (!strcasecmp(s, "bold")) return AA_BOLD;
- else if (!strcasecmp(s, "boldfont")) return AA_BOLDFONT;
- else if (!strcasecmp(s, "special")) return AA_SPECIAL;
- else return -1;
-}
-
-static int parse_suboptions(const char *arg) {
- char *pseudoargv[4], *osdcolor = NULL, *subcolor = NULL, **strings,
- *helpmsg = NULL;
- int pseudoargc, displayhelp = 0, *booleans;
- const opt_t extra_opts[] = {
- {"osdcolor", OPT_ARG_MSTRZ, &osdcolor, NULL},
- {"subcolor", OPT_ARG_MSTRZ, &subcolor, NULL},
- {"help", OPT_ARG_BOOL, &displayhelp, NULL} };
- opt_t *subopts = NULL, *p;
- char * const strings_list[] = {"-driver", "-kbddriver", "-mousedriver", "-font",
- "-width", "-height", "-minwidth", "-minheight", "-maxwidth",
- "-maxheight", "-recwidth", "-recheight", "-bright", "-contrast",
- "-gamma", "-dimmul", "-boldmul", "-random" };
- char * const booleans_list[] = {"-dim", "-bold", "-reverse", "-normal",
- "-boldfont", "-inverse", "-extended", "-eight", "-dither",
- "-floyd_steinberg", "-error_distribution"};
- char * const nobooleans_list[] = {"-nodim", "-nobold", "-noreverse", "-nonormal",
- "-noboldfont", "-noinverse", "-noextended", "-noeight", "-nodither",
- "-nofloyd_steinberg", "-noerror_distribution"};
- const int nstrings = sizeof(strings_list) / sizeof(char*);
- const int nbooleans = sizeof(booleans_list) / sizeof(char*);
- const int nextra_opts = sizeof(extra_opts) / sizeof(opt_t);
- const int nsubopts = nstrings + nbooleans + nextra_opts;
- int i, retval = 0;
-
- subopts = calloc(nsubopts + 1, sizeof(opt_t));
- strings = calloc(nstrings, sizeof(char*));
- booleans = calloc(nbooleans, sizeof(int));
-
- p = subopts;
- for (i=0; i<nstrings; i++, p++) {
- p->name = strings_list[i] + 1; // skip '-'
- p->type = OPT_ARG_MSTRZ;
- p->valp = &strings[i];
- }
- for (i=0; i<nbooleans; i++, p++) {
- p->name = booleans_list[i] + 1;
- p->type = OPT_ARG_BOOL;
- p->valp = &booleans[i];
- }
- memcpy(p, extra_opts, sizeof(extra_opts));
-
- retval = subopt_parse(arg, subopts);
-
- if (retval == 0 && displayhelp) {
- helpmsg = strdup(aa_help);
- for (i=0; i<(signed)strlen(helpmsg); i++)
- if (helpmsg[i] == '-') helpmsg[i] = ' ';
- mp_tmsg(MSGT_VO, MSGL_INFO, "\n\nHere are the aalib vo_aa suboptions:\n");
- mp_msg(MSGT_VO, MSGL_INFO, "%s\n\n", helpmsg);
-#define VO_AA_AdditionalOptions _("Additional options vo_aa provides:\n" \
-" help print this help message\n" \
-" osdcolor set OSD color\n subcolor set subtitle color\n" \
-" the color parameters are:\n 0 : normal\n" \
-" 1 : dim\n 2 : bold\n 3 : boldfont\n" \
-" 4 : reverse\n 5 : special\n\n\n")
-
- mp_tmsg(MSGT_VO, MSGL_INFO, VO_AA_AdditionalOptions);
- retval = -1;
- }
- if (retval == 0) {
- pseudoargv[3] = NULL;
- for (i=0; i<nstrings; i++) {
- pseudoargc = 3; // inside loop because aalib changes it
- if (strings[i] != NULL) {
- pseudoargv[1] = strings_list[i];
- pseudoargv[2] = strings[i];
- aa_parseoptions(&aa_defparams, &aa_defrenderparams,
- &pseudoargc, pseudoargv);
- }
- }
- pseudoargv[2] = NULL;
- for (i=0; i<nbooleans; i++) {
- pseudoargc = 2;
- if (booleans[i]) pseudoargv[1] = booleans_list[i];
- else pseudoargv[1] = nobooleans_list[i];
- aa_parseoptions(&aa_defparams, &aa_defrenderparams,
- &pseudoargc, pseudoargv);
- }
- if (osdcolor) aaopt_osdcolor = getcolor(osdcolor);
- if (subcolor) aaopt_subcolor = getcolor(subcolor);
- }
-
- free(subopts);
- free(booleans);
- if (strings) {
- for (i=0; i<nstrings; i++)
- free(strings[i]);
- free(strings);
- }
- free(osdcolor);
- free(subcolor);
- free(helpmsg);
- return retval;
-}
-
-static int preinit(const char *arg)
-{
- char * hidis = NULL;
- struct stat sbuf;
- int fd, vt;
- FILE * fp;
- char fname[12];
-
- if(arg)
- {
- if (parse_suboptions(arg) != 0)
- return ENOSYS;
- }
-
- /* initializing of aalib */
-
- hidis=aa_getfirst(&aa_displayrecommended);
- if ( hidis==NULL ){
- /* check /dev/vcsa<vt> */
- /* check only, if no driver is explicit set */
- fd = dup (fileno (stderr));
- fstat (fd, &sbuf);
- vt = sbuf.st_rdev & 0xff; // hi: major, low: minor
- close (fd);
- sprintf (fname, "/dev/vcsa%2.2i", vt);
- fp = fopen (fname, "w+");
- if (fp==NULL){
- fprintf(stderr,"VO: [aa] cannot open %s for writing,"
- "so we'll not use linux driver\n", fname);
- aa_recommendlowdisplay("linux");
- aa_recommendhidisplay("curses");
- aa_recommendhidisplay("X11");
- }else fclose(fp);
- } else aa_recommendhidisplay(hidis);
- c = aa_autoinit(&aa_defparams);
-
- if (c == NULL) {
- mp_msg(MSGT_VO,MSGL_ERR,"Cannot initialize aalib\n");
- return VO_ERROR;
- }
- if (!aa_autoinitkbd(c,0)) {
- mp_msg(MSGT_VO,MSGL_ERR,"Cannot initialize keyboard\n");
- aa_close(c);
- return VO_ERROR;
- }
-
- aa_resizehandler(c, (void *)resize);
- aa_hidecursor(c);
- p = aa_getrenderparams();
-
- if ((strstr(c->driver->name,"Curses")) || (strstr(c->driver->name,"Linux"))){
- freopen("/dev/null", "w", stderr);
- /* disable console blanking */
- printf("\033[9;0]");
- }
-
- memset(image,0,3*sizeof(uint8_t));
- osdmessagetext[0] = '\0';
- osdx = osdy = 0;
-
- return 0;
-}
-
-static int control(uint32_t request, void *data)
-{
- switch (request) {
- case VOCTRL_QUERY_FORMAT:
- return query_format(*((uint32_t*)data));
- case VOCTRL_SET_EQUALIZER: {
- struct voctrl_set_equalizer_args *args = data;
- if (strcmp(args->name, "contrast") == 0)
- p->contrast = (args->value + 100) * 64 / 100;
- else if (strcmp(args->name, "brightness") == 0)
- p->bright = (args->value + 100) * 128 / 100;
- return VO_TRUE;
- }
- case VOCTRL_GET_EQUALIZER: {
- struct voctrl_get_equalizer_args *args = data;
-
- if (strcmp(args->name, "contrast") == 0)
- *args->valueptr = (p->contrast - 64) * 100 / 64;
- else if (strcmp(args->name, "brightness") == 0)
- *args->valueptr = (p->bright - 128) * 100 / 128;
-
- return VO_TRUE;
- }
- }
- return VO_NOTIMPL;
-}
diff --git a/libvo/vo_bl.c b/libvo/vo_bl.c
deleted file mode 100644
index 8a4c29edd7..0000000000
--- a/libvo/vo_bl.c
+++ /dev/null
@@ -1,479 +0,0 @@
-/*
- * playback using the Blinkenlights UDP protocol (and to files)
- *
- * UDP socket handling copied from bsender.c part of blib-0.6:
- * http://sven.gimp.org/blinkenlights/
- * copyright (c) 2001-2001 The Blinkenlights Crew:
- * Sven Neumann <sven@gimp.org>
- * Michael Natterer <mitch@gimp.org>
- * Daniel Mack <daniel@yoobay.net>
- * copyright (C) 2004 Stefan Schuermans <1stein@schuermans.info>
- * other stuff: copyright (C) 2002 Rik Snel
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-#include <sys/ioctl.h>
-
-#include "config.h"
-
-#include <netdb.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include "video_out.h"
-#include "video_out_internal.h"
-#include "mp_msg.h"
-#include "m_option.h"
-#include "fastmemcpy.h"
-
-static const vo_info_t info =
-{
- "Blinkenlights driver: http://www.blinkenlights.de",
- "bl",
- "Rik Snel <snel@phys.uu.nl>",
- ""
-};
-
-const LIBVO_EXTERN (bl)
-
-/* General variables */
-
-static unsigned char *image = NULL;
-static unsigned char *tmp = NULL;
-static int framenum;
-static char *bl_subdevice = NULL;
-static int prevpts = -1;
-
-typedef struct {
- char *name; /* filename */
- FILE *fp;
- int header_written; /* if header was written already */
-} bl_file_t;
-
-typedef struct {
- char *name; /* hostname */
- int port;
- int fd; /* file descriptor */
-} bl_host_t;
-
-typedef struct {
- char *name;
- int img_format;
-
- int channels;
- int width;
- int height;
- int bpc; /* bits per component: bpc = 3, channels = 3 => bpp = 24*/
-
- /* file output functions */
- int (*init_file)(bl_file_t *file);
- void (*write_frame)(bl_file_t *file, unsigned char *i, int duration);
- void (*close_file)(bl_file_t *file);
-
- /* network output functions */
- int (*init_connection)(bl_host_t *host);
- void (*send_frame)(bl_host_t *host);
- void (*close_connection)(bl_host_t *host);
-} bl_properties_t;
-
-static bl_properties_t *bl = NULL;
-
-/* arbitrary limit because I am too lazy to do proper memory management */
-#define BL_MAX_FILES 16
-#define BL_MAX_HOSTS 16
-static bl_file_t bl_files[BL_MAX_FILES];
-static bl_host_t bl_hosts[BL_MAX_HOSTS];
-static int no_bl_files = 0;
-static int no_bl_hosts = 0;
-
-typedef struct {
- uint32_t magic;
- uint16_t height;
- uint16_t width;
- uint16_t channels;
- uint16_t maxval;
- unsigned char data[0];
-} bl_packet_t;
-
-static bl_packet_t *bl_packet = NULL;
-static int bl_size;
-
-/* bml output functions */
-static int bml_init(bl_file_t *f) {
- f->fp = fopen(f->name, "w");
- if (!f->fp) {
- mp_msg(MSGT_VO, MSGL_ERR, "bl: error opening %s\n", f->name);
- return 1;
- }
- f->header_written = 0;
- return 0;
-}
-
-static void bml_write_frame(bl_file_t *f, unsigned char *i, int duration) {
- int j, k;
- if( ! f->header_written )
- {
- fprintf(f->fp,
-"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
-"<blm width=\"%d\" height=\"%d\" bits=\"%d\" channels=\"%d\">\n"
-" <header>\n"
-" <title>Movie autogenerated by MPlayer</title>\n"
-" <url>http://www.mplayerhq.hu</url>\n"
-" </header>\n", bl->width, bl->height, bl->bpc, bl->channels);
- f->header_written = 1;
- }
- fprintf(f->fp, " <frame duration=\"%d\">\n", duration);
- for (j = 0; j < bl->height; j++) {
- fprintf(f->fp, " <row>");
- for (k = 0; k < bl->width; k++)
- fprintf(f->fp, "%02x", *(i + j * bl->width + k));
- fprintf(f->fp, "</row>\n");
- }
- fprintf(f->fp, " </frame>\n");
-}
-
-static void bml_close(bl_file_t *f) {
- fprintf(f->fp, "</blm>\n");
- fclose(f->fp);
-}
-
-/* Blinkenlights UDP protocol */
-static int udp_init(bl_host_t *h) {
- struct sockaddr_in addr;
- struct hostent *dest;
-
- dest = gethostbyname(h->name);
- if (!dest) {
- mp_msg(MSGT_VO, MSGL_ERR,
- "unable to resolve host %s\n", h->name);
- return 1;
- }
-
- h->fd = -1;
- memset(&addr, 0, sizeof(addr));
- addr.sin_family = AF_INET;
- addr.sin_port = htons(h->port);
-
- memcpy(&addr.sin_addr.s_addr, dest->h_addr_list[0], dest->h_length);
-
- h->fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
- if (h->fd < 0) {
- mp_msg(MSGT_VO, MSGL_ERR,
- "couldn't create socket for %s\n", h->name);
- return 1;
- }
- if (connect(h->fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
- mp_msg(MSGT_VO, MSGL_ERR, "couldn't connect socket for %s\n",
- h->name);
- close(h->fd);
- return 1;
- }
- return 0;
-}
-
-static void udp_send(bl_host_t *h) {
- if (send(h->fd, bl_packet, bl_size, 0) != bl_size)
- mp_msg(MSGT_VO, MSGL_ERR, "unable to send to %s\n", h->name);
-}
-
-static void udp_close(bl_host_t *h) {
- close(h->fd);
-}
-
-#define NO_BLS 3
-
-static bl_properties_t bls[NO_BLS] = {
- { "hdl", IMGFMT_YV12, 1, 18, 8, 8,
- &bml_init, &bml_write_frame, &bml_close,
- &udp_init, &udp_send, &udp_close },
- { "arcade", IMGFMT_YV12, 1, 26, 20, 8,
- &bml_init, &bml_write_frame, &bml_close,
- &udp_init, &udp_send, &udp_close },
- { "grayscale", IMGFMT_YV12, 1, -1, -1, 8, /* use width and height of movie */
- &bml_init, &bml_write_frame, &bml_close,
- &udp_init, &udp_send, &udp_close } };
-
-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)
-{
- void * ptr;
-
- /* adapt size of Blinkenlights UDP stream to size of movie */
- if (bl->width < 0 || bl->height < 0) {
- if (bl->width < 0) { /* use width of movie */
- bl->width = width;
- bl_packet->width = htons(bl->width);
- }
- if (bl->height < 0) { /* use height of movie */
- bl->height = height;
- bl_packet->height = htons(bl->height);
- }
- /* check for maximum size of UDP packet */
- if (12 + bl->width*bl->height*bl->channels > 65507) {
- mp_msg(MSGT_VO, MSGL_ERR, "bl: %dx%d-%d does not fit into an UDP packet\n",
- bl->width, bl->height, bl->channels);
- return 1;
- }
- /* resize frame and tmp buffers */
- bl_size = 12 + bl->width*bl->height*bl->channels;
- ptr = realloc(bl_packet, 12 + bl->width*bl->height*3); /* space for header and image data */
- if (ptr)
- bl_packet = (bl_packet_t*)ptr;
- else {
- mp_msg(MSGT_VO, MSGL_ERR, "bl: out of memory error\n");
- return 1;
- }
- image = ((unsigned char*)bl_packet + 12); /* pointer to image data */
- ptr = realloc(tmp, bl->width*bl->height*3); /* space for image data only */
- if (ptr)
- tmp = (unsigned char*)ptr;
- else {
- mp_msg(MSGT_VO, MSGL_ERR, "bl: out of memory error\n");
- return 1;
- }
- }
-
- framenum = 0;
- if (format != IMGFMT_YV12) {
- mp_msg(MSGT_VO, MSGL_ERR, "vo_bl called with wrong format");
- return 1;
- }
- if (width > bl->width) {
- mp_msg(MSGT_VO, MSGL_ERR, "bl: width of movie too large %d > %d\n", width, bl->width);
- return 1;
- }
- if (height > bl->height) {
- mp_msg(MSGT_VO, MSGL_ERR, "bl: height of movie too large %d > %d\n", height, bl->height);
- return 1;
- }
- if (!image) {
- mp_msg(MSGT_VO, MSGL_ERR, "bl: image should be initialized, internal error\n");
- return 1;
- }
- memset(image, 0, bl->width*bl->height*3); /* blank the image */
- mp_msg(MSGT_VO, MSGL_V, "vo_config bl called\n");
- return 0;
-}
-
-static void draw_osd(void) {
-}
-
-static void flip_page (void) {
- int i;
-
- if (prevpts >= 0) for (i = 0; i < no_bl_files; i++)
- bl->write_frame(&bl_files[i], tmp, (vo_pts - prevpts)/90);
- fast_memcpy(tmp, image, bl->width*bl->height*bl->channels);
- prevpts = vo_pts;
-
- for (i = 0; i < no_bl_hosts; i++) bl->send_frame(&bl_hosts[i]);
-
-
- framenum++;
- return;
-}
-
-static int draw_frame(uint8_t * src[]) {
- return 0;
-}
-
-static int query_format(uint32_t format) {
- if (format == bl->img_format)
- return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW;
- return 0;
-}
-
-static void uninit(void) {
- int i;
- mp_msg(MSGT_VO, MSGL_V, "bl: uninit called\n");
- free(bl_packet);
- bl_packet = NULL;
- free(bl_subdevice);
- bl_subdevice = NULL;
- for (i = 0; i < no_bl_files; i++) bl->close_file(&bl_files[i]);
- for (i = 0; i < no_bl_hosts; i++) bl->close_connection(&bl_hosts[i]);
- no_bl_files = 0;
- no_bl_hosts = 0;
- bl = NULL;
-}
-
-static void check_events(void) {
-}
-
-static int draw_slice(uint8_t *srcimg[], int stride[],
- int wf, int hf, int xf, int yf) {
- int i, w, h, x, y;
- uint8_t *dst;
- uint8_t *src=srcimg[0];
- w = wf; h = hf; x = xf; y = yf;
- dst=image; /* + zr->off_y + zr->image_width*(y/zr->vdec)+x;*/
- // copy Y:
- for (i = 0; i < h; i++) {
- fast_memcpy(dst,src,w);
- dst+=bl->width;
- src+=stride[0];
-
- }
- return 0;
-}
-
-static int preinit(const char *arg) {
- char *p, *q;
- int end = 0, i;
- char txt[256];
- if (!arg || strlen(arg) == 0) {
- mp_msg(MSGT_VO, MSGL_ERR, "bl: subdevice must be given, example: -vo bl:arcade:host=localhost:2323\n");
- return 1;
- }
-
- bl_subdevice = malloc(strlen(arg) + 1);
- if (!bl_subdevice) {
- mp_msg(MSGT_VO, MSGL_ERR, "bl: out of memory error\n");
- return 1;
- }
- p = bl_subdevice;
- strcpy(p, arg);
- mp_msg(MSGT_VO, MSGL_V, "bl: preinit called with %s\n", arg);
- for (i = 0; i < NO_BLS; i++) {
- if (!strncmp(p, bls[i].name, strlen(bls[i].name)))
- break;
- }
- if (i >= NO_BLS) {
- txt[0] = 0;
- for (i = 0; i < NO_BLS; i++)
- if (strlen( txt ) + 4 + strlen( bls[i].name ) + 1 < sizeof(txt))
- sprintf( txt + strlen( txt ), "%s%s",
- txt[0] == 0 ? "" : i == NO_BLS - 1 ? " or " : ", ", bls[i].name );
- mp_msg(MSGT_VO, MSGL_ERR, "bl: subdevice must start with %s\nbl: i.e. -vo bl:arcade:host=localhost:2323\n", txt);
- return 1;
- }
- bl = &bls[i];
- p += strlen(bls[i].name);
- if (*p == '\0') {
- no_bl_hosts = 1;
- bl_hosts[0].name = "localhost";
- bl_hosts[0].port = 2323;
- mp_msg(MSGT_VO, MSGL_V, "bl: no hosts/files specified, using localhost:2323\n");
- end = 1;
- } else if (*p != ':') {
- mp_msg(MSGT_VO, MSGL_ERR, "bl: syntax error in subdevice\n");
- return 1;
- }
- p++;
-
- while (!end) {
- q = p + 5;
- if (!strncmp(p, "file=", 5)) {
- if (no_bl_files == BL_MAX_FILES) {
- mp_msg(MSGT_VO, MSGL_ERR, "bl: maximum number of files reached (%d)\n", BL_MAX_FILES);
- return 1;
- }
- p += 5;
- while (*q != ',' && *q != '\0') q++;
- if (*q == '\0') end = 1;
- *q = '\0';
- bl_files[no_bl_files].name = p;
- mp_msg(MSGT_VO, MSGL_V, "blfile[%d]: %s\n",
- no_bl_files, p);
- no_bl_files++;
- } else if (!strncmp(p, "host=", 5)) {
- if (no_bl_hosts == BL_MAX_HOSTS) {
- mp_msg(MSGT_VO, MSGL_ERR, "bl: maximum number of hosts reached (%d)\n", BL_MAX_HOSTS);
- return 1;
- }
- p += 5;
- while (*q != ',' && *q != '\0' && *q != ':') q++;
- if (*q == ':') {
- *q++ = '\0';
- bl_hosts[no_bl_hosts].name = p;
- bl_hosts[no_bl_hosts].port = atoi(q);
- while (*q != ',' && *q != '\0') q++;
- if (*q == '\0') end = 1;
- } else {
- /* use default port */
- if (*q == '\0') end = 1;
- *q = '\0';
- bl_hosts[no_bl_hosts].name = p;
- bl_hosts[no_bl_hosts].port = 2323;
- }
- mp_msg(MSGT_VO, MSGL_V,
- "blhost[%d]: %s:%d\n",
- no_bl_hosts, p,
- bl_hosts[no_bl_hosts].port);
- no_bl_hosts++;
- } else {
- mp_msg(MSGT_VO, MSGL_ERR, "bl: syntax error in entry %d in subdevice %s, should be a comma separated\nlist of host=name:port and file=foo.bml\n", no_bl_hosts + no_bl_files, arg);
- return 1;
- }
- p = ++q;
- }
-
- if (bl->width >= 0 && bl->height >= 0) { /* size already known */
- bl_size = 12 + bl->width*bl->height*bl->channels;
- bl_packet = malloc(12 + bl->width*bl->height*3); /* space for header and image data */
- image = ((unsigned char*)bl_packet + 12); /* pointer to image data */
- tmp = malloc(bl->width*bl->height*3); /* space for image data only */
- }
- else { /* size unknown yet */
- bl_size = 12;
- bl_packet = malloc(12 + 3); /* space for header and a pixel */
- image = ((unsigned char*)bl_packet + 12); /* pointer to image data */
- tmp = malloc(3); /* space for a pixel only */
- }
-
- if (!bl_packet || !tmp) {
- mp_msg(MSGT_VO, MSGL_ERR, "bl: out of memory error\n");
- return 1;
- }
- bl_packet->magic = htonl(0x23542666);
- bl_packet->width = htons(bl->width);
- bl_packet->height = htons(bl->height);
- bl_packet->channels = htons(bl->channels);
- bl_packet->maxval = htons((1 << bl->bpc) - 1);
-
- /* open all files */
- for (i = 0; i < no_bl_files; i++)
- if (bl->init_file(&bl_files[i])) return 1;
-
- /* open all sockets */
- for (i = 0; i < no_bl_hosts; i++)
- if (bl->init_connection(&bl_hosts[i])) return 1;
-
-
- return 0;
-}
-
-static int control(uint32_t request, void *data) {
- switch (request) {
- case VOCTRL_QUERY_FORMAT:
- return query_format(*((uint32_t*)data));
- }
- return VO_NOTIMPL;
-}
diff --git a/libvo/vo_dfbmga.c b/libvo/vo_dfbmga.c
deleted file mode 100644
index 57b798040e..0000000000
--- a/libvo/vo_dfbmga.c
+++ /dev/null
@@ -1,1536 +0,0 @@
-/*
- * MPlayer video driver for DirectFB / Matrox G200/G400/G450/G550
- *
- * copyright (C) 2002-2008 Ville Syrjala <syrjala@sci.fi>
- * Originally based on vo_directfb.c by Jiri Svoboda <Jiri.Svoboda@seznam.cz>.
- *
- * This file is part of MPlayer.
- *
- * MPlayer 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.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 <directfb.h>
-#include <directfb_version.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-#include "fastmemcpy.h"
-#include "sub/sub.h"
-#include "mp_msg.h"
-#include "aspect.h"
-#include "mp_fifo.h"
-#include "input/keycodes.h"
-
-static const vo_info_t info = {
- "DirectFB / Matrox G200/G400/G450/G550",
- "dfbmga",
- "Ville Syrjala <syrjala@sci.fi>",
- ""
-};
-
-const LIBVO_EXTERN(dfbmga)
-
-static IDirectFB *dfb;
-
-static IDirectFBDisplayLayer *crtc1;
-static IDirectFBDisplayLayer *bes;
-static IDirectFBDisplayLayer *crtc2;
-static IDirectFBDisplayLayer *spic;
-
-static int num_bufs;
-static int current_buf;
-static int current_ip_buf;
-static IDirectFBSurface *bufs[3];
-
-static IDirectFBSurface *frame;
-static IDirectFBSurface *subframe;
-
-static IDirectFBSurface *besframe;
-static IDirectFBSurface *c1frame;
-static IDirectFBSurface *c2frame;
-static IDirectFBSurface *spicframe;
-
-static DFBSurfacePixelFormat frame_format;
-static DFBSurfacePixelFormat subframe_format;
-
-static DFBRectangle besrect;
-static DFBRectangle c1rect;
-static DFBRectangle c2rect;
-static DFBRectangle *subrect;
-
-static IDirectFBInputDevice *keyboard;
-static IDirectFBInputDevice *remote;
-static IDirectFBEventBuffer *buffer;
-
-static int blit_done;
-static int c1stretch;
-static int c2stretch;
-
-static int use_bes;
-static int use_crtc1;
-static int use_crtc2;
-static int use_spic;
-static int use_input;
-static int use_remote;
-static int field_parity;
-static int flipping;
-static DFBDisplayLayerBufferMode buffermode;
-static int tvnorm;
-
-static int osd_changed;
-static int osd_dirty;
-static int osd_current;
-static int osd_max;
-
-static int is_g200;
-
-static uint32_t in_width;
-static uint32_t in_height;
-static uint32_t buf_height;
-static uint32_t screen_width;
-static uint32_t screen_height;
-static uint32_t sub_width;
-static uint32_t sub_height;
-
-static char *
-pixelformat_name( DFBSurfacePixelFormat format )
-{
- switch(format) {
- case DSPF_ARGB:
- return "ARGB";
- case DSPF_RGB32:
- return "RGB32";
- case DSPF_RGB16:
- return "RGB16";
- case DSPF_ARGB1555:
- return "ARGB1555";
- case DSPF_YUY2:
- return "YUY2";
- case DSPF_UYVY:
- return "UYVY";
- case DSPF_YV12:
- return "YV12";
- case DSPF_I420:
- return "I420";
- case DSPF_ALUT44:
- return "ALUT44";
- case DSPF_NV12:
- return "NV12";
- case DSPF_NV21:
- return "NV21";
- default:
- return "Unknown pixel format";
- }
-}
-
-static DFBSurfacePixelFormat
-imgfmt_to_pixelformat( uint32_t format )
-{
- switch (format) {
- case IMGFMT_BGR32:
- return DSPF_RGB32;
- case IMGFMT_BGR16:
- return DSPF_RGB16;
- case IMGFMT_BGR15:
- return DSPF_ARGB1555;
- case IMGFMT_YUY2:
- return DSPF_YUY2;
- case IMGFMT_UYVY:
- return DSPF_UYVY;
- case IMGFMT_YV12:
- return DSPF_YV12;
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- return DSPF_I420;
- case IMGFMT_NV12:
- return DSPF_NV12;
- case IMGFMT_NV21:
- return DSPF_NV21;
- default:
- return DSPF_UNKNOWN;
- }
-}
-
-struct layer_enum
-{
- const char *name;
- IDirectFBDisplayLayer **layer;
- DFBResult res;
-};
-
-static DFBEnumerationResult
-get_layer_by_name( DFBDisplayLayerID id,
- DFBDisplayLayerDescription desc,
- void *data )
-{
- struct layer_enum *l = (struct layer_enum *) data;
-
- if (!strcmp( l->name, desc.name ))
- if ((l->res = dfb->GetDisplayLayer( dfb, id, l->layer )) == DFB_OK)
- return DFENUM_CANCEL;
-
- return DFENUM_OK;
-}
-
-static int
-preinit( const char *arg )
-{
- DFBResult res;
- int force_input = -1;
-
- /* Some defaults */
- use_bes = 0;
- use_crtc1 = 0;
- use_crtc2 = 1;
- use_spic = 1;
- field_parity = -1;
- buffermode = DLBM_TRIPLE;
- osd_max = 4;
- flipping = 1;
- tvnorm = -1;
-
- use_input = !getenv( "DISPLAY" );
-
- if (vo_subdevice) {
- int show_help = 0;
- int opt_no = 0;
- while (*vo_subdevice != '\0') {
- if (!strncmp(vo_subdevice, "bes", 3)) {
- use_bes = !opt_no;
- vo_subdevice += 3;
- opt_no = 0;
- } else if (!strncmp(vo_subdevice, "crtc1", 5)) {
- use_crtc1 = !opt_no;
- vo_subdevice += 5;
- opt_no = 0;
- } else if (!strncmp(vo_subdevice, "crtc2", 5)) {
- use_crtc2 = !opt_no;
- vo_subdevice += 5;
- opt_no = 0;
- } else if (!strncmp(vo_subdevice, "spic", 4)) {
- use_spic = !opt_no;
- vo_subdevice += 4;
- opt_no = 0;
- } else if (!strncmp(vo_subdevice, "input", 5)) {
- force_input = !opt_no;
- vo_subdevice += 5;
- opt_no = 0;
- } else if (!strncmp(vo_subdevice, "remote", 6)) {
- use_remote = !opt_no;
- vo_subdevice += 6;
- opt_no = 0;
- } else if (!strncmp(vo_subdevice, "buffermode=", 11)) {
- if (opt_no) {
- show_help = 1;
- break;
- }
- vo_subdevice += 11;
- if (!strncmp(vo_subdevice, "single", 6)) {
- buffermode = DLBM_FRONTONLY;
- osd_max = 1;
- flipping = 0;
- vo_subdevice += 6;
- } else if (!strncmp(vo_subdevice, "double", 6)) {
- buffermode = DLBM_BACKVIDEO;
- osd_max = 2;
- flipping = 1;
- vo_subdevice += 6;
- } else if (!strncmp(vo_subdevice, "triple", 6)) {
- buffermode = DLBM_TRIPLE;
- osd_max = 4;
- flipping = 1;
- vo_subdevice += 6;
- } else {
- show_help = 1;
- break;
- }
- opt_no = 0;
- } else if (!strncmp(vo_subdevice, "fieldparity=", 12)) {
- if (opt_no) {
- show_help = 1;
- break;
- }
- vo_subdevice += 12;
- if (!strncmp(vo_subdevice, "top", 3)) {
- field_parity = 0;
- vo_subdevice += 3;
- } else if (!strncmp(vo_subdevice, "bottom", 6)) {
- field_parity = 1;
- vo_subdevice += 6;
- } else {
- show_help = 1;
- break;
- }
- opt_no = 0;
- } else if (!strncmp(vo_subdevice, "tvnorm=", 7)) {
- if (opt_no) {
- show_help = 1;
- break;
- }
- vo_subdevice += 7;
- if (!strncmp(vo_subdevice, "pal", 3)) {
- tvnorm = 0;
- vo_subdevice += 3;
- } else if (!strncmp(vo_subdevice, "ntsc" , 4)) {
- tvnorm = 1;
- vo_subdevice += 4;
- } else if (!strncmp(vo_subdevice, "auto" , 4)) {
- tvnorm = 2;
- vo_subdevice += 4;
- } else {
- show_help = 1;
- break;
- }
- opt_no = 0;
- } else if (!strncmp(vo_subdevice, "no", 2)) {
- if (opt_no) {
- show_help = 1;
- break;
- }
- vo_subdevice += 2;
- opt_no = 1;
- } else if (*vo_subdevice == ':') {
- if (opt_no) {
- show_help = 1;
- break;
- }
- vo_subdevice++;
- opt_no = 0;
- } else {
- show_help = 1;
- break;
- }
- }
- if (show_help) {
- mp_msg( MSGT_VO, MSGL_ERR,
- "\nvo_dfbmga command line help:\n"
- "Example: mplayer -vo dfbmga:nocrtc2:bes:buffermode=single\n"
- "\nOptions (use 'no' prefix to disable):\n"
- " bes Use Backend Scaler\n"
- " crtc1 Use CRTC1\n"
- " crtc2 Use CRTC2\n"
- " spic Use hardware sub-picture for OSD\n"
- " input Use DirectFB for keyboard input\n"
- " remote Use DirectFB for remote control input\n"
- "\nOther options:\n"
- " buffermode=(single|double|triple)\n"
- " single Use single buffering\n"
- " double Use double buffering\n"
- " triple Use triple buffering\n"
- " fieldparity=(top|bottom)\n"
- " top Top field first\n"
- " bottom Bottom field first\n"
- " tvnorm=(pal|ntsc|auto)\n"
- " pal Force PAL\n"
- " ntsc Force NTSC\n"
- " auto Select according to FPS\n"
- "\n" );
- return -1;
- }
- }
- if (!use_bes && !use_crtc1 && !use_crtc2) {
- mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: No output selected\n" );
- return -1;
- }
- if (use_bes && use_crtc1) {
- mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: Both BES and CRTC1 outputs selected\n" );
- return -1;
- }
-
- if ((res = DirectFBInit( NULL, NULL )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR,
- "vo_dfbmga: DirectFBInit() failed - %s\n",
- DirectFBErrorString( res ) );
- return -1;
- }
-
- switch (tvnorm) {
- case 0:
- DirectFBSetOption( "matrox-tv-standard", "pal" );
- mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Forced TV standard to PAL\n" );
- break;
- case 1:
- DirectFBSetOption( "matrox-tv-standard", "ntsc" );
- mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Forced TV standard to NTSC\n" );
- break;
- case 2:
- if (vo_fps > 27) {
- DirectFBSetOption( "matrox-tv-standard", "ntsc" );
- mp_msg( MSGT_VO, MSGL_INFO,
- "vo_dfbmga: Selected TV standard based upon FPS: NTSC\n" );
- } else {
- DirectFBSetOption( "matrox-tv-standard", "pal" );
- mp_msg( MSGT_VO, MSGL_INFO,
- "vo_dfbmga: Selected TV standard based upon FPS: PAL\n" );
- }
- break;
- }
-
- if ((res = DirectFBCreate( &dfb )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR,
- "vo_dfbmga: DirectFBCreate() failed - %s\n",
- DirectFBErrorString( res ) );
- return -1;
- }
-
- if (use_crtc1 || use_bes) {
- struct layer_enum l = {
- "FBDev Primary Layer",
- &crtc1,
- DFB_UNSUPPORTED
- };
- dfb->EnumDisplayLayers( dfb, get_layer_by_name, &l );
- if (l.res != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: Can't get CRTC1 layer - %s\n",
- DirectFBErrorString( l.res ) );
- uninit();
- return -1;
- }
- if ((res = crtc1->SetCooperativeLevel( crtc1, DLSCL_EXCLUSIVE )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR, "Can't get exclusive access to CRTC1 layer - %s\n",
- DirectFBErrorString( res ) );
- uninit();
- return -1;
- }
- use_input = 1;
- }
-
- if (force_input != -1)
- use_input = force_input;
-
- if (use_bes) {
- DFBDisplayLayerConfig dlc;
- DFBDisplayLayerConfigFlags failed;
- struct layer_enum l = {
- "Matrox Backend Scaler",
- &bes,
- DFB_UNSUPPORTED
- };
-
- dfb->EnumDisplayLayers( dfb, get_layer_by_name, &l );
- if (l.res != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR, "Can't get BES layer - %s\n",
- DirectFBErrorString( l.res ) );
- uninit();
- return -1;
- }
- if ((res = bes->SetCooperativeLevel( bes, DLSCL_EXCLUSIVE )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR, "Can't get exclusive access to BES - %s\n",
- DirectFBErrorString( res ) );
- uninit();
- return -1;
- }
- dlc.flags = DLCONF_PIXELFORMAT;
- dlc.pixelformat = DSPF_RGB16;
- if (bes->TestConfiguration( bes, &dlc, &failed ) != DFB_OK) {
- is_g200 = 1;
- use_crtc2 = 0;
- }
- }
-
- if (use_crtc2) {
- struct layer_enum l = {
- "Matrox CRTC2 Layer",
- &crtc2,
- DFB_UNSUPPORTED
- };
-
- dfb->EnumDisplayLayers( dfb, get_layer_by_name, &l );
- if (l.res != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR, "Can't get CRTC2 layer - %s\n",
- DirectFBErrorString( l.res ) );
- uninit();
- return -1;
- }
- if ((res = crtc2->SetCooperativeLevel( crtc2, DLSCL_EXCLUSIVE )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR, "Can't get exclusive access to CRTC2 - %s\n",
- DirectFBErrorString( res ) );
- uninit();
- return -1;
- }
- }
-
- if (use_input || use_remote) {
- if ((res = dfb->CreateEventBuffer( dfb, &buffer )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR,
- "vo_dfbmga: Can't create event buffer - %s\n",
- DirectFBErrorString( res ) );
- uninit();
- return -1;
- }
- }
-
- if (use_input) {
- if ((res = dfb->GetInputDevice( dfb, DIDID_KEYBOARD, &keyboard )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR,
- "vo_dfbmga: Can't get keyboard - %s\n",
- DirectFBErrorString( res ) );
- uninit();
- return -1;
- }
- if ((res = keyboard->AttachEventBuffer( keyboard, buffer )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR,
- "vo_dfbmga: Can't attach event buffer to keyboard - %s\n",
- DirectFBErrorString( res ) );
- uninit();
- return -1;
- }
- }
- if (use_remote) {
- if ((res = dfb->GetInputDevice( dfb, DIDID_REMOTE, &remote )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR,
- "vo_dfbmga: Can't get remote control - %s\n",
- DirectFBErrorString( res ) );
- uninit();
- return -1;
- }
- if ((res = remote->AttachEventBuffer( remote, buffer )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR,
- "vo_dfbmga: Can't attach event buffer to remote control - %s\n",
- DirectFBErrorString( res ) );
- uninit();
- return -1;
- }
- }
-
- return 0;
-}
-
-static void release_config( void )
-{
- if (spicframe)
- spicframe->Release( spicframe );
- if (spic)
- spic->Release( spic );
- if (c2frame)
- c2frame->Release( c2frame );
- if (c1frame)
- c1frame->Release( c1frame );
- if (besframe)
- besframe->Release( besframe );
- if (bufs[0])
- bufs[0]->Release( bufs[0] );
- if (bufs[1])
- bufs[1]->Release( bufs[1] );
- if (bufs[2])
- bufs[2]->Release( bufs[2] );
-
- spicframe = NULL;
- spic = NULL;
- c2frame = NULL;
- c1frame = NULL;
- besframe = NULL;
- bufs[0] = NULL;
- bufs[1] = NULL;
- bufs[2] = NULL;
-}
-
-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 )
-{
- DFBResult res;
-
- DFBDisplayLayerConfig dlc;
- DFBDisplayLayerConfigFlags failed;
-
- uint32_t out_width;
- uint32_t out_height;
-
- release_config();
-
- in_width = width;
- in_height = height;
-
- aspect_save_orig(width, height);
- aspect_save_prescale(d_width, d_height);
-
- dlc.pixelformat = imgfmt_to_pixelformat( format );
-
- {
- /* Draw to a temporary surface */
- DFBSurfaceDescription dsc;
-
- dsc.flags = DSDESC_WIDTH | DSDESC_HEIGHT |
- DSDESC_PIXELFORMAT;
- dsc.width = (in_width + 15) & ~15;
- dsc.height = (in_height + 15) & ~15;
- dsc.pixelformat = dlc.pixelformat;
-
- /* Don't waste video memory since we don't need direct stretchblit */
- if (use_bes) {
- dsc.flags |= DSDESC_CAPS;
- dsc.caps = DSCAPS_SYSTEMONLY;
- }
-
- for (num_bufs = 0; num_bufs < 3; num_bufs++) {
- if ((res = dfb->CreateSurface( dfb, &dsc, &bufs[num_bufs] )) != DFB_OK) {
- if (num_bufs == 0) {
- mp_msg( MSGT_VO, MSGL_ERR,
- "vo_dfbmga: Can't create surfaces - %s!\n",
- DirectFBErrorString( res ) );
- return -1;
- }
- break;
- }
- }
- frame = bufs[0];
- current_buf = 0;
- current_ip_buf = 0;
- buf_height = dsc.height;
- }
- frame->GetPixelFormat( frame, &frame_format );
- mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Video surface %dx%d %s\n",
- in_width, in_height,
- pixelformat_name( frame_format ) );
-
-
- /*
- * BES
- */
- if (use_bes) {
- aspect_save_screenres( 0x10000, 0x10000 );
- aspect( &out_width, &out_height, A_ZOOM );
- besrect.x = (0x10000 - out_width) * in_width / out_width / 2;
- besrect.y = (0x10000 - out_height) * in_height / out_height / 2;
- besrect.w = in_width;
- besrect.h = in_height;
-
- dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE;
- dlc.width = besrect.w + besrect.x * 2;
- dlc.height = besrect.h + besrect.y * 2;
- dlc.buffermode = buffermode;
-
- if ((res = bes->TestConfiguration( bes, &dlc, &failed )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR,
- "vo_dfbmga: Invalid BES configuration - %s!\n",
- DirectFBErrorString( res ) );
- return -1;
- }
- if ((res = bes->SetConfiguration( bes, &dlc )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR,
- "vo_dfbmga: BES configuration failed - %s!\n",
- DirectFBErrorString( res ) );
- return -1;
- }
- bes->GetSurface( bes, &besframe );
- besframe->SetBlittingFlags( besframe, DSBLIT_NOFX );
-
- bes->SetScreenLocation( bes, 0.0, 0.0, 1.0, 1.0 );
-
- besframe->Clear( besframe, 0, 0, 0, 0xff );
- besframe->Flip( besframe, NULL, 0 );
- besframe->Clear( besframe, 0, 0, 0, 0xff );
- besframe->Flip( besframe, NULL, 0 );
- besframe->Clear( besframe, 0, 0, 0, 0xff );
-
- mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: BES using %s buffering\n",
- dlc.buffermode == DLBM_TRIPLE ? "triple" :
- dlc.buffermode == DLBM_BACKVIDEO ? "double" : "single" );
- mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: BES surface %dx%d %s\n", dlc.width, dlc.height, pixelformat_name( dlc.pixelformat ) );
- }
-
- /*
- * CRTC1
- */
- if (use_crtc1) {
- dlc.flags = DLCONF_BUFFERMODE;
- dlc.buffermode = buffermode;
-
- if ((res = crtc1->TestConfiguration( crtc1, &dlc, &failed )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR,
- "vo_dfbmga: Invalid CRTC1 configuration - %s!\n",
- DirectFBErrorString( res ) );
- return -1;
- }
- if ((res = crtc1->SetConfiguration( crtc1, &dlc )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR,
- "vo_dfbmga: CRTC1 configuration failed - %s!\n",
- DirectFBErrorString( res ) );
- return -1;
- }
- if ((res = crtc1->GetConfiguration( crtc1, &dlc )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR,
- "vo_dfbmga: Getting CRTC1 configuration failed - %s!\n",
- DirectFBErrorString( res ) );
- return -1;
- }
-
- crtc1->GetSurface( crtc1, &c1frame );
- c1frame->SetBlittingFlags( c1frame, DSBLIT_NOFX );
- c1frame->SetColor( c1frame, 0, 0, 0, 0xff );
-
- c1frame->GetSize( c1frame, &screen_width, &screen_height );
-
- aspect_save_screenres( screen_width, screen_height );
- aspect( &out_width, &out_height, (flags & VOFLAG_FULLSCREEN) ? A_ZOOM : A_NOZOOM );
-
- if (in_width != out_width || in_height != out_height)
- c1stretch = 1;
- else
- c1stretch = 0;
-
- c1rect.x = (screen_width - out_width) / 2;
- c1rect.y = (screen_height - out_height) / 2;
- c1rect.w = out_width;
- c1rect.h = out_height;
-
- c1frame->Clear( c1frame, 0, 0, 0, 0xff );
- c1frame->Flip( c1frame, NULL, 0 );
- c1frame->Clear( c1frame, 0, 0, 0, 0xff );
- c1frame->Flip( c1frame, NULL, 0 );
- c1frame->Clear( c1frame, 0, 0, 0, 0xff );
-
- mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: CRTC1 using %s buffering\n",
- dlc.buffermode == DLBM_TRIPLE ? "triple" :
- dlc.buffermode == DLBM_BACKVIDEO ? "double" : "single" );
- mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: CRTC1 surface %dx%d %s\n", screen_width, screen_height, pixelformat_name( dlc.pixelformat ) );
- }
-
- /*
- * CRTC2
- */
- if (use_crtc2) {
- dlc.flags = DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE | DLCONF_OPTIONS;
- dlc.buffermode = buffermode;
- dlc.options = DLOP_NONE;
-
- if (field_parity != -1) {
- dlc.options |= DLOP_FIELD_PARITY;
- }
- mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Field parity set to: ");
- switch (field_parity) {
- case -1:
- mp_msg( MSGT_VO, MSGL_INFO, "Don't care\n");
- break;
- case 0:
- mp_msg( MSGT_VO, MSGL_INFO, "Top field first\n");
- break;
- case 1:
- mp_msg( MSGT_VO, MSGL_INFO, "Bottom field first\n");
- break;
- }
-
- switch (dlc.pixelformat) {
- case DSPF_I420:
- case DSPF_YV12:
- /* sub-picture supported */
- break;
-
- case DSPF_YUY2:
- case DSPF_UYVY:
- /* Blit to YUY2/UYVY not supported */
- dlc.pixelformat = DSPF_ARGB;
-
- /* fall through */
- default:
- /* sub-picture not supported */
- use_spic = 0;
- }
-
- if ((res = crtc2->TestConfiguration( crtc2, &dlc, &failed )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR,
- "vo_dfbmga: Invalid CRTC2 configuration - %s!\n",
- DirectFBErrorString( res ) );
- return -1;
- }
- if ((res = crtc2->SetConfiguration( crtc2, &dlc )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR,
- "vo_dfbmga: CRTC2 configuration failed - %s!\n",
- DirectFBErrorString( res ) );
- return -1;
- }
-
- if (field_parity != -1)
- crtc2->SetFieldParity( crtc2, field_parity );
-
- crtc2->GetSurface( crtc2, &c2frame );
- c2frame->SetBlittingFlags( c2frame, DSBLIT_NOFX );
- c2frame->SetColor( c2frame, 0, 0, 0, 0xff );
-
- c2frame->GetSize( c2frame, &screen_width, &screen_height );
-
- /* Don't stretch only slightly smaller videos */
- if ((in_width > (0.95 * screen_width)) &&
- (in_width < screen_width))
- out_width = in_width;
- else
- out_width = screen_width;
- if ((in_height > (0.95 * screen_height)) &&
- (in_height < screen_height))
- out_height = in_height;
- else
- out_height = screen_height;
-
- aspect_save_screenres( out_width, out_height );
- aspect( &out_width, &out_height, (flags & VOFLAG_FULLSCREEN) ? A_ZOOM : A_NOZOOM );
-
- if (in_width != out_width ||
- in_height != out_height)
- c2stretch = 1;
- else
- c2stretch = 0;
-
- c2rect.x = (screen_width - out_width) / 2;
- c2rect.y = (screen_height - out_height) / 2;
- c2rect.w = out_width;
- c2rect.h = out_height;
-
- c2frame->Clear( c2frame, 0, 0, 0, 0xff );
- c2frame->Flip( c2frame, NULL, 0 );
- c2frame->Clear( c2frame, 0, 0, 0, 0xff );
- c2frame->Flip( c2frame, NULL, 0 );
- c2frame->Clear( c2frame, 0, 0, 0, 0xff );
-
- mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: CRTC2 using %s buffering\n",
- dlc.buffermode == DLBM_TRIPLE ? "triple" :
- dlc.buffermode == DLBM_BACKVIDEO ? "double" : "single" );
- mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: CRTC2 surface %dx%d %s\n", screen_width, screen_height, pixelformat_name( dlc.pixelformat ) );
- } else {
- use_spic = 0;
- }
-
- /*
- * Sub-picture
- */
- if (use_spic) {
- /* Draw OSD to sub-picture surface */
- IDirectFBPalette *palette;
- DFBColor color;
- int i;
- struct layer_enum l = {
- "Matrox CRTC2 Sub-Picture",
- &spic,
- DFB_UNSUPPORTED
- };
- dfb->EnumDisplayLayers( dfb, get_layer_by_name, &l );
- if (l.res != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR, "vo_dfbmga: Can't get sub-picture layer - %s\n",
- DirectFBErrorString( l.res ) );
- return -1;
- }
- if ((res = spic->SetCooperativeLevel( spic, DLSCL_EXCLUSIVE )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR, "Can't get exclusive access to sub-picture - %s\n",
- DirectFBErrorString( res ) );
- return -1;
- }
-
- dlc.flags = DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE;
- dlc.pixelformat = DSPF_ALUT44;
- dlc.buffermode = buffermode;
- dlc.flags |= DLCONF_OPTIONS;
- dlc.options = DLOP_ALPHACHANNEL;
-
- if ((res = spic->TestConfiguration( spic, &dlc, &failed )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR,
- "vo_dfbmga: Invalid sub-picture configuration - %s!\n",
- DirectFBErrorString( res ) );
- return -1;
- }
- if ((res = spic->SetConfiguration( spic, &dlc )) != DFB_OK) {
- mp_msg( MSGT_VO, MSGL_ERR,
- "vo_dfbmga: Sub-picture configuration failed - %s!\n",
- DirectFBErrorString( res ) );
- return -1;
- }
-
- spic->GetSurface( spic, &spicframe );
-
- spicframe->GetPalette( spicframe, &palette );
- color.a = 0xff;
- for (i = 0; i < 16; i++) {
- color.r = i * 17;
- color.g = i * 17;
- color.b = i * 17;
- palette->SetEntries( palette, &color, 1, i );
- }
- palette->Release( palette );
-
- spicframe->Clear( spicframe, 0, 0, 0, 0 );
- spicframe->Flip( spicframe, NULL, 0 );
- spicframe->Clear( spicframe, 0, 0, 0, 0 );
- spicframe->Flip( spicframe, NULL, 0 );
- spicframe->Clear( spicframe, 0, 0, 0, 0 );
-
- mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Sub-picture layer using %s buffering\n",
- dlc.buffermode == DLBM_TRIPLE ? "triple" :
- dlc.buffermode == DLBM_BACKVIDEO ? "double" : "single" );
-
- subframe = spicframe;
- subrect = NULL;
- } else if (use_crtc2) {
- /* Draw OSD to CRTC2 surface */
- subframe = c2frame;
- subrect = &c2rect;
- } else if (use_crtc1) {
- /* Draw OSD to CRTC1 surface */
- subframe = c1frame;
- subrect = &c1rect;
- } else {
- /* Draw OSD to BES surface */
- subframe = besframe;
- subrect = &besrect;
- }
-
- subframe->GetSize( subframe, &sub_width, &sub_height );
- subframe->GetPixelFormat( subframe, &subframe_format );
- mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Sub-picture surface %dx%d %s (%s)\n",
- sub_width, sub_height,
- pixelformat_name( subframe_format ),
- use_crtc2 ? (use_spic ? "Sub-picture layer" : "CRTC2") :
- use_crtc1 ? "CRTC1" : "BES" );
-
- osd_dirty = 0;
- osd_current = 1;
- blit_done = 0;
-
- return 0;
-}
-
-static int
-query_format( uint32_t format )
-{
- switch (format) {
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- if (is_g200 || use_crtc1)
- return 0;
- break;
- case IMGFMT_BGR32:
- case IMGFMT_BGR16:
- case IMGFMT_BGR15:
- if (is_g200 && use_bes)
- return 0;
- break;
- case IMGFMT_UYVY:
- if (is_g200)
- return 0;
- break;
- case IMGFMT_YUY2:
- break;
- case IMGFMT_NV12:
- case IMGFMT_NV21:
- if (use_crtc1 || use_crtc2)
- return 0;
- break;
- default:
- return 0;
- }
-
- return VFCAP_HWSCALE_UP |
- VFCAP_HWSCALE_DOWN |
- VFCAP_CSP_SUPPORTED_BY_HW |
- VFCAP_CSP_SUPPORTED |
- VFCAP_OSD;
-}
-
-static void
-vo_draw_alpha_alut44( int w, int h,
- unsigned char* src,
- unsigned char *srca,
- int srcstride,
- unsigned char* dst,
- int dststride )
-{
- int x;
-
- while (h--) {
- for (x = 0; x < w; x++) {
- if (srca[x])
- dst[x] = ((255 - srca[x]) & 0xF0) | (src[x] >> 4);
- }
- src += srcstride;
- srca += srcstride;
- dst += dststride;
- }
-}
-
-static void
-clear_alpha( int x0, int y0,
- int w, int h )
-{
- if (use_spic && !flipping && vo_osd_changed_flag)
- subframe->FillRectangle( subframe, x0, y0, w, h );
-}
-
-static void
-draw_alpha( int x0, int y0,
- int w, int h,
- unsigned char *src,
- unsigned char *srca,
- int stride )
-{
- uint8_t *dst;
- void *ptr;
- int pitch;
-
- if (use_spic) {
- if (!osd_changed || (!flipping && !vo_osd_changed_flag))
- return;
- osd_dirty |= osd_current;
- } else {
- if (x0 < subrect->x ||
- y0 < subrect->y ||
- x0 + w > subrect->x + subrect->w ||
- y0 + h > subrect->y + subrect->h)
- osd_dirty |= osd_current;
- }
-
- if (subframe->Lock( subframe, DSLF_READ | DSLF_WRITE, &ptr, &pitch ) != DFB_OK)
- return;
- dst = ptr;
-
- switch (subframe_format) {
- case DSPF_ALUT44:
- vo_draw_alpha_alut44( w, h, src, srca, stride,
- dst + pitch * y0 + x0,
- pitch );
- break;
- case DSPF_RGB32:
- case DSPF_ARGB:
- vo_draw_alpha_rgb32( w, h, src, srca, stride,
- dst + pitch * y0 + 4 * x0,
- pitch );
- break;
- case DSPF_RGB16:
- vo_draw_alpha_rgb16( w, h, src, srca, stride,
- dst + pitch * y0 + 2 * x0,
- pitch );
- break;
- case DSPF_ARGB1555:
- vo_draw_alpha_rgb15( w, h, src, srca, stride,
- dst + pitch * y0 + 2 * x0,
- pitch );
- break;
- case DSPF_YUY2:
- vo_draw_alpha_yuy2( w, h, src, srca, stride,
- dst + pitch * y0 + 2 * x0,
- pitch );
- break;
- case DSPF_UYVY:
- vo_draw_alpha_yuy2( w, h, src, srca, stride,
- dst + pitch * y0 + 2 * x0 + 1,
- pitch );
- break;
- case DSPF_NV12:
- case DSPF_NV21:
- case DSPF_I420:
- case DSPF_YV12:
- vo_draw_alpha_yv12( w, h, src, srca, stride,
- dst + pitch * y0 + x0,
- pitch );
- break;
- }
-
- subframe->Unlock( subframe );
-}
-
-static int
-draw_frame( uint8_t * src[] )
-{
- return -1;
-}
-
-static int
-draw_slice( uint8_t * src[], int stride[], int w, int h, int x, int y )
-{
- uint8_t *dst;
- void *ptr;
- int pitch;
-
- if (frame->Lock( frame, DSLF_WRITE, &ptr, &pitch ) != DFB_OK)
- return VO_FALSE;
- dst = ptr;
-
- memcpy_pic( dst + pitch * y + x, src[0],
- w, h, pitch, stride[0] );
-
- dst += pitch * buf_height;
-
- y /= 2;
- h /= 2;
-
- if (frame_format == DSPF_NV12 || frame_format == DSPF_NV21) {
- memcpy_pic( dst + pitch * y + x, src[1],
- w, h, pitch, stride[1] );
- } else {
- x /= 2;
- w /= 2;
- pitch /= 2;
-
- if (frame_format == DSPF_I420 )
- memcpy_pic( dst + pitch * y + x, src[1],
- w, h, pitch, stride[1] );
- else
- memcpy_pic( dst + pitch * y + x, src[2],
- w, h, pitch, stride[2] );
-
- dst += pitch * buf_height / 2;
-
- if (frame_format == DSPF_I420 )
- memcpy_pic( dst + pitch * y + x, src[2],
- w, h, pitch, stride[2] );
- else
- memcpy_pic( dst + pitch * y + x, src[1],
- w, h, pitch, stride[1] );
- }
-
- frame->Unlock( frame );
-
- return VO_TRUE;
-}
-
-static void
-blit_to_screen( void )
-{
- IDirectFBSurface *blitsrc = frame;
- DFBRectangle *srect = NULL;
-
- if (use_bes) {
- if (vo_vsync && !flipping)
- bes->WaitForSync( bes );
-
- besframe->Blit( besframe, blitsrc, NULL, besrect.x, besrect.y );
- blitsrc = besframe;
- srect = &besrect;
- }
-
- if (use_crtc1) {
- if (vo_vsync && !flipping)
- crtc1->WaitForSync( crtc1 );
-
- if (c1stretch)
- c1frame->StretchBlit( c1frame, blitsrc, srect, &c1rect );
- else
- c1frame->Blit( c1frame, blitsrc, srect, c1rect.x, c1rect.y );
- }
-
- if (use_crtc2) {
- if (vo_vsync && !flipping)
- crtc2->WaitForSync( crtc2 );
-
- if (c2stretch)
- c2frame->StretchBlit( c2frame, blitsrc, srect, &c2rect );
- else
- c2frame->Blit( c2frame, blitsrc, srect, c2rect.x, c2rect.y );
- }
-}
-
-static void
-draw_osd( void )
-{
- frame = bufs[current_buf];
- frame->Unlock( frame );
-
- osd_changed = vo_osd_changed( 0 );
- if (osd_dirty & osd_current) {
- if (use_spic) {
- if (flipping)
- subframe->Clear( subframe, 0, 0, 0, 0 );
- } else {
- /* Clear black bars around the picture */
- subframe->FillRectangle( subframe,
- 0, 0,
- sub_width, subrect->y );
- subframe->FillRectangle( subframe,
- 0, subrect->y + subrect->h,
- sub_width, subrect->y );
- subframe->FillRectangle( subframe,
- 0, subrect->y,
- subrect->x, subrect->h );
- subframe->FillRectangle( subframe,
- subrect->x + subrect->w, subrect->y,
- subrect->x, subrect->h );
- }
- osd_dirty &= ~osd_current;
- }
-
- blit_to_screen();
- blit_done = 1;
-
- vo_remove_text( sub_width, sub_height, clear_alpha );
- vo_draw_text( sub_width, sub_height, draw_alpha );
-
- if (use_spic && flipping && osd_changed) {
- subframe->Flip( subframe, NULL, 0 );
- osd_current <<= 1;
- if (osd_current > osd_max)
- osd_current = 1;
- }
-}
-
-static void
-flip_page( void )
-{
- if (!blit_done)
- blit_to_screen();
-
- if (flipping) {
- if (use_crtc2)
- c2frame->Flip( c2frame, NULL, vo_vsync ? DSFLIP_WAITFORSYNC : DSFLIP_ONSYNC );
- if (use_crtc1)
- c1frame->Flip( c1frame, NULL, vo_vsync ? DSFLIP_WAITFORSYNC : DSFLIP_ONSYNC );
- if (use_bes)
- besframe->Flip( besframe, NULL, vo_vsync ? DSFLIP_WAITFORSYNC : DSFLIP_ONSYNC );
-
- if (!use_spic) {
- osd_current <<= 1;
- if (osd_current > osd_max)
- osd_current = 1;
- }
- }
-
- blit_done = 0;
- current_buf = 0;
-}
-
-static void
-uninit( void )
-{
- release_config();
-
- if (buffer)
- buffer->Release( buffer );
- if (remote)
- remote->Release( remote );
- if (keyboard)
- keyboard->Release( keyboard );
- if (crtc2)
- crtc2->Release( crtc2 );
- if (bes)
- bes->Release( bes );
- if (crtc1)
- crtc1->Release( crtc1 );
- if (dfb)
- dfb->Release( dfb );
-
- buffer = NULL;
- remote = NULL;
- keyboard = NULL;
- crtc2 = NULL;
- bes = NULL;
- crtc1 = NULL;
- dfb = NULL;
-}
-
-static uint32_t
-get_image( mp_image_t *mpi )
-{
- int buf = current_buf;
- uint8_t *dst;
- void *ptr;
- int pitch;
-
- if (mpi->flags & MP_IMGFLAG_READABLE &&
- (mpi->type == MP_IMGTYPE_IPB || mpi->type == MP_IMGTYPE_IP)) {
- if (num_bufs < 2)
- return VO_FALSE;
-
- current_ip_buf ^= 1;
-
- if (mpi->type == MP_IMGTYPE_IPB && num_bufs < 3 && current_ip_buf)
- return VO_FALSE;
-
- buf = current_ip_buf;
-
- if (mpi->type == MP_IMGTYPE_IPB)
- buf++;
- }
- frame = bufs[buf];
- frame->Unlock( frame );
-
- /* Always use DSLF_READ to preserve system memory copy */
- if (frame->Lock( frame, DSLF_WRITE | DSLF_READ,
- &ptr, &pitch ) != DFB_OK)
- return VO_FALSE;
- dst = ptr;
-
- if ((mpi->width == pitch) ||
- (mpi->flags & (MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_ACCEPT_WIDTH))) {
-
- mpi->planes[0] = dst;
- mpi->width = in_width;
- mpi->stride[0] = pitch;
-
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- if (mpi->num_planes > 2) {
- mpi->stride[1] = mpi->stride[2] = pitch / 2;
-
- if (mpi->flags & MP_IMGFLAG_SWAPPED) {
- /* I420 */
- mpi->planes[1] = dst + buf_height * pitch;
- mpi->planes[2] = mpi->planes[1] + buf_height * pitch / 4;
- } else {
- /* YV12 */
- mpi->planes[2] = dst + buf_height * pitch;
- mpi->planes[1] = mpi->planes[2] + buf_height * pitch / 4;
- }
- } else {
- /* NV12/NV21 */
- mpi->stride[1] = pitch;
- mpi->planes[1] = dst + buf_height * pitch;
- }
- }
-
- mpi->flags |= MP_IMGFLAG_DIRECT;
- mpi->priv = (void *) buf;
- current_buf = buf;
-
- return VO_TRUE;
- }
-
- frame->Unlock( frame );
-
- return VO_FALSE;
-}
-
-
-
-static uint32_t
-draw_image( mp_image_t *mpi )
-{
- if (mpi->flags & MP_IMGFLAG_DIRECT) {
- current_buf = (int) mpi->priv;
- return VO_TRUE;
- }
- if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
- return VO_TRUE;
-
- if (mpi->flags & MP_IMGFLAG_PLANAR)
- return draw_slice( mpi->planes, mpi->stride,
- mpi->w, mpi->h, 0, 0 );
- else {
- void *dst;
- int pitch;
-
- if (frame->Lock( frame, DSLF_WRITE, &dst, &pitch ) != DFB_OK)
- return VO_FALSE;
- memcpy_pic( dst, mpi->planes[0],
- mpi->w * (mpi->bpp / 8), mpi->h,
- pitch, mpi->stride[0] );
- frame->Unlock( frame );
-
- return VO_TRUE;
- }
-}
-
-static int
-set_equalizer( const char *data, int value )
-{
- DFBResult res;
- DFBColorAdjustment ca;
- float factor = (float) 0xffff / 200.0;
-
- ca.flags = DCAF_NONE;
-
- if (!strcasecmp( data, "brightness" )) {
- ca.flags |= DCAF_BRIGHTNESS;
- ca.brightness = value * factor + 0x8000;
- }
- if (!strcasecmp( data, "contrast" )) {
- ca.flags |= DCAF_CONTRAST;
- ca.contrast = value * factor + 0x8000;
- }
- if (!strcasecmp( data, "hue" )) {
- ca.flags |= DCAF_HUE;
- ca.hue = value * factor + 0x8000;
- }
- if (!strcasecmp( data, "saturation" )) {
- ca.flags |= DCAF_SATURATION;
- ca.saturation = value * factor + 0x8000;
- }
-
- /* Prefer CRTC2 over BES */
- if (use_crtc2)
- res = crtc2->SetColorAdjustment( crtc2, &ca );
- else if (use_crtc1)
- res = crtc1->SetColorAdjustment( crtc1, &ca );
- else
- res = bes->SetColorAdjustment( bes, &ca );
-
- if (res != DFB_OK)
- return VO_FALSE;
-
- return VO_TRUE;
-}
-
-static int
-get_equalizer( const char *data, int *value )
-{
- DFBResult res;
- DFBColorAdjustment ca;
- float factor = 200.0 / (float) 0xffff;
-
- /* Prefer CRTC2 over BES */
- if (use_crtc2)
- res = crtc2->GetColorAdjustment( crtc2, &ca );
- else if (use_crtc1)
- res = crtc1->GetColorAdjustment( crtc1, &ca );
- else
- res = bes->GetColorAdjustment( bes, &ca );
-
- if (res != DFB_OK)
- return VO_FALSE;
-
- if (!strcasecmp( data, "brightness" ) &&
- (ca.flags & DCAF_BRIGHTNESS))
- *value = (ca.brightness - 0x8000) * factor;
- if (!strcasecmp( data, "contrast" ) &&
- (ca.flags & DCAF_CONTRAST))
- *value = (ca.contrast - 0x8000) * factor;
- if (!strcasecmp( data, "hue" ) &&
- (ca.flags & DCAF_HUE))
- *value = (ca.hue - 0x8000) * factor;
- if (!strcasecmp( data, "saturation" ) &&
- (ca.flags & DCAF_SATURATION))
- *value = (ca.saturation - 0x8000) * factor;
-
- return VO_TRUE;
-}
-
-static int
-control( uint32_t request, void *data)
-{
- switch (request) {
- case VOCTRL_QUERY_FORMAT:
- return query_format( *((uint32_t *) data) );
-
- case VOCTRL_GET_IMAGE:
- return get_image( data );
-
- case VOCTRL_DRAW_IMAGE:
- return draw_image( data );
-
- case VOCTRL_SET_EQUALIZER:
- {
- struct voctrl_set_equalizer_args *args = data;
- return set_equalizer(args->name, args->value);
- }
- case VOCTRL_GET_EQUALIZER:
- {
- struct voctrl_get_equalizer_args *args = data;
- return get_equalizer(args->name, args->valueptr);
- }
- }
-
- return VO_NOTIMPL;
-}
-
-static void
-check_events( void )
-{
- DFBInputEvent event;
-
- if (!buffer)
- return;
-
- if (buffer->GetEvent( buffer, DFB_EVENT( &event )) == DFB_OK) {
- if (event.type == DIET_KEYPRESS) {
- switch (event.key_symbol) {
- case DIKS_ESCAPE:
- mplayer_put_key( KEY_ESC );
- break;
- case DIKS_PAGE_UP:
- mplayer_put_key( KEY_PAGE_UP );
- break;
- case DIKS_PAGE_DOWN:
- mplayer_put_key( KEY_PAGE_DOWN );
- break;
- case DIKS_CURSOR_UP:
- mplayer_put_key( KEY_UP );
- break;
- case DIKS_CURSOR_DOWN:
- mplayer_put_key( KEY_DOWN );
- break;
- case DIKS_CURSOR_LEFT:
- mplayer_put_key( KEY_LEFT );
- break;
- case DIKS_CURSOR_RIGHT:
- mplayer_put_key( KEY_RIGHT );
- break;
- case DIKS_INSERT:
- mplayer_put_key( KEY_INSERT );
- break;
- case DIKS_DELETE:
- mplayer_put_key( KEY_DELETE );
- break;
- case DIKS_HOME:
- mplayer_put_key( KEY_HOME );
- break;
- case DIKS_END:
- mplayer_put_key( KEY_END );
- break;
-
- case DIKS_POWER:
- mplayer_put_key( KEY_POWER );
- break;
- case DIKS_MENU:
- mplayer_put_key( KEY_MENU );
- break;
- case DIKS_PLAY:
- mplayer_put_key( KEY_PLAY );
- break;
- case DIKS_STOP:
- mplayer_put_key( KEY_STOP );
- break;
- case DIKS_PAUSE:
- mplayer_put_key( KEY_PAUSE );
- break;
- case DIKS_PLAYPAUSE:
- mplayer_put_key( KEY_PLAYPAUSE );
- break;
- case DIKS_FORWARD:
- mplayer_put_key( KEY_FORWARD );
- break;
- case DIKS_NEXT:
- mplayer_put_key( KEY_NEXT );
- break;
- case DIKS_REWIND:
- mplayer_put_key( KEY_REWIND );
- break;
- case DIKS_PREVIOUS:
- mplayer_put_key( KEY_PREV );
- break;
- case DIKS_VOLUME_UP:
- mplayer_put_key( KEY_VOLUME_UP );
- break;
- case DIKS_VOLUME_DOWN:
- mplayer_put_key( KEY_VOLUME_DOWN );
- break;
- case DIKS_MUTE:
- mplayer_put_key( KEY_MUTE );
- break;
-
- default:
- mplayer_put_key( event.key_symbol );
- }
- }
- }
-
- /*
- * empty buffer, because of repeating
- * keyboard repeat is faster than key handling and this causes problems during seek
- * temporary workabout. should be solved in the future
- */
- buffer->Reset( buffer );
-}
diff --git a/libvo/vo_dga.c b/libvo/vo_dga.c
deleted file mode 100644
index 001d112e8f..0000000000
--- a/libvo/vo_dga.c
+++ /dev/null
@@ -1,999 +0,0 @@
-/*
- * X11 DGA Interface
- *
- * Copyright (C) 2001 Andreas Ackermann <acki@acki-netz.de>
- * Sourceforge username: acki2
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include "config.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-#include "aspect.h"
-#include "x11_common.h"
-#include "fastmemcpy.h"
-#include "mp_msg.h"
-
-#include <X11/Xlib.h>
-#include <X11/extensions/Xxf86dga.h>
-
-#ifdef CONFIG_XF86VM
-#include <X11/extensions/xf86vmode.h>
-#endif
-
-static const vo_info_t info = {
-#ifdef CONFIG_DGA2
- "DGA ( Direct Graphic Access V2.0 )",
-#else
-#ifdef CONFIG_XF86VM
- "DGA ( Direct Graphic Access V1.0+XF86VidModeExt. )",
-#else
- "DGA ( Direct Graphic Access V1.0 )",
-#endif
-#endif
- "dga",
- "Andreas Ackermann <acki@acki-netz.de>",
- ""
-};
-
-const LIBVO_EXTERN(dga)
-//------------------------------------------------------------------
-//#define BITSPP (vo_dga_modes[vo_dga_active_mode].vdm_bitspp)
-//#define BYTESPP (vo_dga_modes[vo_dga_active_mode].vdm_bytespp)
-#define VO_DGA_INVALID_RES 100000
-#define HW_MODE (vo_dga_modes[vo_dga_hw_mode])
-#define SRC_MODE (vo_dga_modes[vo_dga_src_mode])
-struct vd_modes
-{
- int vdm_mplayer_depth;
- int vdm_supported;
- int vdm_depth;
- int vdm_bitspp;
- int vdm_bytespp;
- int vdm_rmask;
- int vdm_gmask;
- int vdm_bmask;
- int vdm_hw_mode;
-};
-
-//------------------------------------------------------------------
-
-static struct vd_modes vo_dga_modes[] = {
- // these entries describe HW modes
- // however, we use the same entries to tell mplayer what we support
- // so the last two values describe, which HW mode to use and which conversion
- // function to use for a mode that is not supported by HW
-
- {0, 0, 0, 0, 0, 0, 0, 0, 0,},
- {15, 0, 15, 16, 2, 0x7c00, 0x03e0, 0x001f, 2,},
- {16, 0, 16, 16, 2, 0xf800, 0x07e0, 0x001f, 2,},
- {24, 0, 24, 24, 3, 0xff0000, 0x00ff00, 0x0000ff, 4},
- {32, 0, 24, 32, 4, 0x00ff0000, 0x0000ff00, 0x000000ff, 4}
-};
-
-static int vo_dga_mode_num =
- sizeof(vo_dga_modes) / sizeof(struct vd_modes);
-
-// enable a HW mode (by description)
-static int vd_EnableMode(int depth, int bitspp,
- int rmask, int gmask, int bmask)
-{
- int i;
-
- for (i = 1; i < vo_dga_mode_num; i++)
- {
- if (vo_dga_modes[i].vdm_depth == depth &&
- vo_dga_modes[i].vdm_bitspp == bitspp &&
- vo_dga_modes[i].vdm_rmask == rmask &&
- vo_dga_modes[i].vdm_gmask == gmask &&
- vo_dga_modes[i].vdm_bmask == bmask)
- {
- vo_dga_modes[i].vdm_supported = 1;
- vo_dga_modes[i].vdm_hw_mode = i;
- return i;
- }
- }
- return 0;
-}
-
-static int vd_ModeEqual(int depth, int bitspp,
- int rmask, int gmask, int bmask, int index)
-{
- return (vo_dga_modes[index].vdm_depth == depth &&
- vo_dga_modes[index].vdm_bitspp == bitspp &&
- vo_dga_modes[index].vdm_rmask == rmask &&
- vo_dga_modes[index].vdm_gmask == gmask &&
- vo_dga_modes[index].vdm_bmask == bmask) ? 1 : 0;
-}
-
-
-// enable a HW mode (mplayer_depth decides which)
-static int vd_ValidateMode(int mplayer_depth)
-{
- int i;
-
- if (mplayer_depth == 0)
- return 0;
- for (i = 1; i < vo_dga_mode_num; i++)
- {
- if (vo_dga_modes[i].vdm_mplayer_depth == mplayer_depth)
- {
- vo_dga_modes[i].vdm_supported = 1;
- vo_dga_modes[i].vdm_hw_mode = i;
- return i;
- }
- }
- return 0;
-}
-
-// do we support this mode? (not important whether native or conversion)
-static int vd_ModeValid(int mplayer_depth)
-{
- int i;
-
- if (mplayer_depth == 0)
- return 0;
- for (i = 1; i < vo_dga_mode_num; i++)
- {
- if (vo_dga_modes[i].vdm_mplayer_depth == mplayer_depth &&
- vo_dga_modes[i].vdm_supported != 0)
- {
- return i;
- }
- }
- return 0;
-}
-
-static char *vd_GetModeString(int index)
-{
-
-#define VO_DGA_MAX_STRING_LEN 100
- static char stringbuf[VO_DGA_MAX_STRING_LEN];
-
- stringbuf[VO_DGA_MAX_STRING_LEN - 1] = 0;
- snprintf(stringbuf, VO_DGA_MAX_STRING_LEN - 2,
- "depth=%d, bpp=%d, r=%06x, g=%06x, b=%06x, %s (-bpp %d)",
- vo_dga_modes[index].vdm_depth,
- vo_dga_modes[index].vdm_bitspp,
- vo_dga_modes[index].vdm_rmask,
- vo_dga_modes[index].vdm_gmask,
- vo_dga_modes[index].vdm_bmask,
- vo_dga_modes[index].
- vdm_supported ? "native" : "not supported",
- vo_dga_modes[index].vdm_mplayer_depth);
- return stringbuf;
-}
-
-//-----------------------------------------------------------------
-
-#if defined(CONFIG_XF86VM) && !defined(CONFIG_DGA2)
-static XF86VidModeModeInfo **vo_dga_vidmodes = NULL;
-#endif
-
-
-static int vo_dga_src_format;
-static int vo_dga_width; // bytes per line in framebuffer
-static int vo_dga_vp_width; // visible pixels per line in
-
- // framebuffer
-static int vo_dga_vp_height; // visible lines in framebuffer
-static int vo_dga_is_running = 0;
-static int vo_dga_src_width; // width of video in pixels
-static int vo_dga_src_height; // height of video in pixels
-static int vo_dga_src_offset = 0; // offset in src
-static int vo_dga_vp_offset = 0; // offset in dest
-static int vo_dga_bytes_per_line; // bytes per line to copy
-static int vo_dga_vp_skip; // dto. for dest
-static int vo_dga_lines; // num of lines to copy
-static int vo_dga_hw_mode = 0; // index in mode list that is actually
-
- // used by framebuffer
-static int vo_dga_src_mode = 0; // index in mode list that is used by
-
- // codec
-static int vo_dga_XServer_mode = 0; // index in mode list for resolution
-
-#ifdef CONFIG_DGA2
-static XDGAMode *vo_modelines;
-static int vo_modecount;
-#endif
-
-#define MAX_NR_VIDEO_BUFFERS 3
-
-#define CURRENT_VIDEO_BUFFER \
- (vo_dga_video_buffer[vo_dga_current_video_buffer])
-
-static int vo_dga_nr_video_buffers; // Total number of frame buffers.
-static int vo_dga_current_video_buffer; // Buffer available for rendering.
-
-static struct video_buffer
-{
- int y;
- uint8_t *data;
-} vo_dga_video_buffer[MAX_NR_VIDEO_BUFFERS];
-
-/* saved src and dst dimensions for SwScaler */
-static unsigned int scale_srcW = 0,
- scale_dstW = 0, scale_srcH = 0, scale_dstH = 0;
-
-//---------------------------------------------------------
-
-static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src,
- unsigned char *srca, int stride)
-{
-
- char *d;
- unsigned int offset;
- int buffer_stride;
-
- offset = vo_dga_width * y0 + x0;
- buffer_stride = vo_dga_width;
- d = CURRENT_VIDEO_BUFFER.data + vo_dga_vp_offset;
-
- switch (HW_MODE.vdm_mplayer_depth)
- {
-
- case 32:
- vo_draw_alpha_rgb32(w, h, src, srca, stride, d + 4 * offset,
- 4 * buffer_stride);
- break;
- case 24:
- vo_draw_alpha_rgb24(w, h, src, srca, stride, d + 3 * offset,
- 3 * buffer_stride);
- break;
- case 15:
- vo_draw_alpha_rgb15(w, h, src, srca, stride, d + 2 * offset,
- 2 * buffer_stride);
- break;
- case 16:
- vo_draw_alpha_rgb16(w, h, src, srca, stride, d + 2 * offset,
- 2 * buffer_stride);
- break;
- }
-}
-
-
-//---------------------------------------------------------
-
-
-
-
-// quick & dirty - for debugging only
-#if 0
-static void fillblock(char *strt, int yoff, int lines, int val)
-{
- char *i;
-
- for (i = strt + yoff * vo_dga_width * HW_MODE.vdm_bytespp;
- i < strt + (lines + yoff) * vo_dga_width * HW_MODE.vdm_bytespp;)
- {
- *i++ = val;
- }
-}
-#endif
-
-//---------------------------------------------------------
-
-static int draw_frame(uint8_t * src[])
-{
-
- int numlines = vo_dga_lines;
-
- char *s, *d;
-
- s = *src;
- d = CURRENT_VIDEO_BUFFER.data + vo_dga_vp_offset;
-
- mem2agpcpy_pic(d, s,
- vo_dga_bytes_per_line,
- numlines,
- vo_dga_bytes_per_line + vo_dga_vp_skip,
- vo_dga_bytes_per_line);
-
- // DBG-COde
-
-#if 0
- d = CURRENT_VIDEO_BUFFER.data + vo_dga_vp_offset;
- fillblock(d, 0, 10, 0x800000ff);
- fillblock(d, 10, 10, 0x8000ff00);
- fillblock(d, 20, 10, 0x80ff0000);
- fillblock(d, 30, 10, 0xff0000ff);
- fillblock(d, 40, 10, 0x800000ff);
- fillblock(d, 50, 10, 0x0f0000ff);
-#endif
- return 0;
-}
-
-//---------------------------------------------------------
-
-static void check_events(void)
-{
- vo_x11_check_events(mDisplay);
-}
-
-//---------------------------------------------------------
-
-#include "sub/sub.h"
-
-static void draw_osd(void)
-{
- vo_draw_text(vo_dga_src_width, vo_dga_src_height, draw_alpha);
-}
-
-static void switch_video_buffers(void)
-{
- vo_dga_current_video_buffer =
- (vo_dga_current_video_buffer + 1) % vo_dga_nr_video_buffers;
-}
-
-static void flip_page(void)
-{
- if (1 < vo_dga_nr_video_buffers)
- {
-#ifdef CONFIG_DGA2
- XDGASetViewport(mDisplay, mScreen,
- 0, CURRENT_VIDEO_BUFFER.y, XDGAFlipRetrace);
-#else
- XF86DGASetViewPort(mDisplay, mScreen, 0, CURRENT_VIDEO_BUFFER.y);
-#endif
- switch_video_buffers();
- }
-}
-
-//---------------------------------------------------------
-
-static int draw_slice(uint8_t * src[], int stride[],
- int w, int h, int x, int y)
-{
- return 0;
-};
-
-//---------------------------------------------------------
-
-static int query_format(uint32_t format)
-{
-
- if ((format & IMGFMT_BGR_MASK) == IMGFMT_BGR &&
- vd_ModeValid(format & 0xff))
- {
- return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD;
- }
-
- return 0;
-}
-
-//---------------------------------------------------------
-
-static void uninit(void)
-{
-
-#ifdef CONFIG_DGA2
- XDGADevice *dgadevice;
-#endif
-
- if (!vo_config_count)
- return;
-
- if (vo_dga_is_running)
- {
- vo_dga_is_running = 0;
- mp_msg(MSGT_VO, MSGL_V, "vo_dga: in uninit\n");
- if (vo_grabpointer)
- XUngrabPointer(mDisplay, CurrentTime);
- XUngrabKeyboard(mDisplay, CurrentTime);
-#ifdef CONFIG_DGA2
- XDGACloseFramebuffer(mDisplay, mScreen);
- dgadevice = XDGASetMode(mDisplay, mScreen, 0);
- if (dgadevice != NULL)
- {
- XFree(dgadevice);
- }
-#else
- XF86DGADirectVideo(mDisplay, mScreen, 0);
- // first disable DirectVideo and then switch mode back!
-#ifdef CONFIG_XF86VM
- if (vo_dga_vidmodes != NULL)
- {
- int screen;
-
- screen = XDefaultScreen(mDisplay);
- mp_msg(MSGT_VO, MSGL_V,
- "vo_dga: VidModeExt: Switching back..\n");
- // seems some graphics adaptors need this more than once ...
- XF86VidModeSwitchToMode(mDisplay, screen, vo_dga_vidmodes[0]);
- XF86VidModeSwitchToMode(mDisplay, screen, vo_dga_vidmodes[0]);
- XF86VidModeSwitchToMode(mDisplay, screen, vo_dga_vidmodes[0]);
- XF86VidModeSwitchToMode(mDisplay, screen, vo_dga_vidmodes[0]);
- XFree(vo_dga_vidmodes);
- }
-#endif
-#endif
- }
- vo_x11_uninit();
-}
-
-
-//----------------------------------------------------------
-// TODO: check for larger maxy value
-// (useful for double buffering!!!)
-
-static int check_res(int num, int x, int y, int bpp,
- int new_x, int new_y, int new_vbi, int new_maxy,
- int *old_x, int *old_y, int *old_vbi, int *old_maxy)
-{
-
- mp_msg(MSGT_VO, MSGL_V,
- "vo_dga: (%3d) Trying %4d x %4d @ %3d Hz @ depth %2d ..", num,
- new_x, new_y, new_vbi, bpp);
- mp_msg(MSGT_VO, MSGL_V, "(old: %dx%d@%d).", *old_x, *old_y, *old_vbi);
- if ((new_x >= x) && (new_y >= y) && (
- // prefer a better resolution either in X or in Y
- // as long as the other dimension is at least the same
- //
- // hmm ... MAYBE it would be more clever to focus on the
- // x-resolution; I had 712x400 and 640x480 and the movie
- // was 640x360; 640x480 would be the 'right thing' here
- // but since 712x400 was queried first I got this one.
- // I think there should be a cmd-line switch to let the
- // user choose the mode he likes ... (acki2)
- (((new_x < *old_x) &&
- !(new_y > *old_y)) ||
- ((new_y < *old_y) &&
- !(new_x > *old_x)))
- // but if we get an identical resolution choose
- // the one with the lower refreshrate (saves bandwidth !!!)
- // as long as it's above 50 Hz (acki2 on 30/3/2001)
- ||
- (((new_x == *old_x) &&
- (new_y == *old_y) &&
- ((new_vbi >= *old_vbi
- && *old_vbi < 50)
- || (*old_vbi >= 50
- && new_vbi < *old_vbi
- && new_vbi >= 50))) ||
- // if everything is equal, then use the mode with the lower
- // stride
- ((new_x == *old_x) &&
- (new_y == *old_y) &&
- (new_vbi == *old_vbi) &&
- (new_maxy > *old_maxy)))))
- {
- *old_x = new_x;
- *old_y = new_y;
- *old_maxy = new_maxy;
- *old_vbi = new_vbi;
- mp_msg(MSGT_VO, MSGL_V, ".ok!!\n");
- return 1;
- } else
- {
- mp_msg(MSGT_VO, MSGL_V, ".no\n");
- return 0;
- }
-}
-
-
-
-//---------------------------------------------------------
-
-static void init_video_buffers(uint8_t * buffer_base,
- int view_port_height,
- int bytes_per_scanline,
- int max_view_port_y,
- int use_multiple_buffers)
-{
- int bytes_per_buffer = view_port_height * bytes_per_scanline;
- int i;
-
- if (use_multiple_buffers)
- vo_dga_nr_video_buffers = max_view_port_y / view_port_height;
- else
- vo_dga_nr_video_buffers = 1;
-
- if (vo_dga_nr_video_buffers > MAX_NR_VIDEO_BUFFERS)
- vo_dga_nr_video_buffers = MAX_NR_VIDEO_BUFFERS;
- if (vo_dga_nr_video_buffers <= 0)
- vo_dga_nr_video_buffers = 1;
-
- vo_dga_current_video_buffer = 0;
-
- for (i = 0; i < vo_dga_nr_video_buffers; i++)
- {
- vo_dga_video_buffer[i].y = i * view_port_height;
- vo_dga_video_buffer[i].data = buffer_base + i * bytes_per_buffer;
-
- // Clear video buffer.
- memset(vo_dga_video_buffer[i].data, 0, bytes_per_buffer);
- }
-}
-
-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)
-{
-
- int x_off, y_off;
- int wanted_width, wanted_height;
-
- static unsigned char *vo_dga_base;
- static int prev_width, prev_height;
-
-#ifdef CONFIG_DGA2
- // needed to change DGA video mode
- int mX = VO_DGA_INVALID_RES, mY = VO_DGA_INVALID_RES, mVBI =
- 100000, mMaxY = 0, i, j = 0;
- int dga_modenum;
- XDGAMode *modeline;
- XDGADevice *dgadevice;
-#else
-#ifdef CONFIG_XF86VM
- unsigned int vm_event, vm_error;
- unsigned int vm_ver, vm_rev;
- int i, j = 0, have_vm = 0;
- int mX = VO_DGA_INVALID_RES, mY = VO_DGA_INVALID_RES, mVBI =
- 100000, mMaxY = 0, dga_modenum;
-#endif
- int bank, ram;
-#endif
-
- vo_dga_src_format = format;
-
- wanted_width = d_width;
- wanted_height = d_height;
-
- if (!wanted_height)
- wanted_height = height;
- if (!wanted_width)
- wanted_width = width;
-
- if (!vo_dbpp)
- {
- if ((format & IMGFMT_BGR_MASK) == IMGFMT_BGR)
- {
- vo_dga_src_mode = vd_ModeValid(format & 0xff);
- }
- } else
- {
- vo_dga_src_mode = vd_ModeValid(vo_dbpp);
- }
- vo_dga_hw_mode = SRC_MODE.vdm_hw_mode;
-
- if (!vo_dga_src_mode)
- {
- mp_msg(MSGT_VO, MSGL_ERR, "vo_dga: unsupported video format!\n");
- return 1;
- }
-
- vo_dga_vp_width = vo_screenwidth;
- vo_dga_vp_height = vo_screenheight;
-
- mp_msg(MSGT_VO, MSGL_V, "vo_dga: XServer res: %dx%d\n",
- vo_dga_vp_width, vo_dga_vp_height);
-
-// choose a suitable mode ...
-
-#ifdef CONFIG_DGA2
-// Code to change the video mode added by Michael Graffam
-// mgraffam@idsi.net
-
- mp_msg(MSGT_VO, MSGL_V, "vo_dga: vo_modelines=%p, vo_modecount=%d\n",
- vo_modelines, vo_modecount);
-
- if (vo_modelines == NULL)
- {
- mp_msg(MSGT_VO, MSGL_ERR, "vo_dga: can't get modelines\n");
- return 1;
- }
-
- mp_msg(MSGT_VO, MSGL_INFO,
- "vo_dga: DGA 2.0 available :-) Can switch resolution AND depth!\n");
- for (i = 0; i < vo_modecount; i++)
- {
- if (vd_ModeEqual(vo_modelines[i].depth,
- vo_modelines[i].bitsPerPixel,
- vo_modelines[i].redMask,
- vo_modelines[i].greenMask,
- vo_modelines[i].blueMask, vo_dga_hw_mode))
- {
-
- mp_msg(MSGT_VO, MSGL_V, "maxy: %4d, depth: %2d, %4dx%4d, ",
- vo_modelines[i].maxViewportY, vo_modelines[i].depth,
- vo_modelines[i].imageWidth,
- vo_modelines[i].imageHeight);
- if (check_res
- (i, wanted_width, wanted_height, vo_modelines[i].depth,
- vo_modelines[i].viewportWidth,
- vo_modelines[i].viewportHeight,
- (unsigned) vo_modelines[i].verticalRefresh,
- vo_modelines[i].maxViewportY, &mX, &mY, &mVBI, &mMaxY))
- j = i;
- }
- }
- mp_msg(MSGT_VO, MSGL_INFO,
- "vo_dga: Selected hardware mode %4d x %4d @ %3d Hz @ depth %2d, bitspp %2d.\n",
- mX, mY, mVBI, HW_MODE.vdm_depth, HW_MODE.vdm_bitspp);
- mp_msg(MSGT_VO, MSGL_INFO,
- "vo_dga: Video parameters by codec: %3d x %3d, depth %2d, bitspp %2d.\n",
- width, height, SRC_MODE.vdm_depth, SRC_MODE.vdm_bitspp);
- vo_dga_vp_width = mX;
- vo_dga_vp_height = mY;
-
- if ((flags & VOFLAG_SWSCALE) || (flags & VOFLAG_FULLSCREEN))
- { /* -zoom or -fs */
- scale_dstW = (d_width + 7) & ~7;
- scale_dstH = d_height;
- scale_srcW = width;
- scale_srcH = height;
- aspect_save_screenres(mX, mY);
- aspect_save_orig(scale_srcW, scale_srcH);
- aspect_save_prescale(scale_dstW, scale_dstH);
- if (flags & VOFLAG_FULLSCREEN) /* -fs */
- aspect(&scale_dstW, &scale_dstH, A_ZOOM);
- else if (flags & VOFLAG_SWSCALE) /* -fs */
- aspect(&scale_dstW, &scale_dstH, A_NOZOOM);
- mp_msg(MSGT_VO, MSGL_INFO,
- "vo_dga: Aspect corrected size for SwScaler: %4d x %4d.\n",
- scale_dstW, scale_dstH);
- /* XXX this is a hack, but I'm lazy ;-) :: atmos */
- width = scale_dstW;
- height = scale_dstH;
- }
-
- vo_dga_width = vo_modelines[j].bytesPerScanline / HW_MODE.vdm_bytespp;
- dga_modenum = vo_modelines[j].num;
- modeline = vo_modelines + j;
-
-#else
-
-#ifdef CONFIG_XF86VM
-
- mp_msg(MSGT_VO, MSGL_INFO,
- "vo_dga: DGA 1.0 compatibility code: Using XF86VidMode for mode switching!\n");
-
- if (XF86VidModeQueryExtension(mDisplay, &vm_event, &vm_error))
- {
- XF86VidModeQueryVersion(mDisplay, &vm_ver, &vm_rev);
- mp_msg(MSGT_VO, MSGL_INFO,
- "vo_dga: XF86VidMode Extension v%i.%i\n", vm_ver, vm_rev);
- have_vm = 1;
- } else
- {
- mp_msg(MSGT_VO, MSGL_ERR,
- "vo_dga: XF86VidMode Extension not available.\n");
- }
-
-#define GET_VREFRESH(dotclk, x, y)( (((dotclk)/(x))*1000)/(y) )
-
- if (have_vm)
- {
- int modecount;
-
- XF86VidModeGetAllModeLines(mDisplay, mScreen, &modecount,
- &vo_dga_vidmodes);
-
- if (vo_dga_vidmodes != NULL)
- {
- for (i = 0; i < modecount; i++)
- {
- if (check_res(i, wanted_width, wanted_height,
- vo_dga_modes[vo_dga_hw_mode].vdm_depth,
- vo_dga_vidmodes[i]->hdisplay,
- vo_dga_vidmodes[i]->vdisplay,
- GET_VREFRESH(vo_dga_vidmodes[i]->dotclock,
- vo_dga_vidmodes[i]->htotal,
- vo_dga_vidmodes[i]->vtotal),
- 0, &mX, &mY, &mVBI, &mMaxY))
- j = i;
- }
-
- mp_msg(MSGT_VO, MSGL_INFO,
- "vo_dga: Selected video mode %4d x %4d @ %3d Hz @ depth %2d, bitspp %2d, video %3d x %3d.\n",
- mX, mY, mVBI,
- vo_dga_modes[vo_dga_hw_mode].vdm_depth,
- vo_dga_modes[vo_dga_hw_mode].vdm_bitspp, width, height);
- } else
- {
- mp_msg(MSGT_VO, MSGL_INFO,
- "vo_dga: XF86VidMode returned no screens - using current resolution.\n");
- }
- dga_modenum = j;
- vo_dga_vp_width = mX;
- vo_dga_vp_height = mY;
- }
-
-#else
- mp_msg(MSGT_VO, MSGL_INFO,
- "vo_dga: Only have DGA 1.0 extension and no XF86VidMode :-(\n");
- mp_msg(MSGT_VO, MSGL_INFO,
- " Thus, resolution switching is NOT possible.\n");
-
-#endif
-#endif
-
- vo_dga_src_width = width;
- vo_dga_src_height = height;
-
- if (vo_dga_src_width > vo_dga_vp_width ||
- vo_dga_src_height > vo_dga_vp_height)
- {
- mp_msg(MSGT_VO, MSGL_ERR,
- "vo_dga: Sorry, video larger than viewport is not yet supported!\n");
- // ugly, do something nicer in the future ...
-#ifndef CONFIG_DGA2
-#ifdef CONFIG_XF86VM
- if (vo_dga_vidmodes)
- {
- XFree(vo_dga_vidmodes);
- vo_dga_vidmodes = NULL;
- }
-#endif
-#endif
- return 1;
- }
-
- if (vo_dga_vp_width == VO_DGA_INVALID_RES)
- {
- mp_msg(MSGT_VO, MSGL_ERR,
- "vo_dga: Something is wrong with your DGA. There doesn't seem to be a\n"
- " single suitable mode!\n"
- " Please file a bug report (see DOCS/HTML/en/bugreports.html)\n");
-#ifndef CONFIG_DGA2
-#ifdef CONFIG_XF86VM
- if (vo_dga_vidmodes)
- {
- XFree(vo_dga_vidmodes);
- vo_dga_vidmodes = NULL;
- }
-#endif
-#endif
- return 1;
- }
-// now let's start the DGA thing
-
- if (!vo_config_count || width != prev_width || height != prev_height)
- {
-#ifdef CONFIG_DGA2
-
- if (!XDGAOpenFramebuffer(mDisplay, mScreen))
- {
- mp_msg(MSGT_VO, MSGL_ERR,
- "vo_dga: Framebuffer mapping failed!!!\n");
- return 1;
- }
-
- dgadevice = XDGASetMode(mDisplay, mScreen, dga_modenum);
- XDGASync(mDisplay, mScreen);
-
- vo_dga_base = dgadevice->data;
- XFree(dgadevice);
-
- XDGASetViewport(mDisplay, mScreen, 0, 0, XDGAFlipRetrace);
-
-#else
-
-#ifdef CONFIG_XF86VM
- if (have_vm)
- {
- XF86VidModeLockModeSwitch(mDisplay, mScreen, 0);
- // Two calls are needed to switch modes on my ATI Rage 128. Why?
- // for riva128 one call is enough!
- XF86VidModeSwitchToMode(mDisplay, mScreen,
- vo_dga_vidmodes[dga_modenum]);
- XF86VidModeSwitchToMode(mDisplay, mScreen,
- vo_dga_vidmodes[dga_modenum]);
- }
-#endif
-
- XF86DGAGetViewPortSize(mDisplay, mScreen,
- &vo_dga_vp_width, &vo_dga_vp_height);
-
- XF86DGAGetVideo(mDisplay, mScreen,
- (char **) &vo_dga_base, &vo_dga_width, &bank,
- &ram);
-
- XF86DGADirectVideo(mDisplay, mScreen,
- XF86DGADirectGraphics | XF86DGADirectMouse |
- XF86DGADirectKeyb);
-
- XF86DGASetViewPort(mDisplay, mScreen, 0, 0);
-
-#endif
- }
- // do some more checkings here ...
-
- mp_msg(MSGT_VO, MSGL_V,
- "vo_dga: bytes/line: %d, screen res: %dx%d, depth: %d, base: %p, bpp: %d\n",
- vo_dga_width, vo_dga_vp_width, vo_dga_vp_height,
- HW_MODE.vdm_bytespp, vo_dga_base, HW_MODE.vdm_bitspp);
-
- x_off = (vo_dga_vp_width - vo_dga_src_width) >> 1;
- y_off = (vo_dga_vp_height - vo_dga_src_height) >> 1;
-
- vo_dga_bytes_per_line = vo_dga_src_width * HW_MODE.vdm_bytespp;
- vo_dga_lines = vo_dga_src_height;
-
- vo_dga_src_offset = 0;
- vo_dga_vp_offset =
- (y_off * vo_dga_width + x_off) * HW_MODE.vdm_bytespp;
-
- vo_dga_vp_skip = (vo_dga_width - vo_dga_src_width) * HW_MODE.vdm_bytespp; // todo
-
- mp_msg(MSGT_VO, MSGL_V, "vo_dga: vp_off=%d, vp_skip=%d, bpl=%d\n",
- vo_dga_vp_offset, vo_dga_vp_skip, vo_dga_bytes_per_line);
-
-
- XGrabKeyboard(mDisplay, DefaultRootWindow(mDisplay), True,
- GrabModeAsync, GrabModeAsync, CurrentTime);
- if (vo_grabpointer)
- XGrabPointer(mDisplay, DefaultRootWindow(mDisplay), True,
- ButtonPressMask, GrabModeAsync, GrabModeAsync,
- None, None, CurrentTime);
-
- if (!vo_config_count || width != prev_width || height != prev_height)
- {
- init_video_buffers(vo_dga_base,
- vo_dga_vp_height,
- vo_dga_width * HW_MODE.vdm_bytespp,
-#ifdef CONFIG_DGA2
- modeline->maxViewportY,
-#else
- vo_dga_vp_height,
-#endif
- vo_doublebuffering);
- prev_width = width;
- prev_height = height;
- }
-
- mp_msg(MSGT_VO, MSGL_V, "vo_dga: Using %d frame buffer%s.\n",
- vo_dga_nr_video_buffers,
- vo_dga_nr_video_buffers == 1 ? "" : "s");
-
- vo_dga_is_running = 1;
- return 0;
-}
-
-static int dga_depths_init = 0;
-
-static int preinit(const char *arg)
-{
- if (arg)
- {
- mp_msg(MSGT_VO, MSGL_INFO, "vo_dga: Unknown subdevice: %s\n", arg);
- return ENOSYS;
- }
-
- if (!vo_init())
- return -1; // Can't open X11
-
- if (dga_depths_init == 0)
- { // FIXME!?
- int i;
-
- vo_dga_XServer_mode = vd_ValidateMode(vo_depthonscreen);
-
- if (vo_dga_XServer_mode == 0)
- {
-#ifndef CONFIG_DGA2
- mp_msg(MSGT_VO, MSGL_ERR,
- "vo_dga: Your X-Server is not running in a ");
- mp_msg(MSGT_VO, MSGL_ERR,
- "resolution supported by DGA driver!\n");
-#endif
- } //else{
- // mp_msg(MSGT_VO, MSGL_V, "vo_dga: X running at: %s\n",
- // vd_GetModeString(vo_dga_XServer_mode));
- //}
-
-#ifdef CONFIG_DGA2
- vo_modelines = XDGAQueryModes(mDisplay, mScreen, &vo_modecount);
- if (vo_modelines)
- {
- for (i = 0; i < vo_modecount; i++)
- {
- mp_msg(MSGT_VO, MSGL_V,
- "vo_dga: (%03d) depth=%d, bpp=%d, r=%08lx, g=%08lx, b=%08lx, %d x %d\n",
- i, vo_modelines[i].depth,
- vo_modelines[i].bitsPerPixel,
- vo_modelines[i].redMask, vo_modelines[i].greenMask,
- vo_modelines[i].blueMask,
- vo_modelines[i].viewportWidth,
- vo_modelines[i].viewportHeight);
- vd_EnableMode(vo_modelines[i].depth,
- vo_modelines[i].bitsPerPixel,
- vo_modelines[i].redMask,
- vo_modelines[i].greenMask,
- vo_modelines[i].blueMask);
- }
- }
-#endif
- dga_depths_init = 1;
-
- if (!vo_dga_modes[1].vdm_supported
- && vo_dga_modes[2].vdm_supported)
- {
- vo_dga_modes[1].vdm_supported = 1;
- }
-
- if (!vo_dga_modes[3].vdm_supported
- && vo_dga_modes[4].vdm_supported)
- {
- vo_dga_modes[3].vdm_supported = 1;
- }
-
- for (i = 1; i < vo_dga_mode_num; i++)
- {
- mp_msg(MSGT_VO, MSGL_INFO, "vo_dga: Mode: %s",
- vd_GetModeString(i));
- if (vo_dbpp && vo_dbpp != vo_dga_modes[i].vdm_mplayer_depth)
- {
- vo_dga_modes[i].vdm_supported = 0;
- mp_msg(MSGT_VO, MSGL_INFO, " ...disabled by -bpp %d",
- vo_dbpp);
- }
- mp_msg(MSGT_VO, MSGL_INFO, "\n");
- }
- }
-
- return 0;
-}
-
-static uint32_t get_image(mp_image_t * mpi)
-{
- if (!IMGFMT_IS_BGR(mpi->imgfmt) ||
- (IMGFMT_BGR_DEPTH(mpi->imgfmt) !=
- vo_dga_modes[vo_dga_hw_mode].vdm_mplayer_depth)
- || (mpi->type == MP_IMGTYPE_STATIC && vo_dga_nr_video_buffers > 1)
- || (mpi->type == MP_IMGTYPE_IP && vo_dga_nr_video_buffers < 2)
- || (mpi->type == MP_IMGTYPE_IPB))
- return VO_FALSE;
-
- if ((mpi->flags & MP_IMGFLAG_ACCEPT_STRIDE) ||
- (mpi->flags & MP_IMGFLAG_ACCEPT_WIDTH &&
- ((vo_dga_bytes_per_line + vo_dga_vp_skip) % (mpi->bpp / 8)) == 0)
- || (mpi->width * (mpi->bpp / 8) ==
- (vo_dga_bytes_per_line + vo_dga_vp_skip)))
- {
-
- mpi->planes[0] = CURRENT_VIDEO_BUFFER.data + vo_dga_vp_offset;
- mpi->stride[0] = vo_dga_bytes_per_line + vo_dga_vp_skip;
- mpi->width =
- (vo_dga_bytes_per_line + vo_dga_vp_skip) / (mpi->bpp / 8);
- mpi->flags |= MP_IMGFLAG_DIRECT;
- return VO_TRUE;
- }
-
- return VO_FALSE;
-}
-
-static int control(uint32_t request, void *data)
-{
- switch (request)
- {
- case VOCTRL_GET_IMAGE:
- return get_image(data);
- case VOCTRL_QUERY_FORMAT:
- return query_format(*((uint32_t *) data));
- }
- return VO_NOTIMPL;
-}
-
-//---------------------------------------------------------
diff --git a/libvo/vo_dxr3.c b/libvo/vo_dxr3.c
deleted file mode 100644
index 8f7b471306..0000000000
--- a/libvo/vo_dxr3.c
+++ /dev/null
@@ -1,1321 +0,0 @@
-/*
- * DXR3/H+ video output
- *
- * Copyright (C) 2002-2003 David Holm <david@realityrift.com>
- *
- * 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 <linux/em8300.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/select.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <time.h>
-#include <math.h>
-
-#include "config.h"
-#include "mp_msg.h"
-#include "fastmemcpy.h"
-
-#include "video_out.h"
-#include "video_out_internal.h"
-#include "aspect.h"
-#include "spuenc.h"
-#include "sub/sub.h"
-#ifdef CONFIG_X11
-#include "x11_common.h"
-#endif
-#include "libavutil/avstring.h"
-
-#define SPU_SUPPORT
-
-static const vo_info_t info =
-{
- "DXR3/H+ video out",
- "dxr3",
- "David Holm <dholm@iname.com>",
- ""
-};
-const LIBVO_EXTERN (dxr3)
-
-/* Resolutions and positions */
-static int v_width, v_height;
-static int s_width, s_height;
-static int osd_w, osd_h;
-static int img_format;
-
-/* Configuration values
- * Don't declare these static, they
- * should be accessible from the gui.
- */
-int dxr3_prebuf = 0;
-int dxr3_newsync = 0;
-int dxr3_overlay = 0;
-int dxr3_device_num = 0;
-int dxr3_norm = 0;
-
-#define MAX_STR_SIZE 80 /* length for the static strings */
-
-/* File descriptors */
-static int fd_control = -1;
-static int fd_video = -1;
-static int fd_spu = -1;
-static char fdv_name[MAX_STR_SIZE];
-static char fds_name[MAX_STR_SIZE];
-
-#ifdef SPU_SUPPORT
-/* on screen display/subpics */
-static char *osdpicbuf;
-static int osdpicbuf_w;
-static int osdpicbuf_h;
-static int disposd;
-static encodedata *spued;
-static encodedata *spubuf;
-#endif
-
-
-/* Static variable used in ioctl's */
-static int ioval;
-static int prev_pts;
-static int pts_offset;
-static int old_vmode = -1;
-
-
-/* Begin overlay.h */
-/*
- Simple analog overlay API for DXR3/H+ linux driver.
-
- Henrik Johansson
-*/
-
-
-/* Pattern drawing callback used by the calibration functions.
- The function is expected to:
- Clear the entire screen.
- Fill the screen with color bgcol (0xRRGGBB)
- Draw a rectangle at (xpos,ypos) of size (width,height) in fgcol (0xRRGGBB)
-*/
-
-typedef int (*pattern_drawer_cb)(int fgcol, int bgcol,
- int xpos, int ypos, int width, int height, void *arg);
-
-struct coeff {
- float k,m;
-};
-
-typedef struct {
- int dev;
-
- int xres, yres,depth;
- int xoffset,yoffset,xcorr;
- int jitter;
- int stability;
- int keycolor;
- struct coeff colcal_upper[3];
- struct coeff colcal_lower[3];
- float color_interval;
-
- pattern_drawer_cb draw_pattern;
- void *dp_arg;
-} overlay_t;
-
-
-static overlay_t *overlay_init(int dev);
-static int overlay_release(overlay_t *);
-
-static int overlay_read_state(overlay_t *o, char *path);
-static int overlay_write_state(overlay_t *o, char *path);
-
-static int overlay_set_screen(overlay_t *o, int xres, int yres, int depth);
-static int overlay_set_mode(overlay_t *o, int mode);
-static int overlay_set_attribute(overlay_t *o, int attribute, int val);
-static int overlay_set_keycolor(overlay_t *o, int color);
-static int overlay_set_window(overlay_t *o, int xpos,int ypos,int width,int height);
-static int overlay_set_bcs(overlay_t *o, int brightness, int contrast, int saturation);
-
-static int overlay_autocalibrate(overlay_t *o, pattern_drawer_cb pd, void *arg);
-static void overlay_update_params(overlay_t *o);
-static int overlay_signalmode(overlay_t *o, int mode);
-/* End overlay.h */
-
-
-#ifdef CONFIG_X11
-#define KEY_COLOR 0x80a040
-static XWindowAttributes xwin_attribs;
-static overlay_t *overlay_data;
-#endif
-
-
-/* Functions for working with the em8300's internal clock */
-/* End of internal clock functions */
-
-static int control(uint32_t request, void *data)
-{
- switch (request) {
- case VOCTRL_SET_SPU_PALETTE:
- if (ioctl(fd_spu, EM8300_IOCTL_SPU_SETPALETTE, data) < 0) {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] Unable to load new SPU palette!\n");
- return VO_ERROR;
- }
- return VO_TRUE;
-#ifdef CONFIG_X11
- case VOCTRL_ONTOP:
- vo_x11_ontop();
- return VO_TRUE;
- case VOCTRL_FULLSCREEN:
- if (dxr3_overlay) {
- vo_x11_fullscreen();
- overlay_signalmode(overlay_data,
- vo_fs ? EM8300_OVERLAY_SIGNAL_ONLY :
- EM8300_OVERLAY_SIGNAL_WITH_VGA);
- return VO_TRUE;
- }
- return VO_FALSE;
-#endif
- case VOCTRL_RESUME:
- if (dxr3_newsync) {
- ioctl(fd_control, EM8300_IOCTL_SCR_GET, &ioval);
- pts_offset = vo_pts - (ioval << 1);
- if (pts_offset < 0) {
- pts_offset = 0;
- }
- }
-
- if (dxr3_prebuf) {
- ioval = EM8300_PLAYMODE_PLAY;
- if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Unable to set playmode!\n");
- }
- }
- return VO_TRUE;
- case VOCTRL_PAUSE:
- if (dxr3_prebuf) {
- ioval = EM8300_PLAYMODE_PAUSED;
- if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Unable to set playmode!\n");
- }
- }
- return VO_TRUE;
- case VOCTRL_RESET:
- if (dxr3_prebuf) {
- close(fd_video);
- fd_video = open(fdv_name, O_WRONLY);
- close(fd_spu);
- fd_spu = open(fds_name, O_WRONLY);
- fsync(fd_video);
- fsync(fd_spu);
- }
- return VO_TRUE;
- case VOCTRL_QUERY_FORMAT:
- {
- uint32_t flag = 0;
-
- if (*((uint32_t*)data) != IMGFMT_MPEGPES)
- return 0;
-
- flag = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_SPU;
- if (dxr3_prebuf)
- flag |= VFCAP_TIMER;
- return flag;
- }
- case VOCTRL_SET_EQUALIZER:
- {
- em8300_bcs_t bcs;
- struct voctrl_set_equalizer_args *args = data;
-
- if (ioctl(fd_control, EM8300_IOCTL_GETBCS, &bcs) < 0)
- return VO_FALSE;
- if (!strcasecmp(args->name, "brightness"))
- bcs.brightness = (args->value+100)*5;
- else if (!strcasecmp(args->name, "contrast"))
- bcs.contrast = (args->value+100)*5;
- else if (!strcasecmp(args->name, "saturation"))
- bcs.saturation = (args->value+100)*5;
- else return VO_FALSE;
-
- if (ioctl(fd_control, EM8300_IOCTL_SETBCS, &bcs) < 0)
- return VO_FALSE;
- return VO_TRUE;
- }
- case VOCTRL_GET_EQUALIZER:
- {
- em8300_bcs_t bcs;
- struct voctrl_get_equalizer_args *args = data;
-
- if (ioctl(fd_control, EM8300_IOCTL_GETBCS, &bcs) < 0)
- return VO_FALSE;
-
- if (!strcasecmp(args->name, "brightness"))
- *args->valueptr = (bcs.brightness/5)-100;
- else if (!strcasecmp(args->name, "contrast"))
- *args->valueptr = (bcs.contrast/5)-100;
- else if (!strcasecmp(args->name, "saturation"))
- *args->valueptr = (bcs.saturation/5)-100;
- else return VO_FALSE;
-
- return VO_TRUE;
- }
- }
- return VO_NOTIMPL;
-}
-
-void calculate_cvals(unsigned long mask, int *shift, int *prec)
-{
- /* Calculate shift and precision */
- (*shift) = 0;
- (*prec) = 0;
-
- while (!(mask & 0x1)) {
- (*shift)++;
- mask >>= 1;
- }
-
- while (mask & 0x1) {
- (*prec)++;
- mask >>= 1;
- }
-}
-
-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)
-{
- int tmp1, tmp2, size;
- em8300_register_t reg;
-
- /* Softzoom turned on, downscale */
- /* This activates the subpicture processor, you can safely disable this and still send */
- /* broken subpics to the em8300, if it's enabled and you send broken subpics you will end */
- /* up in a lockup */
- ioval = EM8300_SPUMODE_ON;
- if (ioctl(fd_control, EM8300_IOCTL_SET_SPUMODE, &ioval) < 0) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Unable to set subpicture mode!\n");
- uninit();
- return -1;
- }
-
- /* Set the playmode to play (just in case another app has set it to something else) */
- ioval = EM8300_PLAYMODE_PLAY;
- if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Unable to set playmode!\n");
- }
-
- /* Start em8300 prebuffering and sync engine */
- reg.microcode_register = 1;
- reg.reg = 0;
- reg.val = MVCOMMAND_SYNC;
- ioctl(fd_control, EM8300_IOCTL_WRITEREG, &reg);
-
- /* Clean buffer by syncing it */
- ioval = EM8300_SUBDEVICE_VIDEO;
- ioctl(fd_control, EM8300_IOCTL_FLUSH, &ioval);
- ioval = EM8300_SUBDEVICE_AUDIO;
- ioctl(fd_control, EM8300_IOCTL_FLUSH, &ioval);
-
- /* Sync the video device to make sure the buffers are empty
- * and set the playback speed to normal. Also reset the
- * em8300 internal clock.
- */
- fsync(fd_video);
- ioval = 0x900;
- ioctl(fd_control, EM8300_IOCTL_SCR_SETSPEED, &ioval);
-
- /* Store some variables statically that we need later in another scope */
- img_format = format;
- v_width = width;
- v_height = height;
-
- /* Set monitor_aspect to avoid jitter */
- monitor_aspect = (float) width / (float) height;
-
- if (ioctl(fd_control, EM8300_IOCTL_GET_VIDEOMODE, &old_vmode) < 0) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Unable to get TV norm!\n");
- old_vmode = -1;
- }
-
- /* adjust TV norm */
- if (dxr3_norm != 0) {
- if (dxr3_norm == 5) {
- ioval = EM8300_VIDEOMODE_NTSC;
- } else if (dxr3_norm == 4) {
- ioval = EM8300_VIDEOMODE_PAL60;
- } else if (dxr3_norm == 3) {
- ioval = EM8300_VIDEOMODE_PAL;
- } else if (dxr3_norm == 2) {
- if (vo_fps > 28) {
- ioval = EM8300_VIDEOMODE_PAL60;
- } else {
- ioval = EM8300_VIDEOMODE_PAL;
- }
-
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Auto-selected TV norm by framerate: ");
- ioval == EM8300_VIDEOMODE_PAL60 ? mp_msg(MSGT_VO,MSGL_INFO, "PAL-60") : mp_msg(MSGT_VO,MSGL_INFO, "PAL");
- printf(".\n");
- } else {
- if (vo_fps > 28) {
- ioval = EM8300_VIDEOMODE_NTSC;
- } else {
- ioval = EM8300_VIDEOMODE_PAL;
- }
-
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Auto-selected TV norm by framerate: ");
- ioval == EM8300_VIDEOMODE_NTSC ? mp_msg(MSGT_VO,MSGL_INFO, "NTSC") : mp_msg(MSGT_VO,MSGL_INFO, "PAL");
- printf(".\n");
- }
-
- if (old_vmode != ioval) {
- if (ioctl(fd_control, EM8300_IOCTL_SET_VIDEOMODE, &ioval) < 0) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Unable to set TV norm!\n");
- }
- }
- }
-
-
- /* libavcodec requires a width and height that is x|16 */
- aspect_save_orig(width, height);
- aspect_save_prescale(d_width, d_height);
- ioctl(fd_control, EM8300_IOCTL_GET_VIDEOMODE, &ioval);
- if (ioval == EM8300_VIDEOMODE_NTSC) {
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Setting up for NTSC.\n");
- aspect_save_screenres(352, 240);
- } else {
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Setting up for PAL/SECAM.\n");
- aspect_save_screenres(352, 288);
- }
- aspect(&s_width, &s_height, A_ZOOM);
- s_width -= s_width % 16;
- s_height -= s_height % 16;
-
- /* Try to figure out whether to use widescreen output or not */
- /* Anamorphic widescreen modes makes this a pain in the ass */
- tmp1 = abs(d_height - ((d_width / 4) * 3));
- tmp2 = abs(d_height - (int) (d_width / 2.35));
- if (tmp1 < tmp2) {
- ioval = EM8300_ASPECTRATIO_4_3;
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Setting aspect ratio to 4:3.\n");
- } else {
- ioval = EM8300_ASPECTRATIO_16_9;
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Setting aspect ratio to 16:9.\n");
- }
- ioctl(fd_control, EM8300_IOCTL_SET_ASPECTRATIO, &ioval);
-
-#ifdef SPU_SUPPORT
-#ifdef CONFIG_FREETYPE
- if (ioval == EM8300_ASPECTRATIO_16_9) {
- s_width *= d_height*1.78/s_height*(d_width*1.0/d_height)/2.35;
- } else {
- s_width *= 0.84;
- }
- //printf("VO: [dxr3] sw/sh:dw/dh ->%i,%i,%i,%i\n",s_width,s_height,d_width,d_height);
-#else
- s_width*=2;
- s_height*=2;
-#endif
-
- osdpicbuf = calloc( 1,s_width * s_height);
- if (osdpicbuf == NULL) {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] out of memory\n");
- return -1;
- }
- spued = malloc(sizeof(encodedata));
- if (spued == NULL) {
- free( osdpicbuf );
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] out of memory\n");
- return -1;
- }
- spubuf = malloc(sizeof(encodedata));
- if (spubuf == NULL) {
- free( osdpicbuf );
- free( spued );
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] out of memory\n");
- return -1;
- }
- osd_w = s_width;
- osd_h = s_height;
- osdpicbuf_w = s_width;
- osdpicbuf_h = s_height;
-
- spubuf->count=0;
- pixbuf_encode_rle( 0,0,osdpicbuf_w,osdpicbuf_h - 1,osdpicbuf,osdpicbuf_w,spubuf );
-
-#endif
-
-#ifdef CONFIG_X11
- if (dxr3_overlay) {
- XVisualInfo vinfo;
- XSetWindowAttributes xswa;
- XSizeHints hint;
- unsigned long xswamask;
- Colormap cmap;
- XColor key_color;
- Window junkwindow;
- Screen *scr;
- int depth, red_shift, red_prec, green_shift, green_prec, blue_shift, blue_prec, acq_color;
- em8300_overlay_screen_t ovlscr;
- em8300_attribute_t ovlattr;
-
- vo_dx = (vo_screenwidth - d_width) / 2;
- vo_dy = (vo_screenheight - d_height) / 2;
- vo_dwidth = d_width;
- vo_dheight = d_height;
- XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &xwin_attribs);
- depth = xwin_attribs.depth;
- if (depth != 15 && depth != 16 && depth != 24 && depth != 32) {
- depth = 24;
- }
- XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo);
- vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy,
- d_width, d_height, flags,
- CopyFromParent, "Viewing Window", title);
- xswa.background_pixel = KEY_COLOR;
- xswa.border_pixel = 0;
- xswamask = CWBackPixel | CWBorderPixel;
- XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa);
-
- /* Start setting up overlay */
- XGetWindowAttributes(mDisplay, mRootWin, &xwin_attribs);
- overlay_set_screen(overlay_data, xwin_attribs.width, xwin_attribs.height, xwin_attribs.depth);
- overlay_read_state(overlay_data, NULL);
-
- /* Allocate keycolor */
- cmap = vo_x11_create_colormap(&vinfo);
- calculate_cvals(vinfo.red_mask, &red_shift, &red_prec);
- calculate_cvals(vinfo.green_mask, &green_shift, &green_prec);
- calculate_cvals(vinfo.blue_mask, &blue_shift, &blue_prec);
-
- key_color.red = ((KEY_COLOR >> 16) & 0xff) * 256;
- key_color.green = ((KEY_COLOR >> 8) & 0xff) * 256;
- key_color.blue = (KEY_COLOR & 0xff) * 256;
- key_color.pixel = (((key_color.red >> (16 - red_prec)) << red_shift) +
- ((key_color.green >> (16 - green_prec)) << green_shift) +
- ((key_color.blue >> (16 - blue_prec)) << blue_shift));
- key_color.flags = DoRed | DoGreen | DoBlue;
- if (!XAllocColor(mDisplay, cmap, &key_color)) {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] Unable to allocate keycolor!\n");
- return -1;
- }
-
- acq_color = ((key_color.red / 256) << 16) | ((key_color.green / 256) << 8) | key_color.blue;
- if (key_color.pixel != KEY_COLOR) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Unable to allocate exact keycolor, using closest match (0x%lx).\n", key_color.pixel);
- }
-
- /* Set keycolor and activate overlay */
- XSetWindowBackground(mDisplay, vo_window, key_color.pixel);
- XClearWindow(mDisplay, vo_window);
- overlay_set_keycolor(overlay_data, key_color.pixel);
- overlay_set_mode(overlay_data, EM8300_OVERLAY_MODE_OVERLAY);
- overlay_set_mode(overlay_data, EM8300_OVERLAY_MODE_RECTANGLE);
- }
-#endif
-
- return 0;
-}
-
-static void draw_alpha(int x, int y, int w, int h, unsigned char* src, unsigned char *srca, int srcstride)
-{
-#ifdef SPU_SUPPORT
- unsigned char *buf = &osdpicbuf[(y * osdpicbuf_w) + x];
- int by = 0;
- register int lx, ly;
- register int stride = 0;
-
- for (ly = 0; ly < h - 1; ly++)
- {
- for(lx = 0; lx < w; lx++ )
- if ( ( srca[stride + lx] )&&( src[stride + lx] >= 128 ) ) buf[by + lx] = 3;
- by+=osdpicbuf_w;
- stride+=srcstride;
- }
- pixbuf_encode_rle(x, y, osdpicbuf_w, osdpicbuf_h - 1, osdpicbuf, osdpicbuf_w, spued);
-#endif
-}
-
-extern mp_osd_obj_t* vo_osd_list;
-
-static void draw_osd(void)
-{
-#ifdef SPU_SUPPORT
- static int cleared = 0;
- int changed = 0;
-
- if ((disposd % 15) == 0)
- {
- {
- mp_osd_obj_t* obj = vo_osd_list;
- vo_update_osd( osd_w,osd_h );
- while( obj )
- {
- if ( obj->flags & OSDFLAG_VISIBLE ) { changed=1; break; }
- obj=obj->next;
- }
- }
- if ( changed )
- {
- vo_draw_text(osd_w, osd_h, draw_alpha);
- memset(osdpicbuf, 0, s_width * s_height);
- cleared=0;
- }
- else
- {
- if ( !cleared )
- {
- spued->count=spubuf->count;
- fast_memcpy( spued->data,spubuf->data,DATASIZE );
- cleared=1;
- }
- }
-
-
- /* could stand some check here to see if the subpic hasn't changed
- * as if it hasn't and we re-send it it will "blink" as the last one
- * is turned off, and the new one (same one) is turned on
- */
-/* Subpics are not stable yet =(
- expect lockups if you enable */
- write(fd_spu, spued->data, spued->count);
- }
- disposd++;
-#endif
-}
-
-
-static int draw_frame(uint8_t * src[])
-{
- vo_mpegpes_t *p = (vo_mpegpes_t *) src[0];
-
-#ifdef SPU_SUPPORT
- if (p->id == 0x20) {
- write(fd_spu, p->data, p->size);
- } else
-#endif
- write(fd_video, p->data, p->size);
- return 0;
-}
-
-static void flip_page(void)
-{
-#ifdef CONFIG_X11
- if (dxr3_overlay) {
- int event = vo_x11_check_events(mDisplay);
- if (event & VO_EVENT_RESIZE) {
- Window junkwindow;
- XGetWindowAttributes(mDisplay, vo_window, &xwin_attribs);
- XTranslateCoordinates(mDisplay, vo_window, mRootWin, -xwin_attribs.border_width, -xwin_attribs.border_width, &xwin_attribs.x, &xwin_attribs.y, &junkwindow);
- overlay_set_window(overlay_data, xwin_attribs.x, xwin_attribs.y, xwin_attribs.width, xwin_attribs.height);
- }
- if (event & VO_EVENT_EXPOSE) {
- Window junkwindow;
- XSetWindowBackground(mDisplay, vo_window, KEY_COLOR);
- XClearWindow(mDisplay, vo_window);
- XGetWindowAttributes(mDisplay, vo_window, &xwin_attribs);
- XTranslateCoordinates(mDisplay, vo_window, mRootWin, -xwin_attribs.border_width, -xwin_attribs.border_width, &xwin_attribs.x, &xwin_attribs.y, &junkwindow);
- overlay_set_window(overlay_data, xwin_attribs.x, xwin_attribs.y, xwin_attribs.width, xwin_attribs.height);
- }
- }
-#endif
-
- if (dxr3_newsync) {
- ioctl(fd_control, EM8300_IOCTL_SCR_GET, &ioval);
- ioval <<= 1;
- if (vo_pts == 0) {
- ioval = 0;
- ioctl(fd_control, EM8300_IOCTL_SCR_SET, &ioval);
- pts_offset = 0;
- } else if ((vo_pts - pts_offset) < (ioval - 7200) || (vo_pts - pts_offset) > (ioval + 7200)) {
- ioval = (vo_pts + pts_offset) >> 1;
- ioctl(fd_control, EM8300_IOCTL_SCR_SET, &ioval);
- ioctl(fd_control, EM8300_IOCTL_SCR_GET, &ioval);
- pts_offset = vo_pts - (ioval << 1);
- if (pts_offset < 0) {
- pts_offset = 0;
- }
- }
- ioval = vo_pts + pts_offset;
- ioctl(fd_video, EM8300_IOCTL_SPU_SETPTS, &ioval);
- ioctl(fd_video, EM8300_IOCTL_VIDEO_SETPTS, &ioval);
- prev_pts = vo_pts;
- } else if (dxr3_prebuf) {
- ioctl(fd_spu, EM8300_IOCTL_SPU_SETPTS, &vo_pts);
- ioctl(fd_video, EM8300_IOCTL_VIDEO_SETPTS, &vo_pts);
- }
-}
-
-static int draw_slice(uint8_t *srcimg[], int stride[], int w, int h, int x0, int y0)
-{
- return -1;
-}
-
-static void uninit(void)
-{
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Uninitializing.\n");
-#ifdef CONFIG_X11
- if (dxr3_overlay) {
- overlay_set_mode(overlay_data, EM8300_OVERLAY_MODE_OFF);
- overlay_release(overlay_data);
-
- vo_x11_uninit();
- }
-#endif
- if (old_vmode != -1) {
- if (ioctl(fd_control, EM8300_IOCTL_SET_VIDEOMODE, &old_vmode) < 0) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed restoring TV norm!\n");
- }
- }
-
- if (fd_video != -1) {
- close(fd_video);
- }
- if (fd_spu != -1) {
- close(fd_spu);
- }
- if (fd_control != -1) {
- close(fd_control);
- }
-#ifdef SPU_SUPPORT
- free(osdpicbuf);
- free(spued);
-#endif
-}
-
-static void check_events(void)
-{
-}
-
-static int preinit(const char *arg)
-{
- char devname[MAX_STR_SIZE];
- int fdflags = O_WRONLY;
-
- /* Parse commandline */
- while (arg) {
- if (!strncmp("prebuf", arg, 6) && !dxr3_prebuf) {
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Enabling prebuffering.\n");
- dxr3_prebuf = 1;
- } else if (!strncmp("sync", arg, 4) && !dxr3_newsync) {
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Using new sync engine.\n");
- dxr3_newsync = 1;
- } else if (!strncmp("overlay", arg, 7) && !dxr3_overlay) {
-#ifdef CONFIG_X11
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Using overlay.\n");
- dxr3_overlay = 1;
-#else
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Error: Overlay requires compiling with X11 libs/headers installed.\n");
-#endif
- } else if (!strncmp("norm=", arg, 5)) {
- arg += 5;
- // dxr3_norm is 0 (-> don't change norm) by default
- // but maybe someone changes this in the future
-
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Will set TV norm to: ");
-
- if (*arg == '5') {
- dxr3_norm = 5;
- mp_msg(MSGT_VO,MSGL_INFO, "NTSC");
- } else if (*arg == '4') {
- dxr3_norm = 4;
- mp_msg(MSGT_VO,MSGL_INFO, "PAL-60");
- } else if (*arg == '3') {
- dxr3_norm = 3;
- mp_msg(MSGT_VO,MSGL_INFO, "PAL");
- } else if (*arg == '2') {
- dxr3_norm = 2;
- mp_tmsg(MSGT_VO,MSGL_INFO, "auto-adjust to movie framerate (PAL/PAL-60)");
- } else if (*arg == '1') {
- dxr3_norm = 1;
- mp_tmsg(MSGT_VO,MSGL_INFO, "auto-adjust to movie framerate (PAL/NTSC)");
- } else if (*arg == '0') {
- dxr3_norm = 0;
- mp_tmsg(MSGT_VO,MSGL_INFO, "Use current norm.");
- } else {
- dxr3_norm = 0;
- mp_tmsg(MSGT_VO,MSGL_INFO, "Unknown norm supplied. Use current norm.");
- }
-
- mp_msg(MSGT_VO,MSGL_INFO, ".\n");
- } else if (arg[0] == '0' || arg[0] == '1' || arg[0] == '2' || arg[0] == '3') {
- dxr3_device_num = arg[0];
- }
-
- arg = strchr(arg, ':');
- if (arg) {
- arg++;
- }
- }
-
-
- /* Open the control interface */
- sprintf(devname, "/dev/em8300-%d", dxr3_device_num);
- fd_control = open(devname, fdflags);
- if (fd_control < 1) {
- /* Fall back to old naming scheme */
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Error opening %s for writing, trying /dev/em8300 instead.\n", devname);
- sprintf(devname, "/dev/em8300");
- fd_control = open(devname, fdflags);
- if (fd_control < 1) {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] Error opening /dev/em8300 for writing as well!\nBailing out.\n");
- return -1;
- }
- } else {
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Opened: %s.\n", devname);
- }
-
- /* Open the video interface */
- sprintf(devname, "/dev/em8300_mv-%d", dxr3_device_num);
- fd_video = open(devname, fdflags);
- if (fd_video < 0) {
- /* Fall back to old naming scheme */
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Error opening %s for writing, trying /dev/em8300_mv instead.\n", devname);
- sprintf(devname, "/dev/em8300_mv");
- fd_video = open(devname, fdflags);
- if (fd_video < 0) {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] Error opening /dev/em8300_mv for writing as well!\nBailing out.\n");
- uninit();
- return -1;
- }
- } else {
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Opened: %s.\n", devname);
- }
- strcpy(fdv_name, devname);
-
- /* Open the subpicture interface */
- sprintf(devname, "/dev/em8300_sp-%d", dxr3_device_num);
- fd_spu = open(devname, fdflags);
- if (fd_spu < 0) {
- /* Fall back to old naming scheme */
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Error opening %s for writing, trying /dev/em8300_sp instead.\n", devname);
- sprintf(devname, "/dev/em8300_sp");
- fd_spu = open(devname, fdflags);
- if (fd_spu < 0) {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] Error opening /dev/em8300_sp for writing as well!\nBailing out.\n");
- uninit();
- return -1;
- }
- } else {
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Opened: %s.\n", devname);
- }
- strcpy(fds_name, devname);
-
-#ifdef CONFIG_X11
- if (dxr3_overlay) {
-
- /* Fucked up hack needed to enable overlay.
- * Will be removed as soon as I figure out
- * how to make it work like it should
- */
- Display *dpy;
- overlay_t *ov;
- XWindowAttributes attribs;
-
- dpy = XOpenDisplay(NULL);
- if (!dpy) {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] Unable to open display during overlay hack setup!\n");
- return -1;
- }
- XGetWindowAttributes(dpy, RootWindow(dpy, DefaultScreen(dpy)), &attribs);
- ov = overlay_init(fd_control);
- overlay_set_screen(ov, attribs.width, attribs.height, PlanesOfScreen(ScreenOfDisplay(dpy, 0)));
- overlay_read_state(ov, NULL);
- overlay_set_keycolor(ov, KEY_COLOR);
- overlay_set_mode(ov, EM8300_OVERLAY_MODE_OVERLAY);
- overlay_set_mode(ov, EM8300_OVERLAY_MODE_RECTANGLE);
- overlay_release(ov);
- XCloseDisplay(dpy);
- /* End of fucked up hack */
-
- /* Initialize overlay and X11 */
- overlay_data = overlay_init(fd_control);
- if (!vo_init()) {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] Unable to init X11!\n");
- return -1;
- }
- }
-#endif
-
- if (dxr3_newsync) {
- ioctl(fd_control, EM8300_IOCTL_SCR_GET, &ioval);
- pts_offset = vo_pts - (ioval << 1);
- if (pts_offset < 0) {
- pts_offset = 0;
- }
- }
-
- return 0;
-}
-
-/* Begin overlay.c */
-static int update_parameters(overlay_t *o)
-{
- overlay_set_attribute(o, EM9010_ATTRIBUTE_XOFFSET, o->xoffset);
- overlay_set_attribute(o, EM9010_ATTRIBUTE_YOFFSET, o->yoffset);
- overlay_set_attribute(o, EM9010_ATTRIBUTE_XCORR, o->xcorr);
- overlay_set_attribute(o, EM9010_ATTRIBUTE_STABILITY, o->stability);
- overlay_set_attribute(o, EM9010_ATTRIBUTE_JITTER, o->jitter);
- return 0;
-}
-
-static int overlay_set_attribute(overlay_t *o, int attribute, int value)
-{
- em8300_attribute_t attr;
-
- attr.attribute = attribute;
- attr.value = value;
- if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_SET_ATTRIBUTE, &attr)==-1)
- {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed setting overlay attribute.\n");
- return -1;
- }
-
- return 0;
-}
-
-static overlay_t *overlay_init(int dev)
-{
- overlay_t *o;
-
- o = malloc(sizeof(overlay_t));
-
- if(!o)
- return NULL;
-
- memset(o,0,sizeof(overlay_t));
-
- o->dev = dev;
- o->xres = 1280; o->yres=1024; o->xcorr=1000;
- o->color_interval=10;
-
- return o;
-}
-
-static int overlay_release(overlay_t *o)
-{
- free(o);
- return 0;
-}
-#define TYPE_INT 1
-#define TYPE_XINT 2
-#define TYPE_COEFF 3
-#define TYPE_FLOAT 4
-
-struct lut_entry {
- char *name;
- int type;
- void *ptr;
-};
-
-static struct lut_entry *new_lookuptable(overlay_t *o)
-{
- struct lut_entry m[] = {
- {"xoffset", TYPE_INT, &o->xoffset},
- {"yoffset", TYPE_INT, &o->yoffset},
- {"xcorr", TYPE_INT, &o->xcorr},
- {"jitter", TYPE_INT, &o->jitter},
- {"stability", TYPE_INT, &o->stability},
- {"keycolor", TYPE_XINT, &o->keycolor},
- {"colcal_upper", TYPE_COEFF, &o->colcal_upper[0]},
- {"colcal_lower", TYPE_COEFF, &o->colcal_lower[0]},
- {"color_interval", TYPE_FLOAT, &o->color_interval},
- {0,0,0}
- },*p;
-
- p = malloc(sizeof(m));
- memcpy(p,m,sizeof(m));
- return p;
-}
-
-static int lookup_parameter(overlay_t *o, struct lut_entry *lut, char *name, void **ptr, int *type) {
- int i;
-
- for(i=0; lut[i].name; i++) {
- if(!strcmp(name,lut[i].name)) {
- *ptr = lut[i].ptr;
- *type = lut[i].type;
- return 1;
- }
- }
- return 0;
-}
-
-static int overlay_read_state(overlay_t *o, char *p)
-{
- char *a,*tok;
- char path[128],fname[128],tmp[128],line[256];
- FILE *fp;
- struct lut_entry *lut;
- void *ptr;
- int type;
- int j;
-
- if(!p) {
- av_strlcpy(fname, getenv("HOME"), sizeof( fname ));
- av_strlcat(fname,"/.overlay", sizeof( fname ));
- } else
- av_strlcpy(fname, p, sizeof( fname ));
-
- sprintf(tmp,"/res_%dx%dx%d",o->xres,o->yres,o->depth);
- av_strlcat(fname, tmp, sizeof( fname ));
-
- if(!(fp=fopen(fname,"r")))
- return -1;
-
- lut = new_lookuptable(o);
-
- while(!feof(fp)) {
- if(!fgets(line,256,fp))
- break;
- tok=strtok(line," ");
- if(lookup_parameter(o,lut,tok,&ptr,&type)) {
- tok=strtok(NULL," ");
- switch(type) {
- case TYPE_INT:
- sscanf(tok,"%d",(int *)ptr);
- break;
- case TYPE_XINT:
- sscanf(tok,"%x",(int *)ptr);
- break;
- case TYPE_FLOAT:
- sscanf(tok,"%f",(float *)ptr);
- break;
- case TYPE_COEFF:
- for(j=0;j<3;j++) {
- sscanf(tok,"%f",&((struct coeff *)ptr)[j].k);
- tok=strtok(NULL," ");
- sscanf(tok,"%f",&((struct coeff *)ptr)[j].m);
- tok=strtok(NULL," ");
- }
- break;
- }
-
- }
- }
-
- update_parameters(o);
-
- free(lut);
- fclose(fp);
- return 0;
-}
-
-static void overlay_update_params(overlay_t *o) {
- update_parameters(o);
-}
-
-static int overlay_write_state(overlay_t *o, char *p)
-{
- char *a;
- char path[128],fname[128],tmp[128];
- FILE *fp;
- char line[256],*tok;
- struct lut_entry *lut;
- int i,j;
-
- if(!p) {
- av_strlcpy(fname, getenv("HOME"), sizeof( fname ));
- av_strlcat(fname,"/.overlay", sizeof( fname ));
- } else
- av_strlcpy(fname, p, sizeof( fname ));
-
- if(access(fname, W_OK|X_OK|R_OK)) {
- if(mkdir(fname,0766))
- return -1;
- }
-
- sprintf(tmp,"/res_%dx%dx%d",o->xres,o->yres,o->depth);
- av_strlcat(fname, tmp, sizeof( fname ));
-
- if(!(fp=fopen(fname,"w")))
- return -1;
-
- lut = new_lookuptable(o);
-
- for(i=0; lut[i].name; i++) {
- fprintf(fp,"%s ",lut[i].name);
- switch(lut[i].type) {
- case TYPE_INT:
- fprintf(fp,"%d\n",*(int *)lut[i].ptr);
- break;
- case TYPE_XINT:
- fprintf(fp,"%06x\n",*(int *)lut[i].ptr);
- break;
- case TYPE_FLOAT:
- fprintf(fp,"%f\n",*(float *)lut[i].ptr);
- break;
- case TYPE_COEFF:
- for(j=0;j<3;j++)
- fprintf(fp,"%f %f ",((struct coeff *)lut[i].ptr)[j].k,
- ((struct coeff *)lut[i].ptr)[j].m);
- fprintf(fp,"\n");
- break;
- }
- }
-
- fclose(fp);
- return 0;
-}
-
-static int overlay_set_screen(overlay_t *o, int xres, int yres, int depth)
-{
- em8300_overlay_screen_t scr;
-
- o->xres = xres;
- o->yres = yres;
- o->depth = depth;
-
- scr.xsize = xres;
- scr.ysize = yres;
-
- if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_SETSCREEN, &scr)==-1)
- {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed setting overlay screen!\nExiting.\n");
- return -1;
- }
- return 0;
-}
-
-static int overlay_set_mode(overlay_t *o, int mode)
-{
- if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_SETMODE, &mode)==-1) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed enabling overlay!\nExiting.\n");
- return -1;
- }
- return 0;
-}
-
-static int overlay_set_window(overlay_t *o, int xpos,int ypos,int width,int height)
-{
- em8300_overlay_window_t win;
- win.xpos = xpos;
- win.ypos = ypos;
- win.width = width;
- win.height = height;
-
- if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_SETWINDOW, &win)==-1)
- {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed resizing overlay window!\n");
- return -1;
- }
- return 0;
-}
-
-static int overlay_set_bcs(overlay_t *o, int brightness, int contrast, int saturation)
-{
- em8300_bcs_t bcs;
- bcs.brightness = brightness;
- bcs.contrast = contrast;
- bcs.saturation = saturation;
-
- if (ioctl(o->dev, EM8300_IOCTL_GETBCS, &bcs)==-1)
- {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed setting overlay bcs!\n");
- return -1;
- }
- return 0;
-}
-
-static int col_interp(float x, struct coeff c)
-{
- float y;
- y = x*c.k + c.m;
- if(y > 255)
- y = 255;
- if(y < 0)
- y = 0;
- return rint(y);
-}
-
-static int overlay_set_keycolor(overlay_t *o, int color) {
- int r = (color & 0xff0000) >> 16;
- int g = (color & 0x00ff00) >> 8;
- int b = (color & 0x0000ff);
- float ru,gu,bu;
- float rl,gl,bl;
- int upper,lower;
-
- ru = r+o->color_interval;
- gu = g+o->color_interval;
- bu = b+o->color_interval;
-
- rl = r-o->color_interval;
- gl = g-o->color_interval;
- bl = b-o->color_interval;
-
- upper = (col_interp(ru, o->colcal_upper[0]) << 16) |
- (col_interp(gu, o->colcal_upper[1]) << 8) |
- (col_interp(bu, o->colcal_upper[2]));
-
- lower = (col_interp(rl, o->colcal_lower[0]) << 16) |
- (col_interp(gl, o->colcal_lower[1]) << 8) |
- (col_interp(bl, o->colcal_lower[2]));
-
- //printf("0x%06x 0x%06x\n",upper,lower);
- overlay_set_attribute(o,EM9010_ATTRIBUTE_KEYCOLOR_UPPER,upper);
- overlay_set_attribute(o,EM9010_ATTRIBUTE_KEYCOLOR_LOWER,lower);
- return 0;
-}
-
-static void least_sq_fit(int *x, int *y, int n, float *k, float *m)
-{
- float sx=0,sy=0,sxx=0,sxy=0;
- float delta,b;
- int i;
-
- for(i=0; i < n; i++) {
- sx=sx+x[i];
- sy=sy+y[i];
- sxx=sxx+x[i]*x[i];
- sxy=sxy+x[i]*y[i];
- }
-
- delta=sxx*n-sx*sx;
-
- *m=(sxx*sy-sx*sxy)/delta;
- *k=(sxy*n-sx*sy)/delta;
-}
-
-static int overlay_autocalibrate(overlay_t *o, pattern_drawer_cb pd, void *arg)
-{
- em8300_overlay_calibrate_t cal;
- em8300_overlay_window_t win;
- int x[256],r[256],g[256],b[256],n;
- float k,m;
-
- int i;
-
- o->draw_pattern=pd;
- o->dp_arg = arg;
-
- overlay_set_mode(o, EM8300_OVERLAY_MODE_OVERLAY);
- overlay_set_screen(o, o->xres, o->yres, o->depth);
-
- /* Calibrate Y-offset */
-
- o->draw_pattern(0x0000ff, 0, 0, 0, 355, 1, o->dp_arg);
-
- cal.cal_mode = EM8300_OVERLAY_CALMODE_YOFFSET;
- if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_CALIBRATE, &cal))
- {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed getting overlay Y-offset values!\nExiting.\n");
- return -1;
- }
- o->yoffset = cal.result;
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Yoffset: %d.\n",cal.result);
-
- /* Calibrate X-offset */
-
- o->draw_pattern(0x0000ff, 0, 0, 0, 2, 288, o->dp_arg);
-
- cal.cal_mode = EM8300_OVERLAY_CALMODE_XOFFSET;
- if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_CALIBRATE, &cal))
- {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed getting overlay X-offset values!\nExiting.\n");
- return -1;
- }
- o->xoffset = cal.result;
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Xoffset: %d.\n",cal.result);
-
- /* Calibrate X scale correction */
-
- o->draw_pattern(0x0000ff, 0, 355, 0, 2, 288, o->dp_arg);
-
- cal.cal_mode = EM8300_OVERLAY_CALMODE_XCORRECTION;
- if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_CALIBRATE, &cal))
- {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed getting overlay X scale correction!\nExiting.\n");
- return -1;
- }
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Xcorrection: %d.\n",cal.result);
- o->xcorr = cal.result;
-
- win.xpos = 10;
- win.ypos = 10;
- win.width = o->xres-20;
- win.height = o->yres-20;
- if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_SETWINDOW, &win)==-1) {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] Failed resizing overlay window!\n");
- exit(1);
- }
-
- /* Calibrate key color upper limit */
-
- for(i=128,n=0; i <= 0xff; i+=4) {
- o->draw_pattern(i | (i << 8) | (i << 16), 0,
- (o->xres-200)/2,0,200,o->yres,o->dp_arg);
-
- cal.arg = i;
- cal.arg2 = 1;
- cal.cal_mode = EM8300_OVERLAY_CALMODE_COLOR;
-
- if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_CALIBRATE, &cal))
- {
- return -1 ;
- }
-
- x[n] = i;
- r[n] = (cal.result>>16)&0xff;
- g[n] = (cal.result>>8)&0xff;
- b[n] = (cal.result)&0xff;
- n++;
- }
-
- least_sq_fit(x,r,n,&o->colcal_upper[0].k,&o->colcal_upper[0].m);
- least_sq_fit(x,g,n,&o->colcal_upper[1].k,&o->colcal_upper[1].m);
- least_sq_fit(x,b,n,&o->colcal_upper[2].k,&o->colcal_upper[2].m);
-
- /* Calibrate key color lower limit */
-
- for(i=128,n=0; i <= 0xff; i+=4) {
- o->draw_pattern(i | (i << 8) | (i << 16), 0xffffff,
- (o->xres-200)/2,0,200,o->yres, o->dp_arg);
-
- cal.arg = i;
- cal.arg2 = 2;
- cal.cal_mode = EM8300_OVERLAY_CALMODE_COLOR;
-
- if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_CALIBRATE, &cal))
- {
- return -1 ;
- }
- x[n] = i;
- r[n] = (cal.result>>16)&0xff;
- g[n] = (cal.result>>8)&0xff;
- b[n] = (cal.result)&0xff;
- n++;
- }
-
- least_sq_fit(x,r,n,&o->colcal_lower[0].k,&o->colcal_lower[0].m);
- least_sq_fit(x,g,n,&o->colcal_lower[1].k,&o->colcal_lower[1].m);
- least_sq_fit(x,b,n,&o->colcal_lower[2].k,&o->colcal_lower[2].m);
-
- overlay_set_mode(o, EM8300_OVERLAY_MODE_OFF);
-
- return 0;
-}
-
-
-static int overlay_signalmode(overlay_t *o, int mode) {
- if(ioctl(o->dev, EM8300_IOCTL_OVERLAY_SIGNALMODE, &mode) ==-1) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed to set signal mix!\n");
- return -1;
- }
- return 0;
-}
-/* End overlay.c */
diff --git a/libvo/vo_fbdev.c b/libvo/vo_fbdev.c
deleted file mode 100644
index 6d70cca0fe..0000000000
--- a/libvo/vo_fbdev.c
+++ /dev/null
@@ -1,1091 +0,0 @@
-/*
- * video driver for framebuffer device
- * copyright (C) 2001 Szabolcs Berecz <szabi@inf.elte.hu>
- *
- * Some idea and code borrowed from Chris Lawrence's ppmtofb-0.27
- * Some fixes and small improvements by Joey Parrish <joey@nicewarrior.org>
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <ctype.h>
-
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include <sys/kd.h>
-#include <linux/fb.h>
-#include <libavutil/common.h>
-
-#include "config.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-#include "fastmemcpy.h"
-#include "sub/sub.h"
-#include "geometry.h"
-#include "aspect.h"
-#include "mp_msg.h"
-
-static const vo_info_t info = {
- "Framebuffer Device",
- "fbdev",
- "Szabolcs Berecz <szabi@inf.elte.hu>",
- ""
-};
-
-LIBVO_EXTERN(fbdev)
-
-static signed int pre_init_err = -2;
-/******************************
- * fb.modes support *
- ******************************/
-
-static range_t *monitor_hfreq = NULL;
-static range_t *monitor_vfreq = NULL;
-static range_t *monitor_dotclock = NULL;
-
-typedef struct {
- char *name;
- uint32_t xres, yres, vxres, vyres, depth;
- uint32_t pixclock, left, right, upper, lower, hslen, vslen;
- uint32_t sync;
- uint32_t vmode;
-} fb_mode_t;
-
-#define MAX_NR_TOKEN 16
-
-#define MAX_LINE_LEN 1000
-
-#define RET_EOF -1
-#define RET_EOL -2
-
-static int validate_mode(fb_mode_t *m)
-{
- if (!m->xres) {
- mp_msg(MSGT_VO, MSGL_V, "needs geometry ");
- return 0;
- }
- if (!m->pixclock) {
- mp_msg(MSGT_VO, MSGL_V, "needs timings ");
- return 0;
- }
- return 1;
-}
-
-static FILE *fp;
-static int line_num = 0;
-static char *line;
-static char *token[MAX_NR_TOKEN];
-
-static int get_token(int num)
-{
- static int read_nextline = 1;
- static int line_pos;
- int i;
- char c;
-
- if (num >= MAX_NR_TOKEN) {
- mp_msg(MSGT_VO, MSGL_V, "get_token(): max >= MAX_NR_TOKEN!\n");
- goto out_eof;
- }
-
- if (read_nextline) {
- if (!fgets(line, MAX_LINE_LEN, fp))
- goto out_eof;
- line_pos = 0;
- ++line_num;
- read_nextline = 0;
- }
- for (i = 0; i < num; i++) {
- while (isspace(line[line_pos]))
- ++line_pos;
- if (line[line_pos] == '\0' || line[line_pos] == '#') {
- read_nextline = 1;
- goto out_eol;
- }
- token[i] = line + line_pos;
- c = line[line_pos];
- if (c == '"' || c == '\'') {
- token[i]++;
- while (line[++line_pos] != c && line[line_pos])
- /* NOTHING */;
- if (!line[line_pos])
- goto out_eol;
- line[line_pos] = ' ';
- } else {
- for (/* NOTHING */; !isspace(line[line_pos]) &&
- line[line_pos]; line_pos++)
- /* NOTHING */;
- }
- if (!line[line_pos]) {
- read_nextline = 1;
- if (i == num - 1)
- goto out_ok;
- goto out_eol;
- }
- line[line_pos++] = '\0';
- }
-out_ok:
- return i;
-out_eof:
- return RET_EOF;
-out_eol:
- return RET_EOL;
-}
-
-static fb_mode_t *fb_modes = NULL;
-static int nr_modes = 0;
-
-static int parse_fbmode_cfg(char *cfgfile)
-{
-#define CHECK_IN_MODE_DEF\
- if (!in_mode_def) {\
- mp_msg(MSGT_VO, MSGL_V, "'needs 'mode' first");\
- goto err_out_print_linenum;\
- }
- fb_mode_t *mode = NULL;
- char *endptr; // strtoul()...
- int in_mode_def = 0;
- int tmp, i;
-
- /* If called more than once, reuse parsed data */
- if (nr_modes)
- return nr_modes;
-
- mp_msg(MSGT_VO, MSGL_V, "Reading %s: ", cfgfile);
-
- if ((fp = fopen(cfgfile, "r")) == NULL) {
- mp_msg(MSGT_VO, MSGL_V, "can't open '%s': %s\n", cfgfile, strerror(errno));
- return -1;
- }
-
- 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;
- }
-
- /*
- * check if the cfgfile starts with 'mode'
- */
- while ((tmp = get_token(1)) == RET_EOL)
- /* NOTHING */;
- if (tmp == RET_EOF)
- goto out;
- if (!strcmp(token[0], "mode"))
- goto loop_enter;
- goto err_out_parse_error;
-
- while ((tmp = get_token(1)) != RET_EOF) {
- if (tmp == RET_EOL)
- continue;
- if (!strcmp(token[0], "mode")) {
- if (in_mode_def) {
- mp_msg(MSGT_VO, MSGL_V, "'endmode' required");
- goto err_out_print_linenum;
- }
- if (!validate_mode(mode))
- goto err_out_not_valid;
- loop_enter:
- 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));
- goto err_out;
- }
- mode = fb_modes + nr_modes;
- ++nr_modes;
- memset(mode, 0, sizeof(fb_mode_t));
-
- if (get_token(1) < 0)
- goto err_out_parse_error;
- for (i = 0; i < nr_modes - 1; i++) {
- if (!strcmp(token[0], fb_modes[i].name)) {
- mp_msg(MSGT_VO, MSGL_V, "mode name '%s' isn't unique", token[0]);
- goto err_out_print_linenum;
- }
- }
- if (!(mode->name = strdup(token[0]))) {
- mp_msg(MSGT_VO, MSGL_V, "can't strdup -> 'name': %s\n", strerror(errno));
- goto err_out;
- }
- in_mode_def = 1;
- } else if (!strcmp(token[0], "geometry")) {
- CHECK_IN_MODE_DEF;
- if (get_token(5) < 0)
- goto err_out_parse_error;
- mode->xres = strtoul(token[0], &endptr, 0);
- if (*endptr)
- goto err_out_parse_error;
- mode->yres = strtoul(token[1], &endptr, 0);
- if (*endptr)
- goto err_out_parse_error;
- mode->vxres = strtoul(token[2], &endptr, 0);
- if (*endptr)
- goto err_out_parse_error;
- mode->vyres = strtoul(token[3], &endptr, 0);
- if (*endptr)
- goto err_out_parse_error;
- mode->depth = strtoul(token[4], &endptr, 0);
- if (*endptr)
- goto err_out_parse_error;
- } else if (!strcmp(token[0], "timings")) {
- CHECK_IN_MODE_DEF;
- if (get_token(7) < 0)
- goto err_out_parse_error;
- mode->pixclock = strtoul(token[0], &endptr, 0);
- if (*endptr)
- goto err_out_parse_error;
- mode->left = strtoul(token[1], &endptr, 0);
- if (*endptr)
- goto err_out_parse_error;
- mode->right = strtoul(token[2], &endptr, 0);
- if (*endptr)
- goto err_out_parse_error;
- mode->upper = strtoul(token[3], &endptr, 0);
- if (*endptr)
- goto err_out_parse_error;
- mode->lower = strtoul(token[4], &endptr, 0);
- if (*endptr)
- goto err_out_parse_error;
- mode->hslen = strtoul(token[5], &endptr, 0);
- if (*endptr)
- goto err_out_parse_error;
- mode->vslen = strtoul(token[6], &endptr, 0);
- if (*endptr)
- goto err_out_parse_error;
- } else if (!strcmp(token[0], "endmode")) {
- CHECK_IN_MODE_DEF;
- in_mode_def = 0;
- } else if (!strcmp(token[0], "accel")) {
- CHECK_IN_MODE_DEF;
- if (get_token(1) < 0)
- goto err_out_parse_error;
- /*
- * it's only used for text acceleration
- * so we just ignore it.
- */
- } else if (!strcmp(token[0], "hsync")) {
- CHECK_IN_MODE_DEF;
- if (get_token(1) < 0)
- goto err_out_parse_error;
- if (!strcmp(token[0], "low"))
- mode->sync &= ~FB_SYNC_HOR_HIGH_ACT;
- else if (!strcmp(token[0], "high"))
- mode->sync |= FB_SYNC_HOR_HIGH_ACT;
- else
- goto err_out_parse_error;
- } else if (!strcmp(token[0], "vsync")) {
- CHECK_IN_MODE_DEF;
- if (get_token(1) < 0)
- goto err_out_parse_error;
- if (!strcmp(token[0], "low"))
- mode->sync &= ~FB_SYNC_VERT_HIGH_ACT;
- else if (!strcmp(token[0], "high"))
- mode->sync |= FB_SYNC_VERT_HIGH_ACT;
- else
- goto err_out_parse_error;
- } else if (!strcmp(token[0], "csync")) {
- CHECK_IN_MODE_DEF;
- if (get_token(1) < 0)
- goto err_out_parse_error;
- if (!strcmp(token[0], "low"))
- mode->sync &= ~FB_SYNC_COMP_HIGH_ACT;
- else if (!strcmp(token[0], "high"))
- mode->sync |= FB_SYNC_COMP_HIGH_ACT;
- else
- goto err_out_parse_error;
- } else if (!strcmp(token[0], "extsync")) {
- CHECK_IN_MODE_DEF;
- if (get_token(1) < 0)
- goto err_out_parse_error;
- if (!strcmp(token[0], "false"))
- mode->sync &= ~FB_SYNC_EXT;
- else if (!strcmp(token[0], "true"))
- mode->sync |= FB_SYNC_EXT;
- else
- goto err_out_parse_error;
- } else if (!strcmp(token[0], "laced")) {
- CHECK_IN_MODE_DEF;
- if (get_token(1) < 0)
- goto err_out_parse_error;
- if (!strcmp(token[0], "false"))
- mode->vmode = FB_VMODE_NONINTERLACED;
- else if (!strcmp(token[0], "true"))
- mode->vmode = FB_VMODE_INTERLACED;
- else
- goto err_out_parse_error;
- } else if (!strcmp(token[0], "double")) {
- CHECK_IN_MODE_DEF;
- if (get_token(1) < 0)
- goto err_out_parse_error;
- if (!strcmp(token[0], "false"))
- ;
- else if (!strcmp(token[0], "true"))
- mode->vmode = FB_VMODE_DOUBLE;
- else
- goto err_out_parse_error;
- } else
- goto err_out_parse_error;
- }
- if (!validate_mode(mode))
- goto err_out_not_valid;
-out:
- mp_msg(MSGT_VO, MSGL_V, "%d modes\n", nr_modes);
- free(line);
- fclose(fp);
- return nr_modes;
-err_out_parse_error:
- mp_msg(MSGT_VO, MSGL_V, "parse error");
-err_out_print_linenum:
- mp_msg(MSGT_VO, MSGL_V, " at line %d\n", line_num);
-err_out:
- free(fb_modes);
- fb_modes = NULL;
- nr_modes = 0;
- free(line);
- free(fp);
- return -2;
-err_out_not_valid:
- mp_msg(MSGT_VO, MSGL_V, "previous mode is not correct");
- goto err_out_print_linenum;
-}
-
-static fb_mode_t *find_mode_by_name(char *name)
-{
- int i;
-
- for (i = 0; i < nr_modes; i++)
- if (!strcmp(name, fb_modes[i].name))
- return fb_modes + i;
- return NULL;
-}
-
-static float dcf(fb_mode_t *m) //driving clock frequency
-{
- return 1e12f / m->pixclock;
-}
-
-static float hsf(fb_mode_t *m) //horizontal scan frequency
-{
- int htotal = m->left + m->xres + m->right + m->hslen;
- return dcf(m) / htotal;
-}
-
-static float vsf(fb_mode_t *m) //vertical scan frequency
-{
- int vtotal = m->upper + m->yres + m->lower + m->vslen;
- return hsf(m) / vtotal;
-}
-
-
-static int mode_works(fb_mode_t *m, range_t *hfreq, range_t *vfreq,
- range_t *dotclock)
-{
- float h = hsf(m);
- float v = vsf(m);
- float d = dcf(m);
- int ret = 1;
-
- mp_msg(MSGT_VO, MSGL_DBG2, "mode %dx%d:", m->xres, m->yres);
- if (!in_range(hfreq, h)) {
- ret = 0;
- mp_msg(MSGT_VO, MSGL_DBG2, " hsync out of range.");
- }
- if (!in_range(vfreq, v)) {
- ret = 0;
- mp_msg(MSGT_VO, MSGL_DBG2, " vsync out of range.");
- }
- if (!in_range(dotclock, d)) {
- ret = 0;
- mp_msg(MSGT_VO, MSGL_DBG2, " dotclock out of range.");
- }
- if (ret)
- mp_msg(MSGT_VO, MSGL_DBG2, " hsync, vsync, dotclock ok.\n");
- else
- mp_msg(MSGT_VO, MSGL_DBG2, "\n");
-
- return ret;
-}
-
-static fb_mode_t *find_best_mode(int xres, int yres, range_t *hfreq,
- range_t *vfreq, range_t *dotclock)
-{
- int i;
- fb_mode_t *best = fb_modes;
- fb_mode_t *curr;
-
- mp_msg(MSGT_VO, MSGL_DBG2, "Searching for first working mode\n");
-
- for (i = 0; i < nr_modes; i++, best++)
- if (mode_works(best, hfreq, vfreq, dotclock))
- break;
-
- if (i == nr_modes)
- return NULL;
- if (i == nr_modes - 1)
- return best;
-
- mp_msg(MSGT_VO, MSGL_DBG2, "First working mode: %dx%d\n", best->xres, best->yres);
- mp_msg(MSGT_VO, MSGL_DBG2, "Searching for better modes\n");
-
- for (curr = best + 1; i < nr_modes - 1; i++, curr++) {
- if (!mode_works(curr, hfreq, vfreq, dotclock))
- continue;
-
- if (best->xres < xres || best->yres < yres) {
- if (curr->xres > best->xres || curr->yres > best->yres) {
- mp_msg(MSGT_VO, MSGL_DBG2, "better than %dx%d, which is too small.\n",
- best->xres, best->yres);
- best = curr;
- } else
- mp_msg(MSGT_VO, MSGL_DBG2, "too small.\n");
- } else if (curr->xres == best->xres && curr->yres == best->yres &&
- vsf(curr) > vsf(best)) {
- mp_msg(MSGT_VO, MSGL_DBG2, "faster screen refresh.\n");
- best = curr;
- } else if ((curr->xres <= best->xres && curr->yres <= best->yres) &&
- (curr->xres >= xres && curr->yres >= yres)) {
- mp_msg(MSGT_VO, MSGL_DBG2, "better than %dx%d, which is too large.\n",
- best->xres, best->yres);
- best = curr;
- } else {
- if (curr->xres < xres || curr->yres < yres)
- mp_msg(MSGT_VO, MSGL_DBG2, "too small.\n");
- else if (curr->xres > best->xres || curr->yres > best->yres)
- mp_msg(MSGT_VO, MSGL_DBG2, "too large.\n");
- else
- mp_msg(MSGT_VO, MSGL_DBG2, "it's worse, don't know why.\n");
- }
- }
-
- return best;
-}
-
-static void set_bpp(struct fb_var_screeninfo *p, int bpp, int rgb)
-{
- 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;
- switch (bpp) {
- case 32:
- p->transp.offset = 24;
- p->transp.length = 8;
- case 24:
- p->red.offset = 16;
- p->red.length = 8;
- p->green.offset = 8;
- p->green.length = 8;
- p->blue.length = 8;
- break;
- case 16:
- p->red.offset = 11;
- p->green.length = 6;
- p->red.length = 5;
- p->green.offset = 5;
- p->blue.length = 5;
- break;
- case 15:
- p->red.offset = 10;
- p->green.length = 5;
- p->red.length = 5;
- p->green.offset = 5;
- p->blue.length = 5;
- break;
- case 12:
- p->red.offset = 8;
- p->green.length = 4;
- p->red.length = 4;
- p->green.offset = 4;
- p->blue.length = 4;
- break;
- }
- if (rgb) {
- p->blue.offset = p->red.offset;
- p->red.offset = 0;
- }
-}
-
-static void fb_mode2fb_vinfo(fb_mode_t *m, struct fb_var_screeninfo *v, int rgb)
-{
- v->xres = m->xres;
- v->yres = m->yres;
- v->xres_virtual = m->vxres;
- v->yres_virtual = m->vyres;
- set_bpp(v, m->depth, rgb);
- v->pixclock = m->pixclock;
- v->left_margin = m->left;
- v->right_margin = m->right;
- v->upper_margin = m->upper;
- v->lower_margin = m->lower;
- v->hsync_len = m->hslen;
- v->vsync_len = m->vslen;
- v->sync = m->sync;
- v->vmode = m->vmode;
-}
-
-
-/******************************
-* vo_fbdev *
-******************************/
-
-/* command line/config file options */
-static char *fb_dev_name = NULL;
-char *fb_mode_cfgfile = NULL;
-char *fb_mode_name = NULL;
-
-static fb_mode_t *fb_mode = NULL;
-
-/* vo_fbdev related variables */
-static int fb_dev_fd;
-static int fb_tty_fd = -1;
-static size_t fb_size;
-static uint8_t *frame_buffer;
-static uint8_t *center;
-static struct fb_fix_screeninfo fb_finfo;
-static struct fb_var_screeninfo fb_orig_vinfo;
-static struct fb_var_screeninfo fb_vinfo;
-static unsigned short fb_ored[256], fb_ogreen[256], fb_oblue[256];
-static struct fb_cmap fb_oldcmap = { 0, 256, fb_ored, fb_ogreen, fb_oblue };
-static int fb_cmap_changed = 0;
-static int fb_rgb;
-static int fb_pixel_size; // 32: 4 24: 3 16: 2 15: 2
-static int fb_bpp; // 32: 32 24: 24 16: 16 15: 15
-static int fb_bpp_we_want; // 32: 32 24: 24 16: 16 15: 15
-static int fb_line_len;
-static int fb_xres;
-static int fb_yres;
-static int fb_page;
-static void (*draw_alpha_p)(int w, int h, unsigned char *src,
- unsigned char *srca, int stride,
- unsigned char *dst, int dstride);
-
-static int in_width;
-static int in_height;
-static int out_width;
-static int out_height;
-static int first_row;
-static int last_row;
-static uint32_t pixel_format;
-static int fs;
-
-/*
- * Note: this function is completely cut'n'pasted from
- * Chris Lawrence's code.
- * (modified a bit to fit in my code...)
- */
-static struct fb_cmap *make_directcolor_cmap(struct fb_var_screeninfo *var)
-{
- /* Hopefully any DIRECTCOLOR device will have a big enough palette
- * to handle mapping the full color depth.
- * e.g. 8 bpp -> 256 entry palette
- *
- * We could handle some sort of gamma here
- */
- int i, cols, rcols, gcols, bcols;
- uint16_t *red, *green, *blue;
- struct fb_cmap *cmap;
-
- rcols = 1 << var->red.length;
- gcols = 1 << var->green.length;
- bcols = 1 << var->blue.length;
-
- /* Make our palette the length of the deepest color */
- cols = FFMAX3(rcols, gcols, bcols);
-
- red = malloc(cols * sizeof(red[0]));
- if (!red) {
- mp_msg(MSGT_VO, MSGL_V, "Can't allocate red palette with %d entries.\n", cols);
- return NULL;
- }
- for (i = 0; i < rcols; i++)
- red[i] = (65535 / (rcols - 1)) * i;
-
- green = malloc(cols * sizeof(green[0]));
- if (!green) {
- mp_msg(MSGT_VO, MSGL_V, "Can't allocate green palette with %d entries.\n", cols);
- free(red);
- return NULL;
- }
- for (i = 0; i < gcols; i++)
- green[i] = (65535 / (gcols - 1)) * i;
-
- blue = malloc(cols * sizeof(blue[0]));
- if (!blue) {
- mp_msg(MSGT_VO, MSGL_V, "Can't allocate blue palette with %d entries.\n", cols);
- free(red);
- free(green);
- return NULL;
- }
- for (i = 0; i < bcols; i++)
- blue[i] = (65535 / (bcols - 1)) * i;
-
- cmap = malloc(sizeof(struct fb_cmap));
- if (!cmap) {
- mp_msg(MSGT_VO, MSGL_V, "Can't allocate color map\n");
- free(red);
- free(green);
- free(blue);
- return NULL;
- }
- cmap->start = 0;
- cmap->transp = 0;
- cmap->len = cols;
- cmap->red = red;
- cmap->blue = blue;
- cmap->green = green;
- cmap->transp = NULL;
-
- return cmap;
-}
-
-
-static int fb_preinit(int reset)
-{
- static int fb_preinit_done = 0;
- static int fb_works = 0;
-
- if (reset) {
- fb_preinit_done = 0;
- return 0;
- }
-
- 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);
-
- if ((fb_dev_fd = open(fb_dev_name, O_RDWR)) == -1) {
- mp_msg(MSGT_VO, MSGL_ERR, "Can't open %s: %s\n", fb_dev_name, strerror(errno));
- goto err_out;
- }
- 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;
- }
- fb_orig_vinfo = fb_vinfo;
-
- if ((fb_tty_fd = open("/dev/tty", O_RDWR)) < 0) {
- mp_msg(MSGT_VO, MSGL_ERR, "notice: Can't open /dev/tty: %s\n", strerror(errno));
- }
-
- fb_rgb = !fb_vinfo.red.offset;
- fb_bpp = fb_vinfo.bits_per_pixel;
- if (fb_bpp == 16)
- fb_bpp = fb_vinfo.red.length + fb_vinfo.green.length + fb_vinfo.blue.length;
-
- if (fb_bpp == 8 && !vo_dbpp) {
- mp_msg(MSGT_VO, MSGL_ERR, "8 bpp output is not supported.\n");
- goto err_out;
- }
-
- if (vo_dbpp) {
- if (vo_dbpp != 12 && 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;
- }
- fb_bpp = vo_dbpp;
- }
-
- if (!fb_mode_cfgfile)
- fb_mode_cfgfile = strdup("/etc/fb.modes");
-
- fb_preinit_done = 1;
- fb_works = 1;
- return 1;
-err_out:
- if (fb_tty_fd != -1)
- close(fb_tty_fd);
- fb_tty_fd = -1;
- if (fb_dev_fd != -1)
- close(fb_dev_fd);
- fb_dev_fd = -1;
- fb_preinit_done = 1;
- fb_works = 0;
- return 0;
-}
-
-static void vt_set_textarea(int u, int l)
-{
- /* how can I determine the font height?
- * just use 16 for now
- */
- int urow = ((u + 15) / 16) + 1;
- int lrow = l / 16;
-
- mp_msg(MSGT_VO, MSGL_DBG2, "vt_set_textarea(%d,%d): %d,%d\n", u, l, urow, lrow);
- if (fb_tty_fd >= 0) {
- char modestring[100];
- snprintf(modestring, sizeof(modestring), "\33[%d;%dr\33[%d;%dH", urow, lrow, lrow, 0);
- write(fb_tty_fd, modestring, strlen(modestring));
- fsync(fb_tty_fd);
- }
-}
-
-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)
-{
- struct fb_cmap *cmap;
- int vm = flags & VOFLAG_MODESWITCHING;
-
- fs = flags & VOFLAG_FULLSCREEN;
-
- if (pre_init_err == -2) {
- mp_msg(MSGT_VO, MSGL_ERR, "Internal fatal error: config() was called before preinit()\n");
- return -1;
- }
-
- if (pre_init_err)
- return 1;
-
- if (fb_mode_name && !vm) {
- 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)
- return 1;
- if (d_width && (fs || vm)) {
- out_width = d_width;
- out_height = d_height;
- } else {
- out_width = width;
- out_height = height;
- }
- in_width = width;
- in_height = height;
- pixel_format = format;
-
- if (fb_mode_name) {
- if (!(fb_mode = find_mode_by_name(fb_mode_name))) {
- mp_msg(MSGT_VO, MSGL_ERR, "can't find requested video mode\n");
- return 1;
- }
- fb_mode2fb_vinfo(fb_mode, &fb_vinfo, fb_rgb);
- } else if (vm) {
- monitor_hfreq = str2range(monitor_hfreq_str);
- monitor_vfreq = str2range(monitor_vfreq_str);
- monitor_dotclock = str2range(monitor_dotclock_str);
- if (!monitor_hfreq || !monitor_vfreq || !monitor_dotclock) {
- mp_msg(MSGT_VO, MSGL_ERR, "you have to specify the capabilities of"
- " the monitor.\n");
- return 1;
- }
- if (!(fb_mode = find_best_mode(out_width, out_height, monitor_hfreq,
- monitor_vfreq, monitor_dotclock))) {
- mp_msg(MSGT_VO, MSGL_ERR, "can't find best video mode\n");
- return 1;
- }
- mp_msg(MSGT_VO, MSGL_V, "using mode %dx%d @ %.1fHz\n", fb_mode->xres,
- fb_mode->yres, vsf(fb_mode));
- fb_mode2fb_vinfo(fb_mode, &fb_vinfo, fb_rgb);
- }
- fb_bpp_we_want = fb_bpp;
- set_bpp(&fb_vinfo, fb_bpp, fb_rgb);
- fb_vinfo.xres_virtual = fb_vinfo.xres;
- fb_vinfo.yres_virtual = fb_vinfo.yres;
- fb_page = 0;
- if (vo_doublebuffering) {
- fb_vinfo.yres_virtual <<= 1;
- fb_vinfo.yoffset = 0;
- fb_page = 1; // start writing into the page we don't display
- }
-
- if (fb_tty_fd >= 0 && ioctl(fb_tty_fd, KDSETMODE, KD_GRAPHICS) < 0) {
- mp_msg(MSGT_VO, MSGL_V, "Can't set graphics mode: %s\n", strerror(errno));
- close(fb_tty_fd);
- fb_tty_fd = -1;
- }
-
- if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_vinfo))
- // Intel drivers fail if we request a transparency channel
- fb_vinfo.transp.length = fb_vinfo.transp.offset = 0;
- if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_vinfo)) {
- mp_msg(MSGT_VO, MSGL_ERR, "Can't put VSCREENINFO: %s\n", strerror(errno));
- if (fb_tty_fd >= 0 && ioctl(fb_tty_fd, KDSETMODE, KD_TEXT) < 0) {
- mp_msg(MSGT_VO, MSGL_ERR, "Can't restore text mode: %s\n", strerror(errno));
- }
- return 1;
- }
-
- fb_pixel_size = fb_vinfo.bits_per_pixel / 8;
- fb_bpp = fb_vinfo.bits_per_pixel;
- if (fb_bpp == 16)
- fb_bpp = fb_vinfo.red.length + fb_vinfo.green.length + fb_vinfo.blue.length;
- if (fb_bpp_we_want != fb_bpp)
- mp_msg(MSGT_VO, MSGL_WARN, "requested %d bpp, got %d bpp!!!\n",
- fb_bpp_we_want, fb_bpp);
-
- switch (fb_bpp) {
- case 32:
- draw_alpha_p = vo_draw_alpha_rgb32;
- break;
- case 24:
- draw_alpha_p = vo_draw_alpha_rgb24;
- break;
- case 16:
- draw_alpha_p = vo_draw_alpha_rgb16;
- break;
- case 15:
- draw_alpha_p = vo_draw_alpha_rgb15;
- break;
- case 12:
- draw_alpha_p = vo_draw_alpha_rgb12;
- break;
- default:
- return 1;
- }
-
- fb_xres = fb_vinfo.xres;
- fb_yres = fb_vinfo.yres;
-
- if (vm || fs) {
- out_width = fb_xres;
- out_height = fb_yres;
- }
- if (out_width < in_width || out_height < in_height) {
- mp_msg(MSGT_VO, MSGL_ERR, "screensize is smaller than video size\n");
- return 1;
- }
-
- first_row = (out_height - in_height) / 2;
- last_row = (out_height + in_height) / 2;
-
- if (ioctl(fb_dev_fd, FBIOGET_FSCREENINFO, &fb_finfo)) {
- mp_msg(MSGT_VO, MSGL_ERR, "Can't get FSCREENINFO: %s\n", strerror(errno));
- return 1;
- }
-
- if (fb_finfo.type != FB_TYPE_PACKED_PIXELS) {
- mp_msg(MSGT_VO, MSGL_ERR, "type %d not supported\n", fb_finfo.type);
- return 1;
- }
-
- switch (fb_finfo.visual) {
- case FB_VISUAL_TRUECOLOR:
- break;
- case FB_VISUAL_DIRECTCOLOR:
- mp_msg(MSGT_VO, MSGL_V, "creating cmap for directcolor\n");
- if (ioctl(fb_dev_fd, FBIOGETCMAP, &fb_oldcmap)) {
- mp_msg(MSGT_VO, MSGL_ERR, "can't get cmap: %s\n",
- strerror(errno));
- return 1;
- }
- if (!(cmap = make_directcolor_cmap(&fb_vinfo)))
- return 1;
- if (ioctl(fb_dev_fd, FBIOPUTCMAP, cmap)) {
- mp_msg(MSGT_VO, MSGL_ERR, "can't put cmap: %s\n",
- strerror(errno));
- return 1;
- }
- fb_cmap_changed = 1;
- free(cmap->red);
- free(cmap->green);
- free(cmap->blue);
- free(cmap);
- break;
- default:
- mp_msg(MSGT_VO, MSGL_ERR, "visual: %d not yet supported\n",
- fb_finfo.visual);
- return 1;
- }
-
- fb_line_len = fb_finfo.line_length;
- fb_size = fb_finfo.smem_len;
- if (vo_doublebuffering && fb_size < 2 * fb_yres * fb_line_len)
- {
- mp_msg(MSGT_VO, MSGL_WARN, "framebuffer too small for double-buffering, disabling\n");
- vo_doublebuffering = 0;
- fb_page = 0;
- }
-
- {
- int x_offset = 0, y_offset = 0;
- geometry(&x_offset, &y_offset, &out_width, &out_height, fb_xres, fb_yres);
-
- 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;
- }
-
- center = frame_buffer +
- ( (out_width - in_width) / 2 ) * fb_pixel_size +
- ( (out_height - in_height) / 2 ) * fb_line_len +
- x_offset * fb_pixel_size + y_offset * fb_line_len +
- fb_page * fb_yres * fb_line_len;
-
- mp_msg(MSGT_VO, MSGL_DBG2, "frame_buffer @ %p\n", frame_buffer);
- mp_msg(MSGT_VO, MSGL_DBG2, "center @ %p\n", center);
- mp_msg(MSGT_VO, MSGL_V, "pixel per line: %d\n", fb_line_len / fb_pixel_size);
-
- if (fs || vm) {
- int clear_size = fb_line_len * fb_yres;
- if (vo_doublebuffering)
- clear_size <<= 1;
- memset(frame_buffer, 0, clear_size);
- }
- }
-
- vt_set_textarea(last_row, fb_yres);
-
- return 0;
-}
-
-static int query_format(uint32_t format)
-{
- if (!fb_preinit(0))
- return 0;
- if ((format & IMGFMT_BGR_MASK) == (fb_rgb ? IMGFMT_RGB : IMGFMT_BGR)) {
- int bpp = format & 0xff;
-
- if (bpp == fb_bpp)
- return VFCAP_ACCEPT_STRIDE | VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
- }
- return 0;
-}
-
-static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src,
- unsigned char *srca, int stride)
-{
- unsigned char *dst;
-
- dst = center + fb_line_len * y0 + fb_pixel_size * x0;
-
- (*draw_alpha_p)(w, h, src, srca, stride, dst, fb_line_len);
-}
-
-static int draw_frame(uint8_t *src[])
-{
- return 1;
-}
-
-static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y)
-{
- uint8_t *d;
-
- d = center + fb_line_len * y + fb_pixel_size * x;
-
- memcpy_pic2(d, src[0], w * fb_pixel_size, h, fb_line_len, stride[0], 1);
-
- return 0;
-}
-
-static void check_events(void)
-{
-}
-
-static void flip_page(void)
-{
- int next_page = !fb_page;
- int page_delta = next_page - fb_page;
- if (!vo_doublebuffering)
- return;
-
- fb_vinfo.yoffset = fb_page * fb_yres;
- ioctl(fb_dev_fd, FBIOPAN_DISPLAY, &fb_vinfo);
-
- center += page_delta * fb_yres * fb_line_len;
- fb_page = next_page;
-}
-
-static void draw_osd(void)
-{
- vo_draw_text(in_width, in_height, draw_alpha);
-}
-
-static void uninit(void)
-{
- if (fb_cmap_changed) {
- if (ioctl(fb_dev_fd, FBIOPUTCMAP, &fb_oldcmap))
- mp_msg(MSGT_VO, MSGL_WARN, "Can't restore original cmap\n");
- fb_cmap_changed = 0;
- }
- if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo))
- mp_msg(MSGT_VO, MSGL_WARN, "ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno));
- fb_orig_vinfo.xoffset = fb_vinfo.xoffset;
- fb_orig_vinfo.yoffset = fb_vinfo.yoffset;
- if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_orig_vinfo))
- mp_msg(MSGT_VO, MSGL_WARN, "Can't reset original fb_var_screeninfo: %s\n", strerror(errno));
- if (fb_tty_fd >= 0) {
- if (ioctl(fb_tty_fd, KDSETMODE, KD_TEXT) < 0)
- mp_msg(MSGT_VO, MSGL_WARN, "Can't restore text mode: %s\n", strerror(errno));
- }
- vt_set_textarea(0, fb_orig_vinfo.yres);
- close(fb_tty_fd);
- close(fb_dev_fd);
- if (frame_buffer)
- munmap(frame_buffer, fb_size);
- frame_buffer = NULL;
- fb_preinit(1);
-}
-
-static int preinit(const char *vo_subdevice)
-{
- pre_init_err = 0;
-
- if (vo_subdevice) {
- {
- free(fb_dev_name);
- fb_dev_name = strdup(vo_subdevice);
- }
- }
- if (!pre_init_err)
- 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) ||
- (mpi->flags & MP_IMGFLAG_PLANAR) ||
- (mpi->flags & MP_IMGFLAG_YUV) ||
- mpi->width != in_width ||
- mpi->height != in_height
- )
- return VO_FALSE;
-
- mpi->planes[0] = center;
- mpi->stride[0] = fb_line_len;
- mpi->flags |= MP_IMGFLAG_DIRECT;
- return VO_TRUE;
-}
-
-static int control(uint32_t request, void *data)
-{
- switch (request) {
- case VOCTRL_GET_IMAGE:
- return get_image(data);
- case VOCTRL_QUERY_FORMAT:
- return query_format(*(uint32_t*)data);
- }
-
- return VO_NOTIMPL;
-}
diff --git a/libvo/vo_fbdev2.c b/libvo/vo_fbdev2.c
deleted file mode 100644
index bec9fea8ff..0000000000
--- a/libvo/vo_fbdev2.c
+++ /dev/null
@@ -1,412 +0,0 @@
-/*
- * video driver for framebuffer device
- * copyright (C) 2003 Joey Parrish <joey@nicewarrior.org>
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include <linux/fb.h>
-
-#include "config.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-#include "fastmemcpy.h"
-#include "sub/sub.h"
-#include "mp_msg.h"
-#include "aspect.h"
-#include "libavutil/common.h"
-
-static const vo_info_t info = {
- "Framebuffer Device",
- "fbdev2",
- "Joey Parrish <joey@nicewarrior.org>",
- ""
-};
-
-const LIBVO_EXTERN(fbdev2)
-
-static void set_bpp(struct fb_var_screeninfo *p, int bpp)
-{
- p->bits_per_pixel = (bpp + 1) & ~1;
- 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;
- switch (bpp) {
- case 32:
- p->transp.offset = 24;
- p->transp.length = 8;
- case 24:
- p->red.offset = 16;
- p->red.length = 8;
- p->green.offset = 8;
- p->green.length = 8;
- p->blue.length = 8;
- break;
- case 16:
- p->red.offset = 11;
- p->green.length = 6;
- p->red.length = 5;
- p->green.offset = 5;
- p->blue.length = 5;
- break;
- case 15:
- p->red.offset = 10;
- p->green.length = 5;
- p->red.length = 5;
- p->green.offset = 5;
- p->blue.length = 5;
- break;
- case 12:
- p->red.offset = 8;
- p->green.length = 4;
- p->red.length = 4;
- p->green.offset = 4;
- p->blue.length = 4;
- break;
- }
-}
-
-static char *fb_dev_name = NULL; // such as /dev/fb0
-static int fb_dev_fd; // handle for fb_dev_name
-static uint8_t *frame_buffer = NULL; // mmap'd access to fbdev
-static uint8_t *center = NULL; // where to begin writing our image (centered?)
-static struct fb_fix_screeninfo fb_finfo; // fixed info
-static struct fb_var_screeninfo fb_vinfo; // variable info
-static struct fb_var_screeninfo fb_orig_vinfo; // variable info to restore later
-static unsigned short fb_ored[256], fb_ogreen[256], fb_oblue[256];
-static struct fb_cmap fb_oldcmap = { 0, 256, fb_ored, fb_ogreen, fb_oblue };
-static int fb_cmap_changed = 0; // to restore map
-static int fb_pixel_size; // 32: 4 24: 3 16: 2 15: 2
-static int fb_bpp; // 32: 32 24: 24 16: 16 15: 15
-static size_t fb_size; // size of frame_buffer
-static int fb_line_len; // length of one line in bytes
-static void (*draw_alpha_p)(int w, int h, unsigned char *src,
- unsigned char *srca, int stride, unsigned char *dst,
- int dstride);
-
-static uint8_t *next_frame = NULL; // for double buffering
-static int in_width;
-static int in_height;
-
-static struct fb_cmap *make_directcolor_cmap(struct fb_var_screeninfo *var)
-{
- int i, cols, rcols, gcols, bcols;
- uint16_t *red, *green, *blue;
- struct fb_cmap *cmap;
-
- rcols = 1 << var->red.length;
- gcols = 1 << var->green.length;
- bcols = 1 << var->blue.length;
-
- /* Make our palette the length of the deepest color */
- cols = FFMAX3(rcols, gcols, bcols);
-
- red = malloc(3 * cols * sizeof(red[0]));
- if(!red) {
- mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't allocate red palette with %d entries.\n", cols);
- return NULL;
- }
- green = red + cols;
- blue = green + cols;
- for (i = 0; i < cols; i++) {
- red[i] = (65535/(rcols-1)) * i;
- green[i] = (65535/(gcols-1)) * i;
- blue[i] = (65535/(bcols-1)) * i;
- }
-
- cmap = malloc(sizeof(struct fb_cmap));
- if(!cmap) {
- mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't allocate color map\n");
- free(red);
- return NULL;
- }
- cmap->start = 0;
- cmap->transp = 0;
- cmap->len = cols;
- cmap->red = red;
- cmap->blue = blue;
- cmap->green = green;
- cmap->transp = NULL;
-
- return cmap;
-}
-
-static int fb_preinit(int reset)
-{
- static int fb_preinit_done = 0;
- static int fb_err = -1;
-
- if (reset) {
- fb_preinit_done = 0;
- return 0;
- }
-
- if (fb_preinit_done)
- return fb_err;
- fb_preinit_done = 1;
-
- if (!fb_dev_name && !(fb_dev_name = getenv("FRAMEBUFFER")))
- fb_dev_name = strdup("/dev/fb0");
-
- mp_msg(MSGT_VO, MSGL_V, "[fbdev2] Using device %s\n", fb_dev_name);
-
- if ((fb_dev_fd = open(fb_dev_name, O_RDWR)) == -1) {
- mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't open %s: %s\n", fb_dev_name, strerror(errno));
- goto err_out;
- }
- if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo)) {
- mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't get VSCREENINFO: %s\n", strerror(errno));
- goto err_out;
- }
- fb_orig_vinfo = fb_vinfo;
-
- fb_bpp = fb_vinfo.bits_per_pixel;
-
- /* 16 and 15 bpp is reported as 16 bpp */
- if (fb_bpp == 16)
- fb_bpp = fb_vinfo.red.length + fb_vinfo.green.length +
- fb_vinfo.blue.length;
-
- fb_err = 0;
- return 0;
-err_out:
- if (fb_dev_fd >= 0) close(fb_dev_fd);
- fb_dev_fd = -1;
- fb_err = -1;
- return -1;
-}
-
-static int preinit(const char *subdevice)
-{
- if (subdevice)
- {
- free(fb_dev_name);
- fb_dev_name = strdup(subdevice);
- }
- return fb_preinit(0);
-}
-
-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)
-{
- struct fb_cmap *cmap;
- int fs = flags & VOFLAG_FULLSCREEN;
- int x_offset = vo_dx + (d_width - width ) / 2;
- int y_offset = vo_dy + (d_height - height) / 2;
- x_offset = av_clip(x_offset, 0, fb_vinfo.xres - width);
- y_offset = av_clip(y_offset, 0, fb_vinfo.yres - height);
-
- in_width = width;
- in_height = height;
-
- if (fb_vinfo.xres < in_width || fb_vinfo.yres < in_height) {
- mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Screensize is smaller than video size (%dx%d < %dx%d)\n",
- fb_vinfo.xres, fb_vinfo.yres, in_width, in_height);
- return 1;
- }
-
- switch (fb_bpp) {
- case 32: draw_alpha_p = vo_draw_alpha_rgb32; break;
- case 24: draw_alpha_p = vo_draw_alpha_rgb24; break;
- case 16: draw_alpha_p = vo_draw_alpha_rgb16; break;
- case 15: draw_alpha_p = vo_draw_alpha_rgb15; break;
- case 12: draw_alpha_p = vo_draw_alpha_rgb12; break;
- default: return 1;
- }
-
- if (vo_config_count == 0) {
- if (ioctl(fb_dev_fd, FBIOGET_FSCREENINFO, &fb_finfo)) {
- mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't get FSCREENINFO: %s\n", strerror(errno));
- return 1;
- }
-
- if (fb_finfo.type != FB_TYPE_PACKED_PIXELS) {
- mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] type %d not supported\n", fb_finfo.type);
- return 1;
- }
-
- switch (fb_finfo.visual) {
- case FB_VISUAL_TRUECOLOR:
- break;
- case FB_VISUAL_DIRECTCOLOR:
- mp_msg(MSGT_VO, MSGL_V, "[fbdev2] creating cmap for directcolor\n");
- if (ioctl(fb_dev_fd, FBIOGETCMAP, &fb_oldcmap)) {
- mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] can't get cmap: %s\n", strerror(errno));
- return 1;
- }
- if (!(cmap = make_directcolor_cmap(&fb_vinfo)))
- return 1;
- if (ioctl(fb_dev_fd, FBIOPUTCMAP, cmap)) {
- mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] can't put cmap: %s\n", strerror(errno));
- free(cmap->red);
- free(cmap);
- return 1;
- }
- fb_cmap_changed = 1;
- free(cmap->red);
- free(cmap);
- break;
- default:
- mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] visual: %d not yet supported\n", fb_finfo.visual);
- return 1;
- }
-
- fb_size = fb_finfo.smem_len;
- fb_line_len = fb_finfo.line_length;
- if ((frame_buffer = (uint8_t *) mmap(0, fb_size, PROT_READ | PROT_WRITE, MAP_SHARED, fb_dev_fd, 0)) == (uint8_t *) -1) {
- mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't mmap %s: %s\n", fb_dev_name, strerror(errno));
- return 1;
- }
- }
-
- center = frame_buffer +
- x_offset * fb_pixel_size +
- y_offset * fb_line_len;
-
-#ifndef USE_CONVERT2FB
- if (!(next_frame = realloc(next_frame, in_width * in_height * fb_pixel_size))) {
- mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't malloc next_frame: %s\n", strerror(errno));
- return 1;
- }
-#endif
- if (fs) memset(frame_buffer, '\0', fb_line_len * fb_vinfo.yres);
-
- return 0;
-}
-
-static int query_format(uint32_t format)
-{
- // open the device, etc.
- if (fb_preinit(0)) return 0;
- if ((format & IMGFMT_BGR_MASK) == IMGFMT_BGR) {
- int fb_target_bpp = format & 0xff;
- set_bpp(&fb_vinfo, fb_target_bpp);
- fb_vinfo.xres_virtual = fb_vinfo.xres;
- fb_vinfo.yres_virtual = fb_vinfo.yres;
- if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_vinfo))
- // Needed for Intel framebuffer with 32 bpp
- fb_vinfo.transp.length = fb_vinfo.transp.offset = 0;
- if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_vinfo)) {
- mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't put VSCREENINFO: %s\n", strerror(errno));
- return 0;
- }
- fb_pixel_size = fb_vinfo.bits_per_pixel / 8;
- fb_bpp = fb_vinfo.bits_per_pixel;
- if (fb_bpp == 16)
- fb_bpp = fb_vinfo.red.length + fb_vinfo.green.length + fb_vinfo.blue.length;
- if (fb_bpp == fb_target_bpp)
- return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_ACCEPT_STRIDE;
- }
- return 0;
-}
-
-static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src,
- unsigned char *srca, int stride)
-{
- unsigned char *dst;
- int dstride;
-
-#ifdef USE_CONVERT2FB
- dst = center + (fb_line_len * y0) + (x0 * fb_pixel_size);
- dstride = fb_line_len;
-#else
- dst = next_frame + (in_width * y0 + x0) * fb_pixel_size;
- dstride = in_width * fb_pixel_size;
-#endif
- (*draw_alpha_p)(w, h, src, srca, stride, dst, dstride);
-}
-
-static void draw_osd(void)
-{
- vo_draw_text(in_width, in_height, draw_alpha);
-}
-
-// all csp support stride
-static int draw_frame(uint8_t *src[]) { return 1; }
-
-static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y)
-{
- uint8_t *in = src[0];
-#ifdef USE_CONVERT2FB
- uint8_t *dest = center + (fb_line_len * y) + (x * fb_pixel_size);
- int next = fb_line_len;
-#else
- uint8_t *dest = next_frame + (in_width * y + x) * fb_pixel_size;
- int next = in_width * fb_pixel_size;
-#endif
-
- memcpy_pic(dest, in, w * fb_pixel_size, h, next, stride[0]);
- return 0;
-}
-
-static void check_events(void)
-{
-}
-
-static void flip_page(void)
-{
-#ifndef USE_CONVERT2FB
- int out_offset = 0, in_offset = 0;
-
- memcpy_pic(center + out_offset, next_frame + in_offset,
- in_width * fb_pixel_size, in_height,
- fb_line_len, in_width * fb_pixel_size);
-#endif
-}
-
-static void uninit(void)
-{
- if (fb_cmap_changed) {
- if (ioctl(fb_dev_fd, FBIOPUTCMAP, &fb_oldcmap))
- mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't restore original cmap\n");
- fb_cmap_changed = 0;
- }
- free(next_frame);
- if (fb_dev_fd >= 0) {
- if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_orig_vinfo))
- mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't reset original fb_var_screeninfo: %s\n", strerror(errno));
- close(fb_dev_fd);
- fb_dev_fd = -1;
- }
- if(frame_buffer) munmap(frame_buffer, fb_size);
- next_frame = frame_buffer = NULL;
- fb_preinit(1); // so that later calls to preinit don't fail
-}
-
-static int control(uint32_t request, void *data)
-{
- switch (request) {
- case VOCTRL_QUERY_FORMAT:
- return query_format(*((uint32_t*)data));
- case VOCTRL_UPDATE_SCREENINFO:
- vo_screenwidth = fb_vinfo.xres;
- vo_screenheight = fb_vinfo.yres;
- aspect_save_screenres(vo_screenwidth, vo_screenheight);
- return VO_TRUE;
- }
- return VO_NOTIMPL;
-}
diff --git a/libvo/vo_ggi.c b/libvo/vo_ggi.c
deleted file mode 100644
index b994dce81f..0000000000
--- a/libvo/vo_ggi.c
+++ /dev/null
@@ -1,591 +0,0 @@
-/*
- * General Graphics Interface (GGI) vo driver
- *
- * copyright (C) 2001 Alex Beregszaszi
- *
- * Uses libGGI - http://www.ggi-project.org/
- *
- * TODO:
- * * implement gamma handling (VAA isn't obsoleted?)
- *
- * Thanks to Andreas Beck for his patches.
- *
- * Many thanks to Atmosfear, he hacked this driver to work with planar
- * formats, and he fixed the RGB handling.
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include "mp_msg.h"
-
-#include "config.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-
-#include "mp_fifo.h"
-#include "input/keycodes.h"
-
-#include <ggi/ggi.h>
-
-#ifdef CONFIG_GGIWMH
-#include <ggi/wmh.h>
-#endif
-
-/* maximum buffers */
-#undef GGI_FLIP
-
-static const vo_info_t info =
-{
- "General Graphics Interface (GGI) output",
- "ggi",
- "Alex Beregszaszi",
- "major"
-};
-
-const LIBVO_EXTERN(ggi)
-
-
-static struct ggi_conf_s {
- char *driver;
-
- ggi_visual_t vis;
- ggi_visual_t drawvis;
-
- /* source image format */
- int srcwidth;
- int srcheight;
- int srcformat;
- int srcdepth;
- int srcbpp;
-
- /* dirty region */
- struct {
- int x1, y1;
- int x2, y2;
- } flushregion;
-
- int voflags;
-
- int depthonscreen;
-} ggi_conf;
-
-
-#ifdef CONFIG_GGIWMH
-static void window_ontop(void)
-{
- mp_msg(MSGT_VO, MSGL_V, "[ggi] debug: window_ontop() called\n");
- ggiWmhZOrder(ggi_conf.vis, ZO_TOP);
- return;
-}
-#endif
-
-
-static void set_graphtype(uint32_t format, ggi_mode *mode)
-{
- switch (format) {
- case IMGFMT_RGB4:
- mode->graphtype = GT_4BIT;
- break;
- case IMGFMT_BGR4:
- mode->graphtype = GT_4BIT;
- GT_SETSUBSCHEME(mode->graphtype, GT_SUB_HIGHBIT_RIGHT);
- break;
- case IMGFMT_RGB8:
- case IMGFMT_BGR8:
- mode->graphtype = GT_8BIT;
- break;
- case IMGFMT_RGB15:
- case IMGFMT_BGR15:
- mode->graphtype = GT_15BIT;
- break;
- case IMGFMT_RGB16:
- case IMGFMT_BGR16:
- mode->graphtype = GT_16BIT;
- break;
- case IMGFMT_RGB24:
- case IMGFMT_BGR24:
- mode->graphtype = GT_24BIT;
- break;
- case IMGFMT_RGB32:
- case IMGFMT_BGR32:
- mode->graphtype = GT_32BIT;
- break;
- }
-
- return;
-}
-
-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)
-{
- ggi_mode mode = {
- 1, /* frames */
- {width, height}, /* visible */
- {GGI_AUTO, GGI_AUTO}, /* virt */
- {GGI_AUTO, GGI_AUTO}, /* size */
- GT_AUTO, /* graphtype */
- {GGI_AUTO, GGI_AUTO} /* dots per pixel */
- };
-
-
- set_graphtype(format, &mode);
-
-#if 0
- printf("[ggi] mode: ");
- ggiPrintMode(&mode);
- printf("\n");
-#endif
-
- ggiCheckMode(ggi_conf.vis, &mode);
-
- if (ggiSetMode(ggi_conf.vis, &mode) < 0) {
- mp_msg(MSGT_VO, MSGL_ERR, "[ggi] unable to set display mode\n");
- return -1;
- }
- if (ggiGetMode(ggi_conf.vis, &mode) < 0) {
- mp_msg(MSGT_VO, MSGL_ERR, "[ggi] unable to get display mode\n");
- return -1;
- }
- if ((mode.graphtype == GT_INVALID)
- || (mode.graphtype == GT_AUTO))
- {
- mp_msg(MSGT_VO, MSGL_ERR, "[ggi] not supported depth/bpp\n");
- return -1;
- }
-
-#if 0
- printf("[ggi] mode: ");
- ggiPrintMode(&mode);
- printf("\n");
-#endif
-
-
-#ifdef CONFIG_GGIWMH
- ggiWmhSetTitle(ggi_conf.vis, title);
- if (vo_ontop) window_ontop();
-#endif
-
- ggiSetFlags(ggi_conf.vis, GGIFLAG_ASYNC);
-
- if (GT_SCHEME(mode.graphtype) == GT_PALETTE)
- ggiSetColorfulPalette(ggi_conf.vis);
-
- if (GT_SCHEME(mode.graphtype) != GT_TRUECOLOR) {
- ggi_mode drawmode;
-
- ggi_conf.drawvis = ggiOpen("display-memory", NULL);
- if (ggi_conf.drawvis == NULL) {
- mp_msg(MSGT_VO, MSGL_ERR,
- "[ggi] unable to get backbuffer for conversion\n");
- return -1;
- }
- memcpy(&drawmode, &mode, sizeof(ggi_mode));
- drawmode.graphtype = GT_32BIT;
- drawmode.size.x = GGI_AUTO;
- drawmode.size.y = GGI_AUTO;
- ggiCheckMode(ggi_conf.drawvis, &drawmode);
- if (ggiSetMode(ggi_conf.drawvis, &drawmode) < 0) {
- mp_msg(MSGT_VO, MSGL_ERR,
- "[ggi] unable to set backbuffer mode\n");
- return -1;
- }
- mode.graphtype = drawmode.graphtype;
-
- ggiSetFlags(ggi_conf.drawvis, GGIFLAG_ASYNC);
- }
- ggi_conf.depthonscreen = GT_DEPTH(mode.graphtype);
- vo_screenwidth = mode.virt.x;
- vo_screenheight = mode.virt.y;
-
- vo_dwidth = width;
- vo_dheight = height;
- vo_dbpp = GT_SIZE(mode.graphtype);
-
-
- /* calculate top, left corner */
- vo_dx = (vo_screenwidth - vo_dwidth) / 2;
- vo_dy = (vo_screenheight - vo_dheight) / 2;
-
-
- ggi_conf.srcwidth = width;
- ggi_conf.srcheight = height;
- ggi_conf.srcformat = format;
-
- ggi_conf.voflags = flags;
-
- if (IMGFMT_IS_RGB(ggi_conf.srcformat)) {
- ggi_conf.srcdepth = IMGFMT_RGB_DEPTH(ggi_conf.srcformat);
- } else if (IMGFMT_IS_BGR(ggi_conf.srcformat)) {
- ggi_conf.srcdepth = IMGFMT_BGR_DEPTH(ggi_conf.srcformat);
- } else {
- mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] Unknown image format: %s\n",
- vo_format_name(ggi_conf.srcformat));
- return -1;
- }
-
- mp_msg(MSGT_VO, MSGL_INFO, "[ggi] input: %dx%dx%d, output: %dx%dx%d\n",
- ggi_conf.srcwidth, ggi_conf.srcheight, ggi_conf.srcdepth,
- mode.virt.x, mode.virt.y, vo_dbpp);
-
- ggi_conf.srcbpp = (ggi_conf.srcdepth + 7) / 8;
-
- ggi_conf.flushregion.x1 = vo_dx;
- ggi_conf.flushregion.y1 = vo_dy;
- ggi_conf.flushregion.x2 = vo_dwidth;
- ggi_conf.flushregion.y2 = vo_dheight;
-
- return 0;
-}
-
-static uint32_t get_image(mp_image_t *mpi)
-{
- /* GGI DirectRendering supports (yet) only BGR/RGB modes */
- if (!((IMGFMT_IS_BGR(mpi->imgfmt)) &&
- (IMGFMT_BGR_DEPTH(mpi->imgfmt) == vo_dbpp)))
- {
- return VO_FALSE;
- }
-
- if (!((IMGFMT_IS_RGB(mpi->imgfmt)) &&
- (IMGFMT_RGB_DEPTH(mpi->imgfmt) == vo_dbpp)))
- {
- return VO_FALSE;
- }
-
- if (!((mpi->width == ggi_conf.srcwidth) &&
- (mpi->height == ggi_conf.srcheight)))
- {
- return VO_FALSE;
- }
-
- mpi->planes[1] = mpi->planes[2] = NULL;
- mpi->stride[1] = mpi->stride[2] = 0;
-
- mpi->planes[0] = NULL;
- mpi->stride[0] = ggi_conf.srcwidth * ggi_conf.srcbpp;
- mpi->flags |= MP_IMGFLAG_DIRECT;
-
-#ifdef GGI_FLIP
- if (ggi_conf.voflags & VOFLAG_FLIPPING) {
- mpi->stride[0] = -mpi->stride[0];
- }
-#endif
-
- return VO_TRUE;
-}
-
-
-static int draw_frame(uint8_t *src[])
-{
- ggiPutBox(ggi_conf.drawvis, vo_dx, vo_dy,
- vo_dwidth, vo_dheight, src[0]);
-
- ggi_conf.flushregion.x1 = vo_dx;
- ggi_conf.flushregion.y1 = vo_dy;
- ggi_conf.flushregion.x2 = vo_dwidth;
- ggi_conf.flushregion.y2 = vo_dheight;
-
- return 0;
-}
-
-static void draw_osd(void)
-{
- return;
-}
-
-static void flip_page(void)
-{
- if (ggi_conf.drawvis != ggi_conf.vis) {
-#if 0
- ggiFlushRegion(ggi_conf.drawvis,
- ggi_conf.flushregion.x1, ggi_conf.flushregion.y1,
- ggi_conf.flushregion.x2 - ggi_conf.flushregion.x1,
- ggi_conf.flushregion.y2 - ggi_conf.flushregion.y1);
-#endif
- ggiCrossBlit(ggi_conf.drawvis,
- ggi_conf.flushregion.x1, ggi_conf.flushregion.y1,
- ggi_conf.flushregion.x2 - ggi_conf.flushregion.x1,
- ggi_conf.flushregion.y2 - ggi_conf.flushregion.y1,
- ggi_conf.vis,
- ggi_conf.flushregion.x1, ggi_conf.flushregion.y1);
-
- }
- ggiFlushRegion(ggi_conf.vis,
- ggi_conf.flushregion.x1, ggi_conf.flushregion.y1,
- ggi_conf.flushregion.x2 - ggi_conf.flushregion.x1,
- ggi_conf.flushregion.y2 - ggi_conf.flushregion.y1);
-
- ggi_conf.flushregion.x1 = ggi_conf.flushregion.x2 = -1;
- ggi_conf.flushregion.y1 = ggi_conf.flushregion.y2 = -1;
-}
-
-static int draw_slice(uint8_t *src[], int stride[],
- int w, int h, int x, int y)
-{
- ggiPutBox(ggi_conf.drawvis, vo_dx + x, vo_dy + y, w, h, src[0]);
-
- if ((ggi_conf.flushregion.x1 == -1) ||
- ((vo_dx + x) < ggi_conf.flushregion.x1))
- {
- ggi_conf.flushregion.x1 = vo_dx + x;
- }
- if ((ggi_conf.flushregion.y1 == -1) ||
- ((vo_dy + y) < ggi_conf.flushregion.y1))
- {
- ggi_conf.flushregion.y1 = vo_dy + y;
- }
- if ((ggi_conf.flushregion.x2 == -1) ||
- ((vo_dx + x + w) > ggi_conf.flushregion.x2))
- {
- ggi_conf.flushregion.x2 = vo_dx + x + w;
- }
- if ((ggi_conf.flushregion.y2 == -1) ||
- ((vo_dy + y + h) > ggi_conf.flushregion.y2))
- {
- ggi_conf.flushregion.y2 = vo_dy + y + h;
- }
-
- return 1;
-}
-
-static int query_format(uint32_t format)
-{
- ggi_mode mode;
- uint32_t vfcap;
-
- vfcap = VFCAP_CSP_SUPPORTED
- | VFCAP_CSP_SUPPORTED_BY_HW
- | VFCAP_ACCEPT_STRIDE;
-
- if ((!ggi_conf.depthonscreen || !vo_dbpp) && ggi_conf.vis) {
- if (ggiGetMode(ggi_conf.vis, &mode) == 0) {
- ggi_conf.depthonscreen = GT_DEPTH(mode.graphtype);
- vo_dbpp = GT_SIZE(mode.graphtype);
- }
- if (GT_SCHEME(mode.graphtype) == GT_AUTO) {
- ggiCheckMode(ggi_conf.vis, &mode);
- }
- if (GT_SCHEME(mode.graphtype) != GT_TRUECOLOR) {
- mode.graphtype = GT_32BIT;
- ggi_conf.depthonscreen = GT_DEPTH(mode.graphtype);
- vo_dbpp = GT_SIZE(mode.graphtype);
- }
- }
- if ((IMGFMT_IS_BGR(format) && (IMGFMT_BGR_DEPTH(format) == vo_dbpp)) ||
- (IMGFMT_IS_RGB(format) && (IMGFMT_RGB_DEPTH(format) == vo_dbpp)))
- {
- return vfcap;
- }
- if (IMGFMT_IS_BGR(format) || IMGFMT_IS_RGB(format)) {
- set_graphtype(format, &mode);
-
- if (ggiCheckMode(ggi_conf.drawvis, &mode) < 0) {
- return 0;
- } else {
- return vfcap;
- }
- }
- return 0;
-}
-
-static int preinit(const char *arg)
-{
- if (ggiInit() != 0) {
- mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to initialize GGI\n");
- return -1;
- }
-#ifdef CONFIG_GGIWMH
- if (ggiWmhInit() < 0) {
- mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to initialize libggiwmh\n");
- return -1;
- }
-#endif
-
- if (arg) {
- int i = 0;
- ggi_conf.driver = strdup(arg);
- while (ggi_conf.driver[i] != '\0') {
- if (ggi_conf.driver[i] == '.')
- ggi_conf.driver[i] = ',';
- i++;
- }
- } else {
- ggi_conf.driver = NULL;
- }
-
- ggi_conf.vis = ggiOpen(ggi_conf.driver);
- if (ggi_conf.vis == NULL) {
- mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] unable to open '%s' output\n",
- (ggi_conf.driver == NULL) ? "default" : ggi_conf.driver);
- ggiExit();
- return -1;
- }
- ggi_conf.drawvis = ggi_conf.vis;
-
-
-#ifdef CONFIG_GGIWMH
- ggiWmhAttach(ggi_conf.vis);
-#endif
-
-
- mp_msg(MSGT_VO, MSGL_V, "[ggi] using '%s' output\n",
- (ggi_conf.driver == NULL) ? "default" : ggi_conf.driver);
-
- return 0;
-}
-
-static void uninit(void)
-{
- free(ggi_conf.driver);
-
-#ifdef CONFIG_GGIWMH
- ggiWmhDetach(ggi_conf.vis);
- ggiWmhExit();
-#endif
-
- if (ggi_conf.drawvis != NULL && ggi_conf.drawvis != ggi_conf.vis)
- ggiClose(ggi_conf.drawvis);
-
- ggiClose(ggi_conf.vis);
- ggiExit();
-}
-
-static int control(uint32_t request, void *data)
-{
- switch (request) {
- case VOCTRL_QUERY_FORMAT:
- return query_format(*((uint32_t *) data));
- case VOCTRL_GET_IMAGE:
- return get_image(data);
-#ifdef CONFIG_GGIWMH
- case VOCTRL_ONTOP:
- vo_ontop = (!(vo_ontop));
- window_ontop();
- return VO_TRUE;
-#endif
- }
- return VO_NOTIMPL;
-}
-
-static void check_events(void)
-{
- struct timeval tv = {0, 0};
- ggi_event event;
- ggi_event_mask mask;
-
- if ((mask = ggiEventPoll(ggi_conf.vis, emAll, &tv))) {
- if (ggiEventRead(ggi_conf.vis, &event, emAll) != 0) {
- mp_dbg(MSGT_VO, MSGL_DBG3,
- "type: %4x, origin: %4x, "
- "sym: %4x, label: %4x, button=%4x\n",
- event.any.origin, event.any.type, event.key.sym,
- event.key.label, event.key.button);
-
- switch (event.any.type) {
- case evKeyPress:
- switch (event.key.sym) {
- case GIIK_PAsterisk: /* PStar */
- case GIIUC_Asterisk:
- mplayer_put_key('*');
- break;
- case GIIK_PSlash:
- case GIIUC_Slash:
- mplayer_put_key('/');
- break;
- case GIIK_PPlus:
- case GIIUC_Plus:
- mplayer_put_key('+');
- break;
- case GIIK_PMinus:
- case GIIUC_Minus:
- mplayer_put_key('-');
- break;
- case GIIUC_o:
- case GIIUC_O:
- mplayer_put_key('o');
- break;
- case GIIUC_g:
- case GIIUC_G:
- mplayer_put_key('g');
- break;
- case GIIUC_z:
- case GIIUC_Z:
- mplayer_put_key('z');
- break;
- case GIIUC_x:
- case GIIUC_X:
- mplayer_put_key('x');
- break;
- case GIIUC_m:
- case GIIUC_M:
- mplayer_put_key('m');
- break;
- case GIIUC_d:
- case GIIUC_D:
- mplayer_put_key('d');
- break;
- case GIIUC_q:
- case GIIUC_Q:
- mplayer_put_key('q');
- break;
- case GIIUC_h:
- case GIIUC_H:
- mplayer_put_key('h');
- break;
- case GIIUC_l:
- case GIIUC_L:
- mplayer_put_key('l');
- break;
- case GIIUC_Space:
- case GIIUC_p:
- case GIIUC_P:
- mplayer_put_key('p');
- break;
- case GIIK_Up:
- mplayer_put_key(KEY_UP);
- break;
- case GIIK_Down:
- mplayer_put_key(KEY_DOWN);
- break;
- case GIIK_Left:
- mplayer_put_key(KEY_LEFT);
- break;
- case GIIK_Right:
- mplayer_put_key(KEY_RIGHT);
- break;
- case GIIK_PageUp:
- mplayer_put_key(KEY_PAGE_UP);
- break;
- case GIIK_PageDown:
- mplayer_put_key(KEY_PAGE_DOWN);
- break;
- default:
- break;
- } /* switch */
-
- break;
- } /* switch */
- } /* if */
- } /* if */
- return;
-}
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index f72f1ae70c..f44404b2be 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -1325,7 +1325,6 @@ static int preinit(struct vo *vo, const char *arg)
" cocoa: Cocoa/OSX\n"
" win: Win32/WGL\n"
" x11: X11/GLX\n"
- " sdl: SDL\n"
"\n");
return -1;
}
@@ -1354,13 +1353,6 @@ static int preinit(struct vo *vo, const char *arg)
goto err_out;
p->gl = p->glctx->gl;
- if (p->glctx->type == GLTYPE_SDL && p->use_yuv == -1) {
- // Apparently it's not possible to implement VOFLAG_HIDDEN on SDL 1.2,
- // so don't do autodetection. Use a sufficiently useful and safe YUV
- // conversion mode.
- p->use_yuv = YUV_CONVERSION_FRAGMENT;
- }
-
if (p->use_yuv == -1 || !allow_sw) {
if (create_window(vo, 320, 200, VOFLAG_HIDDEN) < 0)
goto err_out;
diff --git a/libvo/vo_ivtv.c b/libvo/vo_ivtv.c
deleted file mode 100644
index d745701159..0000000000
--- a/libvo/vo_ivtv.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * video output for WinTV PVR-150/250/350 (a.k.a IVTV) cards
- * TV-Out through hardware MPEG decoder
- * Based on some old code from ivtv driver authors.
- * See http://ivtvdriver.org/index.php/Main_Page for more details on the
- * cards supported by the ivtv driver.
- *
- * Copyright (C) 2006 Benjamin Zores
- *
- * 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 "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include <linux/types.h>
-#include <linux/videodev2.h>
-#include <linux/ivtv.h>
-#include <linux/ioctl.h>
-
-#include "mp_msg.h"
-#include "subopt-helper.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-#include "vo_ivtv.h"
-#include "libmpdemux/mpeg_packetizer.h"
-
-#define DEFAULT_MPEG_DECODER "/dev/video16"
-#define IVTV_VO_HDR "VO: [ivtv]"
-
-/* ivtv private */
-int ivtv_fd = -1;
-static vo_mpegpes_t *pes;
-
-/* suboptions */
-static int output = -1;
-static char *device = NULL;
-
-static const opt_t subopts[] = {
- {"output", OPT_ARG_INT, &output, int_non_neg},
- {"device", OPT_ARG_MSTRZ, &device, NULL},
- {NULL}
-};
-
-static const vo_info_t info =
-{
- "IVTV MPEG Video Decoder TV-Out",
- "ivtv",
- "Benjamin Zores",
- ""
-};
-const LIBVO_EXTERN (ivtv)
-
-/* ivtv internals */
-
-static uint32_t
-ivtv_reset (int blank_screen)
-{
- struct ivtv_cfg_stop_decode sd;
- struct ivtv_cfg_start_decode sd1;
- int flags = 0;
-
- if (blank_screen)
- flags |= IVTV_STOP_FL_HIDE_FRAME;
- sd.flags = flags;
-
- if (ioctl (ivtv_fd, IVTV_IOC_STOP_DECODE, &sd) < 0)
- {
- mp_msg (MSGT_VO, MSGL_ERR,
- "IVTV_IOC_STOP_DECODE: %s\n", strerror (errno));
- return 1;
- }
-
- sd1.gop_offset = 0;
- sd1.muted_audio_frames = 0;
-
- if (ioctl (ivtv_fd, IVTV_IOC_START_DECODE, &sd1) < 0)
- {
- mp_msg (MSGT_VO, MSGL_ERR,
- "IVTV_IOC_START_DECODE: %s\n", strerror (errno));
- return 1;
- }
-
- return 0;
-}
-
-int
-ivtv_write (const unsigned char *data, int len)
-{
- if (ivtv_fd < 0)
- return 0;
-
- return write (ivtv_fd, data, len);
-}
-
-/* video out functions */
-
-static int
-config (uint32_t width, uint32_t height,
- uint32_t d_width, uint32_t d_height,
- uint32_t fullscreen, char *title, uint32_t format)
-{
- return 0;
-}
-
-static int
-preinit (const char *arg)
-{
- struct v4l2_output vout;
- int err;
-
- if (subopt_parse (arg, subopts) != 0)
- {
- mp_msg (MSGT_VO, MSGL_FATAL,
- "\n-vo ivtv command line help:\n"
- "Example: mplayer -vo ivtv:device=/dev/video16:output=2\n"
- "\nOptions:\n"
- " device=/dev/videoX\n"
- " Name of the MPEG decoder device file.\n"
- " output=<0-...>\n"
- " V4L2 id of the TV output.\n"
- "\n" );
- return -1;
- }
-
- if (!device)
- device = strdup (DEFAULT_MPEG_DECODER);
-
- ivtv_fd = open (device, O_RDWR);
- if (ivtv_fd < 0)
- {
- free (device);
- mp_msg (MSGT_VO, MSGL_FATAL, "%s %s\n", IVTV_VO_HDR, strerror (errno));
- return -1;
- }
-
- /* list available outputs */
- vout.index = 0;
- err = 1;
- mp_msg (MSGT_VO, MSGL_INFO, "%s Available video outputs: ", IVTV_VO_HDR);
- while (ioctl (ivtv_fd, VIDIOC_ENUMOUTPUT, &vout) >= 0)
- {
- err = 0;
- mp_msg (MSGT_VO, MSGL_INFO, "'#%d, %s' ", vout.index, vout.name);
- vout.index++;
- }
- if (err)
- {
- mp_msg (MSGT_VO, MSGL_INFO, "none\n");
- free (device);
- return -1;
- }
- else
- mp_msg (MSGT_VO, MSGL_INFO, "\n");
-
- /* set user specified output */
- if (output != -1)
- {
- if (ioctl (ivtv_fd, VIDIOC_S_OUTPUT, &output) < 0)
- {
- mp_msg (MSGT_VO, MSGL_ERR,
- "%s can't set output (%s)\n", IVTV_VO_HDR, strerror (errno));
- free (device);
- return -1;
- }
- }
-
- /* display device name */
- mp_msg (MSGT_VO, MSGL_INFO, "%s using %s\n", IVTV_VO_HDR, device);
- free (device);
-
- /* display current video output */
- if (ioctl (ivtv_fd, VIDIOC_G_OUTPUT, &output) == 0)
- {
- vout.index = output;
- if (ioctl (ivtv_fd, VIDIOC_ENUMOUTPUT, &vout) < 0)
- {
- mp_msg (MSGT_VO, MSGL_ERR,
- "%s can't get output (%s).\n", IVTV_VO_HDR, strerror (errno));
- return -1;
- }
- else
- mp_msg (MSGT_VO, MSGL_INFO,
- "%s video output: %s\n", IVTV_VO_HDR, vout.name);
- }
- else
- {
- mp_msg (MSGT_VO, MSGL_ERR,
- "%s can't get output (%s).\n", IVTV_VO_HDR, strerror (errno));
- return -1;
- }
-
- /* clear output */
- ivtv_reset (1);
-
- return 0;
-}
-
-static void
-draw_osd (void)
-{
- /* do nothing */
-}
-
-static int
-draw_frame (uint8_t * src[])
-{
- pes = (vo_mpegpes_t *) src[0];
- return 0;
-}
-
-static void
-flip_page (void)
-{
- if (ivtv_fd < 0)
- return;
-
- if (!pes)
- return;
-
- send_mpeg_pes_packet (pes->data, pes->size, pes->id,
- pes->timestamp ? pes->timestamp : vo_pts, 2,
- ivtv_write);
-
- /* ensure flip_page() won't be called twice */
- pes = NULL;
-}
-
-static int
-draw_slice (uint8_t *image[], int stride[], int w, int h, int x, int y)
-{
- return 0;
-}
-
-static void
-uninit (void)
-{
- if (ivtv_fd < 0)
- return;
-
- /* clear output */
- ivtv_reset (1);
-
- /* close device */
- close (ivtv_fd);
- ivtv_fd = -1;
-}
-
-static void
-check_events (void)
-{
- /* do nothing */
-}
-
-static int
-query_format (uint32_t format)
-{
- if (format != IMGFMT_MPEGPES)
- return 0;
-
- return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_TIMER;
-}
-
-static int
-control (uint32_t request, void *data)
-{
- switch (request)
- {
- case VOCTRL_PAUSE:
- case VOCTRL_RESUME:
- return ivtv_reset (0);
-
- case VOCTRL_RESET:
- return ivtv_reset (1);
-
- case VOCTRL_QUERY_FORMAT:
- return query_format (*((uint32_t*) data));
- }
-
- return VO_NOTIMPL;
-}
diff --git a/libvo/vo_ivtv.h b/libvo/vo_ivtv.h
deleted file mode 100644
index da957b4a70..0000000000
--- a/libvo/vo_ivtv.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * video output for WinTV PVR-150/250/350 (a.k.a IVTV) cards
- * TV-Out through hardware MPEG decoder
- * Based on some old code from ivtv driver authors.
- * See http://ivtvdriver.org/index.php/Main_Page for more details on the
- * cards supported by the ivtv driver.
- *
- * Copyright (C) 2006 Benjamin Zores
- *
- * 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.
- */
-
-#ifndef MPLAYER_VO_IVTV_H
-#define MPLAYER_VO_IVTV_H
-
-extern int ivtv_fd;
-
-int ivtv_write(const unsigned char *data, int len);
-
-#endif /* MPLAYER_VO_IVTV_H */
diff --git a/libvo/vo_mga.c b/libvo/vo_mga.c
deleted file mode 100644
index df99251847..0000000000
--- a/libvo/vo_mga.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * video output through mga_vid kernel driver
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "mp_msg.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <linux/fb.h>
-
-#include "drivers/mga_vid.h"
-#include "sub/sub.h"
-#include "aspect.h"
-
-static const vo_info_t info =
-{
- "Matrox G200/G4x0/G550 overlay (/dev/mga_vid)",
- "mga",
- "A'rpi",
- "Based on some code by Aaron Holtzman <aholtzma@ess.engr.uvic.ca>"
-};
-
-const LIBVO_EXTERN(mga)
-
-#include "mga_template.c"
-
-#define FBDEV "/dev/fb0"
-
-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)
-{
-
-// if (f >= 0) mga_uninit();
- if(!vo_screenwidth || !vo_screenheight) {
- int fd;
- struct fb_var_screeninfo fbinfo;
-
- if(-1 != (fd = open(FBDEV, O_RDONLY))) {
- if(0 == ioctl(fd, FBIOGET_VSCREENINFO, &fbinfo)) {
- if(!vo_screenwidth) vo_screenwidth = fbinfo.xres;
- if(!vo_screenheight) vo_screenheight = fbinfo.yres;
- } else {
- perror("FBIOGET_VSCREENINFO");
- }
- close(fd);
- } else {
- perror(FBDEV);
- }
- }
-
- if(vo_screenwidth && vo_screenheight){
- aspect_save_orig(width,height);
- aspect_save_prescale(d_width,d_height);
- aspect_save_screenres(vo_screenwidth,vo_screenheight);
-
- if(flags&VOFLAG_FULLSCREEN) { /* -fs */
- aspect(&d_width,&d_height,A_ZOOM);
- vo_fs = VO_TRUE;
- } else {
- aspect(&d_width,&d_height,A_NOZOOM);
- vo_fs = VO_FALSE;
- }
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_MGA] aspect(): resized to %dx%d.\n",d_width,d_height);
- }
-
- vo_dwidth=d_width; vo_dheight=d_height;
- mga_vid_config.dest_width = d_width;
- mga_vid_config.dest_height= d_height;
- mga_vid_config.x_org= 0; // (720-mga_vid_config.dest_width)/2;
- mga_vid_config.y_org= 0; // (576-mga_vid_config.dest_height)/2;
- if(vo_screenwidth && vo_screenheight){
- mga_vid_config.x_org=(vo_screenwidth-d_width)/2;
- mga_vid_config.y_org=(vo_screenheight-d_height)/2;
- }
-
- return mga_init(width,height,format);
-}
-
-static void uninit(void)
-{
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO] uninit!\n");
- mga_uninit();
-}
-
-static void flip_page(void)
-{
- vo_mga_flip_page();
-}
-
-
-static void check_events(void)
-{
-}
diff --git a/libvo/vo_mpegpes.c b/libvo/vo_mpegpes.c
deleted file mode 100644
index cae6278e8f..0000000000
--- a/libvo/vo_mpegpes.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * based on: test_av.c - test program for new API
- *
- * Copyright (C) 2000 Ralph Metzler <ralph@convergence.de>
- * & Marcus Metzler <marcus@convergence.de>
- * for convergence integrated media GmbH
- *
- * MPEG-PS multiplexer, part of FFmpeg
- * Copyright Gerard Lantau (see http://ffmpeg.org)
- *
- * 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 "config.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include "mp_msg.h"
-
-#ifdef CONFIG_DVB
-#define true 1
-#define false 0
-#include <poll.h>
-
-#include <sys/ioctl.h>
-#include <stdio.h>
-#include <time.h>
-
-#include <linux/dvb/dmx.h>
-#include <linux/dvb/frontend.h>
-#include <linux/dvb/video.h>
-#include <linux/dvb/audio.h>
-#endif
-
-#include "config.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-#include "libmpdemux/mpeg_packetizer.h"
-
-int vo_mpegpes_fd=-1;
-extern int ao_mpegpes_fd;
-
-static const vo_info_t info =
-{
-#ifdef CONFIG_DVB
- "MPEG-PES to DVB card",
-#else
- "MPEG-PES file",
-#endif
- "mpegpes",
- "A'rpi",
- ""
-};
-
-const LIBVO_EXTERN (mpegpes)
-
-static int
-config(uint32_t s_width, uint32_t s_height, uint32_t width, uint32_t height, uint32_t flags, char *title, uint32_t format)
-{
-#ifdef CONFIG_DVB
- switch(s_height){
- case 288:
- case 576:
- case 240:
- case 480:
- break;
- default:
- mp_msg(MSGT_VO,MSGL_ERR,"DVB: height=%d not supported (try 240/480 (ntsc) or 288/576 (pal)\n",s_height);
- return -1;
- }
-#endif
- return 0;
-}
-
-static int preinit(const char *arg){
-#ifdef CONFIG_DVB
- int card = -1;
- char vo_file[30], ao_file[30], *tmp;
-
- if(arg != NULL){
- if((tmp = strstr(arg, "card=")) != NULL) {
- card = atoi(&tmp[5]);
- if((card < 1) || (card > 4)) {
- mp_msg(MSGT_VO, MSGL_ERR, "DVB card number must be between 1 and 4\n");
- return -1;
- }
- card--;
- arg = NULL;
- }
- }
-
- if(!arg){
- //|O_NONBLOCK
- //search the first usable card
- if(card==-1) {
- int n;
- for(n=0; n<4; n++) {
- sprintf(vo_file, "/dev/dvb/adapter%d/video0", n);
- if(access(vo_file, F_OK | W_OK)==0) {
- card = n;
- break;
- }
- }
- }
- if(card==-1) {
- mp_msg(MSGT_VO,MSGL_INFO, "Couldn't find a usable dvb video device, exiting\n");
- return -1;
- }
- mp_msg(MSGT_VO,MSGL_INFO, "Opening /dev/dvb/adapter%d/video0+audio0\n", card);
- sprintf(vo_file, "/dev/dvb/adapter%d/video0", card);
- sprintf(ao_file, "/dev/dvb/adapter%d/audio0", card);
- if((vo_mpegpes_fd = open(vo_file,O_RDWR)) < 0){
- perror("DVB VIDEO DEVICE: ");
- return -1;
- }
- if ( (ioctl(vo_mpegpes_fd,VIDEO_SET_BLANK, false) < 0)){
- perror("DVB VIDEO SET BLANK: ");
- return -1;
- }
- if ( (ioctl(vo_mpegpes_fd,VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY) < 0)){
- perror("DVB VIDEO SELECT SOURCE: ");
- return -1;
- }
- if ( (ioctl(vo_mpegpes_fd,VIDEO_PLAY) < 0)){
- perror("DVB VIDEO PLAY: ");
- return -1;
- }
- return 0;
- }
-#endif
- arg = (arg ? arg : "grab.mpg");
- mp_msg(MSGT_VO,MSGL_INFO, "Saving PES stream to %s\n", arg);
- vo_mpegpes_fd=open(arg,O_WRONLY|O_CREAT,0666);
- if(vo_mpegpes_fd<0){
- perror("vo_mpegpes");
- return -1;
- }
- return 0;
-}
-
-
-static void draw_osd(void)
-{
-}
-
-
-static int my_write(const unsigned char* data,int len){
- int orig_len = len;
-#ifdef CONFIG_DVB
-#define NFD 2
- struct pollfd pfd[NFD];
-
-// printf("write %d bytes \n",len);
-
- pfd[0].fd = vo_mpegpes_fd;
- pfd[0].events = POLLOUT;
-
- pfd[1].fd = ao_mpegpes_fd;
- pfd[1].events = POLLOUT;
-
- while(len>0){
- if (poll(pfd,NFD,1)){
- if (pfd[0].revents & POLLOUT){
- int ret=write(vo_mpegpes_fd,data,len);
-// printf("ret=%d \n",ret);
- if(ret<=0){
- perror("write");
- usleep(0);
- } else {
- len-=ret; data+=ret;
- }
- } else usleep(1000);
- }
- }
-
-#else
- write(vo_mpegpes_fd,data,len); // write to file
-#endif
- return orig_len;
-}
-
-static void send_pes_packet(unsigned char* data, int len, int id, int timestamp)
-{
- send_mpeg_pes_packet (data, len, id, timestamp, 1, my_write);
-}
-
-static int draw_frame(uint8_t * src[])
-{
- vo_mpegpes_t *p=(vo_mpegpes_t *)src[0];
- send_pes_packet(p->data,p->size,p->id,(p->timestamp>0)?p->timestamp:vo_pts); // video data
- return 0;
-}
-
-static void flip_page (void)
-{
-}
-
-static int draw_slice(uint8_t *srcimg[], int stride[], int w,int h,int x0,int y0)
-{
- return 0;
-}
-
-
-static int
-query_format(uint32_t format)
-{
- if(format==IMGFMT_MPEGPES) return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_TIMER;
- return 0;
-}
-
-static void
-uninit(void)
-{
- if(ao_mpegpes_fd >= 0 && ao_mpegpes_fd != vo_mpegpes_fd) close(ao_mpegpes_fd);
- ao_mpegpes_fd = -1;
- if(vo_mpegpes_fd>=0){ close(vo_mpegpes_fd);vo_mpegpes_fd=-1;}
-}
-
-
-static void check_events(void)
-{
-}
-
-static int control(uint32_t request, void *data)
-{
- switch (request) {
- case VOCTRL_QUERY_FORMAT:
- return query_format(*((uint32_t*)data));
- }
- return VO_NOTIMPL;
-}
diff --git a/libvo/vo_s3fb.c b/libvo/vo_s3fb.c
deleted file mode 100644
index bd04ea29a7..0000000000
--- a/libvo/vo_s3fb.c
+++ /dev/null
@@ -1,560 +0,0 @@
-/*
- * copyright (C) 2006 Mark Sanderson <mmp@kiora.ath.cx>
- *
- * 30-Mar-2006 Modified from tdfxfb.c by Mark Zealey
- *
- * 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.
- */
-
-/* Hints and tricks:
- * - Use -dr to get direct rendering
- * - Use -vf yuy2 to get yuy2 rendering, *MUCH* faster than yv12
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <linux/fb.h>
-#include <sys/io.h>
-
-#include "config.h"
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-#include "mp_msg.h"
-#include "fastmemcpy.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-#include "aspect.h"
-#include "sub/sub.h"
-
-static const vo_info_t info =
- {
- "S3 Virge over fbdev",
- "s3fb",
- "Mark Sanderson <mmp@kiora.ath.cx>",
- ""
- };
-
-const LIBVO_EXTERN(s3fb)
-
-typedef struct vga_type {
- int cr38, cr39, cr53;
- unsigned char *mmio;
-} vga_t;
-
-static vga_t *v = NULL;
-static int fd = -1;
-static struct fb_fix_screeninfo fb_finfo;
-static struct fb_var_screeninfo fb_vinfo;
-static uint32_t in_width, in_height, in_format, in_depth, in_s3_format,
- screenwidth, screenheight, screendepth, screenstride,
- vidwidth, vidheight, vidx, vidy, page, offset, sreg;
-static char *inpage, *inpage0, *smem = NULL;
-static void (*alpha_func)();
-
-static void clear_screen(void);
-
-/* streams registers */
-#define PSTREAM_CONTROL_REG 0x8180
-#define COL_CHROMA_KEY_CONTROL_REG 0x8184
-#define SSTREAM_CONTROL_REG 0x8190
-#define CHROMA_KEY_UPPER_BOUND_REG 0x8194
-#define SSTREAM_STRETCH_REG 0x8198
-#define BLEND_CONTROL_REG 0x81A0
-#define PSTREAM_FBADDR0_REG 0x81C0
-#define PSTREAM_FBADDR1_REG 0x81C4
-#define PSTREAM_STRIDE_REG 0x81C8
-#define DOUBLE_BUFFER_REG 0x81CC
-#define SSTREAM_FBADDR0_REG 0x81D0
-#define SSTREAM_FBADDR1_REG 0x81D4
-#define SSTREAM_STRIDE_REG 0x81D8
-#define OPAQUE_OVERLAY_CONTROL_REG 0x81DC
-#define K1_VSCALE_REG 0x81E0
-#define K2_VSCALE_REG 0x81E4
-#define DDA_VERT_REG 0x81E8
-#define STREAMS_FIFO_REG 0x81EC
-#define PSTREAM_START_REG 0x81F0
-#define PSTREAM_WINDOW_SIZE_REG 0x81F4
-#define SSTREAM_START_REG 0x81F8
-#define SSTREAM_WINDOW_SIZE_REG 0x81FC
-
-#define S3_MEMBASE sreg
-#define S3_NEWMMIO_REGBASE 0x1000000 /* 16MB */
-#define S3_NEWMMIO_REGSIZE 0x10000 /* 64KB */
-#define S3V_MMIO_REGSIZE 0x8000 /* 32KB */
-#define S3_NEWMMIO_VGABASE (S3_NEWMMIO_REGBASE + 0x8000)
-
-#define OUTREG(mmreg, value) *(unsigned int *)(&v->mmio[mmreg]) = value
-
-static int readcrtc(int reg)
-{
- outb(reg, 0x3d4);
- return inb(0x3d5);
-}
-
-static void writecrtc(int reg, int value)
-{
- outb(reg, 0x3d4);
- outb(value, 0x3d5);
-}
-
-// enable S3 registers
-static int enable(void)
-{
- int fd;
-
- if (v)
- return 1;
- errno = 0;
- v = malloc(sizeof(vga_t));
- if (v) {
- if (ioperm(0x3d4, 2, 1) == 0) {
- fd = open("/dev/mem", O_RDWR);
- if (fd != -1) {
- v->mmio = mmap(0, S3_NEWMMIO_REGSIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd,
- S3_MEMBASE + S3_NEWMMIO_REGBASE);
- close(fd);
- if (v->mmio != MAP_FAILED) {
- v->cr38 = readcrtc(0x38);
- v->cr39 = readcrtc(0x39);
- v->cr53 = readcrtc(0x53);
- writecrtc(0x38, 0x48);
- writecrtc(0x39, 0xa5);
- writecrtc(0x53, 0x08);
- return 1;
- }
- }
- iopl(0);
- }
- free(v);
- v = NULL;
- }
- return 0;
-}
-
-static void disable(void)
-{
- if (v) {
- writecrtc(0x53, v->cr53);
- writecrtc(0x39, v->cr39);
- writecrtc(0x38, v->cr38);
- ioperm(0x3d4, 2, 0);
- munmap(v->mmio, S3_NEWMMIO_REGSIZE);
- free(v);
- v = NULL;
- }
-}
-
-static int yuv_on(int format, int src_w, int src_h, int dst_x, int dst_y,
- int dst_w, int dst_h, int crop, int xres, int yres,
- int line_length, int offset)
-{
- int tmp, pitch, start, src_wc, src_hc, bpp;
-
- if (format == 0 || format == 7)
- bpp = 4;
- else if (format == 6)
- bpp = 3;
- else
- bpp = 2;
-
- src_wc = src_w - crop * 2;
- src_hc = src_h - crop * 2;
- pitch = src_w * bpp;
-
- // video card memory layout:
- // 0-n: visible screen memory, n = width * height * bytes per pixel
- // n-m: scaler source memory, n is aligned to a page boundary
- // m+: scaler source memory for multiple buffers
-
- // offset is the first aligned byte after the screen memory, where the scaler input buffer is
- tmp = (yres * line_length + 4095) & ~4095;
- offset += tmp;
-
- // start is the top left viewable scaler input pixel
- start = offset + crop * pitch + crop * bpp;
-
- OUTREG(COL_CHROMA_KEY_CONTROL_REG, 0x47000000);
- OUTREG(CHROMA_KEY_UPPER_BOUND_REG, 0x0);
- OUTREG(BLEND_CONTROL_REG, 0x00000020);
- OUTREG(DOUBLE_BUFFER_REG, 0x0); /* Choose fbaddr0 as stream source. */
- OUTREG(OPAQUE_OVERLAY_CONTROL_REG, 0x0);
-
- OUTREG(PSTREAM_CONTROL_REG, 0x06000000);
- OUTREG(PSTREAM_FBADDR0_REG, 0x0);
- OUTREG(PSTREAM_FBADDR1_REG, 0x0);
- OUTREG(PSTREAM_STRIDE_REG, line_length);
- OUTREG(PSTREAM_START_REG, 0x00010001);
- OUTREG(PSTREAM_WINDOW_SIZE_REG, 0x00010001);
- //OUTREG(SSTREAM_WINDOW_SIZE_REG, ( ((xres-1) << 16) | yres) & 0x7ff07ff);
-
- if (dst_w == src_w)
- tmp = 0;
- else
- tmp = 2;
- /* format 1=YCbCr-16 2=YUV-16 3=BGR15 4=YUV-16/32(mixed 2/4byte stride) 5=BGR16 6=BGR24 0,7=BGR32 */
- /* The YUV format pixel has a range of value from 0 to 255, while the YCbCr format pixel values are in the range of 16 to 240. */
- OUTREG(SSTREAM_CONTROL_REG, tmp << 28 | (format << 24) |
- ((((src_wc-1)<<1)-(dst_w-1)) & 0xfff));
- OUTREG(SSTREAM_STRETCH_REG,
- ((src_wc - 1) & 0x7ff) | (((src_wc - dst_w-1) & 0x7ff) << 16));
- OUTREG(SSTREAM_FBADDR0_REG, start & 0x3fffff );
- OUTREG(SSTREAM_STRIDE_REG, pitch & 0xfff );
- OUTREG(SSTREAM_START_REG, ((dst_x + 1) << 16) | (dst_y + 1));
- OUTREG(SSTREAM_WINDOW_SIZE_REG, ( ((dst_w-1) << 16) | (dst_h ) ) & 0x7ff07ff);
- OUTREG(K1_VSCALE_REG, src_hc - 1 );
- OUTREG(K2_VSCALE_REG, (src_hc - dst_h) & 0x7ff );
- /* 0xc000 = bw & vert interp */
- /* 0x8000 = no bw save */
- OUTREG(DDA_VERT_REG, (((~dst_h)-1) & 0xfff ) | 0xc000);
- writecrtc(0x92, (((pitch + 7) / 8) >> 8) | 0x80);
- writecrtc(0x93, (pitch + 7) / 8);
-
- writecrtc(0x67, readcrtc(0x67) | 0x4);
-
- return offset;
-}
-
-static void yuv_off(void)
-{
- writecrtc(0x67, readcrtc(0x67) & ~0xc);
- memset(v->mmio + 0x8180, 0, 0x80);
- OUTREG(0x81b8, 0x900);
- OUTREG(0x81bc, 0x900);
- OUTREG(0x81c8, 0x900);
- OUTREG(0x81cc, 0x900);
- OUTREG(0x81d8, 0x1);
- OUTREG(0x81f8, 0x07ff07ff);
- OUTREG(0x81fc, 0x00010001);
- writecrtc(0x92, 0);
- writecrtc(0x93, 0);
-}
-
-static int preinit(const char *arg)
-{
- char *name;
-
- if(arg)
- name = (char*)arg;
- else if(!(name = getenv("FRAMEBUFFER")))
- name = "/dev/fb0";
-
- if((fd = open(name, O_RDWR)) == -1) {
- mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: can't open %s: %s\n", name, strerror(errno));
- return -1;
- }
-
- if(ioctl(fd, FBIOGET_FSCREENINFO, &fb_finfo)) {
- mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: problem with FBITGET_FSCREENINFO ioctl: %s\n",
- strerror(errno));
- close(fd);
- fd = -1;
- return -1;
- }
-
- if(ioctl(fd, FBIOGET_VSCREENINFO, &fb_vinfo)) {
- mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: problem with FBITGET_VSCREENINFO ioctl: %s\n",
- strerror(errno));
- close(fd);
- fd = -1;
- return -1;
- }
-
- // Check the depth now as config() musn't fail
- switch(fb_vinfo.bits_per_pixel) {
- case 16:
- case 24:
- case 32:
- break; // Ok
- default:
- mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: %d bpp output is not supported\n", fb_vinfo.bits_per_pixel);
- close(fd);
- fd = -1;
- return -1;
- }
-
- /* Open up a window to the hardware */
- smem = mmap(0, fb_finfo.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
- sreg = fb_finfo.smem_start;
-
- if(smem == (void *)-1) {
- mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: Couldn't map memory areas: %s\n", strerror(errno));
- smem = NULL;
- close(fd);
- fd = -1;
- return -1;
- }
-
- if (!enable()) {
- mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: Couldn't map S3 registers: %s\n", strerror(errno));
- close(fd);
- fd = -1;
- return -1;
- }
-
- return 0; // Success
-}
-
-/* And close our mess */
-static void uninit(void)
-{
- if (inpage0) {
- clear_screen();
- yuv_off();
- inpage0 = NULL;
- }
-
- if(smem) {
- munmap(smem, fb_finfo.smem_len);
- smem = NULL;
- }
-
- disable();
-
- if(fd != -1) {
- close(fd);
- fd = -1;
- }
-}
-
-static void clear_screen(void)
-{
- if (inpage0) {
- int n;
-
- memset(smem, 0, screenheight * screenstride);
-
- if (in_format == IMGFMT_YUY2) {
- unsigned short *ptr;
- int i;
-
- ptr = (unsigned short *)inpage0;
- n = in_width * in_height;
- if (vo_doublebuffering)
- n *= 2;
- for(i=0; i<n; i++)
- *ptr++ = 0x8000;
-
- } else {
- n = in_depth * in_width * in_height;
- if (vo_doublebuffering)
- n *= 2;
- memset(inpage0, 0, n);
- }
- }
-}
-
-/* Setup output screen dimensions etc */
-static void setup_screen(uint32_t full)
-{
- int inpageoffset;
-
- aspect(&vidwidth, &vidheight, full ? A_ZOOM : A_NOZOOM);
-
- // center picture
- vidx = (screenwidth - vidwidth) / 2;
- vidy = (screenheight - vidheight) / 2;
-
- geometry(&vidx, &vidy, &vidwidth, &vidheight, screenwidth, screenheight);
- vo_fs = full;
-
- inpageoffset = yuv_on(in_s3_format, in_width, in_height, vidx, vidy, vidwidth, vidheight, 0, screenwidth, screenheight, screenstride, 0);
- inpage0 = smem + inpageoffset;
- inpage = inpage0;
- mp_msg(MSGT_VO, MSGL_INFO, "s3fb: output is at %dx%d +%dx%d\n", vidx, vidy, vidwidth, vidheight);
-
- clear_screen();
-}
-
-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)
-{
- screenwidth = fb_vinfo.xres;
- screenheight = fb_vinfo.yres;
- screenstride = fb_finfo.line_length;
- aspect_save_screenres(fb_vinfo.xres,fb_vinfo.yres);
-
- in_width = width;
- in_height = height;
- in_format = format;
- aspect_save_orig(width,height);
-
- aspect_save_prescale(d_width,d_height);
-
- /* Setup the screen for rendering to */
- screendepth = fb_vinfo.bits_per_pixel / 8;
-
- switch(in_format) {
-
- case IMGFMT_YUY2:
- in_depth = 2;
- in_s3_format = 1;
- alpha_func = vo_draw_alpha_yuy2;
- break;
-
- case IMGFMT_BGR15:
- in_depth = 2;
- in_s3_format = 3;
- alpha_func = vo_draw_alpha_rgb16;
- break;
-
- case IMGFMT_BGR16:
- in_depth = 2;
- in_s3_format = 5;
- alpha_func = vo_draw_alpha_rgb16;
- break;
-
- case IMGFMT_BGR24:
- in_depth = 3;
- in_s3_format = 6;
- alpha_func = vo_draw_alpha_rgb24;
- break;
-
- case IMGFMT_BGR32:
- in_depth = 4;
- in_s3_format = 7;
- alpha_func = vo_draw_alpha_rgb32;
- break;
-
- default:
- mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: Eik! Something's wrong with control().\n");
- return -1;
- }
-
- offset = in_width * in_depth * in_height;
- if (vo_doublebuffering)
- page = offset;
- else
- page = 0;
-
- if(screenheight * screenstride + page + offset > fb_finfo.smem_len) {
- mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: Not enough video memory to play this movie. Try at a lower resolution\n");
- return -1;
- }
-
- setup_screen(flags & VOFLAG_FULLSCREEN);
- if (vo_doublebuffering)
- inpage = inpage0 + page;
-
- mp_msg(MSGT_VO, MSGL_INFO, "s3fb: screen is %dx%d at %d bpp, in is %dx%d at %d bpp, norm is %dx%d\n",
- screenwidth, screenheight, screendepth * 8,
- in_width, in_height, in_depth * 8,
- d_width, d_height);
-
- return 0;
-}
-
-static void draw_alpha(int x, int y, int w, int h, unsigned char *src,
- unsigned char *srca, int stride)
-{
- char *dst = inpage + (y * in_width + x) * in_depth;
- alpha_func(w, h, src, srca, stride, dst, in_width * in_depth);
-}
-
-static void draw_osd(void)
-{
- if (!vo_doublebuffering)
- vo_draw_text(in_width, in_height, draw_alpha);
-}
-
-/* Render onto the screen */
-static void flip_page(void)
-{
- if(vo_doublebuffering) {
- vo_draw_text(in_width, in_height, draw_alpha);
- yuv_on(in_s3_format, in_width, in_height, vidx, vidy, vidwidth, vidheight, 0, screenwidth, screenheight, screenstride, page);
- page ^= offset;
- inpage = inpage0 + page;
- }
-}
-
-static int draw_frame(uint8_t *src[])
-{
- mem2agpcpy(inpage, src[0], in_width * in_depth * in_height);
- return 0;
-}
-
-static int draw_slice(uint8_t *i[], int s[], int w, int h, int x, int y)
-{
- return 1;
-}
-
-/* Attempt to start doing DR */
-static uint32_t get_image(mp_image_t *mpi)
-{
-
- if(mpi->flags & MP_IMGFLAG_READABLE)
- return VO_FALSE;
- if(mpi->type == MP_IMGTYPE_STATIC && vo_doublebuffering)
- return VO_FALSE;
- if(mpi->type > MP_IMGTYPE_TEMP)
- return VO_FALSE; // TODO ??
-
- switch(in_format) {
- case IMGFMT_BGR15:
- case IMGFMT_BGR16:
- case IMGFMT_BGR24:
- case IMGFMT_BGR32:
- case IMGFMT_YUY2:
- mpi->planes[0] = inpage;
- mpi->stride[0] = in_width * in_depth;
- break;
-
- default:
- return VO_FALSE;
- }
-
- mpi->width = in_width;
- mpi->flags |= MP_IMGFLAG_DIRECT;
-
- return VO_TRUE;
-}
-
-static int control(uint32_t request, void *data)
-{
- switch(request) {
- case VOCTRL_GET_IMAGE:
- return get_image(data);
-
- case VOCTRL_QUERY_FORMAT:
- switch(*((uint32_t*)data)) {
- case IMGFMT_BGR15:
- case IMGFMT_BGR16:
- case IMGFMT_BGR24:
- case IMGFMT_BGR32:
- case IMGFMT_YUY2:
- return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW |
- VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN;
- }
-
- return 0; /* Not supported */
-
- case VOCTRL_FULLSCREEN:
- setup_screen(!vo_fs);
- return 0;
- }
-
- return VO_NOTIMPL;
-}
-
-/* Dummy funcs */
-static void check_events(void) {}
diff --git a/libvo/vo_sdl.c b/libvo/vo_sdl.c
deleted file mode 100644
index 71cf75323a..0000000000
--- a/libvo/vo_sdl.c
+++ /dev/null
@@ -1,1534 +0,0 @@
-/*
- * vo_sdl.c
- *
- * (was video_out_sdl.c from OMS project/mpeg2dec -> http://linuxvideo.org)
- *
- * Copyright (C) Ryan C. Gordon <icculus@lokigames.com> - April 22, 2000
- *
- * Copyright (C) Felix Buenemann <atmosfear@users.sourceforge.net> - 2001
- *
- * (for extensive code enhancements)
- *
- * Current maintainer for MPlayer project (report bugs to that address):
- * Felix Buenemann <atmosfear@users.sourceforge.net>
- *
- * This file is a video out driver using the SDL library (http://libsdl.org/),
- * to be used with MPlayer, further info from http://www.mplayerhq.hu
- *
- * -- old disclaimer --
- *
- * A mpeg2dec display driver that does output through the
- * Simple DirectMedia Layer (SDL) library. This effectively gives us all
- * sorts of output options: X11, SVGAlib, fbcon, AAlib, GGI. Win32, MacOS
- * and BeOS support, too. Yay. SDL info, source, and binaries can be found
- * at http://slouken.devolution.com/SDL/
- *
- * -- end old disclaimer --
- *
- * 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.
- */
-
-/* define to force software-surface (video surface stored in system memory)*/
-#undef SDL_NOHWSURFACE
-
-/* define to enable surface locks, this might be needed on SMP machines */
-#undef SDL_ENABLE_LOCKS
-
-/* MONITOR_ASPECT MUST BE FLOAT */
-#define MONITOR_ASPECT 4.0/3.0
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "config.h"
-#include "mp_msg.h"
-#include "mp_msg.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-
-#include "fastmemcpy.h"
-#include "sub/sub.h"
-#include "aspect.h"
-#include "libmpcodecs/vfcap.h"
-#include "mpbswap.h"
-
-#ifdef CONFIG_X11
-#include <X11/Xlib.h>
-#include "x11_common.h"
-#endif
-
-#include "subopt-helper.h"
-
-static const vo_info_t info =
-{
- "SDL YUV/RGB/BGR renderer (SDL v1.1.7+ only!)",
- "sdl",
- "Ryan C. Gordon <icculus@lokigames.com>, Felix Buenemann <atmosfear@users.sourceforge.net>",
- ""
-};
-
-const LIBVO_EXTERN(sdl)
-
-#include "sdl_common.h"
-//#include <SDL/SDL_syswm.h>
-
-
-#ifdef SDL_ENABLE_LOCKS
-#define SDL_OVR_LOCK(x) if (SDL_LockYUVOverlay (priv->overlay)) { \
- mp_msg(MSGT_VO,MSGL_V, "SDL: Couldn't lock YUV overlay\n"); \
- return x; \
- }
-#define SDL_OVR_UNLOCK SDL_UnlockYUVOverlay (priv->overlay);
-
-#define SDL_SRF_LOCK(srf, x) if(SDL_MUSTLOCK(srf)) { \
- if(SDL_LockSurface (srf)) { \
- mp_msg(MSGT_VO,MSGL_V, "SDL: Couldn't lock RGB surface\n"); \
- return x; \
- } \
- }
-
-#define SDL_SRF_UNLOCK(srf) if(SDL_MUSTLOCK(srf)) \
- SDL_UnlockSurface (srf);
-#else
-#define SDL_OVR_LOCK(x)
-#define SDL_OVR_UNLOCK
-#define SDL_SRF_LOCK(srf, x)
-#define SDL_SRF_UNLOCK(srf)
-#endif
-
-/** Private SDL Data structure **/
-
-static struct sdl_priv_s {
-
- /* output driver used by sdl */
- char driver[8];
-
- /* SDL display surface */
- SDL_Surface *surface;
-
- /* SDL RGB surface */
- SDL_Surface *rgbsurface;
-
- /* SDL YUV overlay */
- SDL_Overlay *overlay;
-
- /* available fullscreen modes */
- SDL_Rect **fullmodes;
-
- /* surface attributes for fullscreen and windowed mode */
- Uint32 sdlflags, sdlfullflags;
-
- /* save the windowed output extents */
- SDL_Rect windowsize;
-
- /* Bits per Pixel */
- Uint8 bpp;
-
- /* RGB or YUV? */
- Uint8 mode;
- #define YUV 0
- #define RGB 1
- #define BGR 2
-
- /* use direct blitting to surface */
- int dblit;
-
- /* current fullscreen mode, 0 = highest available fullscreen mode */
- int fullmode;
-
- /* YUV ints */
- int framePlaneY, framePlaneUV, framePlaneYUY;
- int stridePlaneY, stridePlaneUV, stridePlaneYUY;
-
- /* RGB ints */
- int framePlaneRGB;
- int stridePlaneRGB;
-
- /* Flip image */
- int flip;
-
- /* fullscreen behaviour; see init */
- int fulltype;
-
- /* is X running (0/1) */
- int X;
-
- /* X11 Resolution */
- int XWidth, XHeight;
-
- /* original image dimensions */
- int width, height;
-
- /* destination dimensions */
- int dstwidth, dstheight;
-
- /* Draw image at coordinate y on the SDL surfaces */
- int y;
-
- /* The image is displayed between those y coordinates in priv->surface */
- int y_screen_top, y_screen_bottom;
-
- /* 1 if the OSD has changed otherwise 0 */
- int osd_has_changed;
-
- /* source image format (YUV/RGB/...) */
- uint32_t format;
-
- /* dirty_off_frame[0] contains a bounding box around the osd contents drawn above the image
- dirty_off_frame[1] is the corresponding thing for OSD contents drawn below the image
- */
- SDL_Rect dirty_off_frame[2];
-} sdl_priv;
-
-static void erase_area_4(int x_start, int width, int height, int pitch, uint32_t color, uint8_t* pixels);
-static void erase_area_1(int x_start, int width, int height, int pitch, uint8_t color, uint8_t* pixels);
-static int setup_surfaces(void);
-static void set_video_mode(int width, int height, int bpp, uint32_t sdlflags);
-static void erase_rectangle(int x, int y, int w, int h);
-
-/* Expand 'rect' to contain the rectangle specified by x, y, w and h */
-static void expand_rect(SDL_Rect* rect, int x, int y, int w, int h)
-{
- if(rect->x < 0 || rect->y < 0) {
- rect->x = x;
- rect->y = y;
- rect->w = w;
- rect->h = h;
- return;
- }
-
- if(rect->x > x)
- rect->x = x;
-
- if(rect->y > y)
- rect->y = y;
-
- if(rect->x + rect->w < x + w)
- rect->w = x + w - rect->x;
-
- if(rect->y + rect->h < y + h)
- rect->h = y + h - rect->y;
-}
-
-/** libvo Plugin functions **/
-
-/**
- * draw_alpha is used for osd and subtitle display.
- *
- **/
-
-static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
- struct sdl_priv_s *priv = &sdl_priv;
-
- if(priv->osd_has_changed) {
- /* OSD did change. Store a bounding box of everything drawn into the OSD */
- if(priv->y >= y0) {
- /* Make sure we don't mark part of the frame area dirty */
- if(h + y0 > priv->y)
- expand_rect(&priv->dirty_off_frame[0], x0, y0, w, priv->y - y0);
- else
- expand_rect(&priv->dirty_off_frame[0], x0, y0, w, h);
- }
- else if(priv->y + priv->height <= y0 + h) {
- /* Make sure we don't mark part of the frame area dirty */
- if(y0 < priv->y + priv->height)
- expand_rect(&priv->dirty_off_frame[1], x0,
- priv->y + priv->height,
- w, h - ((priv->y + priv->height) - y0));
- else
- expand_rect(&priv->dirty_off_frame[1], x0, y0, w, h);
- }
- }
- else { /* OSD contents didn't change only draw parts that was erased by the frame */
- if(priv->y >= y0) {
- src = src + (priv->y - y0) * stride;
- srca = srca + (priv->y - y0) * stride;
- h -= priv->y - y0;
- y0 = priv->y;
- }
-
- if(priv->y + priv->height <= y0 + h)
- h = priv->y + priv->height - y0;
-
- if(h <= 0)
- return;
- }
-
- switch(priv->format) {
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- vo_draw_alpha_yv12(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->overlay->pitches[0]*y0+x0,priv->overlay->pitches[0]);
- break;
- case IMGFMT_YUY2:
- case IMGFMT_YVYU:
- x0 *= 2;
- vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->overlay->pitches[0]*y0+x0,priv->overlay->pitches[0]);
- break;
- case IMGFMT_UYVY:
- x0 *= 2;
- vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->overlay->pitches[0]*y0+x0,priv->overlay->pitches[0]);
- break;
-
- default:
- if(priv->dblit) {
- x0 *= priv->surface->format->BytesPerPixel;
- switch(priv->format) {
- case IMGFMT_RGB15:
- case IMGFMT_BGR15:
- vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+y0*priv->surface->pitch+x0,priv->surface->pitch);
- break;
- case IMGFMT_RGB16:
- case IMGFMT_BGR16:
- vo_draw_alpha_rgb16(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+y0*priv->surface->pitch+x0,priv->surface->pitch);
- break;
- case IMGFMT_RGB24:
- case IMGFMT_BGR24:
- vo_draw_alpha_rgb24(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+y0*priv->surface->pitch+x0,priv->surface->pitch);
- break;
- case IMGFMT_RGB32:
- case IMGFMT_BGR32:
- vo_draw_alpha_rgb32(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+y0*priv->surface->pitch+x0,priv->surface->pitch);
- break;
- }
- }
- else {
- x0 *= priv->rgbsurface->format->BytesPerPixel;
- switch(priv->format) {
- case IMGFMT_RGB15:
- case IMGFMT_BGR15:
- vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+y0*priv->rgbsurface->pitch+x0,priv->rgbsurface->pitch);
- break;
- case IMGFMT_RGB16:
- case IMGFMT_BGR16:
- vo_draw_alpha_rgb16(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+y0*priv->rgbsurface->pitch+x0,priv->rgbsurface->pitch);
- break;
- case IMGFMT_RGB24:
- case IMGFMT_BGR24:
- vo_draw_alpha_rgb24(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+y0*priv->rgbsurface->pitch+x0,priv->rgbsurface->pitch);
- break;
- case IMGFMT_RGB32:
- case IMGFMT_BGR32:
- vo_draw_alpha_rgb32(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+y0*priv->rgbsurface->pitch+x0,priv->rgbsurface->pitch);
- break;
- }
- }
-
- }
-}
-
-
-/**
- * Take a null-terminated array of pointers, and find the last element.
- *
- * params : array == array of which we want to find the last element.
- * returns : index of last NON-NULL element.
- **/
-
-static inline int findArrayEnd (SDL_Rect **array)
-{
- int i = 0;
- while ( array[i++] ); /* keep loopin' ... */
-
- /* return the index of the last array element */
- return i - 1;
-}
-
-
-/**
- * Open and prepare SDL output.
- *
- * params : *plugin ==
- * *name ==
- * returns : 0 on success, -1 on failure
- **/
-
-static int sdl_open (void *plugin, void *name)
-{
- struct sdl_priv_s *priv = &sdl_priv;
- const SDL_VideoInfo *vidInfo = NULL;
- /*static int opened = 0;
-
- if (opened)
- return 0;
- opened = 1;*/
-
-
- /* other default values */
- #ifdef SDL_NOHWSURFACE
- mp_msg(MSGT_VO,MSGL_V, "SDL: using software-surface\n");
- priv->sdlflags = SDL_SWSURFACE|SDL_RESIZABLE|SDL_ANYFORMAT;
- priv->sdlfullflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ANYFORMAT;
- // XXX:FIXME: ASYNCBLIT should be enabled for SMP systems
- #else
- /*if((strcmp(priv->driver, "dga") == 0) && (priv->mode)) {
- if( mp_msg_test(MSGT_VO,MSGL_V) ) {
- printf("SDL: using software-surface\n"); }
- priv->sdlflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ASYNCBLIT|SDL_HWACCEL|SDL_ANYFORMAT;
- priv->sdlfullflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ASYNCBLIT|SDL_HWACCEL|SDL_ANYFORMAT;
- }
- else { */
- mp_msg(MSGT_VO,MSGL_V, "SDL: using hardware-surface\n");
- priv->sdlflags = SDL_HWSURFACE|SDL_RESIZABLE/*|SDL_ANYFORMAT*/;
- priv->sdlfullflags = SDL_HWSURFACE|SDL_FULLSCREEN/*|SDL_ANYFORMAT*/;
- // XXX:FIXME: ASYNCBLIT should be enabled for SMP systems
- //}
- #endif
-
-#if !defined( __AMIGAOS4__ ) && !defined( __APPLE__ )
- priv->sdlfullflags |= SDL_DOUBLEBUF;
- if (vo_doublebuffering)
- priv->sdlflags |= SDL_DOUBLEBUF;
-#endif
-
- /* get information about the graphics adapter */
- vidInfo = SDL_GetVideoInfo ();
-
- /* collect all fullscreen & hardware modes available */
- if (!(priv->fullmodes = SDL_ListModes (vidInfo->vfmt, priv->sdlfullflags))) {
-
- /* non hardware accelerated fullscreen modes */
- priv->sdlfullflags &= ~SDL_HWSURFACE;
- priv->fullmodes = SDL_ListModes (vidInfo->vfmt, priv->sdlfullflags);
- }
-
- /* test for normal resizeable & windowed hardware accellerated surfaces */
- if (!SDL_ListModes (vidInfo->vfmt, priv->sdlflags)) {
-
- /* test for NON hardware accelerated resizeable surfaces - poor you.
- * That's all we have. If this fails there's nothing left.
- * Theoretically there could be Fullscreenmodes left - we ignore this for now.
- */
- priv->sdlflags &= ~SDL_HWSURFACE;
- if ((!SDL_ListModes (vidInfo->vfmt, priv->sdlflags)) && (!priv->fullmodes)) {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_SDL] Couldn't get any acceptable SDL Mode for output.\n");
- return -1;
- }
- }
-
-
- /* YUV overlays need at least 16-bit color depth, but the
- * display might less. The SDL AAlib target says it can only do
- * 8-bits, for example. So, if the display is less than 16-bits,
- * we'll force the BPP to 16, and pray that SDL can emulate for us.
- */
- priv->bpp = vidInfo->vfmt->BitsPerPixel;
- if (priv->mode == YUV && priv->bpp < 16) {
-
- mp_msg(MSGT_VO,MSGL_V, "SDL: Your SDL display target wants to be at a color "
- "depth of (%d), but we need it to be at least 16 "
- "bits, so we need to emulate 16-bit color. This is "
- "going to slow things down; you might want to "
- "increase your display's color depth, if possible.\n",
- priv->bpp);
-
- priv->bpp = 16;
- }
-
- /* Success! */
- return 0;
-}
-
-
-/**
- * Close SDL, Cleanups, Free Memory
- *
- * params : *plugin
- * returns : non-zero on success, zero on error.
- **/
-
-static int sdl_close (void)
-{
- struct sdl_priv_s *priv = &sdl_priv;
-
- if (priv->fullmode)
- SDL_ShowCursor(1);
-
- /* Cleanup YUV Overlay structure */
- if (priv->overlay) {
- SDL_FreeYUVOverlay(priv->overlay);
- priv->overlay=NULL;
- }
-
- /* Free RGB Surface */
- if (priv->rgbsurface) {
- SDL_FreeSurface(priv->rgbsurface);
- priv->rgbsurface=NULL;
- }
-
- /* Free our blitting surface */
- if (priv->surface) {
- SDL_FreeSurface(priv->surface);
- priv->surface=NULL;
- }
-
- /* DON'T attempt to free the fullscreen modes array. SDL_Quit* does this for us */
-
- return 0;
-}
-
-/**
- * Do aspect ratio calculations
- *
- * params : srcw == sourcewidth
- * srch == sourceheight
- * dstw == destinationwidth
- * dsth == destinationheight
- *
- * returns : SDL_Rect structure with new x and y, w and h
- **/
-
-#if 0
-static SDL_Rect aspect(int srcw, int srch, int dstw, int dsth) {
- SDL_Rect newres;
- mp_msg(MSGT_VO,MSGL_V, "SDL Aspect-Destinationres: %ix%i (x: %i, y: %i)\n", newres.w, newres.h, newres.x, newres.y);
- newres.h = ((float)dstw / (float)srcw * (float)srch) * ((float)dsth/((float)dstw/(MONITOR_ASPECT)));
- if(newres.h > dsth) {
- newres.w = ((float)dsth / (float)newres.h) * dstw;
- newres.h = dsth;
- newres.x = (dstw - newres.w) / 2;
- newres.y = 0;
- }
- else {
- newres.w = dstw;
- newres.x = 0;
- newres.y = (dsth - newres.h) / 2;
- }
-
- mp_msg(MSGT_VO,MSGL_V, "SDL Mode: %d: %d x %d\n", i, priv->fullmodes[i]->w, priv->fullmodes[i]->h);
-
- return newres;
-}
-#endif
-
-/**
- * Sets the specified fullscreen mode.
- *
- * params : mode == index of the desired fullscreen mode
- * returns : doesn't return
- **/
-
-#if 0
-static void set_fullmode (int mode)
-{
- struct sdl_priv_s *priv = &sdl_priv;
- SDL_Surface *newsurface = NULL;
- int haspect, waspect = 0;
-
- /* if we haven't set a fullmode yet, default to the lowest res fullmode first */
- if (mode < 0)
- mode = priv->fullmode = findArrayEnd(priv->fullmodes) - 1;
-
- /* Calculate proper aspect ratio for fullscreen
- * Height smaller than expected: add horizontal black bars (haspect)*/
- haspect = (priv->width * (float) ((float) priv->fullmodes[mode]->h / (float) priv->fullmodes[mode]->w) - priv->height) * (float) ((float) priv->fullmodes[mode]->w / (float) priv->width);
- /* Height bigger than expected: add vertical black bars (waspect)*/
- if (haspect < 0) {
- haspect = 0; /* set haspect to zero because image will be scaled horizontal instead of vertical */
- waspect = priv->fullmodes[mode]->w - ((float) ((float) priv->fullmodes[mode]->h / (float) priv->height) * (float) priv->width);
- }
-// printf ("W-Aspect: %i H-Aspect: %i\n", waspect, haspect);
-
- /* change to given fullscreen mode and hide the mouse cursor */
- newsurface = SDL_SetVideoMode(priv->fullmodes[mode]->w - waspect, priv->fullmodes[mode]->h - haspect, priv->bpp, priv->sdlfullflags);
-
- /* if we were successful hide the mouse cursor and save the mode */
- if (newsurface) {
- if (priv->surface)
- SDL_FreeSurface(priv->surface);
- priv->surface = newsurface;
- SDL_ShowCursor(0);
- }
-}
-#endif
-
-/* Set video mode. Not fullscreen */
-static void set_video_mode(int width, int height, int bpp, uint32_t sdlflags)
-{
- struct sdl_priv_s *priv = &sdl_priv;
- SDL_Surface* newsurface;
-
- if(priv->rgbsurface)
- SDL_FreeSurface(priv->rgbsurface);
- else if(priv->overlay)
- SDL_FreeYUVOverlay(priv->overlay);
-
- priv->rgbsurface = NULL;
- priv->overlay = NULL;
-
- newsurface = SDL_SetVideoMode(width, height, bpp, sdlflags);
-
- if(newsurface) {
-
- /* priv->surface will be NULL the first time this function is called. */
- if(priv->surface)
- SDL_FreeSurface(priv->surface);
-
- priv->surface = newsurface;
- priv->dstwidth = width;
- priv->dstheight = height;
- vo_dwidth = width;
- vo_dheight = height;
-
- setup_surfaces();
- }
- else
- mp_msg(MSGT_VO,MSGL_WARN, "set_video_mode: SDL_SetVideoMode failed: %s\n", SDL_GetError());
-}
-
-static void set_fullmode (int mode) {
- struct sdl_priv_s *priv = &sdl_priv;
- SDL_Surface *newsurface = NULL;
- int screen_surface_w, screen_surface_h;
-
- if(priv->rgbsurface)
- SDL_FreeSurface(priv->rgbsurface);
- else if(priv->overlay)
- SDL_FreeYUVOverlay(priv->overlay);
-
- priv->rgbsurface = NULL;
- priv->overlay = NULL;
-
- /* if we haven't set a fullmode yet, default to the lowest res fullmode first */
- /* But select a mode where the full video enter */
- if(priv->X && priv->fulltype & VOFLAG_FULLSCREEN) {
- screen_surface_w = priv->XWidth;
- screen_surface_h = priv->XHeight;
- }
- else if (mode < 0) {
- int i,j,imax;
- mode = 0; // Default to the biggest mode avaible
- if ( mp_msg_test(MSGT_VO,MSGL_V) ) for(i=0;priv->fullmodes[i];++i)
- mp_msg(MSGT_VO,MSGL_V, "SDL Mode: %d: %d x %d\n", i, priv->fullmodes[i]->w, priv->fullmodes[i]->h);
- for(i = findArrayEnd(priv->fullmodes) - 1; i >=0; i--) {
- if( (priv->fullmodes[i]->w >= priv->dstwidth) &&
- (priv->fullmodes[i]->h >= priv->dstheight) ) {
- imax = i;
- for (j = findArrayEnd(priv->fullmodes) - 1; j >=0; j--) {
- if (priv->fullmodes[j]->w > priv->fullmodes[imax]->w
- && priv->fullmodes[j]->h == priv->fullmodes[imax]->h)
- imax = j;
- }
- mode = imax;
- break;
- }
- }
- mp_msg(MSGT_VO,MSGL_V, "SET SDL Mode: %d: %d x %d\n", mode, priv->fullmodes[mode]->w, priv->fullmodes[mode]->h);
- priv->fullmode = mode;
- screen_surface_h = priv->fullmodes[mode]->h;
- screen_surface_w = priv->fullmodes[mode]->w;
- }
- else {
- screen_surface_h = priv->fullmodes[mode]->h;
- screen_surface_w = priv->fullmodes[mode]->w;
- }
-
- aspect_save_screenres(screen_surface_w, screen_surface_h);
-
- /* calculate new video size/aspect */
- if(priv->mode == YUV) {
- if(priv->fulltype&VOFLAG_FULLSCREEN)
- aspect_save_screenres(priv->XWidth, priv->XHeight);
-
- aspect(&priv->dstwidth, &priv->dstheight, A_ZOOM);
- }
-
- /* try to change to given fullscreenmode */
- newsurface = SDL_SetVideoMode(priv->dstwidth, screen_surface_h, priv->bpp,
- priv->sdlfullflags);
-
- /*
- * In Mac OS X (and possibly others?) SDL_SetVideoMode() appears to
- * destroy the datastructure previously retrived, so we need to
- * re-assign it. The comment in sdl_close() seems to imply that we
- * should not free() anything.
- */
- #ifdef __APPLE__
- {
- const SDL_VideoInfo *vidInfo = NULL;
- vidInfo = SDL_GetVideoInfo ();
-
- /* collect all fullscreen & hardware modes available */
- if (!(priv->fullmodes = SDL_ListModes (vidInfo->vfmt, priv->sdlfullflags))) {
-
- /* non hardware accelerated fullscreen modes */
- priv->sdlfullflags &= ~SDL_HWSURFACE;
- priv->fullmodes = SDL_ListModes (vidInfo->vfmt, priv->sdlfullflags);
- }
- }
- #endif
-
-
-
- /* if creation of new surface was successful, save it and hide mouse cursor */
- if(newsurface) {
- if (priv->surface)
- SDL_FreeSurface(priv->surface);
- priv->surface = newsurface;
- SDL_ShowCursor(0);
- SDL_SRF_LOCK(priv->surface, -1)
- SDL_FillRect(priv->surface, NULL, 0);
- SDL_SRF_UNLOCK(priv->surface)
- setup_surfaces();
- }
- else
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SDL] Set_fullmode: SDL_SetVideoMode failed: %s.\n", SDL_GetError());
-}
-
-
-/**
- * Initialize an SDL surface and an SDL YUV overlay.
- *
- * params : width == width of video we'll be displaying.
- * height == height of video we'll be displaying.
- * fullscreen == want to be fullscreen?
- * title == Title for window titlebar.
- * returns : non-zero on success, zero on error.
- **/
-
-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)
-//static int sdl_setup (int width, int height)
-{
- struct sdl_priv_s *priv = &sdl_priv;
-
- switch(format){
- case IMGFMT_I420:
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SDL] Mapping I420 to IYUV.\n");
- format = SDL_IYUV_OVERLAY;
- case IMGFMT_YV12:
- case IMGFMT_IYUV:
- case IMGFMT_YUY2:
- case IMGFMT_UYVY:
- case IMGFMT_YVYU:
- priv->mode = YUV;
- break;
- case IMGFMT_BGR15:
- case IMGFMT_BGR16:
- case IMGFMT_BGR24:
- case IMGFMT_BGR32:
- priv->mode = BGR;
- break;
- case IMGFMT_RGB15:
- case IMGFMT_RGB16:
- case IMGFMT_RGB24:
- case IMGFMT_RGB32:
- priv->mode = RGB;
- break;
- default:
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_SDL] Unsupported image format (0x%X).\n",format);
- return -1;
- }
-
- if ( vo_config_count ) sdl_close();
-
- mp_msg(MSGT_VO,MSGL_V, "SDL: Using 0x%X (%s) image format\n", format, vo_format_name(format));
-
- if(priv->mode != YUV) {
- priv->sdlflags |= SDL_ANYFORMAT;
- priv->sdlfullflags |= SDL_ANYFORMAT;
- }
-
- /* SDL can only scale YUV data */
- if(priv->mode == RGB || priv->mode == BGR) {
- d_width = width;
- d_height = height;
- }
-
- aspect_save_orig(width,height);
- aspect_save_prescale(d_width ? d_width : width, d_height ? d_height : height);
-
- /* Save the original Image size */
- priv->width = width;
- priv->height = height;
- priv->dstwidth = d_width ? d_width : width;
- priv->dstheight = d_height ? d_height : height;
-
- priv->format = format;
-
- if (sdl_open(NULL, NULL) != 0)
- return -1;
-
- /* Set output window title */
- SDL_WM_SetCaption (".: MPlayer : F = Fullscreen/Windowed : C = Cycle Fullscreen Resolutions :.", title);
- //SDL_WM_SetCaption (title, title);
-
- if(priv->X) {
- aspect_save_screenres(priv->XWidth,priv->XHeight);
- aspect(&priv->dstwidth,&priv->dstheight,A_NOZOOM);
- }
-
- priv->windowsize.w = priv->dstwidth;
- priv->windowsize.h = priv->dstheight;
-
- /* bit 0 (0x01) means fullscreen (-fs)
- * bit 1 (0x02) means mode switching (-vm)
- * bit 2 (0x04) enables software scaling (-zoom)
- * bit 3 (0x08) enables flipping (-flip)
- */
-// printf("SDL: flags are set to: %i\n", flags);
-// printf("SDL: Width: %i Height: %i D_Width %i D_Height: %i\n", width, height, d_width, d_height);
- if(flags&VOFLAG_FLIPPING) {
- mp_msg(MSGT_VO,MSGL_V, "SDL: using flipped video (only with RGB/BGR/packed YUV)\n");
- priv->flip = 1;
- }
- if(flags&VOFLAG_FULLSCREEN) {
- mp_msg(MSGT_VO,MSGL_V, "SDL: setting zoomed fullscreen without modeswitching\n");
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SDL] Info - please use -vm or -zoom to switch to the best resolution.\n");
- priv->fulltype = VOFLAG_FULLSCREEN;
- set_fullmode(priv->fullmode);
- /*if((priv->surface = SDL_SetVideoMode (d_width, d_height, priv->bpp, priv->sdlfullflags)))
- SDL_ShowCursor(0);*/
- } else
- if(flags&VOFLAG_MODESWITCHING) {
- mp_msg(MSGT_VO,MSGL_V, "SDL: setting zoomed fullscreen with modeswitching\n");
- priv->fulltype = VOFLAG_MODESWITCHING;
- set_fullmode(priv->fullmode);
- /*if((priv->surface = SDL_SetVideoMode (d_width ? d_width : width, d_height ? d_height : height, priv->bpp, priv->sdlfullflags)))
- SDL_ShowCursor(0);*/
- } else
- if(flags&VOFLAG_SWSCALE) {
- mp_msg(MSGT_VO,MSGL_V, "SDL: setting zoomed fullscreen with modeswitching\n");
- priv->fulltype = VOFLAG_SWSCALE;
- set_fullmode(priv->fullmode);
- }
- else {
- if((strcmp(priv->driver, "x11") == 0)
- ||(strcmp(priv->driver, "windib") == 0)
- ||(strcmp(priv->driver, "directx") == 0)
- ||(strcmp(priv->driver, "Quartz") == 0)
- ||(strcmp(priv->driver, "cgx") == 0)
- ||(strcmp(priv->driver, "os4video") == 0)
- ||((strcmp(priv->driver, "aalib") == 0) && priv->X)){
- mp_msg(MSGT_VO,MSGL_V, "SDL: setting windowed mode\n");
- set_video_mode(priv->dstwidth, priv->dstheight, priv->bpp, priv->sdlflags);
- }
- else {
- mp_msg(MSGT_VO,MSGL_V, "SDL: setting zoomed fullscreen with modeswitching\n");
- priv->fulltype = VOFLAG_SWSCALE;
- set_fullmode(priv->fullmode);
- }
- }
-
- if(!priv->surface) { // cannot SetVideoMode
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_SDL] Failed to set video mode: %s.\n", SDL_GetError());
- return -1;
- }
-
- return 0;
-}
-
-/* Free priv->rgbsurface or priv->overlay if they are != NULL.
- * Setup priv->rgbsurface or priv->overlay depending on source format.
- * The size of the created surface or overlay depends on the size of
- * priv->surface, priv->width, priv->height, priv->dstwidth and priv->dstheight.
- */
-static int setup_surfaces(void)
-{
- struct sdl_priv_s *priv = &sdl_priv;
- float v_scale = ((float) priv->dstheight) / priv->height;
- int surfwidth, surfheight;
-
- surfwidth = priv->width;
- surfheight = priv->height + (priv->surface->h - priv->dstheight) / v_scale;
- surfheight&= ~1;
- /* Place the image in the middle of the screen */
- priv->y = (surfheight - priv->height) / 2;
- priv->y_screen_top = priv->y * v_scale;
- priv->y_screen_bottom = priv->y_screen_top + priv->dstheight;
-
- priv->dirty_off_frame[0].x = -1;
- priv->dirty_off_frame[0].y = -1;
- priv->dirty_off_frame[1].x = -1;
- priv->dirty_off_frame[1].y = -1;
-
- /* Make sure the entire screen is updated */
- vo_osd_changed(1);
-
- if(priv->rgbsurface)
- SDL_FreeSurface(priv->rgbsurface);
- else if(priv->overlay)
- SDL_FreeYUVOverlay(priv->overlay);
-
- priv->rgbsurface = NULL;
- priv->overlay = NULL;
-
- if(priv->mode != YUV && (priv->format&0xFF) == priv->bpp) {
- if(strcmp(priv->driver, "x11") == 0) {
- priv->dblit = 1;
- priv->framePlaneRGB = priv->width * priv->height * priv->surface->format->BytesPerPixel;
- priv->stridePlaneRGB = priv->width * priv->surface->format->BytesPerPixel;
- erase_rectangle(0, 0, priv->surface->w, priv->surface->h);
- return 0;
- }
- }
-
- switch(priv->format) {
- /* Initialize and create the RGB Surface used for video out in BGR/RGB mode */
-//SDL_Surface *SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
- // SDL_SWSURFACE,SDL_HWSURFACE,SDL_SRCCOLORKEY, priv->flags? guess: exchange Rmask and Bmask for BGR<->RGB
- // 32 bit: a:ff000000 r:ff000 g:ff00 b:ff
- // 24 bit: r:ff0000 g:ff00 b:ff
- // 16 bit: r:1111100000000000b g:0000011111100000b b:0000000000011111b
- // 15 bit: r:111110000000000b g:000001111100000b b:000000000011111b
- // FIXME: colorkey detect based on bpp, FIXME static bpp value, FIXME alpha value correct?
- case IMGFMT_RGB15:
- priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 15, 31, 992, 31744, 0);
- break;
- case IMGFMT_BGR15:
- priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 15, 31744, 992, 31, 0);
- break;
- case IMGFMT_RGB16:
- priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 16, 31, 2016, 63488, 0);
- break;
- case IMGFMT_BGR16:
- priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 16, 63488, 2016, 31, 0);
- break;
- case IMGFMT_RGB24:
- priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 24, 0x0000FF, 0x00FF00, 0xFF0000, 0);
- break;
- case IMGFMT_BGR24:
- priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 24, 0xFF0000, 0x00FF00, 0x0000FF, 0);
- break;
- case IMGFMT_RGB32:
- priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0/*0xFF000000*/);
- break;
- case IMGFMT_BGR32:
- priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, surfwidth, surfheight, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0/*0xFF000000*/);
- break;
- default:
- /* Initialize and create the YUV Overlay used for video out */
- if (!(priv->overlay = SDL_CreateYUVOverlay (surfwidth, surfheight, priv->format, priv->surface))) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_SDL] Couldn't create a YUV overlay: %s.\n", SDL_GetError());
- return -1;
- }
- priv->framePlaneY = priv->width * priv->height;
- priv->framePlaneUV = (priv->width * priv->height) >> 2;
- priv->framePlaneYUY = priv->width * priv->height * 2;
- priv->stridePlaneY = priv->width;
- priv->stridePlaneUV = priv->width/2;
- priv->stridePlaneYUY = priv->width * 2;
- }
-
- if(priv->mode != YUV) {
- if(!priv->rgbsurface) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_SDL] Couldn't create an RGB surface: %s.\n", SDL_GetError());
- return -1;
- }
-
- priv->dblit = 0;
-
- if((priv->format&0xFF) != priv->bpp)
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SDL] Using depth/colorspace conversion, this will slow things down (%ibpp -> %ibpp).\n", priv->format&0xFF, priv->bpp);
-
- priv->framePlaneRGB = priv->width * priv->height * priv->rgbsurface->format->BytesPerPixel;
- priv->stridePlaneRGB = priv->width * priv->rgbsurface->format->BytesPerPixel;
- }
-
- erase_rectangle(0, 0, surfwidth, surfheight);
-
- return 0;
-}
-
-
-/**
- * Draw a frame to the SDL YUV overlay.
- *
- * params : *src[] == the Y, U, and V planes that make up the frame.
- * returns : non-zero on success, zero on error.
- **/
-
-//static int sdl_draw_frame (frame_t *frame)
-static int draw_frame(uint8_t *src[])
-{
- struct sdl_priv_s *priv = &sdl_priv;
- uint8_t *dst;
- int i;
- uint8_t *mysrc = src[0];
-
- switch(priv->format){
- case IMGFMT_YUY2:
- case IMGFMT_UYVY:
- case IMGFMT_YVYU:
- SDL_OVR_LOCK(-1)
- dst = (uint8_t *) *(priv->overlay->pixels) + priv->overlay->pitches[0]*priv->y;
- if(priv->flip) {
- mysrc+=priv->framePlaneYUY;
- for(i = 0; i < priv->height; i++) {
- mysrc-=priv->stridePlaneYUY;
- fast_memcpy (dst, mysrc, priv->stridePlaneYUY);
- dst+=priv->overlay->pitches[0];
- }
- }
- else fast_memcpy (dst, src[0], priv->framePlaneYUY);
- SDL_OVR_UNLOCK
- break;
-
- case IMGFMT_RGB15:
- case IMGFMT_BGR15:
- case IMGFMT_RGB16:
- case IMGFMT_BGR16:
- case IMGFMT_RGB24:
- case IMGFMT_BGR24:
- case IMGFMT_RGB32:
- case IMGFMT_BGR32:
- if(priv->dblit) {
- SDL_SRF_LOCK(priv->surface, -1)
- dst = (uint8_t *) priv->surface->pixels + priv->y*priv->surface->pitch;
- if(priv->flip) {
- mysrc+=priv->framePlaneRGB;
- for(i = 0; i < priv->height; i++) {
- mysrc-=priv->stridePlaneRGB;
- fast_memcpy (dst, mysrc, priv->stridePlaneRGB);
- dst += priv->surface->pitch;
- }
- }
- else fast_memcpy (dst, src[0], priv->framePlaneRGB);
- SDL_SRF_UNLOCK(priv->surface)
- } else {
- SDL_SRF_LOCK(priv->rgbsurface, -1)
- dst = (uint8_t *) priv->rgbsurface->pixels + priv->y*priv->rgbsurface->pitch;
- if(priv->flip) {
- mysrc+=priv->framePlaneRGB;
- for(i = 0; i < priv->height; i++) {
- mysrc-=priv->stridePlaneRGB;
- fast_memcpy (dst, mysrc, priv->stridePlaneRGB);
- dst += priv->rgbsurface->pitch;
- }
- }
- else fast_memcpy (dst, src[0], priv->framePlaneRGB);
- SDL_SRF_UNLOCK(priv->rgbsurface)
- }
- break;
-
- }
-
- return 0;
-}
-
-
-/**
- * Draw a slice (16 rows of image) to the SDL YUV overlay.
- *
- * params : *src[] == the Y, U, and V planes that make up the slice.
- * returns : non-zero on error, zero on success.
- **/
-
-//static uint32_t draw_slice(uint8_t *src[], uint32_t slice_num)
-static int draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
-{
- struct sdl_priv_s *priv = &sdl_priv;
- uint8_t *dst;
-
- SDL_OVR_LOCK(-1)
-
- y += priv->y;
-
- dst = priv->overlay->pixels[0] + priv->overlay->pitches[0]*y + x;
- memcpy_pic(dst, image[0], w, h, priv->overlay->pitches[0], stride[0]);
- x/=2;y/=2;w/=2;h/=2;
-
- switch(priv->format) {
- case IMGFMT_YV12:
- dst = priv->overlay->pixels[2] + priv->overlay->pitches[2]*y + x;
- memcpy_pic(dst, image[1], w, h, priv->overlay->pitches[2], stride[1]);
-
- dst = priv->overlay->pixels[1] + priv->overlay->pitches[1]*y + x;
- memcpy_pic(dst, image[2], w, h, priv->overlay->pitches[1], stride[2]);
-
- break;
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- dst = priv->overlay->pixels[1] + priv->overlay->pitches[1]*y + x;
- memcpy_pic(dst, image[1], w, h, priv->overlay->pitches[1], stride[1]);
-
- dst = priv->overlay->pixels[2] + priv->overlay->pitches[2]*y + x;
- memcpy_pic(dst, image[2], w, h, priv->overlay->pitches[2], stride[2]);
-
- break;
- default:
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_SDL] Unsupported image format in draw_slice, contact MPlayer developers!\n");
- }
-
- SDL_OVR_UNLOCK
-
- return 0;
-}
-
-
-
-/**
- * Checks for SDL keypress and window resize events
- *
- * params : none
- * returns : doesn't return
- **/
-
-static void check_events (void)
-{
- struct sdl_priv_s *priv = &sdl_priv;
- SDL_Event event;
- SDLKey keypressed = SDLK_UNKNOWN;
-
- /* Poll the waiting SDL Events */
- while ( SDL_PollEvent(&event) ) {
- switch (event.type) {
-
- /* capture window resize events */
- case SDL_VIDEORESIZE:
- if(!priv->dblit)
- set_video_mode(event.resize.w, event.resize.h, priv->bpp, priv->sdlflags);
-
- /* save video extents, to restore them after going fullscreen */
- //if(!(priv->surface->flags & SDL_FULLSCREEN)) {
- priv->windowsize.w = priv->surface->w;
- priv->windowsize.h = priv->surface->h;
- //}
- mp_msg(MSGT_VO,MSGL_DBG3, "SDL: Window resize\n");
- break;
-
- /* graphics mode selection shortcuts */
- case SDL_KEYDOWN:
- keypressed = event.key.keysym.sym;
- mp_msg(MSGT_VO,MSGL_DBG2, "SDL: Key pressed: '%i'\n", keypressed);
-
- /* c key pressed. c cycles through available fullscreenmodes, if we have some */
- if ( ((keypressed == SDLK_c)) && (priv->fullmodes) ) {
- /* select next fullscreen mode */
- priv->fullmode++;
- if (priv->fullmode > (findArrayEnd(priv->fullmodes) - 1)) priv->fullmode = 0;
- set_fullmode(priv->fullmode);
-
- mp_msg(MSGT_VO,MSGL_DBG2, "SDL: Set next available fullscreen mode.\n");
- }
-
- else if ( keypressed == SDLK_n ) {
-#ifdef CONFIG_X11
- aspect(&priv->dstwidth, &priv->dstheight,A_NOZOOM);
-#endif
- if (priv->surface->w != priv->dstwidth || priv->surface->h != priv->dstheight) {
- set_video_mode(priv->dstwidth, priv->dstheight, priv->bpp, priv->sdlflags);
- priv->windowsize.w = priv->surface->w;
- priv->windowsize.h = priv->surface->h;
- mp_msg(MSGT_VO,MSGL_DBG2, "SDL: Normal size\n");
- } else
- if (priv->surface->w != priv->dstwidth * 2 || priv->surface->h != priv->dstheight * 2) {
- set_video_mode(priv->dstwidth * 2, priv->dstheight * 2, priv->bpp, priv->sdlflags);
- priv->windowsize.w = priv->surface->w;
- priv->windowsize.h = priv->surface->h;
- mp_msg(MSGT_VO,MSGL_DBG2, "SDL: Double size\n");
- }
- }
-
- else sdl_default_handle_event(&event);
-
- break;
- default: sdl_default_handle_event(&event); break;
- }
- }
-}
-
-/* Erase (paint it black) the rectangle specified by x, y, w and h in the surface
- or overlay which is used for OSD
-*/
-static void erase_rectangle(int x, int y, int w, int h)
-{
- struct sdl_priv_s *priv = &sdl_priv;
-
- switch(priv->format) {
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- {
- SDL_OVR_LOCK((void) 0)
-
- /* Erase Y plane */
- erase_area_1(x, w, h,
- priv->overlay->pitches[0], 0,
- priv->overlay->pixels[0] +
- priv->overlay->pitches[0]*y);
-
- /* Erase U and V planes */
- w /= 2;
- x /= 2;
- h /= 2;
- y /= 2;
-
- erase_area_1(x, w, h,
- priv->overlay->pitches[1], 128,
- priv->overlay->pixels[1] +
- priv->overlay->pitches[1]*y);
-
- erase_area_1(x, w, h,
- priv->overlay->pitches[2], 128,
- priv->overlay->pixels[2] +
- priv->overlay->pitches[2]*y);
- SDL_OVR_UNLOCK
- break;
- }
-
- case IMGFMT_YUY2:
- case IMGFMT_YVYU:
- {
- SDL_OVR_LOCK((void) 0)
- erase_area_4(x*2, w*2, h,
- priv->overlay->pitches[0],
- be2me_32(0x00800080), /* yuy2 and yvyu represent black the same way */
- priv->overlay->pixels[0] +
- priv->overlay->pitches[0]*y);
- SDL_OVR_UNLOCK
- break;
- }
-
- case IMGFMT_UYVY:
- {
- SDL_OVR_LOCK((void) 0)
- erase_area_4(x*2, w*2, h,
- priv->overlay->pitches[0],
- be2me_32(0x80008000),
- priv->overlay->pixels[0] +
- priv->overlay->pitches[0]*y);
- SDL_OVR_UNLOCK
- break;
- }
-
- case IMGFMT_RGB15:
- case IMGFMT_BGR15:
- case IMGFMT_RGB16:
- case IMGFMT_BGR16:
- case IMGFMT_RGB24:
- case IMGFMT_BGR24:
- case IMGFMT_RGB32:
- case IMGFMT_BGR32:
- {
- SDL_Rect rect;
- rect.w = w; rect.h = h;
- rect.x = x; rect.y = y;
-
- if(priv->dblit) {
- SDL_SRF_LOCK(priv->surface, (void) 0)
- SDL_FillRect(priv->surface, &rect, 0);
- SDL_SRF_UNLOCK(priv->surface)
- }
- else {
- SDL_SRF_LOCK(priv->rgbsurface, (void) 0)
- SDL_FillRect(priv->rgbsurface, &rect, 0);
- SDL_SRF_UNLOCK(priv->rgbsurface)
- }
- break;
- }
- }
-}
-
-static void draw_osd(void)
-{ struct sdl_priv_s *priv = &sdl_priv;
-
- priv->osd_has_changed = vo_osd_changed(0);
-
- if(priv->osd_has_changed)
- {
- int i;
-
- for(i = 0; i < 2; i++) {
- if(priv->dirty_off_frame[i].x < 0 || priv->dirty_off_frame[i].y < 0)
- continue;
-
- erase_rectangle(priv->dirty_off_frame[i].x, priv->dirty_off_frame[i].y,
- priv->dirty_off_frame[i].w, priv->dirty_off_frame[i].h);
-
- priv->dirty_off_frame[i].x = -1;
- priv->dirty_off_frame[i].y = -1;
- }
- }
-
- /* update osd/subtitles */
- if(priv->mode == YUV)
- vo_draw_text(priv->overlay->w, priv->overlay->h, draw_alpha);
- else {
- if(priv->dblit)
- vo_draw_text(priv->surface->w, priv->surface->h, draw_alpha);
- else
- vo_draw_text(priv->rgbsurface->w, priv->rgbsurface->h, draw_alpha);
- }
-}
-
-/* Fill area beginning at 'pixels' with 'color'. 'x_start', 'width' and 'pitch'
- * are given in bytes. 4 bytes at a time.
- */
-static void erase_area_4(int x_start, int width, int height, int pitch, uint32_t color, uint8_t* pixels)
-{
- int x_end = x_start/4 + width/4;
- int x, y;
- uint32_t* data = (uint32_t*) pixels;
-
- x_start /= 4;
- pitch /= 4;
-
- for(y = 0; y < height; y++) {
- for(x = x_start; x < x_end; x++)
- data[y*pitch + x] = color;
- }
-}
-
-/* Fill area beginning at 'pixels' with 'color'. 'x_start', 'width' and 'pitch'
- * are given in bytes. 1 byte at a time.
- */
-static void erase_area_1(int x_start, int width, int height, int pitch, uint8_t color, uint8_t* pixels)
-{
- int y;
-
- for(y = 0; y < height; y++) {
- memset(&pixels[y*pitch + x_start], color, width);
- }
-}
-
-/**
- * Display the surface we have written our data to
- *
- * params : mode == index of the desired fullscreen mode
- * returns : doesn't return
- **/
-
-static void flip_page (void)
-{
- struct sdl_priv_s *priv = &sdl_priv;
-
- switch(priv->format) {
- case IMGFMT_RGB15:
- case IMGFMT_BGR15:
- case IMGFMT_RGB16:
- case IMGFMT_BGR16:
- case IMGFMT_RGB24:
- case IMGFMT_BGR24:
- case IMGFMT_RGB32:
- case IMGFMT_BGR32:
- if(!priv->dblit) {
- /* blit to the RGB surface */
- if(SDL_BlitSurface (priv->rgbsurface, NULL, priv->surface, NULL))
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_SDL] Blit failed: %s.\n", SDL_GetError());
- }
-
- /* update screen */
- //SDL_UpdateRect(priv->surface, 0, 0, priv->surface->clip_rect.w, priv->surface->clip_rect.h);
- if(priv->osd_has_changed) {
- priv->osd_has_changed = 0;
- SDL_UpdateRects(priv->surface, 1, &priv->surface->clip_rect);
- }
- else
- SDL_UpdateRect(priv->surface, 0, priv->y_screen_top,
- priv->surface->clip_rect.w, priv->y_screen_bottom);
-
- /* check if we have a double buffered surface and flip() if we do. */
- if ( priv->surface->flags & SDL_DOUBLEBUF )
- SDL_Flip(priv->surface);
-
- break;
- default:
- /* blit to the YUV overlay */
- SDL_DisplayYUVOverlay (priv->overlay, &priv->surface->clip_rect);
-
- /* check if we have a double buffered surface and flip() if we do. */
- if ( priv->surface->flags & SDL_DOUBLEBUF )
- SDL_Flip(priv->surface);
-
- //SDL_LockYUVOverlay (priv->overlay); // removed because unused!?
- }
-}
-
-static int
-query_format(uint32_t format)
-{
- switch(format){
- case IMGFMT_YV12:
-// it seems buggy (not hw accelerated), so just use YV12 instead!
-// case IMGFMT_I420:
-// case IMGFMT_IYUV:
- case IMGFMT_YUY2:
- case IMGFMT_UYVY:
- case IMGFMT_YVYU:
- return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD |
- VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN;
- case IMGFMT_RGB15:
- case IMGFMT_BGR15:
- case IMGFMT_RGB16:
- case IMGFMT_BGR16:
- case IMGFMT_RGB24:
- case IMGFMT_BGR24:
- case IMGFMT_RGB32:
- case IMGFMT_BGR32:
- return VFCAP_CSP_SUPPORTED | VFCAP_OSD | VFCAP_FLIP;
- }
- return 0;
-}
-
-
-static void
-uninit(void)
-{
-#ifdef CONFIG_X11
- struct sdl_priv_s *priv = &sdl_priv;
- if(priv->X) {
- mp_msg(MSGT_VO,MSGL_V, "SDL: activating XScreensaver/DPMS\n");
- vo_x11_uninit();
- }
-#endif
- sdl_close();
-
- /* Cleanup SDL */
- vo_sdl_uninit();
-
- mp_msg(MSGT_VO,MSGL_DBG3, "SDL: Closed Plugin\n");
-
-}
-
-static int preinit(const char *arg)
-{
- struct sdl_priv_s *priv = &sdl_priv;
- char * sdl_driver = NULL;
- int sdl_hwaccel;
- int sdl_forcexv;
- const opt_t subopts[] = {
- {"forcexv", OPT_ARG_BOOL, &sdl_forcexv, NULL},
- {"hwaccel", OPT_ARG_BOOL, &sdl_hwaccel, NULL},
- {"driver", OPT_ARG_MSTRZ, &sdl_driver, NULL},
- {NULL, 0, NULL, NULL}
- };
-
- sdl_forcexv = 1;
- sdl_hwaccel = 1;
-
- if (subopt_parse(arg, subopts) != 0) return -1;
-
- priv->rgbsurface = NULL;
- priv->overlay = NULL;
- priv->surface = NULL;
-
- mp_msg(MSGT_VO,MSGL_DBG3, "SDL: Opening Plugin\n");
-
- if(sdl_driver) {
- setenv("SDL_VIDEODRIVER", sdl_driver, 1);
- free(sdl_driver);
- }
-
- /* does the user want SDL to try and force Xv */
- if(sdl_forcexv) setenv("SDL_VIDEO_X11_NODIRECTCOLOR", "1", 1);
- else setenv("SDL_VIDEO_X11_NODIRECTCOLOR", "0", 1);
-
- /* does the user want to disable Xv and use software scaling instead */
- if(sdl_hwaccel) setenv("SDL_VIDEO_YUV_HWACCEL", "1", 1);
- else setenv("SDL_VIDEO_YUV_HWACCEL", "0", 1);
-
- /* default to no fullscreen mode, we'll set this as soon we have the avail. modes */
- priv->fullmode = -2;
-
- priv->fullmodes = NULL;
- priv->bpp = 0;
-
- /* initialize the SDL Video system */
- if (!vo_sdl_init()) {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_SDL] SDL initialization failed: %s.\n", SDL_GetError());
-
- return -1;
- }
-
- SDL_VideoDriverName(priv->driver, 8);
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SDL] Using driver: %s.\n", priv->driver);
-
- priv->X = 0;
-#ifdef CONFIG_X11
- if(vo_init()) {
- mp_msg(MSGT_VO,MSGL_V, "SDL: deactivating XScreensaver/DPMS\n");
- priv->XWidth = vo_screenwidth;
- priv->XHeight = vo_screenheight;
- priv->X = 1;
- mp_msg(MSGT_VO,MSGL_V, "SDL: X11 Resolution %ix%i\n", priv->XWidth, priv->XHeight);
- }
-#endif
-
- return 0;
-}
-
-static uint32_t get_image(mp_image_t *mpi)
-{
- struct sdl_priv_s *priv = &sdl_priv;
-
- if(priv->format != mpi->imgfmt) return VO_FALSE;
- if(mpi->type == MP_IMGTYPE_STATIC || mpi->type == MP_IMGTYPE_TEMP) {
- if(mpi->flags&MP_IMGFLAG_PLANAR) {
- mpi->planes[0] = priv->overlay->pixels[0] + priv->y*priv->overlay->pitches[0];
- mpi->stride[0] = priv->overlay->pitches[0];
- if(mpi->flags&MP_IMGFLAG_SWAPPED) {
- mpi->planes[1] = priv->overlay->pixels[1] + priv->y*priv->overlay->pitches[1]/2;
- mpi->stride[1] = priv->overlay->pitches[1];
- mpi->planes[2] = priv->overlay->pixels[2] + priv->y*priv->overlay->pitches[2]/2;
- mpi->stride[2] = priv->overlay->pitches[2];
- } else {
- mpi->planes[2] = priv->overlay->pixels[1] + priv->y*priv->overlay->pitches[1]/2;
- mpi->stride[2] = priv->overlay->pitches[1];
- mpi->planes[1] = priv->overlay->pixels[2] + priv->y*priv->overlay->pitches[2]/2;
- mpi->stride[1] = priv->overlay->pitches[2];
- }
- }
- else if(IMGFMT_IS_RGB(priv->format) || IMGFMT_IS_BGR(priv->format)) {
- if(priv->dblit) {
- if(mpi->type == MP_IMGTYPE_STATIC && (priv->surface->flags & SDL_DOUBLEBUF))
- return VO_FALSE;
-
- mpi->planes[0] = (uint8_t *)priv->surface->pixels + priv->y*priv->surface->pitch;
- mpi->stride[0] = priv->surface->pitch;
- }
- else {
- mpi->planes[0] = (uint8_t *)priv->rgbsurface->pixels + priv->y*priv->rgbsurface->pitch;
- mpi->stride[0] = priv->rgbsurface->pitch;
- }
- }
- else {
- mpi->planes[0] = priv->overlay->pixels[0] + priv->y*priv->overlay->pitches[0];
- mpi->stride[0] = priv->overlay->pitches[0];
- }
-
- mpi->flags|=MP_IMGFLAG_DIRECT;
- return VO_TRUE;
- }
-
- return VO_FALSE;
-}
-
-static int control(uint32_t request, void *data)
-{
- struct sdl_priv_s *priv = &sdl_priv;
- switch (request) {
- case VOCTRL_GET_IMAGE:
- return get_image(data);
- case VOCTRL_QUERY_FORMAT:
- return query_format(*((uint32_t*)data));
- case VOCTRL_FULLSCREEN:
- if (priv->surface->flags & SDL_FULLSCREEN) {
- set_video_mode(priv->windowsize.w, priv->windowsize.h, priv->bpp, priv->sdlflags);
- SDL_ShowCursor(1);
- mp_msg(MSGT_VO,MSGL_DBG2, "SDL: Windowed mode\n");
- } else if (priv->fullmodes) {
- set_fullmode(priv->fullmode);
- mp_msg(MSGT_VO,MSGL_DBG2, "SDL: Set fullscreen mode\n");
- }
- return VO_TRUE;
- }
-
- return VO_NOTIMPL;
-}
diff --git a/libvo/vo_svga.c b/libvo/vo_svga.c
deleted file mode 100644
index 19a454e354..0000000000
--- a/libvo/vo_svga.c
+++ /dev/null
@@ -1,670 +0,0 @@
-/*
- * video driver for SVGAlib
- * by Zoltan Mark Vician <se7en@sch.bme.hu>
- * Code started: Mon Apr 1 23:25:47 2001
- * Some changes by Matan Ziv-Av <matan@svgalib.org>
- * complete rewrite by Ivan Kalvachev 19 Mar 2003
- *
- * 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.
- */
-
-/*
-Wrangings:
- - 1bpp doesn't work right for me with '-double' and svgalib 1.4.3,
- but works OK with svgalib 1.9.17
- - The HW acceleration is not tested - svgalibs supports few chipsets,
- and i don't have any of them. If it works for you then let me know.
- I will remove this warning after confirm its status.
- - retrace sync works only in doublebuffer mode.
- - the retrace sync may slow down decoding a lot - mplayer is blocked while
- waiting for retrace
- - denoise3d fails to find common colorspace, use -vf denoise3d,scale
-
-TODO:
- - let choose_best_mode take aspect into account
- - set palette from mpi->palette or mpi->plane[1]
- - make faster OSD black bars clear - need some OSD changes
- - Make nicer CONFIG parsing
- - change video mode logical width to match img->stride[0] - for HW only
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <vga.h>
-
-#include <limits.h>
-
-#include "config.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-#include "fastmemcpy.h"
-#include "osdep/getch2.h"
-
-#include "sub/sub.h"
-
-#include "mp_msg.h"
-//#include "mp_image.h"
-
-#include <assert.h>
-
-static int query_format(uint32_t format);
-static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src,
- unsigned char *srca, int stride);
-static uint32_t get_image(mp_image_t *mpi);
-
-#define MAXPAGES 16
-#define PAGE_EMPTY 0
-#define PAGE_BUSY 1
-
-#define CAP_ACCEL_CLEAR 8
-#define CAP_ACCEL_PUTIMAGE 4
-#define CAP_ACCEL_BACKGR 2
-#define CAP_LINEAR 1
-
-static uint8_t zerobuf[8192];//used when clear screen with vga_draw
-
-static int squarepix;
-static int force_vm=0;
-static int force_native=0;
-static int sync_flip=0;
-static int blackbar_osd=0;
-static int cpage,max_pages,old_page;
-
-static vga_modeinfo * modeinfo;
-static int mode_stride; //keep it in case of vga_setlogicalwidth
-static int stride_granularity; //not yet used
-static int mode_bpp;
-static int mode_capabilities;
-
-static int image_width,image_height; // used by OSD
-static int x_pos, y_pos;
-
-static struct {
- int yoffset;//y position of the page
- int doffset;//display start of the page
- uint8_t * vbase;//memory start address of the page
- int locks;
-}PageStore[MAXPAGES];
-
-static const vo_info_t info = {
- "SVGAlib",
- "svga",
- "Ivan Kalvachev <iive@users.sf.net>",
- ""
-};
-
-LIBVO_EXTERN(svga)
-
-
-//return number of 1'st free page or -1 if no free one
-static inline int page_find_free(void){
- int i;
- for(i=0;i<max_pages;i++)
- if(PageStore[i].locks == PAGE_EMPTY) return i;
- return -1;
-}
-
-static int preinit(const char *arg)
-{
- int i,rez;
- char s[64];
-
- getch2_disable();
- memset(zerobuf,0,sizeof(zerobuf));
- force_vm=force_native=squarepix=0;
- sync_flip=vo_vsync;
- blackbar_osd=0;
-
- if(arg)while(*arg) {
- if(!strncmp(arg,"sq",2)) {
- squarepix=1;
- arg+=2;
- if( *arg == ':' ) arg++;
- }
-
- if(!strncmp(arg,"native",6)) {
- force_native=1;
- arg+=6;
- if( *arg == ':' ) arg++;
- }
-
- if(!strncmp(arg,"bbosd",5)) {
- blackbar_osd=1;
- arg+=5;
- if( *arg == ':' ) arg++;
- }
-
- if(!strncmp(arg,"retrace",7)) {
- sync_flip=1;
- arg+=7;
- if( *arg == ':' ) arg++;
- }
-
- if(*arg) {
- i=0;
- while(arg[i] && arg[i]!=':')i++;
- if(i<64){
- strncpy(s, arg, i);
- s[i]=0;
-
- force_vm=vga_getmodenumber(s);
- if(force_vm>0) {
- mp_msg(MSGT_VO,MSGL_V, "vo_svga: Forcing mode %i\n",force_vm);
- }else{
- force_vm = 0;
- }
- }
- arg+=i;
- if(*arg==':')arg++;
- }
- }
-
- rez = vga_init();
- if(rez != 0){
- mp_msg(MSGT_VO,MSGL_ERR, "vo_svga: vga_init() returned error=%d\n",rez);
- }
- return !!rez;
-}
-
-static void svga_clear_box(int x,int y,int w,int h){
- uint8_t * rgbplane;
- int i;
-
- if (mode_capabilities&CAP_ACCEL_CLEAR){
- mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: clearing box %d,%d - %d,%d with HW acceleration\n",
- x,y,w,h);
- if(mode_capabilities&CAP_ACCEL_BACKGR)
- vga_accel(ACCEL_SYNC);
- vga_accel(ACCEL_SETFGCOLOR,0);//black
- vga_accel(ACCEL_FILLBOX,x,y,w,h);
- return;
- }
- if (mode_capabilities & CAP_LINEAR){
- mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: clearing box %d,%d - %d,%d with memset\n",x,y,w,h);
- rgbplane=PageStore[0].vbase + (y*mode_stride) + (x*modeinfo->bytesperpixel);
- for(i=0;i<h;i++){
-//i'm afraid that memcpy is better optimized than memset;)
- fast_memcpy(rgbplane,zerobuf,w*modeinfo->bytesperpixel);
-// memset(rgbplane,0,w*modeinfo->bytesperpixel);
- rgbplane+=mode_stride;
- }
- return;
- }
- //native
- mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: clearing box %d,%d - %d,%d with native draw \n",x,y,w,h);
- if(modeinfo->bytesperpixel!=0) w*=modeinfo->bytesperpixel;
- for(i=0;i<h;i++){
- vga_drawscansegment(zerobuf,x,y+i,w);
- }
-};
-
-static uint32_t svga_draw_image(mp_image_t *mpi){
- int i,x,y,w,h;
- int stride;
- uint8_t *rgbplane, *base;
- int bytesperline;
- int page;
-
- if(mpi->flags & MP_IMGFLAG_DIRECT){
- mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: drawing direct rendered surface\n");
- cpage=(uint32_t)mpi->priv;
- assert((cpage>=0)&&(cpage<max_pages));
- return VO_TRUE; //it's already done
- }
-// if (mpi->flags&MP_IMGFLAGS_DRAWBACK)
-// return VO_TRUE;//direct render method 2
-
-//find a free page to draw into
-//if there is no one then use the current one
- page = page_find_free();
- if(page>=0) cpage=page;
- PageStore[cpage].locks=PAGE_BUSY;
-
-// these variables are used in loops
- x = 0;
- y = 0;
- w = mpi->w;
- h = mpi->h;
- stride = mpi->stride[0];
- rgbplane = mpi->planes[0] + y*stride + (x*mpi->bpp)/8;
- x+=x_pos;//center
- y+=y_pos;
-
- if(mpi->bpp >= 8){//for modes<8 use only native
- if( (mode_capabilities&CAP_ACCEL_PUTIMAGE) && (x==0) && (w==mpi->width) &&
- (stride == mode_stride) ){ //only monolite image can be accelerated
- w=(stride*8)/mpi->bpp;//we transfer pixels in the stride so the source
-//ACCELERATE
- mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: using HW PutImage (x=%d,y=%d,w=%d,h=%d)\n",x,y,w,h);
- if(mode_capabilities & CAP_ACCEL_BACKGR)
- vga_accel(ACCEL_SYNC);
-
- vga_accel(ACCEL_PUTIMAGE,x,y+PageStore[cpage].yoffset,w,h,rgbplane);
- return VO_TRUE;
- }
-
- if( mode_capabilities&CAP_LINEAR){
-//DIRECT
- mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: using Direct memcpy (x=%d,y=%d,w=%d,h=%d)\n",x,y,w,h);
- bytesperline=(w*mpi->bpp)/8;
- base=PageStore[cpage].vbase + (y*mode_stride) + (x*mpi->bpp)/8;
-
- for(i=0;i<h;i++){
- mem2agpcpy(base,rgbplane,bytesperline);
- base+=mode_stride;
- rgbplane+=stride;
- }
- return VO_TRUE;
- }
- }//(modebpp>=8
-
-
-//NATIVE
- {
- int length;
- length=(w*mpi->bpp)/8;
- //one byte per pixel! svgalib innovation
- if(mpi->imgfmt==IMGFMT_RG4B || mpi->imgfmt==IMGFMT_BG4B) length=w;
-
- mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: using Native vga_draw(x=%d,y=%d,w=%d,h=%d)\n",x,y,w,h);
- y+=PageStore[cpage].yoffset;//y position of the page beggining
- for(i=0;i<h;i++){
- vga_drawscansegment(rgbplane,x,y+i,length);
- rgbplane+=stride;
- }
- }
- return VO_TRUE;
-}
-
-static int bpp_from_vminfo(vga_modeinfo *vminfo){
- switch(vminfo->colors){
- case 2: return 1;
- case 16: return 4;
- case 256: return 8;
- case 32768: return 15;
- case 65536: return 16;
- case 1<<24: return 8*vminfo->bytesperpixel;
- }
- return 0;
-}
-
-static int find_best_svga_mode(int req_w,int req_h, int req_bpp){
- int badness,prev_badness;
- int bestmode,lastmode;
- int i;
- vga_modeinfo *vminfo;
-//int best aspect mode // best linear mode // best normal mode (no modeX)
-
- prev_badness = 0;//take care of special case below
- bestmode = 0; //0 is the TEXT mode
- lastmode = vga_lastmodenumber();
- for(i=1;i<=lastmode;i++){
- vminfo = vga_getmodeinfo(i);
- if( vminfo == NULL ) continue;
- mp_msg(MSGT_VO,MSGL_DBG4, "vo_svga: testing mode %d (%s)\n",i,vga_getmodename(i));
- if( vga_hasmode(i) == 0 ) continue;
- if( req_bpp != bpp_from_vminfo(vminfo) )continue;
- if( (vminfo->width < req_w) || (vminfo->height < req_h) ) continue;
- badness=(vminfo->width * vminfo->height) - (req_h * req_w);
- //put here aspect calculations
- if(squarepix)
- if( vminfo->width*3 != vminfo->height*4 ) continue;
-
- if( bestmode==0 || prev_badness >= badness ){//modeX etc...
- prev_badness=badness;
- bestmode=i;
- mp_msg(MSGT_VO,MSGL_DBG4, "vo_svga: found good mode %d with badness %d\n",i,badness);
- }
- }
- return bestmode;
-}
-
-static int control(uint32_t request, void *data)
-{
- switch (request) {
- case VOCTRL_QUERY_FORMAT:
- return query_format(*((uint32_t*)data));
- case VOCTRL_DRAW_IMAGE:
- return svga_draw_image( (mp_image_t *)data);
- case VOCTRL_GET_IMAGE:
- return get_image(data);
- }
-
- return VO_NOTIMPL;
-}
-
-//
-// This function is called to init the video driver for specific mode
-//
-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) {
- int32_t req_w = width;// (d_width > 0 ? d_width : width);
- int32_t req_h = height;// (d_height > 0 ? d_height : height);
- uint16_t vid_mode = 0;
- int32_t req_bpp;
-
- uint32_t accflags;
- mp_msg(MSGT_VO,MSGL_V, "vo_svga: config(%i, %i, %i, %i, %08x, %s, %08x)\n", width, height,
- d_width, d_height, flags, title, format);
-//Only RGB modes supported
- if (!IMGFMT_IS_RGB(format) && !IMGFMT_IS_BGR(format)) {assert(0);return -1;}
- req_bpp = IMGFMT_BGR_DEPTH(format);
-
- if( vo_dbpp!=0 && vo_dbpp!=req_bpp) {assert(0);return-1;}
-
- if(!force_vm) {
- mp_msg(MSGT_VO,MSGL_V, "vo_svga: Looking for the best resolution...\n");
- mp_msg(MSGT_VO,MSGL_V, "vo_svga: req_w: %d, req_h: %d, bpp: %d\n",req_w,req_h,req_bpp);
- vid_mode=find_best_svga_mode(req_w,req_h,req_bpp);
- if(vid_mode==0)
- return 1;
- modeinfo=vga_getmodeinfo(vid_mode);
- }else{//force_vm
- vid_mode=force_vm;
- if(vga_hasmode(vid_mode) == 0){
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_SVGA] Forced vid_mode %d (%s) not available.\n",
- vid_mode,vga_getmodename(vid_mode));
- return 1; //error;
- }
- modeinfo=vga_getmodeinfo(vid_mode);
- if( (modeinfo->width < req_w) || (modeinfo->height < req_h) ){
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_SVGA] Forced vid_mode %d (%s) too small.\n",
- vid_mode,vga_getmodename(vid_mode));
- return 1;
- }
- }
- mode_bpp=bpp_from_vminfo(modeinfo);
-
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SVGA] Vid_mode: %d, %dx%d %dbpp.\n",
- vid_mode,modeinfo->width,modeinfo->height,mode_bpp);
-
- if (vga_setmode(vid_mode) == -1) {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_SVGA] Vga_setmode(%d) failed.\n",vid_mode);
- uninit();
- return 1; // error
- }
- /* set 332 palette for 8 bpp */
- if(mode_bpp==8){
- int i;
- for(i=0; i<256; i++)
- vga_setpalette(i, ((i>>5)&7)*9, ((i>>2)&7)*9, (i&3)*21);
- }
- /* set 121 palette for 4 bpp */
- else if(mode_bpp==4){
- int i;
- for(i=0; i<16; i++)
- vga_setpalette(i, ((i>>3)&1)*63, ((i>>1)&3)*21, (i&1)*63);
- }
- //if we change the logical width, we should know the granularity
- stride_granularity=8;//according to man vga_logicalwidth
- if(modeinfo->flags & EXT_INFO_AVAILABLE){
- stride_granularity=modeinfo->linewidth_unit;
- }
- //look for hardware acceleration
- mode_capabilities=0;//NATIVE;
- if(!force_native){//if we want to use only native drawers
- if(modeinfo->flags & HAVE_EXT_SET){//support for hwaccel interface
- accflags=vga_ext_set(VGA_EXT_AVAILABLE,VGA_AVAIL_ACCEL);
- if(accflags & ACCELFLAG_FILLBOX) // clear screen
- mode_capabilities|=CAP_ACCEL_CLEAR;
- if(accflags & ACCELFLAG_PUTIMAGE)//support for mem->vid transfer
- mode_capabilities|=CAP_ACCEL_PUTIMAGE;
- if((accflags & ACCELFLAG_SETMODE) && (accflags & ACCELFLAG_SYNC)){
- vga_accel(ACCEL_SETMODE,BLITS_IN_BACKGROUND);
- mode_capabilities|=CAP_ACCEL_BACKGR;//can draw in backgraund
- }
- }
- if(modeinfo->flags & IS_LINEAR){
- mode_capabilities|=CAP_LINEAR; //don't use bank & vga_draw
- }
- else{
- if(modeinfo->flags & CAPABLE_LINEAR){
- int vid_mem_size;
- vid_mem_size = vga_setlinearaddressing();
- if(vid_mem_size != -1){
- modeinfo=vga_getmodeinfo(vid_mode);//sometimes they change parameters
- mode_capabilities|=CAP_LINEAR;
- }
- }
- }
- }//fi force native
- if(mode_capabilities&CAP_LINEAR){
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SVGA] Video mode is linear and memcpy could be used for image transfer.\n");
- }
- if(mode_capabilities&CAP_ACCEL_PUTIMAGE){
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SVGA] Video mode has hardware acceleration and put_image could be used.\n");
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SVGA] If it works for you I would like to know.\n[VO_SVGA] (send log with `mplayer test.avi -v -v -v -v &> svga.log`). Thx!\n");
- }
-
-//here is the place to handle strides for accel_ modes;
- mode_stride=modeinfo->linewidth;
-//we may try to set a bigger stride for video mode that will match the mpi->stride,
-//this way we will transfer more data, but HW put_image can do it in backgraund!
-
-//now let's see how many pages we can use
- max_pages = modeinfo->maxpixels/(modeinfo->height * modeinfo->width);
- if(max_pages > MAXPAGES) max_pages = MAXPAGES;
- if(!vo_doublebuffering) max_pages=1;
-//fill PageStore structs
- {
- int i;
- uint8_t * GRAPH_MEM;
- int dof;
- GRAPH_MEM=vga_getgraphmem();
- for(i=0;i<max_pages;i++){
- //calculate display offset
- dof = i * modeinfo->height * modeinfo->width;
- if(modeinfo->bytesperpixel != 0) dof*=modeinfo->bytesperpixel;
- //check video chip limitations
- if( dof != (dof & modeinfo->startaddressrange) ){
- max_pages=i;//page 0 will never come here
- break;
- }
- PageStore[i].yoffset = i * modeinfo->height;//starting y offset
- PageStore[i].vbase = GRAPH_MEM + i*modeinfo->height*mode_stride; //memory base address
- PageStore[i].doffset = dof; //display offset
- PageStore[i].locks = PAGE_EMPTY;
- }
- }
- assert(max_pages>0);
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SVGA] Video mode has %d page(s).\n",max_pages);
- //15bpp
- if(modeinfo->bytesperpixel!=0)
- vga_claimvideomemory(max_pages * modeinfo->height * modeinfo->width * modeinfo->bytesperpixel);
- else
- vga_claimvideomemory(max_pages * modeinfo->height * modeinfo->width * mode_bpp / 8);
-
- cpage=old_page=0;
- svga_clear_box(0,0,modeinfo->width,modeinfo->height * max_pages);
-
- image_height=req_h;
- image_width=req_w;
- x_pos = (modeinfo->width - req_w) / 2;
- y_pos = (modeinfo->height - req_h) / 2;
- x_pos &= ~(15); //align x offset position to 16 pixels
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SVGA] Centering image. Starting at (%d,%d)\n",x_pos,y_pos);
-
- vga_setdisplaystart(0);
- return 0;
-}
-
-static int draw_slice(uint8_t *image[],int stride[],
- int w, int h, int x, int y) {
- assert(0);
- return VO_ERROR;//this is yv12 only -> vf_scale should do all transforms
-}
-
-static int draw_frame(uint8_t *src[]) {
- assert(0);
- return VO_ERROR;//this one should not be called
-}
-
-static void draw_osd(void)
-{
- mp_msg(MSGT_VO,MSGL_DBG4, "vo_svga: draw_osd()\n");
- //only modes with bytesperpixel>0 can draw OSD
- if(modeinfo->bytesperpixel==0) return;
- if(!(mode_capabilities&CAP_LINEAR)) return;//force_native will remove OSD
-
- if(blackbar_osd){
-//111
-//3 4
-//222
- svga_clear_box(0,0 + PageStore[cpage].yoffset,
- modeinfo->width, y_pos);
- svga_clear_box(0, image_height + y_pos + PageStore[cpage].yoffset,
- modeinfo->width, modeinfo->height-(image_height+ y_pos));
- svga_clear_box(0, y_pos + PageStore[cpage].yoffset,
- x_pos, image_height);
- svga_clear_box(image_width + x_pos, y_pos + PageStore[cpage].yoffset,
- modeinfo->width-(x_pos+image_width), image_height);
-// vo_remove_text(modeinfo->width, modeinfo->height, clear_alpha);
- vo_draw_text(modeinfo->width, modeinfo->height, draw_alpha);
- }else{
- vo_draw_text(image_width, image_height, draw_alpha);
- }
-}
-
-static void flip_page(void) {
- PageStore[old_page].locks=PAGE_EMPTY;
- PageStore[cpage].locks=PAGE_BUSY;
-
- mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: viewing page %d\n",cpage);
- if(sync_flip && old_page!=cpage){
- mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga:vga_waitretrace\n");
- vga_waitretrace();
- }
- vga_setdisplaystart(PageStore[cpage].doffset);
-
- old_page=cpage;//cpage will be overwriten on next draw_image
-}
-
-static void check_events(void) {
-}
-
-static void uninit(void) {
- vga_setmode(TEXT);
-}
-
-/* --------------------------------------------------------------------- */
-static int query_format(uint32_t format) {
- int32_t req_bpp,flags;
- int i,lastmode;
- vga_modeinfo * vminfo;
-
- mp_msg(MSGT_VO,MSGL_DBG4, "vo_svga: query_format=%X \n",format);
-//only RGB modes supported
- if( (!IMGFMT_IS_RGB(format)) && (!IMGFMT_IS_BGR(format)) ) return 0;
-
-// Reject different endian
-#if HAVE_BIGENDIAN
- if (IMGFMT_IS_BGR(format)) return 0;
-#else
- if (IMGFMT_IS_RGB(format)) return 0;
-#endif
-
- //svgalib supports only BG4B! if we want BGR4 we have to emulate it (sw)
- if( format==IMGFMT_BGR4 || format==IMGFMT_RGB4) return 0;
- req_bpp = IMGFMT_RGB_DEPTH(format);
- if( vo_dbpp>0 && vo_dbpp!=req_bpp ) return 0; //support -bpp options
-//scan all modes
- lastmode = vga_lastmodenumber();
- for(i=1;i<=lastmode;i++){
- vminfo = vga_getmodeinfo(i);
- if( vminfo == NULL ) continue;
- if( vga_hasmode(i) == 0 ) continue;
- if( req_bpp != bpp_from_vminfo(vminfo) ) continue;
- if( (force_vm > 0) && (force_vm != i) ) continue;//quick hack
- flags = VFCAP_CSP_SUPPORTED|
- VFCAP_CSP_SUPPORTED_BY_HW|
- VFCAP_ACCEPT_STRIDE|
- 0;
- if(req_bpp>8) flags|=VFCAP_OSD;
- return flags;
- }
- return 0;
-}
-
-static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src,
- unsigned char *srca, int stride) {
- char* base;
-
- mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: draw_alpha(x0=%d,y0=%d,w=%d,h=%d,src=%p,srca=%p,stride=%d\n",
- x0,y0,w,h,src,srca,stride);
- if(!blackbar_osd) {
- //drawing in the image, so place the stuff there
- x0+=x_pos;
- y0+=y_pos;
- }
-
- mp_msg(MSGT_VO,MSGL_DBG4, "vo_svga: OSD draw in page %d\n",cpage);
- base=PageStore[cpage].vbase + y0*mode_stride + x0*modeinfo->bytesperpixel;
- switch (mode_bpp) {
- case 32:
- vo_draw_alpha_rgb32(w, h, src, srca, stride, base, mode_stride);
- break;
- case 24:
- vo_draw_alpha_rgb24(w, h, src, srca, stride, base, mode_stride);
- break;
- case 16:
- vo_draw_alpha_rgb16(w, h, src, srca, stride, base, mode_stride);
- break;
- case 15:
- vo_draw_alpha_rgb15(w, h, src, srca, stride, base, mode_stride);
- break;
- }
-}
-
-static uint32_t get_image(mp_image_t *mpi){
- int page;
-
- if(!IMGFMT_IS_BGR(mpi->imgfmt) && !IMGFMT_IS_RGB(mpi->imgfmt) ){
- assert(0);//should never happen
- return VO_FALSE;
- }
-
- if (
- ( (mpi->type != MP_IMGTYPE_STATIC) && (mpi->type != MP_IMGTYPE_TEMP)) ||
- (mpi->flags & MP_IMGFLAG_PLANAR) ||
- (mpi->flags & MP_IMGFLAG_YUV)
- )
- return VO_FALSE;
-
-//reading from video memory is horribly slow
- if( !(mpi->flags & MP_IMGFLAG_READABLE) && vo_directrendering &&
- (mode_capabilities & CAP_LINEAR) ){
-
-//find free page and reserve it
- page=page_find_free();
- if(page >= 0){
- PageStore[page].locks=PAGE_BUSY;
-
- mpi->flags |= MP_IMGFLAG_DIRECT;
- mpi->stride[0] = mode_stride;
- mpi->planes[0] = PageStore[page].vbase +
- y_pos*mode_stride + (x_pos*mpi->bpp)/8;
- mpi->priv=(void *)page;
- mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: direct render allocated! page=%d\n",page);
- return VO_TRUE;
- }
- }
-
- return VO_FALSE;
-}
diff --git a/libvo/vo_tdfx_vid.c b/libvo/vo_tdfx_vid.c
deleted file mode 100644
index b49c2a85df..0000000000
--- a/libvo/vo_tdfx_vid.c
+++ /dev/null
@@ -1,667 +0,0 @@
-/*
- * copyright (C) 2003 Alban Bedel
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include "config.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-#include "aspect.h"
-#include "mp_msg.h"
-
-#include "fastmemcpy.h"
-#include "drivers/tdfx_vid.h"
-
-
-static const vo_info_t info =
-{
- "tdfx vid",
- "tdfx_vid",
- "Albeu",
- ""
-};
-
-//#define VERBOSE
-
-const LIBVO_EXTERN(tdfx_vid)
-
-static tdfx_vid_config_t tdfx_cfg;
-
-static unsigned char* agp_mem = NULL;
-static int tdfx_fd = -1;
-
-static uint32_t img_fmt; // The real input format
-static uint32_t src_width, src_height, src_fmt, src_bpp, src_stride;
-static uint32_t dst_width, dst_height, dst_fmt, dst_bpp, dst_stride;
-
-static uint32_t tdfx_page;
-static uint32_t front_buffer;
-static uint32_t back_buffer;
-static uint8_t num_buffer = 3;
-static uint32_t buffer_size; // Max size
-static uint8_t current_buffer = 0;
-static uint8_t current_ip_buf = 0;
-static uint32_t buffer_stride[3];
-
-static int use_overlay = 1;
-static tdfx_vid_overlay_t tdfx_ov;
-
-// FIXME
-#if 0
-static void clear_screen(void) {
- tdfx_vid_agp_move_t mov;
-
- memset(agp_mem,0,tdfx_cfg.screen_width*dst_bpp*tdfx_cfg.screen_height);
-
- mov.move2 = TDFX_VID_MOVE_2_PACKED;
- mov.width = tdfx_cfg.screen_width*dst_bpp;
- mov.height = tdfx_cfg.screen_height;
- mov.src = 0;
- mov.src_stride = tdfx_cfg.screen_width*dst_bpp;
- mov.dst = front_buffer;
- mov.dst_stride = tdfx_cfg.screen_stride;
-
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_TDXVID] Move %d(%d) x %d => %d.\n", mov.width,mov.src_stride,mov.height,mov.dst_stride);
-
- if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov))
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] AGP move failed to clear the screen.\n");
-
-}
-#endif
-
-static int draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
-{
- uint8_t* ptr[3];
-
-#ifdef VERBOSE
- printf("Draw slices %d\n",current_buffer);
-#endif
- switch(img_fmt) {
- case IMGFMT_YUY2:
- case IMGFMT_UYVY:
- case IMGFMT_BGR8:
- case IMGFMT_BGR16:
- case IMGFMT_BGR24:
- case IMGFMT_BGR32:
- // copy :( to agp_mem
- // still faster than tdfxfb wich directly copy to the video mem :)
- mem2agpcpy_pic(agp_mem + current_buffer * buffer_size +
- y*buffer_stride[0] + x * src_bpp,
- image[0],
- src_bpp*w,h,buffer_stride[0],stride[0]);
- return 0;
-
- case IMGFMT_YV12:
- case IMGFMT_I420:
- // Copy to agp mem
- ptr[0] = agp_mem + current_buffer * buffer_size;
- mem2agpcpy_pic(ptr[0] + y * buffer_stride[0] + x,image[0],w,h,
- buffer_stride[0],stride[0]);
- ptr[1] = ptr[0] + (src_height*src_width);
- mem2agpcpy_pic(ptr[1] + y/2 * buffer_stride[1] + x/2,image[1],w/2,h/2,
- buffer_stride[1],stride[1]);
- ptr[2] = ptr[1] + (src_height*src_width/4);
- mem2agpcpy_pic(ptr[2] + y/2 * buffer_stride[2] + x/2,image[2],w/2,h/2,
- buffer_stride[2],stride[2]);
- return 0;
- }
-
- return 1;
-}
-
-static void draw_osd(void)
-{
-}
-
-static void
-flip_page(void)
-{
- tdfx_vid_blit_t blit;
- //return;
- // Scale convert
-#ifdef VERBOSE
- printf("Flip\n");
-#endif
- if(use_overlay) {
- // TDFX_VID_OVERLAY_ON does nothing if the overlay is already on
- if(!ioctl(tdfx_fd,TDFX_VID_OVERLAY_ON)) { // X11 killed the overlay :(
- if(ioctl(tdfx_fd,TDFX_VID_SET_OVERLAY,&tdfx_ov))
- mp_msg(MSGT_VO, MSGL_ERR, "tdfx_vid: set_overlay failed\n");
- }
- // These formats need conversion
- switch(src_fmt) {
- case IMGFMT_BGR8:
- case IMGFMT_BGR24:
- case IMGFMT_BGR32:
- memset(&blit,0,sizeof(tdfx_vid_blit_t));
- blit.src = back_buffer;
- blit.src_stride = src_stride;
- blit.src_x = 0;
- blit.src_y = 0;
- blit.src_w = src_width;
- blit.src_h = src_height;
- blit.src_format = src_fmt;
-
- blit.dst = front_buffer;
- blit.dst_stride = dst_stride;
- blit.dst_x = 0;
- blit.dst_y = 0;
- blit.dst_w = src_width;
- blit.dst_h = src_height;
- blit.dst_format = IMGFMT_BGR16;
- if(ioctl(tdfx_fd,TDFX_VID_BLIT,&blit))
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] Blit failed.\n");
- }
- return;
- }
- memset(&blit,0,sizeof(tdfx_vid_blit_t));
- blit.src = back_buffer;
- blit.src_stride = src_stride;
- blit.src_x = 0;
- blit.src_y = 0;
- blit.src_w = src_width;
- blit.src_h = src_height;
- blit.src_format = src_fmt;
-
- blit.dst = front_buffer;
- blit.dst_stride = dst_stride;
- blit.dst_x = 0;
- blit.dst_y = 0;
- blit.dst_w = dst_width;
- blit.dst_h = dst_height;
- blit.dst_format = dst_fmt;
-
- if(ioctl(tdfx_fd,TDFX_VID_BLIT,&blit))
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] Blit failed.\n");
-}
-
-static int
-draw_frame(uint8_t *src[])
-{
- int stride[] = { src_stride, 0, 0};
- return draw_slice(src,stride,src_width, src_height,0,0);
-}
-
-static int
-query_format(uint32_t format)
-{
- switch(format) {
- case IMGFMT_BGR8:
- if(tdfx_cfg.screen_format == TDFX_VID_FORMAT_BGR8)
- return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_ACCEPT_STRIDE;
- return 0;
- case IMGFMT_YUY2:
- case IMGFMT_UYVY:
- case IMGFMT_BGR15:
- case IMGFMT_BGR16:
- case IMGFMT_BGR24:
- case IMGFMT_BGR32:
- case IMGFMT_YV12:
- case IMGFMT_I420:
- if(tdfx_cfg.screen_format == TDFX_VID_FORMAT_BGR8)
- return 0;
- return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_ACCEPT_STRIDE;
- }
- return 0;
-}
-
-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)
-{
-
- if(tdfx_fd < 0)
- return 1;
- // When we are run as sub vo we must follow the size gaven to us
- if(!(flags & VOFLAG_XOVERLAY_SUB_VO)) {
- if(!vo_screenwidth)
- vo_screenwidth = tdfx_cfg.screen_width;
- if(!vo_screenheight)
- vo_screenheight = tdfx_cfg.screen_height;
-
- aspect_save_orig(width,height);
- aspect_save_prescale(d_width,d_height);
- aspect_save_screenres(vo_screenwidth,vo_screenheight);
-
- if(flags&VOFLAG_FULLSCREEN) { /* -fs */
- aspect(&d_width,&d_height,A_ZOOM);
- vo_fs = VO_TRUE;
- } else {
- aspect(&d_width,&d_height,A_NOZOOM);
- vo_fs = VO_FALSE;
- }
- }
- src_width = width;
- src_height = height;
- buffer_size = 0;
- buffer_stride[0] = 0;
- src_fmt = 0;
- switch(format) {
- case IMGFMT_BGR8:
- case IMGFMT_BGR24:
- case IMGFMT_BGR32:
- if(use_overlay)
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_TDFXVID] Non-native overlay format needs conversion.\n");
- case IMGFMT_BGR15:
- case IMGFMT_BGR16:
- src_bpp = ((format & 0x3F)+7)/8;
- break;
- case IMGFMT_YV12:
- case IMGFMT_I420:
- buffer_size = src_width * src_height * 3 / 2;
- buffer_stride[0] = ((src_width+1)/2)*2;
- buffer_stride[1] = buffer_stride[2] = buffer_stride[0]/2;
- src_fmt = TDFX_VID_FORMAT_YUY2;
- case IMGFMT_YUY2:
- case IMGFMT_UYVY:
- src_bpp = 2;
- break;
- default:
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] Unsupported input format 0x%x.\n",format);
- return 1;
- }
-
- img_fmt = format;
- src_stride = src_width*src_bpp;
- // The overlay need a 4 bytes aligned stride
- if(use_overlay)
- src_stride = ((src_stride+3)/4)*4;
- if(!src_fmt)
- src_fmt = format;
- if(!buffer_size)
- buffer_size = src_stride*src_height;
- if(!buffer_stride[0])
- buffer_stride[0] = src_stride;
-
- dst_fmt = tdfx_cfg.screen_format;
- dst_bpp = ((dst_fmt & 0x3F)+7)/8;
- dst_width = d_width;
- dst_height = d_height;
- dst_stride = tdfx_cfg.screen_stride;
-
- tdfx_page = tdfx_cfg.screen_stride*tdfx_cfg.screen_height;
- front_buffer = tdfx_cfg.screen_start;
- back_buffer = front_buffer + tdfx_page;
-
- while(use_overlay) {
- tdfx_vid_overlay_t ov;
- uint32_t ov_fmt = src_fmt, ov_stride = src_stride;
- // Align the buffer
- back_buffer = (((back_buffer+3)/4)*4);
- // With the overlay the front buffer is not on the screen
- // so we take the back buffer
- front_buffer = back_buffer;
- switch(src_fmt) {
- case IMGFMT_BGR8:
- case IMGFMT_BGR24:
- case IMGFMT_BGR32:
- back_buffer = front_buffer + 2*(src_stride*src_height);
- ov_stride = dst_stride = src_width<<1;
- ov_fmt = IMGFMT_BGR16;
- break;
- }
- ov.src[0] = front_buffer;
- ov.src[1] = front_buffer + (src_stride*src_height);
- ov.src_width = src_width;
- ov.src_height = src_height;
- ov.src_stride = ov_stride;
- ov.format = ov_fmt;
- ov.dst_width = dst_width;
- ov.dst_height = dst_height;
- ov.dst_x = vo_dx;
- ov.dst_y = vo_dy;
- ov.use_colorkey = 0;
-
- if(ioctl(tdfx_fd,TDFX_VID_SET_OVERLAY,&ov)) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] Overlay setup failed.\n");
- use_overlay = 0;
- break;
- }
- tdfx_ov = ov;
- if(use_overlay == 1) {
- if(ioctl(tdfx_fd,TDFX_VID_OVERLAY_ON)) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] Overlay on failed.\n");
- use_overlay = 0;
- break;
- }
- use_overlay++;
- }
-
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_TDFXVID] Overlay ready: %d(%d) x %d @ %d => %d(%d) x %d @ %d.\n",
- src_width,src_stride,src_height,src_bpp,
- dst_width,dst_stride,dst_height,dst_bpp);
- break;
- }
-
- if(!use_overlay)
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_TDFXVID] Texture blit ready: %d(%d) x %d @ %d => %d(%d) x %d @ %d.\n",
- src_width,src_stride,src_height,src_bpp,
- dst_width,dst_stride,dst_height,dst_bpp);
-
- return 0;
-}
-
-static void
-uninit(void)
-{
- if(use_overlay == 2) {
- if(ioctl(tdfx_fd,TDFX_VID_OVERLAY_OFF))
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] Overlay off failed\n");
- use_overlay--;
- }
- close(tdfx_fd);
- tdfx_fd = -1;
-}
-
-
-static void check_events(void)
-{
-}
-
-static int preinit(const char *arg)
-{
-
- tdfx_fd = open(arg ? arg : "/dev/tdfx_vid", O_RDWR);
- if(tdfx_fd < 0) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] Can't open %s: %s.\n",arg ? arg : "/dev/tdfx_vid",
- strerror(errno));
- return 1;
- }
-
- if(ioctl(tdfx_fd,TDFX_VID_GET_CONFIG,&tdfx_cfg)) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] Can't get current configuration: %s.\n",strerror(errno));
- return 1;
- }
-
- mp_msg(MSGT_VO,MSGL_INFO, "tdfx_vid version %d\n"
- " Ram: %d\n"
- " Screen: %d x %d\n"
- " Format: %c%c%c%d\n",
- tdfx_cfg.version,
- tdfx_cfg.ram_size,
- tdfx_cfg.screen_width, tdfx_cfg.screen_height,
- tdfx_cfg.screen_format>>24,(tdfx_cfg.screen_format>>16)&0xFF,
- (tdfx_cfg.screen_format>>8)&0xFF,tdfx_cfg.screen_format&0xFF);
-
- // For now just allocate more than i ever need
- agp_mem = mmap( NULL, 1024*768*4, PROT_READ | PROT_WRITE, MAP_SHARED,
- tdfx_fd, 0);
-
- if(agp_mem == MAP_FAILED) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] Memmap failed !!!!!\n");
- return 1;
- }
-
- memset(agp_mem,0,1024*768*4);
-
- return 0;
-}
-
-static uint32_t get_image(mp_image_t *mpi) {
- int buf = 0;
-
-#ifdef VERBOSE
- printf("Get image %d\n",buf);
-#endif
-
- // Currently read are too slow bcs we read from the
- // agp aperture and not the memory directly
- //if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE;
-
- if(mpi->flags&MP_IMGFLAG_READABLE &&
- (mpi->type==MP_IMGTYPE_IPB || mpi->type==MP_IMGTYPE_IP)){
- // reference (I/P) frame of IP or IPB:
- if(num_buffer<2) return VO_FALSE; // not enough
- current_ip_buf^=1;
- // for IPB with 2 buffers we can DR only one of the 2 P frames:
- if(mpi->type==MP_IMGTYPE_IPB && num_buffer<3 && current_ip_buf) return VO_FALSE;
- buf=current_ip_buf;
- if(mpi->type==MP_IMGTYPE_IPB) ++buf; // preserve space for B
- }
-
- switch(mpi->imgfmt) {
- case IMGFMT_YUY2:
- case IMGFMT_UYVY:
- case IMGFMT_BGR8:
- case IMGFMT_BGR15:
- case IMGFMT_BGR16:
- case IMGFMT_BGR24:
- case IMGFMT_BGR32:
- mpi->planes[0] = agp_mem + buf * buffer_size;
- mpi->stride[0] = src_stride;
- break;
- case IMGFMT_YV12:
- case IMGFMT_I420:
- mpi->planes[0] = agp_mem + buf * buffer_size;
- mpi->stride[0] = mpi->width;
- mpi->planes[1] = mpi->planes[0] + mpi->stride[0]*mpi->height;
- mpi->stride[1] = mpi->chroma_width;
- mpi->planes[2] = mpi->planes[1] + mpi->stride[1]*mpi->chroma_height;
- mpi->stride[2] = mpi->chroma_width;
- break;
- default:
- mp_tmsg(MSGT_VO,MSGL_WARN, "Get image todo.\n");
- return VO_FALSE;
- }
- mpi->flags |= MP_IMGFLAG_DIRECT;
- mpi->priv = (void*)buf;
-
- return VO_TRUE;
-}
-
-static uint32_t start_slice(mp_image_t *mpi){
- int buf = 0;
-
-#ifdef VERBOSE
- printf("Start slices %d\n",buf);
-#endif
-
- if(mpi->flags & MP_IMGFLAG_DIRECT)
- buf = (int)mpi->priv;
- current_buffer = buf;
-
- return VO_TRUE;
-}
-
-static uint32_t draw_image(mp_image_t *mpi){
- int buf = 0;
- tdfx_vid_agp_move_t mov;
- tdfx_vid_yuv_t yuv;
- int p;
- uint8_t* planes[3];
-
-#ifdef VERBOSE
- printf("Draw image %d\n",buf);
-#endif
-
- if(mpi->flags & MP_IMGFLAG_DIRECT)
- buf = (int)mpi->priv;
-
- switch(mpi->imgfmt) {
- case IMGFMT_YUY2:
- case IMGFMT_UYVY:
- case IMGFMT_BGR8:
- case IMGFMT_BGR15:
- case IMGFMT_BGR16:
- case IMGFMT_BGR24:
- case IMGFMT_BGR32:
- if(!(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK))) {
- // copy to agp_mem
-#ifdef VERBOSE
- printf("Memcpy\n");
-#endif
- planes[0] = agp_mem + buf * buffer_size;
- mem2agpcpy_pic(planes[0],mpi->planes[0],src_bpp*mpi->width,mpi->height,
- buffer_stride[0],mpi->stride[0]);
- } else
- planes[0] = agp_mem + buf * buffer_size;
-
- mov.move2 = TDFX_VID_MOVE_2_PACKED;
- mov.width = mpi->width*((mpi->bpp+7)/8);
- mov.height = mpi->height;
- mov.src = planes[0] - agp_mem;
- mov.src_stride = buffer_stride[0];
-
- mov.dst = back_buffer;
- mov.dst_stride = src_stride;
-
- if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov))
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] AGP move failed.\n");
- break;
-
- case IMGFMT_YV12:
- case IMGFMT_I420:
- if(!(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK))) {
- // Copy to agp mem
-#ifdef VERBOSE
- printf("Memcpy\n");
-#endif
- planes[0] = agp_mem + buf * buffer_size;
- memcpy_pic(planes[0],mpi->planes[0],mpi->width,mpi->height,
- buffer_stride[0],mpi->stride[0]);
- planes[1] = planes[0] + (mpi->height*mpi->stride[0]);
- memcpy_pic(planes[1],mpi->planes[1],mpi->chroma_width,mpi->chroma_height,
- buffer_stride[1],mpi->stride[1]);
- planes[2] = planes[1] + (mpi->chroma_height*mpi->stride[1]);
- memcpy_pic(planes[2],mpi->planes[2],mpi->chroma_width,mpi->chroma_height,
- buffer_stride[2],mpi->stride[2]);
- } else {
- planes[0] = agp_mem + buf * buffer_size;
- planes[1] = planes[0] + buffer_stride[0] * src_height;
- planes[2] = planes[1] + buffer_stride[1] * src_height/2;
- }
-
- // Setup the yuv thing
- yuv.base = back_buffer;
- yuv.stride = src_stride;
- if(ioctl(tdfx_fd,TDFX_VID_SET_YUV,&yuv)) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] Set YUV failed.\n");
- break;
- }
-
-
- // Now agp move that
- // Y
- mov.move2 = TDFX_VID_MOVE_2_YUV;
- mov.width = mpi->width;
- mov.height = mpi->height;
- mov.src = planes[0] - agp_mem;
- mov.src_stride = buffer_stride[0];
- mov.dst = 0x0;
- mov.dst_stride = TDFX_VID_YUV_STRIDE;
-
- if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] AGP move failed on Y plane.\n");
- break;
- }
- //return 0;
- // U
- p = mpi->imgfmt == IMGFMT_YV12 ? 1 : 2;
- mov.width = mpi->chroma_width;
- mov.height = mpi->chroma_height;
- mov.src = planes[p] - agp_mem;
- mov.src_stride = buffer_stride[p];
- mov.dst += TDFX_VID_YUV_PLANE_SIZE;
- if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] AGP move failed on U plane.\n");
- break;
- }
- // V
- p = mpi->imgfmt == IMGFMT_YV12 ? 2 : 1;
- mov.src = planes[p] - agp_mem;
- mov.src_stride = buffer_stride[p];
- mov.dst += TDFX_VID_YUV_PLANE_SIZE;
- if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] AGP move failed on V plane.\n");
- break;
- }
- break;
- default:
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] unknown format: 0x%x.\n",mpi->imgfmt);
- return VO_TRUE;
- }
-
- return VO_TRUE;
-}
-
-static uint32_t fullscreen(void) {
- vo_fs ^= 1;
- aspect(&dst_width,&dst_height,vo_fs ? A_ZOOM : A_NOZOOM);
- // This does not work :((
- //clear_screen();
- return VO_TRUE;
-}
-
-static uint32_t set_window(mp_win_t* w) {
- if(!use_overlay) return VO_FALSE;
-
- tdfx_ov.dst_x = w->x;
- tdfx_ov.dst_y = w->y;
- tdfx_ov.dst_width = w->w;
- tdfx_ov.dst_height = w->h;
-
- if(ioctl(tdfx_fd,TDFX_VID_SET_OVERLAY,&tdfx_ov))
- mp_msg(MSGT_VO, MSGL_V, "tdfx_vid: set window failed\n");
-
- return VO_TRUE;
-}
-
-static uint32_t set_colorkey(mp_colorkey_t* colork) {
- if(!use_overlay) return VO_FALSE;
-
- tdfx_ov.colorkey[0] = tdfx_ov.colorkey[1] = colork->x11;
- tdfx_ov.use_colorkey = 1;
- tdfx_ov.invert_colorkey = 0;
-
- if(ioctl(tdfx_fd,TDFX_VID_SET_OVERLAY,&tdfx_ov))
- mp_msg(MSGT_VO, MSGL_V, "tdfx_vid: set colorkey failed\n");
-
- return VO_TRUE;
-}
-
-static int control(uint32_t request, void *data)
-{
- switch (request) {
- case VOCTRL_QUERY_FORMAT:
- return query_format(*((uint32_t*)data));
- case VOCTRL_GET_IMAGE:
- return get_image(data);
- case VOCTRL_DRAW_IMAGE:
- return draw_image(data);
- case VOCTRL_START_SLICE:
- return start_slice(data);
- case VOCTRL_FULLSCREEN:
- return fullscreen();
- case VOCTRL_XOVERLAY_SUPPORT:
- return VO_TRUE;
- case VOCTRL_XOVERLAY_SET_COLORKEY:
- return set_colorkey(data);
- case VOCTRL_XOVERLAY_SET_WIN:
- return set_window(data);
- }
- return VO_NOTIMPL;
-}
diff --git a/libvo/vo_tdfxfb.c b/libvo/vo_tdfxfb.c
deleted file mode 100644
index 6e14f600b7..0000000000
--- a/libvo/vo_tdfxfb.c
+++ /dev/null
@@ -1,529 +0,0 @@
-/*
- * copyright (C) 2002 Mark Zealey <mark@zealos.org>
- *
- * 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.
- */
-
-/*
- * 30/03/02: An almost total rewrite, added DR support and support for modes
- * other than 16bpp. Fixed the crash when playing multiple files
- * 07/04/02: Fixed DR support, added YUY2 support, fixed OSD stuff.
- * 08/04/02: Fixed a wierd sound corruption problem caused by some optomizations
- * I made.
- * 09/04/02: Fixed a problem with changing the variables passed to draw_slice().
- * Fixed DR support for YV12 et al. Added BGR support. Removed lots of dud code.
- * 10/04/02: Changed the memcpy functions to mem2agpcpy.. should be a tad
- * faster.
- * 11/04/02: Added a compile option so you can watch the film with the console
- * as the background, or not.
- * 13/04/02: Fix rough OSD stuff by rendering it straight onto the output
- * buffer. Added double-buffering. Supports hardware zoom/reduce zoom modes.
- * 13/04/02: Misc cleanups of the code.
- * 22/10/02: Added geometry support to it
- *
- * Hints and tricks:
- * - Use -dr to get direct rendering
- * - Use -vf yuy2 to get yuy2 rendering, *MUCH* faster than yv12
- * - To get a black background and nice smooth OSD, use -double
- * - To get the console as a background, but with scaled OSD, use -nodouble
- * - The driver supports both scaling and shrinking the image using the -x and
- * -y options on the mplayer commandline. Also repositioning via the -geometry
- * option.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <linux/fb.h>
-
-#include "config.h"
-#include "mp_msg.h"
-#include "fastmemcpy.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-#include "drivers/3dfx.h"
-#include "aspect.h"
-#include "sub/sub.h"
-
-static const vo_info_t info =
-{
- "3Dfx Banshee/Voodoo3/Voodoo5",
- "tdfxfb",
- "Mark Zealey <mark@zealos.org>",
- ""
-};
-
-const LIBVO_EXTERN(tdfxfb)
-
-/* Some registers on the card */
-#define S2S_STRECH_BLT 2 // BLT + Strech
-#define S2S_IMMED (1 << 8) // Do it immediatly
-#define S2S_ROP (0xCC << 24) // ???
-
-/* Stepping between the different YUV plane registers */
-#define YUV_STRIDE 1024
-struct YUV_plane {
- char Y[0x0100000];
- char U[0x0100000];
- char V[0x0100000];
-};
-
-static int fd = -1;
-static struct fb_fix_screeninfo fb_finfo;
-static struct fb_var_screeninfo fb_vinfo;
-static uint32_t in_width, in_height, in_format, in_depth, in_voodoo_format,
- screenwidth, screenheight, screendepth, vidwidth, vidheight, vidx, vidy,
- vid_voodoo_format, *vidpage, *hidpage, *inpage, vidpageoffset,
- hidpageoffset, inpageoffset, *memBase0 = NULL, *memBase1 = NULL, r_width, r_height;
-static volatile voodoo_io_reg *reg_IO;
-static volatile voodoo_2d_reg *reg_2d;
-static voodoo_yuv_reg *reg_YUV;
-static struct YUV_plane *YUV;
-static void (*alpha_func)(), (*alpha_func_double)();
-
-static int preinit(const char *arg)
-{
- char *name;
-
- if(arg)
- name = (char*)arg;
- else if(!(name = getenv("FRAMEBUFFER")))
- name = "/dev/fb0";
-
- if((fd = open(name, O_RDWR)) == -1) {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_TDFXFB] Can't open %s: %s.\n", name, strerror(errno));
- return -1;
- }
-
- if(ioctl(fd, FBIOGET_FSCREENINFO, &fb_finfo)) {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_TDFXFB] Problem with FBITGET_FSCREENINFO ioctl: %s.\n",
- strerror(errno));
- close(fd);
- fd = -1;
- return -1;
- }
-
- if(ioctl(fd, FBIOGET_VSCREENINFO, &fb_vinfo)) {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_TDFXFB] Problem with FBITGET_VSCREENINFO ioctl: %s.\n",
- strerror(errno));
- close(fd);
- fd = -1;
- return -1;
- }
-
- /* BANSHEE means any of the series aparently */
- if (fb_finfo.accel != FB_ACCEL_3DFX_BANSHEE) {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_TDFXFB] This driver only supports the 3Dfx Banshee, Voodoo3 and Voodoo 5.\n");
- close(fd);
- fd = -1;
- return -1;
- }
-
- // Check the depth now as config() musn't fail
- switch(fb_vinfo.bits_per_pixel) {
- case 16:
- case 24:
- case 32:
- break; // Ok
- default:
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_TDFXFB] %d bpp output is not supported.\n", fb_vinfo.bits_per_pixel);
- close(fd);
- fd = -1;
- return -1;
- }
-
- /* Open up a window to the hardware */
- memBase1 = mmap(0, fb_finfo.smem_len, PROT_READ | PROT_WRITE,
- MAP_SHARED, fd, 0);
- memBase0 = mmap(0, fb_finfo.mmio_len, PROT_READ | PROT_WRITE,
- MAP_SHARED, fd, fb_finfo.smem_len);
-
- if((long)memBase0 == -1 || (long)memBase1 == -1) {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_TDFXFB] Couldn't map memory areas: %s.\n", strerror(errno));
- if((long)memBase0 != -1)
- munmap(memBase0, fb_finfo.smem_len);
- if((long)memBase1 != -1)
- munmap(memBase1, fb_finfo.smem_len);
- memBase0 = memBase1 = NULL;
- return -1;
- }
-
- /* Set up global pointers to the voodoo's regs */
- reg_IO = (void *)memBase0 + VOODOO_IO_REG_OFFSET;
- reg_2d = (void *)memBase0 + VOODOO_2D_REG_OFFSET;
- reg_YUV = (void *)memBase0 + VOODOO_YUV_REG_OFFSET;
- YUV = (void *)memBase0 + VOODOO_YUV_PLANE_OFFSET;
-
- return 0;
-}
-
-static void uninit(void)
-{
- if(reg_IO) {
- /* Restore the screen (Linux lives at 0) */
- reg_IO->vidDesktopStartAddr = 0;
- reg_IO = NULL;
- }
-
- /* And close our mess */
- if(memBase1) {
- munmap(memBase1, fb_finfo.smem_len);
- memBase1 = NULL;
- }
-
- if(memBase0) {
- munmap(memBase0, fb_finfo.mmio_len);
- memBase0 = NULL;
- }
-
- if(fd != -1) {
- close(fd);
- fd = -1;
- }
-}
-
-static void clear_screen(void)
-{
- /* There needs to be some sort of delay here or else things seriously
- * screw up. Causes the image to not be the right size on screen if
- * this isn't like this. A printf before the memset call also seems to
- * work, but this made more sense since it actually checks the status of
- * the card.
- */
- if(vo_doublebuffering) {
- /* first wait for the card to be ready, do not try to write
- * every time - alex */
- do {} while((reg_IO->status & 0x1f) < 1);
- memset(vidpage, 0, screenwidth * screenheight * screendepth);
- memset(hidpage, 0, screenwidth * screenheight * screendepth);
- }
-}
-
-/* Setup output screen dimensions etc */
-static void setup_screen(uint32_t full)
-{
- aspect(&vidwidth, &vidheight, full ? A_ZOOM : A_NOZOOM);
-
- geometry(&vidx, &vidy, &vidwidth, &vidheight, screenwidth, screenheight);
- vo_fs = full;
- clear_screen();
-}
-
-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)
-{
- screenwidth = fb_vinfo.xres;
- screenheight = fb_vinfo.yres;
- aspect_save_screenres(fb_vinfo.xres,fb_vinfo.yres);
-
- in_width = width;
- in_height = height;
- in_format = format;
- aspect_save_orig(width,height);
-
- r_width = d_width;
- r_height = d_height;
- aspect_save_prescale(d_width,d_height);
-
- /* Setup the screen for rendering to */
- switch(fb_vinfo.bits_per_pixel) {
- case 16:
- screendepth = 2;
- vid_voodoo_format = VOODOO_BLT_FORMAT_16;
- alpha_func_double = vo_draw_alpha_rgb16;
- break;
-
- case 24:
- screendepth = 3;
- vid_voodoo_format = VOODOO_BLT_FORMAT_24;
- alpha_func_double = vo_draw_alpha_rgb24;
- break;
-
- case 32:
- screendepth = 4;
- vid_voodoo_format = VOODOO_BLT_FORMAT_32;
- alpha_func_double = vo_draw_alpha_rgb32;
- break;
-
- default:
- mp_tmsg(MSGT_VO, MSGL_ERR, "[VO_TDFXFB] %d bpp output is not supported (This should never have happened).\n", fb_vinfo.bits_per_pixel);
- return -1;
- }
-
- vid_voodoo_format |= screenwidth * screendepth;
-
- /* Some defaults here */
- in_voodoo_format = VOODOO_BLT_FORMAT_YUYV;
- in_depth = 2;
- alpha_func = vo_draw_alpha_yuy2;
-
- switch(in_format) {
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_YUY2:
- break;
- case IMGFMT_UYVY:
- in_voodoo_format = VOODOO_BLT_FORMAT_UYVY;
- break;
- case IMGFMT_BGR16:
- in_voodoo_format = VOODOO_BLT_FORMAT_16;
- alpha_func = vo_draw_alpha_rgb16;
- break;
-
- case IMGFMT_BGR24:
- in_depth = 3;
- in_voodoo_format = VOODOO_BLT_FORMAT_24;
- alpha_func = vo_draw_alpha_rgb24;
- break;
-
- case IMGFMT_BGR32:
- in_depth = 4;
- in_voodoo_format = VOODOO_BLT_FORMAT_32;
- alpha_func = vo_draw_alpha_rgb32;
- break;
-
- default:
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_TDFXFB] Eik! Something's wrong with control().\n");
- return -1;
- }
-
- in_voodoo_format |= in_width * in_depth;
-
- /* Linux lives in the first frame */
- if(vo_doublebuffering) {
- vidpageoffset = screenwidth * screenheight * screendepth;
- hidpageoffset = vidpageoffset + screenwidth * screenheight * screendepth;
- } else
- vidpageoffset = hidpageoffset = 0; /* Console background */
-
-
- inpageoffset = hidpageoffset + screenwidth * screenheight * screendepth;
-
- if(inpageoffset + in_width * in_depth * in_height > fb_finfo.smem_len) {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_TDFXFB] Not enough video memory to play this movie. Try at a lower resolution.\n");
- return -1;
- }
-
- vidpage = (void *)memBase1 + (unsigned long)vidpageoffset;
- hidpage = (void *)memBase1 + (unsigned long)hidpageoffset;
- inpage = (void *)memBase1 + (unsigned long)inpageoffset;
-
- setup_screen(flags & VOFLAG_FULLSCREEN);
-
- memset(inpage, 0, in_width * in_height * in_depth);
-
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_TDFXFB] Screen is %dx%d at %d bpp, in is %dx%d at %d bpp, norm is %dx%d.\n",
- screenwidth, screenheight, screendepth * 8,
- in_width, in_height, in_depth * 8,
- d_width, d_height);
-
- return 0;
-}
-
-/* Double-buffering draw_alpha */
-static void draw_alpha_double(int x, int y, int w, int h, unsigned char *src,
- unsigned char *srca, int stride)
-{
- char *dst = (char *)vidpage + ((y + vidy) * screenwidth + x + vidx) * screendepth;
- alpha_func_double(w, h, src, srca, stride, dst, screenwidth * screendepth);
-}
-
-/* Single-buffering draw_alpha */
-static void draw_alpha(int x, int y, int w, int h, unsigned char *src,
- unsigned char *srca, int stride)
-{
- char *dst = (char *)inpage + (y * in_width + x) * in_depth;
- alpha_func(w, h, src, srca, stride, dst, in_width * in_depth);
-}
-
-static void draw_osd(void)
-{
- if(!vo_doublebuffering)
- vo_draw_text(in_width, in_height, draw_alpha);
-}
-
-/* Render onto the screen */
-static void flip_page(void)
-{
- voodoo_2d_reg regs = *reg_2d; /* Copy the regs */
- int i = 0;
-
- if(vo_doublebuffering) {
- /* Flip to an offscreen buffer for rendering */
- uint32_t t = vidpageoffset;
- void *j = vidpage;
-
- vidpage = hidpage;
- hidpage = j;
- vidpageoffset = hidpageoffset;
- hidpageoffset = t;
- }
-
- reg_2d->commandExtra = 0;
- reg_2d->clip0Min = 0;
- reg_2d->clip0Max = 0xffffffff;
-
- reg_2d->srcBaseAddr = inpageoffset;
- reg_2d->srcXY = 0;
- reg_2d->srcFormat = in_voodoo_format;
- reg_2d->srcSize = XYREG(in_width, in_height);
-
- reg_2d->dstBaseAddr = vidpageoffset;
- reg_2d->dstXY = XYREG(vidx, vidy);
- reg_2d->dstFormat = vid_voodoo_format;
- reg_2d->dstSize = XYREG(vidwidth, vidheight);
- reg_2d->command = S2S_STRECH_BLT | S2S_IMMED | S2S_ROP;
-
- /* Wait for the command to finish (If we don't do this, we get wierd
- * sound corruption... */
- while((reg_IO->status & 0x1f) < 1)
- /* Wait */;
-
- *((volatile uint32_t *)((uint32_t *)reg_IO + COMMAND_3D)) = COMMAND_3D_NOP;
-
- while(i < 3)
- if(!(reg_IO->status & STATUS_BUSY))
- i++;
-
- /* Restore the old regs now */
- reg_2d->commandExtra = regs.commandExtra;
- reg_2d->clip0Min = regs.clip0Min;
- reg_2d->clip0Max = regs.clip0Max;
-
- reg_2d->srcBaseAddr = regs.srcBaseAddr;
- reg_2d->srcXY = regs.srcXY;
- reg_2d->srcFormat = regs.srcFormat;
- reg_2d->srcSize = regs.srcSize;
-
- reg_2d->dstBaseAddr = regs.dstBaseAddr;
- reg_2d->dstXY = regs.dstXY;
- reg_2d->dstFormat = regs.dstFormat;
- reg_2d->dstSize = regs.dstSize;
-
- reg_2d->command = 0;
-
- /* Render any text onto this buffer */
- if(vo_doublebuffering)
- vo_draw_text(vidwidth, vidheight, draw_alpha_double);
-
- /* And flip to the new buffer! */
- reg_IO->vidDesktopStartAddr = vidpageoffset;
-}
-
-static int draw_frame(uint8_t *src[])
-{
- mem2agpcpy(inpage, src[0], in_width * in_depth * in_height);
- return 0;
-}
-
-static int draw_slice(uint8_t *i[], int s[], int w, int h, int x, int y)
-{
- /* We want to render to the YUV to the input page + the location
- * of the stripes we're doing */
- reg_YUV->yuvBaseAddr = inpageoffset + in_width * in_depth * y + x;
- reg_YUV->yuvStride = in_width * in_depth;
-
- /* Put the YUV channels into the voodoos internal combiner unit
- * thingie */
- mem2agpcpy_pic(YUV->Y, i[0], s[0], h , YUV_STRIDE, s[0]);
- mem2agpcpy_pic(YUV->U, i[1], s[1], h / 2, YUV_STRIDE, s[1]);
- mem2agpcpy_pic(YUV->V, i[2], s[2], h / 2, YUV_STRIDE, s[2]);
- return 0;
-}
-
-/* Attempt to start doing DR */
-static uint32_t get_image(mp_image_t *mpi)
-{
-
- if(mpi->flags & MP_IMGFLAG_READABLE)
- return VO_FALSE;
- if(mpi->type == MP_IMGTYPE_STATIC && vo_doublebuffering)
- return VO_FALSE;
- if(mpi->type > MP_IMGTYPE_TEMP)
- return VO_FALSE; // TODO ??
-
- switch(in_format) {
- case IMGFMT_YUY2:
- case IMGFMT_BGR16:
- case IMGFMT_BGR24:
- case IMGFMT_BGR32:
- case IMGFMT_UYVY:
- mpi->planes[0] = (char *)inpage;
- mpi->stride[0] = in_width * in_depth;
- break;
-
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- if(!(mpi->flags & MP_IMGFLAG_ACCEPT_STRIDE) && mpi->w != YUV_STRIDE)
- return VO_FALSE;
- mpi->planes[0] = YUV->Y;
- mpi->planes[1] = YUV->U;
- mpi->planes[2] = YUV->V;
- mpi->stride[0] = mpi->stride[1] = mpi->stride[2] = YUV_STRIDE;
- reg_YUV->yuvBaseAddr = inpageoffset;
- reg_YUV->yuvStride = in_width * in_depth;
- break;
-
- default:
- return VO_FALSE;
- }
-
- mpi->width = in_width;
- mpi->flags |= MP_IMGFLAG_DIRECT;
-
- return VO_TRUE;
-}
-
-static int control(uint32_t request, void *data)
-{
- switch(request) {
- case VOCTRL_GET_IMAGE:
- return get_image(data);
-
- case VOCTRL_QUERY_FORMAT:
- switch(*((uint32_t*)data)) {
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_YUY2:
- case IMGFMT_UYVY:
- case IMGFMT_BGR16:
- case IMGFMT_BGR24:
- case IMGFMT_BGR32:
- return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW |
- VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN;
- }
-
- return 0; /* Not supported */
-
- case VOCTRL_FULLSCREEN:
- setup_screen(!vo_fs);
- return 0;
- }
-
- return VO_NOTIMPL;
-}
-
-/* Dummy funcs */
-static void check_events(void) {}
diff --git a/libvo/vo_vesa.c b/libvo/vo_vesa.c
deleted file mode 100644
index b9cb60a625..0000000000
--- a/libvo/vo_vesa.c
+++ /dev/null
@@ -1,1029 +0,0 @@
-/*
- * copyright (C) 2001 Nick Kurshev <nickols_k@mail.ru>
- * This file is partly based on vbetest.c from lrmi distributive.
- *
- * 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.
- */
-
-/*
- TODO:
- - hw YUV support (need volunteers who have corresponding hardware)
- - triple buffering (if it will really speedup playback).
- note: triple buffering requires VBE 3.0 - need volunteers.
-*/
-#include "config.h"
-#include "mp_msg.h"
-#include "gtf.h"
-#include <stdio.h>
-#if HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#include <stdlib.h>
-#include <string.h>
-#include <stddef.h>
-#include <limits.h>
-#include <unistd.h>
-#include <pwd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <libavutil/common.h>
-#include <vbe.h>
-
-#include "video_out.h"
-#include "video_out_internal.h"
-
-#include "fastmemcpy.h"
-#include "sub/sub.h"
-#include "libavutil/common.h"
-#include "mpbswap.h"
-#include "aspect.h"
-#include "vesa_lvo.h"
-#include "mp_msg.h"
-
-#include "libswscale/swscale.h"
-#include "libmpcodecs/vf_scale.h"
-
-
-#define MAX_BUFFERS 3
-
-static const vo_info_t info =
-{
- "VESA VBE 2.0 video output",
- "vesa",
- "Nick Kurshev <nickols_k@mail.ru>",
- "Requires ROOT privileges"
-};
-
-LIBVO_EXTERN(vesa)
-
-/* driver data */
-
-struct win_frame
-{
- uint8_t *ptr; /* pointer to window's frame memory */
- uint32_t low; /* lowest boundary of frame */
- uint32_t high; /* highest boundary of frame */
- char idx; /* indicates index of relocatable frame (A=0 or B=1)
- special case for DGA: idx=-1
- idx=-2 indicates invalid frame, exists only in init() */
-};
-
-static void (*cpy_blk_fnc)(unsigned long,uint8_t *,unsigned long) = NULL;
-
-static uint32_t srcW=0,srcH=0,srcBpp,srcFourcc; /* source image description */
-static uint32_t dstBpp,dstW, dstH,dstFourcc; /* destinition image description */
-
-static struct SwsContext * sws = NULL;
-
-static int32_t x_offset,y_offset; /* to center image on screen */
-static unsigned init_mode=0; /* mode before run of mplayer */
-static void *init_state = NULL; /* state before run of mplayer */
-static struct win_frame win; /* real-mode window to video memory */
-static uint8_t *dga_buffer = NULL; /* for yuv2rgb and sw_scaling */
-static unsigned video_mode; /* selected video mode for playback */
-static struct VesaModeInfoBlock video_mode_info;
-static int flip_trigger = 0;
-static void (*draw_alpha_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride);
-
-/* multibuffering */
-uint8_t* video_base; /* should be never changed */
-uint32_t multi_buff[MAX_BUFFERS]; /* contains offsets of buffers */
-uint8_t multi_size=0; /* total number of buffers */
-uint8_t multi_idx=0; /* active buffer */
-
-/* Linux Video Overlay */
-static const char *lvo_name = NULL;
-static int lvo_opened = 0;
-
-/* Neomagic TV out */
-static int neomagic_tvout = 0;
-static int neomagic_tvnorm = NEO_PAL;
-
-#define HAS_DGA() (win.idx == -1)
-#define MOVIE_MODE (MODE_ATTR_COLOR | MODE_ATTR_GRAPHICS)
-#define FRAME_MODE (MODE_WIN_RELOCATABLE | MODE_WIN_WRITEABLE)
-
-static char * vbeErrToStr(int err)
-{
- char *retval;
- static char sbuff[80];
- if((err & VBE_VESA_ERROR_MASK) == VBE_VESA_ERROR_MASK)
- {
- sprintf(sbuff,"VESA failed = 0x4f%02x",(err & VBE_VESA_ERRCODE_MASK)>>8);
- retval = sbuff;
- }
- else
- switch(err)
- {
- case VBE_OK: retval = "No error"; break;
- case VBE_VM86_FAIL: retval = "vm86() syscall failed"; break;
- case VBE_OUT_OF_DOS_MEM: retval = "Out of DOS memory"; break;
- case VBE_OUT_OF_MEM: retval = "Out of memory"; break;
- case VBE_BROKEN_BIOS: retval = "Broken BIOS or DOS TSR"; break;
- default: sprintf(sbuff,"Unknown or internal error: %i",err); retval=sbuff; break;
- }
- return retval;
-}
-
-#define PRINT_VBE_ERR(name,err) { mp_msg(MSGT_VO,MSGL_WARN, "vo_vesa: %s returns: %s\n",name,vbeErrToStr(err)); fflush(stdout); }
-
-static void vesa_term( void )
-{
- int err;
- if(lvo_opened) { vlvo_term(); lvo_opened = 0; }
- if(init_state) if((err=vbeRestoreState(init_state)) != VBE_OK) PRINT_VBE_ERR("vbeRestoreState",err);
- init_state=NULL;
- if(init_mode) if((err=vbeSetMode(init_mode,NULL)) != VBE_OK) PRINT_VBE_ERR("vbeSetMode",err);
- init_mode=0;
- if(HAS_DGA()) vbeUnmapVideoBuffer((unsigned long)win.ptr,win.high);
- if(dga_buffer && !HAS_DGA()) free(dga_buffer);
- vbeDestroy();
- if(sws) sws_freeContext(sws);
- sws=NULL;
-}
-
-#define VALID_WIN_FRAME(offset) (offset >= win.low && offset < win.high)
-#define VIDEO_PTR(offset) (win.ptr + offset - win.low)
-
-static inline void vbeSwitchBank(unsigned long offset)
-{
- unsigned long gran;
- unsigned new_offset;
- int err;
- gran = video_mode_info.WinGranularity*1024;
- new_offset = offset / gran;
- if(HAS_DGA()) { err = -1; goto show_err; }
- if((err=vbeSetWindow(win.idx,new_offset)) != VBE_OK)
- {
- show_err:
- vesa_term();
- PRINT_VBE_ERR("vbeSetWindow",err);
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] Fatal error occurred! Can't continue.\n");
- abort();
- }
- win.low = new_offset * gran;
- win.high = win.low + video_mode_info.WinSize*1024;
-}
-
-static void vbeSetPixel(int x, int y, int r, int g, int b)
-{
- int x_res = video_mode_info.XResolution;
- int y_res = video_mode_info.YResolution;
- int shift_r = video_mode_info.RedFieldPosition;
- int shift_g = video_mode_info.GreenFieldPosition;
- int shift_b = video_mode_info.BlueFieldPosition;
- int pixel_size = (dstBpp+7)/8;
- int bpl = video_mode_info.BytesPerScanLine;
- int color;
- unsigned offset;
-
- if (x < 0 || x >= x_res || y < 0 || y >= y_res) return;
- r >>= 8 - video_mode_info.RedMaskSize;
- g >>= 8 - video_mode_info.GreenMaskSize;
- b >>= 8 - video_mode_info.BlueMaskSize;
- color = (r << shift_r) | (g << shift_g) | (b << shift_b);
- offset = y * bpl + (x * pixel_size);
- if(!VALID_WIN_FRAME(offset)) vbeSwitchBank(offset);
- memcpy(VIDEO_PTR(offset), &color, pixel_size);
-}
-
-/*
- Copies part of frame to video memory. Data should be in the same format
- as video memory.
-*/
-static void vbeCopyBlockFast(unsigned long offset,uint8_t *image,unsigned long size)
-{
- fast_memcpy(&win.ptr[offset],image,size);
-}
-
-static void vbeCopyBlock(unsigned long offset,uint8_t *image,unsigned long size)
-{
- unsigned long delta,src_idx = 0;
- while(size)
- {
- if(!VALID_WIN_FRAME(offset)) vbeSwitchBank(offset);
- delta = FFMIN(size, win.high - offset);
- fast_memcpy(VIDEO_PTR(offset),&image[src_idx],delta);
- src_idx += delta;
- offset += delta;
- size -= delta;
- }
-}
-
-/*
- Copies frame to video memory. Data should be in the same format as video
- memory.
-*/
-
-#define PIXEL_SIZE() ((dstBpp+7)/8)
-#define SCREEN_LINE_SIZE(pixel_size) (video_mode_info.XResolution*(pixel_size) )
-#define IMAGE_LINE_SIZE(pixel_size) (dstW*(pixel_size))
-
-static void vbeCopyData(uint8_t *image)
-{
- unsigned long i,j,image_offset,offset;
- unsigned pixel_size,image_line_size,screen_line_size,x_shift;
- pixel_size = PIXEL_SIZE();
- screen_line_size = SCREEN_LINE_SIZE(pixel_size);
- image_line_size = IMAGE_LINE_SIZE(pixel_size);
- if(dstW == video_mode_info.XResolution)
- {
- /* Special case for zooming */
- (*cpy_blk_fnc)(y_offset*screen_line_size,image,image_line_size*dstH);
- }
- else
- {
- x_shift = x_offset*pixel_size;
- for(j=0,i=y_offset;j<dstH;i++,j++)
- {
- offset = i*screen_line_size+x_shift;
- image_offset = j*image_line_size;
- (*cpy_blk_fnc)(offset,&image[image_offset],image_line_size);
- }
- }
-}
-
-/* is called for yuv only */
-static int draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
-{
- int dstride=HAS_DGA()?video_mode_info.XResolution:dstW;
- uint8_t *dst[MP_MAX_PLANES]={dga_buffer};
- int dstStride[MP_MAX_PLANES]={0};
- if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
- mp_msg(MSGT_VO,MSGL_DBG3, "vo_vesa: draw_slice was called: w=%u h=%u x=%u y=%u\n",w,h,x,y);
- dstStride[0]=dstride*((dstBpp+7)/8);
- dstStride[1]=
- dstStride[2]=dstStride[0]>>1;
- if(HAS_DGA()) dst[0] += y_offset*SCREEN_LINE_SIZE(PIXEL_SIZE())+x_offset*PIXEL_SIZE();
- sws_scale(sws,image,stride,y,h,dst,dstStride);
- flip_trigger = 1;
- return 0;
-}
-
-/* Please comment it out if you want have OSD within movie */
-/*#define OSD_OUTSIDE_MOVIE 1*/
-
-static void draw_alpha_32(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)
-{
- int dstride=HAS_DGA()?video_mode_info.XResolution:dstW;
-#ifndef OSD_OUTSIDE_MOVIE
- if(HAS_DGA())
- {
- x0 += x_offset;
- y0 += y_offset;
- }
-#endif
- vo_draw_alpha_rgb32(w,h,src,srca,stride,dga_buffer+4*(y0*dstride+x0),4*dstride);
-}
-
-static void draw_alpha_24(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)
-{
- int dstride=HAS_DGA()?video_mode_info.XResolution:dstW;
-#ifndef OSD_OUTSIDE_MOVIE
- if(HAS_DGA())
- {
- x0 += x_offset;
- y0 += y_offset;
- }
-#endif
- vo_draw_alpha_rgb24(w,h,src,srca,stride,dga_buffer+3*(y0*dstride+x0),3*dstride);
-}
-
-static void draw_alpha_16(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)
-{
- int dstride=HAS_DGA()?video_mode_info.XResolution:dstW;
-#ifndef OSD_OUTSIDE_MOVIE
- if(HAS_DGA())
- {
- x0 += x_offset;
- y0 += y_offset;
- }
-#endif
- vo_draw_alpha_rgb16(w,h,src,srca,stride,dga_buffer+2*(y0*dstride+x0),2*dstride);
-}
-
-static void draw_alpha_15(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)
-{
- int dstride=HAS_DGA()?video_mode_info.XResolution:dstW;
-#ifndef OSD_OUTSIDE_MOVIE
- if(HAS_DGA())
- {
- x0 += x_offset;
- y0 += y_offset;
- }
-#endif
- vo_draw_alpha_rgb15(w,h,src,srca,stride,dga_buffer+2*(y0*dstride+x0),2*dstride);
-}
-
-static void draw_alpha_null(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)
-{
-}
-
-
-static void draw_osd(void)
-{
- uint32_t w,h;
- if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
- mp_msg(MSGT_VO,MSGL_DBG3, "vo_vesa: draw_osd was called\n");
- {
-#ifdef OSD_OUTSIDE_MOVIE
- w = HAS_DGA()?video_mode_info.XResolution:dstW;
- h = HAS_DGA()?video_mode_info.YResolution:dstH;
-#else
- w = dstW;
- h = dstH;
-#endif
- if(dga_buffer) vo_draw_text(w,h,draw_alpha_fnc);
- }
-}
-
-static void flip_page(void)
-{
- if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
- mp_msg(MSGT_VO,MSGL_DBG3, "vo_vesa: flip_page was called\n");
- if(flip_trigger)
- {
- if(!HAS_DGA()) vbeCopyData(dga_buffer);
- flip_trigger = 0;
- }
- if(vo_doublebuffering && multi_size > 1)
- {
- int err;
- if((err=vbeSetDisplayStart(multi_buff[multi_idx],vo_vsync)) != VBE_OK)
- {
- vesa_term();
- PRINT_VBE_ERR("vbeSetDisplayStart",err);
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] Fatal error occurred! Can't continue.\n");
- abort();
- }
- multi_idx = multi_idx ? 0 : 1;
- win.ptr = dga_buffer = video_base + multi_buff[multi_idx];
- }
-/*
- else
- if(tripple_buffering)
- {
- vbeSetScheduledDisplayStart(multi_buff[multi_idx],vo_vsync);
- multi_idx++;
- if(multi_idx > 2) multi_idx = 0;
- win.ptr = dga_buffer = video_base + multi_buff[multi_idx];
- }
-*/
-}
-
-/* is called for rgb only */
-static int draw_frame(uint8_t *src[])
-{
- if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
- mp_msg(MSGT_VO,MSGL_DBG3, "vo_vesa: draw_frame was called\n");
- if(sws)
- {
- int dstride=HAS_DGA()?video_mode_info.XResolution:dstW;
- int srcStride[1];
- uint8_t *dst[MP_MAX_PLANES]={dga_buffer};
- int dstStride[MP_MAX_PLANES]={0};
- dstStride[0]=dstride*((dstBpp+7)/8);
- dstStride[1]=
- dstStride[2]=dstStride[0]>>1;
- if(srcFourcc == IMGFMT_RGB32 || srcFourcc == IMGFMT_BGR32)
- srcStride[0] = srcW*4;
- else
- if(srcFourcc == IMGFMT_RGB24 || srcFourcc == IMGFMT_BGR24)
- srcStride[0] = srcW*3;
- else
- srcStride[0] = srcW*2;
- if(HAS_DGA()) dst[0] += y_offset*SCREEN_LINE_SIZE(PIXEL_SIZE())+x_offset*PIXEL_SIZE();
- sws_scale(sws,src,srcStride,0,srcH,dst,dstStride);
- flip_trigger=1;
- }
- return 0;
-}
-
-#define SUBDEV_NODGA 0x00000001UL
-#define SUBDEV_FORCEDGA 0x00000002UL
-static uint32_t subdev_flags = 0xFFFFFFFEUL;
-static uint32_t parseSubDevice(const char *sd)
-{
- uint32_t flags;
- flags = 0;
- if(strcmp(sd,"nodga") == 0) { flags |= SUBDEV_NODGA; flags &= ~(SUBDEV_FORCEDGA); }
- else
- if(strcmp(sd,"dga") == 0) { flags &= ~(SUBDEV_NODGA); flags |= SUBDEV_FORCEDGA; }
- else
- if(strcmp(sd,"neotv_pal") == 0) { neomagic_tvout = 1; neomagic_tvnorm = NEO_PAL; }
- else
- if(strcmp(sd,"neotv_ntsc") == 0) { neomagic_tvout = 1; neomagic_tvnorm = NEO_NTSC; }
- else
- if(memcmp(sd,"lvo:",4) == 0) lvo_name = &sd[4]; /* lvo_name will be valid within init() */
- else { mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] unknown subdevice: '%s'.\n", sd); return 0xFFFFFFFFUL; }
- return flags;
-}
-
-static int query_format(uint32_t format)
-{
- if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
- mp_msg(MSGT_VO,MSGL_DBG3, "vo_vesa: query_format was called: %x (%s)\n",format,vo_format_name(format));
- if (format == IMGFMT_MPEGPES)
- return 0;
- // FIXME: this is just broken...
- return VFCAP_CSP_SUPPORTED | VFCAP_OSD | VFCAP_SWSCALE | VFCAP_ACCEPT_STRIDE; /* due new SwScale code */
-}
-
-static void paintBkGnd( void )
-{
- int x_res = video_mode_info.XResolution;
- int y_res = video_mode_info.YResolution;
- int x, y;
-
- for (y = 0; y < y_res; ++y)
- {
- for (x = 0; x < x_res; ++x)
- {
- int r, g, b;
- if ((x & 16) ^ (y & 16))
- {
- r = x * 255 / x_res;
- g = y * 255 / y_res;
- b = 255 - x * 255 / x_res;
- }
- else
- {
- r = 255 - x * 255 / x_res;
- g = y * 255 / y_res;
- b = 255 - y * 255 / y_res;
- }
- vbeSetPixel(x, y, r, g, b);
- }
- }
-}
-
-static void clear_screen( void )
-{
- int x_res = video_mode_info.XResolution;
- int y_res = video_mode_info.YResolution;
- int x, y;
-
- for (y = 0; y < y_res; ++y)
- for (x = 0; x < x_res; ++x)
- vbeSetPixel(x, y, 0, 0, 0);
-}
-
-static char *model2str(unsigned char type)
-{
- char *retval;
- switch(type)
- {
- case memText: retval = "Text"; break;
- case memCGA: retval="CGA"; break;
- case memHercules: retval="Hercules"; break;
- case memPL: retval="Planar"; break;
- case memPK: retval="Packed pixel"; break;
- case mem256: retval="256"; break;
- case memRGB: retval="Direct color RGB"; break;
- case memYUV: retval="Direct color YUV"; break;
- default: retval="Unknown"; break;
- }
- return retval;
-}
-
-static unsigned fillMultiBuffer(unsigned long vsize, unsigned nbuffs)
-{
- unsigned long screen_size, offset;
- unsigned total,i;
- screen_size = video_mode_info.XResolution*video_mode_info.YResolution*((dstBpp+7)/8);
- if(screen_size%64) screen_size=((screen_size/64)*64)+64;
- total = vsize / screen_size;
- if( mp_msg_test(MSGT_VO,MSGL_V) )
- mp_msg(MSGT_VO,MSGL_V, "vo_vesa: Can use up to %u video buffers\n",total);
- i = 0;
- offset = 0;
- total = FFMIN(total, nbuffs);
- while(i < total) { multi_buff[i++] = offset; offset += screen_size; }
- if(!i)
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] You have too little video memory for this mode:\n[VO_VESA] Required: %08lX present: %08lX.\n", screen_size, vsize);
- return i;
-}
-
-
-static int set_refresh(unsigned x, unsigned y, unsigned mode,struct VesaCRTCInfoBlock *crtc_pass)
-{
- unsigned pixclk;
- float H_freq;
-
- range_t *monitor_hfreq = NULL;
- range_t *monitor_vfreq = NULL;
- range_t *monitor_dotclock = NULL;
-
- monitor_hfreq = str2range(monitor_hfreq_str);
- monitor_vfreq = str2range(monitor_vfreq_str);
- monitor_dotclock = str2range(monitor_dotclock_str);
-
- if (!monitor_hfreq || !monitor_vfreq || !monitor_dotclock) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] You have to specify the capabilities of the monitor. Not changing refresh rate.\n");
- return 0;
- }
-
- H_freq = range_max(monitor_hfreq)/1000;
-
-// printf("H_freq MAX %f\n",H_freq);
-
- do
- {
- H_freq -= 0.01;
- GTF_calcTimings(x,y,H_freq,GTF_HF,0, 0,crtc_pass);
-// printf("PixelCLK %d\n",(unsigned)crtc_pass->PixelClock);
- }
- while ( (!in_range(monitor_vfreq,crtc_pass->RefreshRate/100)||
- !in_range(monitor_hfreq,H_freq*1000))&&(H_freq>0));
-
- pixclk = crtc_pass->PixelClock;
-// printf("PIXclk before %d\n",pixclk);
- vbeGetPixelClock(&mode,&pixclk);
-// printf("PIXclk after %d\n",pixclk);
- GTF_calcTimings(x,y,pixclk/1000000,GTF_PF,0,0,crtc_pass);
-// printf("Flags: %x\n",(unsigned) crtc_pass->Flags);
-/*
- printf("hTotal %d\n",crtc_pass->hTotal);
- printf("hSyncStart %d\n",crtc_pass->hSyncStart);
- printf("hSyncEnd %d\n",crtc_pass->hSyncEnd);
-
- printf("vTotal %d\n",crtc_pass->vTotal);
- printf("vSyncStart %d\n",crtc_pass->vSyncStart);
- printf("vSyncEnd %d\n",crtc_pass->vSyncEnd);
-
- printf("RR %d\n",crtc_pass->RefreshRate);
- printf("PixelCLK %d\n",(unsigned)crtc_pass->PixelClock);*/
-
- if (!in_range(monitor_vfreq,crtc_pass->RefreshRate/100)||
- !in_range(monitor_hfreq,H_freq*1000)) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] The mode does not fit the monitor limits. Not changing refresh rate.\n");
- return 0;
- }
-
- return 1;
-}
-
-/* fullscreen:
- * bit 0 (0x01) means fullscreen (-fs)
- * bit 1 (0x02) means mode switching (-vm)
- * bit 2 (0x04) enables software scaling (-zoom)
- * bit 3 (0x08) enables flipping (-flip) (NK: and for what?)
- */
-
-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)
-{
- static struct VbeInfoBlock vib;
- static int vib_set;
- struct VesaModeInfoBlock vmib;
- struct VesaCRTCInfoBlock crtc_pass;
- size_t i,num_modes;
- uint32_t w,h;
- unsigned short *mode_ptr,win_seg;
- unsigned bpp,best_x = UINT_MAX,best_y=UINT_MAX,best_mode_idx = UINT_MAX;
- int err,fs_mode,use_scaler=0;
- srcW = dstW = width;
- srcH = dstH = height;
- fs_mode = 0;
- if(subdev_flags == 0xFFFFFFFEUL)
- {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_VESA] Detected internal fatal error: init is called before preinit.\n");
- return -1;
- }
- if(subdev_flags == 0xFFFFFFFFUL) return -1;
- if(flags & VOFLAG_FLIPPING)
- {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] The -flip option is not supported.\n");
- }
- if(flags & VOFLAG_SWSCALE) use_scaler = 1;
- if(flags & VOFLAG_FULLSCREEN)
- {
- if(use_scaler) use_scaler = 2;
- else fs_mode = 1;
- }
- if((err=vbeInit()) != VBE_OK) { PRINT_VBE_ERR("vbeInit",err); return -1; }
- memcpy(vib.VESASignature,"VBE2",4);
- if(!vib_set && (err=vbeGetControllerInfo(&vib)) != VBE_OK)
- {
- PRINT_VBE_ERR("vbeGetControllerInfo",err);
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_VESA] Possible reason: No VBE2 BIOS found.\n");
- return -1;
- }
- vib_set = 1;
- /* Print general info here */
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] Found VESA VBE BIOS Version %x.%x Revision: %x.\n",
- (int)(vib.VESAVersion >> 8) & 0xff,
- (int)(vib.VESAVersion & 0xff),
- (int)(vib.OemSoftwareRev & 0xffff));
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] Video memory: %u Kb.\n",vib.TotalMemory*64);
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] VESA Capabilities: %s %s %s %s %s.\n"
- ,vib.Capabilities & VBE_DAC_8BIT ? "8-bit DAC," : "6-bit DAC,"
- ,vib.Capabilities & VBE_NONVGA_CRTC ? "non-VGA CRTC,":"VGA CRTC,"
- ,vib.Capabilities & VBE_SNOWED_RAMDAC ? "snowed RAMDAC,":"normal RAMDAC,"
- ,vib.Capabilities & VBE_STEREOSCOPIC ? "stereoscopic,":"no stereoscopic,"
- ,vib.Capabilities & VBE_STEREO_EVC ? "Stereo EVC":"no stereo");
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] !!! OEM info will be printed below !!!\n");
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] You should see 5 OEM related lines below; If not, you've broken vm86.\n");
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] OEM info: %s.\n",vib.OemStringPtr);
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] OEM Revision: %x.\n",vib.OemSoftwareRev);
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] OEM vendor: %s.\n",vib.OemVendorNamePtr);
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] OEM Product Name: %s.\n",vib.OemProductNamePtr);
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] OEM Product Rev: %s.\n",vib.OemProductRevPtr);
- mp_tmsg(MSGT_VO,MSGL_INFO,
- "[VO_VESA] Hint: For working TV-Out you should have plugged in the TV connector\n"\
- "[VO_VESA] before booting since VESA BIOS initializes itself only during POST.\n");
- /* Find best mode here */
- num_modes = 0;
- mode_ptr = vib.VideoModePtr;
- while(*mode_ptr++ != 0xffff) num_modes++;
- switch(format)
- {
- case IMGFMT_BGR8:
- case IMGFMT_RGB8: bpp = 8; break;
- case IMGFMT_BGR15:
- case IMGFMT_RGB15: bpp = 15; break;
- case IMGFMT_BGR16:
- case IMGFMT_RGB16: bpp = 16; break;
- case IMGFMT_BGR24:
- case IMGFMT_RGB24: bpp = 24; break;
- case IMGFMT_BGR32:
- case IMGFMT_RGB32: bpp = 32; break;
- default: bpp = 16; break;
- }
- srcBpp = bpp;
- srcFourcc = format;
- if(vo_dbpp) bpp = vo_dbpp;
- switch(bpp)
- {
- case 15: draw_alpha_fnc = draw_alpha_15;
- dstFourcc = IMGFMT_BGR15;
- break;
- case 16: draw_alpha_fnc = draw_alpha_16;
- dstFourcc = IMGFMT_BGR16;
- break;
- case 24: draw_alpha_fnc = draw_alpha_24;
- dstFourcc = IMGFMT_BGR24;
- break;
- case 32: draw_alpha_fnc = draw_alpha_32;
- dstFourcc = IMGFMT_BGR32;
- break;
- default: draw_alpha_fnc = draw_alpha_null;
- dstFourcc = IMGFMT_BGR16;
- break;
- }
- if( mp_msg_test(MSGT_VO,MSGL_V) )
- {
- mp_msg(MSGT_VO,MSGL_V, "vo_vesa: Requested mode: %ux%u@%u (%s)\n",width,height,bpp,vo_format_name(format));
- mp_msg(MSGT_VO,MSGL_V, "vo_vesa: Total modes found: %u\n",num_modes);
- mode_ptr = vib.VideoModePtr;
- mp_msg(MSGT_VO,MSGL_V, "vo_vesa: Mode list:");
- for(i = 0;i < num_modes;i++)
- {
- mp_msg(MSGT_VO,MSGL_V, " %04X",mode_ptr[i]);
- }
- mp_msg(MSGT_VO,MSGL_V, "\nvo_vesa: Modes in detail:\n");
- }
- mode_ptr = vib.VideoModePtr;
- if(use_scaler)
- {
- dstW = d_width;
- dstH = d_height;
- }
- if(vo_screenwidth) w = vo_screenwidth;
- else w = FFMAX(dstW, width);
- if(vo_screenheight) h = vo_screenheight;
- else h = FFMAX(dstH, height);
- for(i=0;i < num_modes;i++)
- {
- if((err=vbeGetModeInfo(mode_ptr[i],&vmib)) != VBE_OK)
- {
- PRINT_VBE_ERR("vbeGetModeInfo",err);
- continue;
- }
- if(vmib.XResolution >= w &&
- vmib.YResolution >= h &&
- (vmib.ModeAttributes & MOVIE_MODE) == MOVIE_MODE &&
- vmib.BitsPerPixel == bpp &&
- vmib.MemoryModel == memRGB)
- {
- if(vmib.XResolution <= best_x &&
- vmib.YResolution <= best_y)
- {
- best_x = vmib.XResolution;
- best_y = vmib.YResolution;
- best_mode_idx = i;
- }
- }
- if( mp_msg_test(MSGT_VO,MSGL_V) )
- {
- mp_msg(MSGT_VO,MSGL_V, "vo_vesa: Mode (%03u): mode=%04X %ux%u@%u attr=%04X\n"
- "vo_vesa: #planes=%u model=%u(%s) #pages=%u\n"
- "vo_vesa: winA=%X(attr=%u) winB=%X(attr=%u) winSize=%u winGran=%u\n"
- "vo_vesa: direct_color=%u DGA_phys_addr=%08lX\n"
- ,i,mode_ptr[i],vmib.XResolution,vmib.YResolution,vmib.BitsPerPixel,vmib.ModeAttributes
- ,vmib.NumberOfPlanes,vmib.MemoryModel,model2str(vmib.MemoryModel),vmib.NumberOfImagePages
- ,vmib.WinASegment,vmib.WinAAttributes,vmib.WinBSegment,vmib.WinBAttributes,vmib.WinSize,vmib.WinGranularity
- ,vmib.DirectColorModeInfo,vmib.PhysBasePtr);
- if(vmib.MemoryModel == 6 || vmib.MemoryModel == 7)
- mp_msg(MSGT_VO,MSGL_V, "vo_vesa: direct_color_info = %u:%u:%u:%u\n"
- ,vmib.RedMaskSize,vmib.GreenMaskSize,vmib.BlueMaskSize,vmib.RsvdMaskSize);
- fflush(stdout);
- }
- }
- if(best_mode_idx != UINT_MAX)
- {
- video_mode = vib.VideoModePtr[best_mode_idx];
- fflush(stdout);
- if((err=vbeGetMode(&init_mode)) != VBE_OK)
- {
- PRINT_VBE_ERR("vbeGetMode",err);
- return -1;
- }
- if( mp_msg_test(MSGT_VO,MSGL_V) ) {
- mp_msg(MSGT_VO,MSGL_V, "vo_vesa: Initial video mode: %x\n",init_mode); }
- if((err=vbeGetModeInfo(video_mode,&video_mode_info)) != VBE_OK)
- {
- PRINT_VBE_ERR("vbeGetModeInfo",err);
- return -1;
- }
- dstBpp = video_mode_info.BitsPerPixel;
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] Using VESA mode (%u) = %x [%ux%u@%u]\n"
- ,best_mode_idx,video_mode,video_mode_info.XResolution
- ,video_mode_info.YResolution,dstBpp);
- if(subdev_flags & SUBDEV_NODGA) video_mode_info.PhysBasePtr = 0;
- if(use_scaler || fs_mode)
- {
- /* software scale */
- if(use_scaler > 1
- )
- {
- aspect_save_orig(width,height);
- aspect_save_prescale(d_width,d_height);
- aspect_save_screenres(video_mode_info.XResolution,video_mode_info.YResolution);
- aspect(&dstW,&dstH,A_ZOOM);
- }
- else
- if(fs_mode)
- {
- dstW = video_mode_info.XResolution;
- dstH = video_mode_info.YResolution;
- }
- use_scaler = 1;
- }
- if(!lvo_name
- )
- {
- sws = sws_getContextFromCmdLine(srcW,srcH,srcFourcc,dstW,dstH,dstFourcc);
- if(!sws)
- {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] Can't initialize software scaler.\n");
- return -1;
- }
- else if( mp_msg_test(MSGT_VO,MSGL_V) ) {
- mp_msg(MSGT_VO,MSGL_V, "vo_vesa: Using SW BES emulator\n"); }
- }
- if((video_mode_info.WinAAttributes & FRAME_MODE) == FRAME_MODE)
- win.idx = 0; /* frame A */
- else
- if((video_mode_info.WinBAttributes & FRAME_MODE) == FRAME_MODE)
- win.idx = 1; /* frame B */
- else win.idx = -2;
- /* Try use DGA instead */
- if(video_mode_info.PhysBasePtr && vib.TotalMemory && (video_mode_info.ModeAttributes & MODE_ATTR_LINEAR))
- {
- void *lfb;
- unsigned long vsize;
- vsize = vib.TotalMemory*64*1024;
- lfb = vbeMapVideoBuffer(video_mode_info.PhysBasePtr,vsize);
- if(lfb == NULL)
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] Can't use DGA. Force bank switching mode. :(\n");
- else
- {
- video_base = win.ptr = lfb;
- win.low = 0UL;
- win.high = vsize;
- win.idx = -1; /* HAS_DGA() is on */
- video_mode |= VESA_MODE_USE_LINEAR;
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] Using DGA (physical resources: %08lXh, %08lXh)"
- ,video_mode_info.PhysBasePtr
- ,vsize);
- if( mp_msg_test(MSGT_VO,MSGL_V) ) {
- printf(" at %08lXh",(unsigned long)lfb); }
- printf("\n");
- if(!(multi_size = fillMultiBuffer(vsize,2))) return -1;
- if(vo_doublebuffering && multi_size < 2)
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] Can't use double buffering: not enough video memory.\n");
- }
- }
- if(win.idx == -2)
- {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_VESA] Can find neither DGA nor relocatable window frame.\n");
- return -1;
- }
- if(!HAS_DGA())
- {
- if(subdev_flags & SUBDEV_FORCEDGA)
- {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_VESA] You've forced DGA. Exiting\n");
- return -1;
- }
- if(!(win_seg = win.idx == 0 ? video_mode_info.WinASegment:video_mode_info.WinBSegment))
- {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_VESA] Can't find valid window address.\n");
- return -1;
- }
- win.ptr = PhysToVirtSO(win_seg,0);
- win.low = 0L;
- win.high= video_mode_info.WinSize*1024;
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] Using bank switching mode (physical resources: %08lXh, %08lXh).\n"
- ,(unsigned long)win.ptr,(unsigned long)win.high);
- }
- if(video_mode_info.XResolution > dstW)
- x_offset = (video_mode_info.XResolution - dstW) / 2;
- else x_offset = 0;
- if(video_mode_info.YResolution > dstH)
- y_offset = (video_mode_info.YResolution - dstH) / 2;
- else y_offset = 0;
- if( mp_msg_test(MSGT_VO,MSGL_V) )
- mp_msg(MSGT_VO,MSGL_V, "vo_vesa: image: %ux%u screen = %ux%u x_offset = %u y_offset = %u\n"
- ,dstW,dstH
- ,video_mode_info.XResolution,video_mode_info.YResolution
- ,x_offset,y_offset);
- if(HAS_DGA())
- {
- dga_buffer = win.ptr; /* Trickly ;) */
- cpy_blk_fnc = vbeCopyBlockFast;
- }
- else
- {
- cpy_blk_fnc = vbeCopyBlock;
- if(!lvo_name
- )
- {
- if(!(dga_buffer = memalign(64,video_mode_info.XResolution*video_mode_info.YResolution*dstBpp)))
- {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_VESA] Can't allocate temporary buffer.\n");
- return -1;
- }
- if( mp_msg_test(MSGT_VO,MSGL_V) ) {
- mp_msg(MSGT_VO,MSGL_V, "vo_vesa: dga emulator was allocated = %p\n",dga_buffer); }
- }
- }
- if((err=vbeSaveState(&init_state)) != VBE_OK)
- {
- PRINT_VBE_ERR("vbeSaveState",err);
- }
-
- /* TODO:
- user might pass refresh value,
- GTF constants might be read from monitor
- for best results, I don't have a spec (RM)
- */
-
- if (((int)(vib.VESAVersion >> 8) & 0xff) > 2) {
-
- if (set_refresh(video_mode_info.XResolution,video_mode_info.YResolution,video_mode,&crtc_pass))
- video_mode = video_mode | 0x800;
-
- }
-
- ;
-
- if ((err=vbeSetMode(video_mode,&crtc_pass)) != VBE_OK)
- {
- PRINT_VBE_ERR("vbeSetMode",err);
- return -1;
- }
-
- if (neomagic_tvout) {
- err = vbeSetTV(video_mode,neomagic_tvnorm);
- if (err!=0x4f) {
- mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] Sorry, unsupported mode -- try -x 640 -zoom.\n");
- }
- else {
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] Oh you really have a picture on the TV!\n");
- }
- }
- /* Now we are in video mode!!!*/
- /* Below 'return -1' is impossible */
- if( mp_msg_test(MSGT_VO,MSGL_V) )
- {
- mp_msg(MSGT_VO,MSGL_V, "vo_vesa: Graphics mode was activated\n");
- fflush(stdout);
- }
- if(lvo_name)
- {
- if(vlvo_init(width,height,x_offset,y_offset,dstW,dstH,format,dstBpp) != 0)
- {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_VESA] Can't initialize Linux Video Overlay.\n");
- vesa_term();
- return -1;
- }
- else mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] Using video overlay: %s.\n",lvo_name);
- lvo_opened = 1;
- }
- }
- else
- {
- mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_VESA] Can't find mode for: %ux%u@%u.\n",width,height,bpp);
- return -1;
- }
- if( mp_msg_test(MSGT_VO,MSGL_V) )
- {
- mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] VESA initialization complete.\n");
- fflush(stdout);
- }
- if(HAS_DGA() && vo_doublebuffering)
- {
- if (VBE_OK != vbeSetDisplayStart(0, vo_vsync))
- {
- mp_msg(MSGT_VO,MSGL_WARN, "[VO_VESA] Can't use double buffering: changing displays failed.\n");
- multi_size = 1;
- }
- for(i=0;i<multi_size;i++)
- {
- win.ptr = dga_buffer = video_base + multi_buff[i];
- clear_screen(); /* Clear screen for stupid BIOSes */
- if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) paintBkGnd();
- }
- }
- else
- {
- clear_screen(); /* Clear screen for stupid BIOSes */
- if( mp_msg_test(MSGT_VO,MSGL_DBG2) )
- {
- int x;
- x = (video_mode_info.XResolution/video_mode_info.XCharSize)/2-strlen(title)/2;
- if(x < 0) x = 0;
- paintBkGnd();
- vbeWriteString(x,0,7,title);
- }
- }
- return 0;
-}
-
-static void
-uninit(void)
-{
- // not initialized
- vesa_term();
- if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
- mp_msg(MSGT_VO,MSGL_DBG3, "vo_vesa: uninit was called\n");
-}
-
-
-static void check_events(void)
-{
- if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
- mp_msg(MSGT_VO,MSGL_DBG3, "vo_vesa: check_events was called\n");
-/* Nothing to do */
-}
-
-static int preinit(const char *arg)
-{
- int pre_init_err = 0;
- int fd;
- if( mp_msg_test(MSGT_VO,MSGL_DBG2) )
- mp_msg(MSGT_VO,MSGL_DBG2, "vo_vesa: preinit(%s) was called\n",arg);
- if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
- mp_msg(MSGT_VO,MSGL_DBG3, "vo_vesa: subdevice %s is being initialized\n",arg);
- subdev_flags = 0;
- lvo_name = NULL;
- if(arg) subdev_flags = parseSubDevice(arg);
- if(lvo_name) pre_init_err = vlvo_preinit(lvo_name);
- // check if we can open /dev/mem (it will be opened later in config(), but if we
- // detect now that we can't we can exit cleanly)
- fd = open("/dev/mem", O_RDWR);
- if (fd < 0)
- return -1;
- else
- close(fd);
- if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
- mp_msg(MSGT_VO,MSGL_DBG3, "vo_subdevice: initialization returns: %i\n",pre_init_err);
- return pre_init_err;
-}
-
-static int control(uint32_t request, void *data)
-{
- switch (request) {
- case VOCTRL_QUERY_FORMAT:
- return query_format(*((uint32_t*)data));
- }
-
- return VO_NOTIMPL;
-}
diff --git a/libvo/vo_wii.c b/libvo/vo_wii.c
deleted file mode 100644
index b7c07fc6cb..0000000000
--- a/libvo/vo_wii.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * Video driver for Nintendo Wii/GameCube Framebuffer device
- *
- * Copyright (C) 2008 Jing Liu <fatersh-1@yahoo.com>
- *
- * Maintainer: Benjamin Zores <ben@geexbox.org>
- *
- * 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.
- */
-
-/*
- * This driver handles dedicated ATI GPU, which can be found in:
- * - Nintendo GameCube (ATI LSI Flipper @ 162 MHz)
- * - Nintendo Wii (ATI Hollywood @ 243 MHz)
- *
- * Flipper and Hollywood chipsets are pretty similar, except from clock speed:
- * - Embedded framebuffer is 2MB.
- * - Texture cache is 1MB.
- * - Vertex cache is 0.1 MB.
- * - Framebuffer is YUY2, not RGB.
- * - Best resolution is 480p (854x480)
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <ctype.h>
-
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include <sys/kd.h>
-#include <linux/fb.h>
-
-#include "config.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-#include "sub/sub.h"
-#include "mp_msg.h"
-
-static const vo_info_t info = {
- "Nintendo Wii/GameCube Framebuffer Device",
- "wii",
- "Jing Liu <fartersh-1@yahoo.com>",
- ""
-};
-
-const LIBVO_EXTERN(wii)
-
-static signed int pre_init_err = -2;
-
-static char *fb_dev_name = NULL;
-
-static FILE *vt_fp = NULL;
-static int vt_doit = 1;
-
-static int fb_dev_fd;
-static int fb_tty_fd = -1;
-static size_t fb_size;
-static uint8_t *frame_buffer;
-static uint8_t *center;
-static struct fb_var_screeninfo fb_orig_vinfo;
-static struct fb_var_screeninfo fb_vinfo;
-static int fb_pixel_size; // 32: 4 24: 3 16: 2 15: 2
-static int fb_line_len;
-static int in_width;
-static int in_height;
-static int out_width;
-static int out_height;
-static int fs;
-
-static int fb_preinit(int reset)
-{
- static int fb_preinit_done = 0;
- static int fb_works = 0;
-
- if (reset) {
- fb_preinit_done = 0;
- return 0;
- }
-
- if (fb_preinit_done)
- return fb_works;
-
- 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);
-
- if ((fb_dev_fd = open(fb_dev_name, O_RDWR)) == -1) {
- mp_msg(MSGT_VO, MSGL_ERR, "Can't open %s: %s\n", fb_dev_name, strerror(errno));
- goto err_out;
- }
- 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;
- }
- fb_orig_vinfo = fb_vinfo;
-
- if ((fb_tty_fd = open("/dev/tty", O_RDWR)) < 0) {
- mp_msg(MSGT_VO, MSGL_ERR, "notice: Can't open /dev/tty: %s\n", strerror(errno));
- goto err_out_fd;
- }
-
- fb_preinit_done = 1;
- fb_works = 1;
- return 1;
-
- err_out_fd:
- close(fb_dev_fd);
- fb_dev_fd = -1;
- err_out:
- fb_preinit_done = 1;
- fb_works = 0;
-
- return 0;
-}
-
-static void vt_set_textarea(int u, int l)
-{
- /* how can I determine the font height?
- * just use 16 for now
- */
- int urow = ((u + 15) / 16) + 1;
- int lrow = l / 16;
-
- mp_msg(MSGT_VO, MSGL_DBG2, "vt_set_textarea(%d, %d): %d,%d\n", u, l, urow, lrow);
-
- if (vt_fp) {
- fprintf(vt_fp, "\33[%d;%dr\33[%d;%dH", urow, lrow, lrow, 0);
- fflush(vt_fp);
- }
-}
-
-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)
-{
- struct fb_fix_screeninfo fb_finfo;
- uint32_t black = 0x00800080;
- long temp;
- int vt_fd;
-
- fs = flags & VOFLAG_FULLSCREEN;
-
- if (pre_init_err == -2) {
- mp_msg(MSGT_VO, MSGL_ERR, "Internal fatal error: config() was called before preinit()\n");
- return -1;
- }
-
- if (pre_init_err)
- return 1;
-
- in_width = width;
- in_height = height;
-
- out_width = (d_width && fs) ? d_width : width;
- out_height = (d_width && fs) ? d_height : height;
-
- fb_vinfo.xres_virtual = fb_vinfo.xres;
- fb_vinfo.yres_virtual = fb_vinfo.yres;
-
- if (fb_tty_fd >= 0 && ioctl(fb_tty_fd, KDSETMODE, KD_GRAPHICS) < 0) {
- mp_msg(MSGT_VO, MSGL_V, "Can't set graphics mode: %s\n", strerror(errno));
- close(fb_tty_fd);
- fb_tty_fd = -1;
- }
-
- if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_vinfo)) {
- mp_msg(MSGT_VO, MSGL_ERR, "Can't put VSCREENINFO: %s\n", strerror(errno));
- if (fb_tty_fd >= 0 && ioctl(fb_tty_fd, KDSETMODE, KD_TEXT) < 0) {
- mp_msg(MSGT_VO, MSGL_ERR, "Can't restore text mode: %s\n", strerror(errno));
- }
- return 1;
- }
-
- fb_pixel_size = 2;
-
- if (fs) {
- out_width = fb_vinfo.xres;
- out_height = fb_vinfo.yres;
- }
- if (out_width < in_width || out_height < in_height) {
- mp_msg(MSGT_VO, MSGL_ERR, "screensize is smaller than video size\n");
- return 1;
- }
-
- if (ioctl(fb_dev_fd, FBIOGET_FSCREENINFO, &fb_finfo)) {
- mp_msg(MSGT_VO, MSGL_ERR, "Can't get FSCREENINFO: %s\n", strerror(errno));
- return 1;
- }
-
- if (fb_finfo.type != FB_TYPE_PACKED_PIXELS) {
- mp_msg(MSGT_VO, MSGL_ERR, "type %d not supported\n", fb_finfo.type);
- return 1;
- }
-
- fb_line_len = fb_finfo.line_length;
- fb_size = fb_finfo.smem_len;
-
- frame_buffer = (uint8_t *) 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;
- }
-
- center = frame_buffer +
- ((out_width - in_width) / 2) * fb_pixel_size +
- ((out_height - in_height) / 2) * fb_line_len;
-
- mp_msg(MSGT_VO, MSGL_DBG2, "frame_buffer @ %p\n", frame_buffer);
- mp_msg(MSGT_VO, MSGL_DBG2, "center @ %p\n", center);
- mp_msg(MSGT_VO, MSGL_V, "pixel per line: %d\n", fb_line_len / fb_pixel_size);
-
- /* blanking screen */
- for (temp = 0; temp < fb_size; temp += 4)
- memcpy(frame_buffer + temp, (void *) &black, 4);
-
- 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_doit)
- vt_set_textarea((out_height + in_height) / 2, fb_vinfo.yres);
-
- return 0;
-}
-
-static int query_format(uint32_t format)
-{
- if (!fb_preinit(0))
- return 0;
-
- if (format != IMGFMT_YUY2)
- return 0;
-
- return VFCAP_ACCEPT_STRIDE | VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
-}
-
-static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src,
- unsigned char *srca, int stride)
-{
- unsigned char *dst;
-
- dst = center + fb_line_len * y0 + fb_pixel_size * x0;
-
- vo_draw_alpha_yuy2(w, h, src, srca, stride, dst, fb_line_len);
-}
-
-static int draw_frame(uint8_t *src[])
-{
- return 1;
-}
-
-static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y)
-{
- uint8_t *d, *s;
-
- d = center + fb_line_len * y + fb_pixel_size * x;
-
- s = src[0];
- while (h) {
- memcpy(d, s, w * fb_pixel_size);
- d += fb_line_len;
- s += stride[0];
- h--;
- }
-
- return 0;
-}
-
-static void check_events(void)
-{
-}
-
-static void flip_page(void)
-{
-}
-
-static void draw_osd(void)
-{
- vo_draw_text(in_width, in_height, draw_alpha);
-}
-
-static void uninit(void)
-{
- if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo))
- mp_msg(MSGT_VO, MSGL_WARN, "ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno));
- fb_orig_vinfo.xoffset = fb_vinfo.xoffset;
- fb_orig_vinfo.yoffset = fb_vinfo.yoffset;
- if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_orig_vinfo))
- mp_msg(MSGT_VO, MSGL_WARN, "Can't reset original fb_var_screeninfo: %s\n", strerror(errno));
- if (fb_tty_fd >= 0) {
- 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);
- close(fb_tty_fd);
- close(fb_dev_fd);
- if (frame_buffer)
- munmap(frame_buffer, fb_size);
- frame_buffer = NULL;
- fb_preinit(1);
-}
-
-static int preinit(const char *vo_subdevice)
-{
- pre_init_err = 0;
-
- if (!pre_init_err)
- return pre_init_err = (fb_preinit(0) ? 0 : -1);
- return -1;
-}
-
-static uint32_t get_image(mp_image_t *mpi)
-{
- if (((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)
- )
- return VO_FALSE;
-
- mpi->planes[0] = center;
- mpi->stride[0] = fb_line_len;
- mpi->flags |= MP_IMGFLAG_DIRECT;
-
- return VO_TRUE;
-}
-
-static int control(uint32_t request, void *data)
-{
- if (request == VOCTRL_GET_IMAGE)
- return get_image(data);
- else if (request == VOCTRL_QUERY_FORMAT)
- return query_format(*((uint32_t*) data));
-
- return VO_NOTIMPL;
-}
diff --git a/libvo/vo_xmga.c b/libvo/vo_xmga.c
deleted file mode 100644
index cc6cd1cd0e..0000000000
--- a/libvo/vo_xmga.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * copyright (C) 2001 Zoltan Ponekker
- *
- * 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.
- */
-
-//#define SHOW_TIME
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-
-#include "video_out.h"
-#include "video_out_internal.h"
-
-
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-
-#include "drivers/mga_vid.h"
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <errno.h>
-
-#ifdef CONFIG_XINERAMA
-#include <X11/extensions/Xinerama.h>
-#endif
-
-#include "x11_common.h"
-#include "sub/sub.h"
-#include "aspect.h"
-
-#ifdef SHOW_TIME
-#include "osdep/timer.h"
-static unsigned int timer = 0;
-static unsigned int timerd = 0;
-#endif
-
-static const vo_info_t info = {
- "Matrox G200/G4x0/G550 overlay in X11 window (using /dev/mga_vid)",
- "xmga",
- "Zoltan Ponekker <pontscho@makacs.poliod.hu>",
- ""
-};
-
-const LIBVO_EXTERN(xmga)
-
-static uint32_t mDepth;
-static XWindowAttributes attribs;
-static int colorkey;
-
-static uint32_t mvHeight;
-static uint32_t mvWidth;
-
-static XSetWindowAttributes xWAttribs;
-
-static int initialized = 0;
-
-#define VO_XMGA
-#include "mga_template.c"
-#undef VO_XMGA
-
-static void mDrawColorKey(void)
-{
- XSetBackground(mDisplay, vo_gc, 0);
- XClearWindow(mDisplay, vo_window);
- XSetForeground(mDisplay, vo_gc, colorkey);
- XFillRectangle(mDisplay, vo_window, vo_gc, drwX, drwY, drwWidth,
- (vo_fs ? drwHeight - 1 : drwHeight));
- XFlush(mDisplay);
-}
-
-static void check_events(void)
-{
- int e = vo_x11_check_events(mDisplay);
-
- if (e & (VO_EVENT_RESIZE | VO_EVENT_MOVE))
- set_window();
- if (e & (VO_EVENT_RESIZE | VO_EVENT_EXPOSE))
- mDrawColorKey();
-}
-
-static void flip_page(void)
-{
-#ifdef SHOW_TIME
- unsigned int t;
-
- t = GetTimer();
- mp_msg(MSGT_VO, MSGL_STATUS,
- " [timer: %08X diff: %6d dd: %6d ] \n", t, t - timer,
- (t - timer) - timerd);
- timerd = t - timer;
- timer = t;
-#endif
-
- vo_mga_flip_page();
-}
-
-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)
-{
- XVisualInfo vinfo;
- unsigned long xswamask;
- int r, g, b;
-
- if (mga_init(width, height, format))
- return -1; // ioctl errors?
-
- mvWidth = width;
- mvHeight = height;
-
- r = (vo_colorkey & 0x00ff0000) >> 16;
- g = (vo_colorkey & 0x0000ff00) >> 8;
- b = vo_colorkey & 0x000000ff;
- switch (vo_depthonscreen)
- {
- case 32:
- colorkey = vo_colorkey;
- break;
- case 24:
- colorkey = vo_colorkey & 0x00ffffff;
- break;
- case 16:
- colorkey = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
- break;
- case 15:
- colorkey = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3);
- break;
- default:
- mp_msg(MSGT_VO, MSGL_ERR,
- "Sorry, this (%d) color depth not supported.\n",
- vo_depthonscreen);
- return -1;
- }
- mp_msg(MSGT_VO, MSGL_V, "Using colorkey: %x\n", colorkey);
-
- initialized = 1;
-
- XGetWindowAttributes(mDisplay, mRootWin, &attribs);
- mDepth = attribs.depth;
- if (mDepth != 15 && mDepth != 16 && mDepth != 24 && mDepth != 32)
- mDepth = 24;
- XMatchVisualInfo(mDisplay, mScreen, mDepth, TrueColor, &vinfo);
- xWAttribs.colormap =
- XCreateColormap(mDisplay, mRootWin, vinfo.visual, AllocNone);
- xWAttribs.background_pixel = 0;
- xWAttribs.border_pixel = 0;
- xswamask = CWBackPixel | CWBorderPixel | CWColormap;
-
- vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, d_width, d_height,
- flags, xWAttribs.colormap, "xmga", title);
- XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xWAttribs);
-
- mga_vid_config.colkey_on = 1;
- mga_vid_config.colkey_red = r;
- mga_vid_config.colkey_green = g;
- mga_vid_config.colkey_blue = b;
-
- set_window(); // set up mga_vid_config.dest_width etc
-
- XSync(mDisplay, False);
-
- ioctl(f, MGA_VID_ON, 0);
-
- return 0;
-}
-
-static void uninit(void)
-{
- mp_msg(MSGT_VO, MSGL_V, "vo: uninit!\n");
- mga_uninit();
- if (!initialized)
- return; // no window?
- initialized = 0;
- vo_x11_uninit(); // destroy the window
-}
diff --git a/libvo/vo_xover.c b/libvo/vo_xover.c
deleted file mode 100644
index 644e99910f..0000000000
--- a/libvo/vo_xover.c
+++ /dev/null
@@ -1,427 +0,0 @@
-/*
- * XOver a general x11 vo for MPlayer overlay drivers based on:
- * VIDIX-accelerated overlay in an X window
- *
- * copyright (C) Alex Beregszaszi & Zoltan Ponekker & Nick Kurshev
- *
- * WS window manager by Pontscho/Fresh!
- *
- * based on vo_gl.c and vo_vesa.c and vo_xmga.c (.so mastah! ;))
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include "config.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-//#include <X11/keysym.h>
-
-#ifdef CONFIG_XINERAMA
-#include <X11/extensions/Xinerama.h>
-#endif
-
-#include "x11_common.h"
-#include "aspect.h"
-#include "mp_msg.h"
-
-
-static const vo_info_t info =
-{
- "General X11 driver for overlay capable video output drivers",
- "xover",
- "Albeu",
- ""
-};
-
-LIBVO_EXTERN(xover)
-
-/* X11 related variables */
-/* Colorkey handling */
-static int colorkey;
-
-/* Image parameters */
-static uint32_t image_width;
-static uint32_t image_height;
-static uint32_t image_format;
-
-/* Window parameters */
-static uint32_t window_x, window_y;
-static uint32_t window_width, window_height;
-
-/* used by XGetGeometry & XTranslateCoordinates for moving/resizing window */
-static uint32_t drwX, drwY, drwWidth, drwHeight, drwBorderWidth,
- drwDepth, drwcX, drwcY, dwidth, dheight;
-
-static const struct vo_old_functions *sub_vo = NULL;
-static const struct vo_info_s *sub_info;
-
-static void set_window(int force_update)
-{
- Window mRoot;
- if ( WinID )
- {
- XGetGeometry(mDisplay, vo_window, &mRoot, &drwX, &drwY, &drwWidth,
- &drwHeight, &drwBorderWidth, &drwDepth);
- drwX = drwY = 0;
-
- XTranslateCoordinates(mDisplay, vo_window, mRoot, 0, 0,
- &drwcX, &drwcY, &mRoot);
- aspect(&dwidth,&dheight,A_NOZOOM);
- if (!vo_fs)
- mp_msg(MSGT_VO, MSGL_V, "[xvidix] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",
- drwcX, drwcY, drwX, drwY, drwWidth, drwHeight);
-
- /* following stuff copied from vo_xmga.c */
- }
- else
- {
- aspect(&dwidth,&dheight,A_NOZOOM);
- drwcX=drwX=vo_dx; drwcY=drwY=vo_dy; drwWidth=vo_dwidth; drwHeight=vo_dheight;
- }
-
-#if X11_FULLSCREEN
- if (vo_fs)
- {
- aspect(&dwidth,&dheight,A_ZOOM);
- drwX = (vo_screenwidth - ((int)dwidth > vo_screenwidth ? vo_screenwidth : dwidth)) / 2;
- drwcX = drwX;
- drwY = (vo_screenheight - ((int)dheight > vo_screenheight ? vo_screenheight : dheight)) / 2;
- drwcY = drwY;
- drwWidth = ((int)dwidth > vo_screenwidth ? vo_screenwidth : dwidth);
- drwHeight = ((int)dheight > vo_screenheight ? vo_screenheight : dheight);
- mp_msg(MSGT_VO, MSGL_V, "[xvidix-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",
- drwcX, drwcY, drwX, drwY, drwWidth, drwHeight);
- }
-#endif
-
- vo_dwidth=drwWidth; vo_dheight=drwHeight;
-
-#ifdef CONFIG_XINERAMA
- if (XineramaIsActive(mDisplay))
- {
- XineramaScreenInfo *screens;
- int num_screens;
- int i = 0;
-
- screens = XineramaQueryScreens(mDisplay, &num_screens);
-
- /* find the screen we are on */
- while (i<num_screens &&
- ((screens[i].x_org < (int)drwcX) ||
- (screens[i].y_org < (int)drwcY) ||
- (screens[i].x_org + screens[i].width >= (int)drwcX) ||
- (screens[i].y_org + screens[i].height >= (int)drwcY)))
- {
- i++;
- }
-
- if(i<num_screens)
- {
- /* save the screen we are on */
- xinerama_screen = i;
- } else {
- /* oops.. couldnt find the screen we are on
- * because the upper left corner left the
- * visual range. assume we are still on the
- * same screen
- */
- i = xinerama_screen;
- }
-
- /* set drwcX and drwcY to the right values */
- drwcX = drwcX - screens[i].x_org;
- drwcY = drwcY - screens[i].y_org;
- XFree(screens);
- }
-#endif
-
- if ( vo_panscan > 0.0f && vo_fs )
- {
- drwcX-=vo_panscan_x >> 1;
- drwcY-=vo_panscan_y >> 1;
- drwX-=vo_panscan_x >> 1;
- drwY-=vo_panscan_y >> 1;
- drwWidth+=vo_panscan_x;
- drwHeight+=vo_panscan_y;
- }
-
- /* set new values in VIDIX */
- if (force_update || (window_x != drwcX) || (window_y != drwcY) ||
- (window_width != drwWidth) || (window_height != drwHeight))
- {
- mp_win_t w;
- // do a backup of window coordinates
- w.x = window_x = drwcX;
- w.y = window_y = drwcY;
- vo_dx = drwcX;
- vo_dy = drwcY;
- w.w = window_width = drwWidth;
- w.h = window_height = drwHeight;
-
- if(sub_vo->control(VOCTRL_XOVERLAY_SET_WIN,&w) != VO_TRUE)
- mp_msg(MSGT_VO, MSGL_ERR, "xvidx: set_overlay failed\n");
-
- mp_msg(MSGT_VO, MSGL_V, "[xvidix] window properties: pos: %dx%d, size: %dx%d\n", vo_dx, vo_dy, window_width, window_height);
- }
-
- /* mDrawColorKey: */
-
- /* fill drawable with specified color */
- XSetBackground(mDisplay, vo_gc, 0L);
- XClearWindow( mDisplay,vo_window );
- XSetForeground(mDisplay, vo_gc, colorkey);
- XFillRectangle(mDisplay, vo_window, vo_gc, drwX, drwY, drwWidth,
- (vo_fs ? drwHeight - 1 : drwHeight));
-
- /* flush, update drawable */
- XFlush(mDisplay);
-
- return;
-}
-
-/* connect to server, create and map window,
- * allocate colors and (shared) memory
- */
-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)
-{
- XVisualInfo vinfo;
- // XSizeHints hint;
- XSetWindowAttributes xswa;
- unsigned long xswamask;
- XWindowAttributes attribs;
- int window_depth, r, g, b;
- mp_colorkey_t colork;
- char _title[255];
-
- sprintf(_title,"MPlayer %s X11 Overlay", sub_info->name);
- title = _title;
-
- panscan_init();
-
- image_height = height;
- image_width = width;
- image_format = format;
-
- aspect_save_orig(width, height);
- aspect_save_prescale(d_width, d_height);
- update_xinerama_info();
-
- window_width = d_width;
- window_height = d_height;
-
- r = (vo_colorkey & 0x00ff0000) >> 16;
- g = (vo_colorkey & 0x0000ff00) >> 8;
- b = vo_colorkey & 0x000000ff;
- switch(vo_depthonscreen)
- {
- case 32:
- colorkey = vo_colorkey;
- break;
- case 24:
- colorkey = vo_colorkey & 0x00ffffff;
- break;
- case 16:
- colorkey = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
- break;
- case 15:
- colorkey = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3);
- break;
- default:
- mp_msg(MSGT_VO, MSGL_ERR, "Sorry, this (%d) color depth is not supported\n",
- vo_depthonscreen);
- }
- mp_msg(MSGT_VO, MSGL_V, "Using colorkey: %x\n", colorkey);
-
- aspect(&d_width, &d_height, A_NOZOOM);
-
- vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2;
- vo_dx += xinerama_x;
- vo_dy += xinerama_y;
- vo_dwidth=d_width; vo_dheight=d_height;
-
-#ifdef X11_FULLSCREEN
- if ( ( flags&VOFLAG_FULLSCREEN )||(flags & VOFLAG_SWSCALE) ) aspect(&d_width, &d_height, A_ZOOM);
-#endif
- dwidth = d_width;
- dheight = d_height;
- /* Make the window */
- XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs);
-
- /* from vo_x11 */
- window_depth = attribs.depth;
- if ((window_depth != 15) && (window_depth != 16) && (window_depth != 24)
- && (window_depth != 32))
- window_depth = 24;
- XMatchVisualInfo(mDisplay, mScreen, window_depth, TrueColor, &vinfo);
-
- xswa.background_pixel = BlackPixel(mDisplay, mScreen);
- xswa.border_pixel = 0;
- xswa.colormap = XCreateColormap(mDisplay, RootWindow(mDisplay, mScreen),
- vinfo.visual, AllocNone);
- xswamask = CWBackPixel | CWBorderPixel | CWColormap;
-
- vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy,
- window_width, window_height, flags,
- xswa.colormap, "xvidix", title);
- XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa);
-
- if ( ( !WinID )&&( flags&VOFLAG_FULLSCREEN ) ) { vo_dx=0; vo_dy=0; vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; vo_fs=1; }
-
- if(sub_vo->config(image_width,image_height,vo_dwidth,vo_dheight,
- flags | VOFLAG_XOVERLAY_SUB_VO,NULL,format)) {
- mp_msg(MSGT_VO, MSGL_ERR, "xover: sub vo config failed\n");
- return 1;
- }
- colork.x11 = colorkey;
- colork.r = r;
- colork.g = g;
- colork.b = b;
- if(sub_vo->control(VOCTRL_XOVERLAY_SET_COLORKEY,&colork) != VO_TRUE)
- mp_msg(MSGT_VO, MSGL_WARN, "xover: set_colorkey failed\n");
-
- set_window(1);
-
- XSync(mDisplay, False);
-
- panscan_calc();
-
- return 0;
-}
-
-static void check_events(void)
-{
- const int event = vo_x11_check_events(mDisplay);
-
- if ((event & VO_EVENT_RESIZE) || (event & VO_EVENT_EXPOSE))
- set_window(0);
- sub_vo->check_events();
- return;
-}
-
-/* draw_osd, flip_page, draw_slice, draw_frame should be
- overwritten with vidix functions (vosub_vidix.c) */
-static void draw_osd(void)
-{
- mp_msg(MSGT_VO, MSGL_FATAL, "xover error: didn't used sub vo draw_osd!\n");
-}
-
-static void flip_page(void)
-{
- mp_msg(MSGT_VO, MSGL_FATAL, "xover error: didn't used sub vo flip_page!\n");
-}
-
-static int draw_slice(uint8_t *src[], int stride[],
- int w, int h, int x, int y)
-{
- mp_msg(MSGT_VO, MSGL_FATAL, "xover error: didn't used sub vo draw_slice!\n");
- return 1;
-}
-
-static int draw_frame(uint8_t *src[])
-{
- mp_msg(MSGT_VO, MSGL_FATAL, "xover error: didn't used sub vo draw_frame!\n");
- return 1;
-}
-
-static void uninit(void)
-{
- if(!vo_config_count) return;
- if(sub_vo) sub_vo->uninit();
- sub_vo = NULL;
- vo_x11_uninit();
- // Restore our callbacks
- video_out_xover.old_functions->draw_frame = draw_frame;
- video_out_xover.old_functions->draw_slice = draw_slice;
- video_out_xover.old_functions->flip_page = flip_page;
- video_out_xover.old_functions->draw_osd = draw_osd;
-}
-
-static int preinit(const char *arg)
-{
- int i;
-
- if(!arg) {
- mp_msg(MSGT_VO, MSGL_ERR, "VO XOverlay need a subdriver\n");
- return 1;
- }
-
- const struct vo_driver *candidate;
- for(i = 0; (candidate = video_out_drivers[i]) != NULL; i++)
- if (!candidate->is_new && !strcmp(candidate->info->short_name,arg) &&
- strcmp(candidate->info->short_name,"xover"))
- break;
- if (!candidate) {
- mp_msg(MSGT_VO, MSGL_ERR, "VO XOverlay: Subdriver %s not found\n", arg);
- return 1;
- }
-
- const struct vo_old_functions *functions = candidate->old_functions;
- if (functions->control(VOCTRL_XOVERLAY_SUPPORT,NULL) != VO_TRUE) {
- mp_msg(MSGT_VO, MSGL_ERR, "VO XOverlay: %s doesn't support XOverlay\n", arg);
- return 1;
- }
- // X11 init
- if (!vo_init()) return VO_FALSE;
- if(functions->preinit(NULL)) {
- mp_msg(MSGT_VO, MSGL_ERR, "VO XOverlay: Subvo init failed\n");
- return 1;
- }
- sub_vo = functions;
- sub_info = candidate->info;
- // Setup the sub vo callbacks
- video_out_xover.old_functions->draw_frame = sub_vo->draw_frame;
- video_out_xover.old_functions->draw_slice = sub_vo->draw_slice;
- video_out_xover.old_functions->flip_page = sub_vo->flip_page;
- video_out_xover.old_functions->draw_osd = sub_vo->draw_osd;
- return 0;
-}
-
-static int control(uint32_t request, void *data)
-{
- if(!sub_vo) return VO_ERROR;
- switch (request) {
- case VOCTRL_GET_PANSCAN:
- if ( !vo_config_count || !vo_fs ) return VO_FALSE;
- return VO_TRUE;
- case VOCTRL_ONTOP:
- vo_x11_ontop();
- return VO_TRUE;
- case VOCTRL_FULLSCREEN:
- vo_x11_fullscreen();
- case VOCTRL_SET_PANSCAN:
- if ( vo_fs && ( vo_panscan != vo_panscan_amount ) )
- {
- panscan_calc();
- set_window(0);
- }
- return VO_TRUE;
- default:
- return sub_vo->control(request,data);
- }
- return VO_NOTIMPL;
-}
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index 5bbcfc4d0a..df9bb69aa1 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -624,7 +624,7 @@ static int preinit(struct vo *vo, const char *arg)
/* check for Xvideo extension */
unsigned int ver, rel, req, ev, err;
if (Success != XvQueryExtension(x11->display, &ver, &rel, &req, &ev, &err)) {
- mp_tmsg(MSGT_VO, MSGL_ERR, "[VO_XV] Sorry, Xv not supported by this X11 version/driver\n[VO_XV] ******** Try with -vo x11 or -vo sdl *********\n");
+ mp_tmsg(MSGT_VO, MSGL_ERR, "[VO_XV] Sorry, Xv not supported by this X11 version/driver\n[VO_XV] ******** Try with -vo x11 *********\n");
goto error;
}
diff --git a/libvo/vo_xvr100.c b/libvo/vo_xvr100.c
deleted file mode 100644
index fcd3b35b54..0000000000
--- a/libvo/vo_xvr100.c
+++ /dev/null
@@ -1,451 +0,0 @@
-/*
- * SUN XVR-100 (ATI Radeon 7000) VO driver for SPARC Solaris(at least)
- *
- * Copyright (C) 2000-2004 Robin Kay <komadori [at] gekkou [dot] co [dot] uk>
- * Copyright (C) 2004 Jake Goerzen
- * Copyright (C) 2007 Denes Balatoni
- *
- * written for xine by
- * Robin Kay <komadori [at] gekkou [dot] co [dot] uk>
- *
- * Sun XVR-100 framebuffer graciously donated by Jake Goerzen.
- *
- * Ported to mplayer by Denes Balatoni
- * Contains portions from the mga and tdfix_vid vo drivers
- *
- * no double-buffering, as it would slow down playback (waiting for vertical retraces)
- * FIXME: only YV12 supported for now
- *
- * 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 <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/fbio.h>
-#include <sys/visual_io.h>
-#include <strings.h>
-#include <sys/mman.h>
-
-#include "config.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-#include "aspect.h"
-#include "geometry.h"
-#include "fastmemcpy.h"
-#include "sub/sub.h"
-#include "mp_msg.h"
-
-
-static const vo_info_t info = {
- "sun xvr-100",
- "xvr100",
- "Denes Balatoni",
- ""
-};
-
-const LIBVO_EXTERN(xvr100)
-
-#define PFB_VRAM_MMAPBASE 0x08000000
-#define PFB_VRAM_MMAPLEN 0x04000000 /* depends on memory size */
-#define PFB_REGS_MMAPBASE 0x10000000
-#define PFB_REGS_MMAPLEN 0x00040000
-
-#define PFB_CLOCK_CNTL_INDEX 0x002
-#define PFB_CLOCK_CNTL_DATA 0x003
-
-#define PFB_MC_FB_LOCATION 0x052
-
-#define PFB_OV0_Y_X_START 0x100
-#define PFB_OV0_Y_X_END 0x101
-#define PFB_OV0_REG_LOAD_CNTL 0x104
-#define PFB_OV0_REG_LOAD_LOCK 0x00000001
-#define PFB_OV0_REG_LOAD_LOCK_READBACK 0x00000008
-#define PFB_OV0_SCALE_CNTL 0x108
-#define PFB_OV0_SCALE_EN 0x417f0000/*417f0000*/
-#define PFB_OV0_SCALE_YUV12 0x00000A00
-#define PFB_OV0_SCALE_VYUY422 0x00000B00
-#define PFB_OV0_V_INC 0x109
-#define PFB_OV0_P1_V_ACCUM_INIT 0x10A
-#define PFB_OV0_P23_V_ACCUM_INIT 0x10B
-#define PFB_OV0_P1_BLANK_LINES_AT_TOP 0x10C
-#define PFB_OV0_P23_BLANK_LINES_AT_TOP 0x10D
-#define PFB_OV0_BASE_ADDR 0x10F
-#define PFB_OV0_BUF0_BASE_ADRS 0x110
-#define PFB_OV0_BUF1_BASE_ADRS 0x111
-#define PFB_OV0_BUF2_BASE_ADRS 0x112
-#define PFB_OV0_BUF3_BASE_ADRS 0x113
-#define PFB_OV0_BUF4_BASE_ADRS 0x114
-#define PFB_OV0_BUF5_BASE_ADRS 0x115
-#define PFB_OV0_VID_BUF_PITCH0_VALUE 0x118
-#define PFB_OV0_VID_BUF_PITCH1_VALUE 0x119
-#define PFB_OV0_AUTO_FLIP_CNTL 0x11C
-#define PFB_OV0_AUTO_FLIP_BUF0 0x00000200
-#define PFB_OV0_AUTO_FLIP_BUF3 0x00000243
-#define PFB_OV0_DEINTERLACE_PATTERN 0x11D
-#define PFB_OV0_H_INC 0x120
-#define PFB_OV0_STEP_BY 0x121
-#define PFB_OV0_P1_H_ACCUM_INIT 0x122
-#define PFB_OV0_P23_H_ACCUM_INIT 0x123
-#define PFB_OV0_P1_X_START_END 0x125
-#define PFB_OV0_P2_X_START_END 0x126
-#define PFB_OV0_P3_X_START_END 0x127
-#define PFB_OV0_FILTER_CNTL 0x128
-#define PFB_OV0_FILTER_EN 0x0000000f
-#define PFB_OV0_GRPH_KEY_CLR_LOW 0x13B
-#define PFB_OV0_GRPH_KEY_CLR_HIGH 0x13C
-#define PFB_OV0_KEY_CNTL 0x13D
-#define PFB_OV0_KEY_EN 0x00000121
-
-#define PFB_DISP_MERGE_CNTL 0x358
-#define PFB_DISP_MERGE_EN 0xffff0000
-
-
-
-static char pfb_devname[]="/dev/fbs/pfb0";
-static int pfb_devfd;
-static uint8_t *pfb_vbase;
-static volatile uint32_t *pfb_vregs;
-static int pfb_buffer[3];
-static int pfb_stride[3];
-static int pfb_srcwidth, pfb_srcheight, pfb_dstwidth, pfb_dstheight;
-static int pfb_native_format=PFB_OV0_SCALE_YUV12;
-static int pfb_deinterlace_en=0;
-static short int pfb_wx0, pfb_wy0, pfb_wx1, pfb_wy1;
-static int pfb_xres,pfb_yres;
-static int pfb_free_top;
-static int pfb_fs;
-static int pfb_usecolorkey=0;
-static uint32_t pfb_colorkey;
-
-
-
-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;
- ecp_div = (pfb_vregs[PFB_CLOCK_CNTL_DATA] >> 8) & 0x3;
- h_inc = (pfb_srcwidth << (12 + ecp_div)) / pfb_dstwidth;
- h_step = 1;
-
- while (h_inc > 0x1fff) {
- h_inc >>= 1;
- h_step++;
- }
-
- pfb_vregs[PFB_OV0_REG_LOAD_CNTL] = PFB_OV0_REG_LOAD_LOCK;
- while (!(pfb_vregs[PFB_OV0_REG_LOAD_CNTL] & PFB_OV0_REG_LOAD_LOCK_READBACK))
- usleep(100);
-
- pfb_vregs[PFB_DISP_MERGE_CNTL] = PFB_DISP_MERGE_EN;
- pfb_vregs[PFB_OV0_Y_X_START] = (pfb_wy0 << 16) | pfb_wx0;
- pfb_vregs[PFB_OV0_Y_X_END] = ((pfb_wy1 - 1) << 16) | (pfb_wx1 - 1);
- pfb_vregs[PFB_OV0_V_INC] = ((pfb_deinterlace_en ? pfb_srcheight/2 : pfb_srcheight) << 20) / pfb_dstheight;
- pfb_vregs[PFB_OV0_P1_V_ACCUM_INIT] = 0x00180001;
- pfb_vregs[PFB_OV0_P23_V_ACCUM_INIT] = 0x00180001;
- pfb_vregs[PFB_OV0_P1_BLANK_LINES_AT_TOP] = (((pfb_deinterlace_en ? pfb_srcheight/2 : pfb_srcheight) - 1) << 16) | 0xfff;
- pfb_vregs[PFB_OV0_P23_BLANK_LINES_AT_TOP] = (((pfb_deinterlace_en ? pfb_srcheight/2 : pfb_srcheight) / 2 - 1) << 16) | 0x7ff;
- pfb_vregs[PFB_OV0_BASE_ADDR] = (pfb_vregs[PFB_MC_FB_LOCATION] & 0xffff) << 16;
- pfb_vregs[PFB_OV0_VID_BUF_PITCH0_VALUE] = pfb_deinterlace_en ? pfb_stride[0]*2 : pfb_stride[0];
- pfb_vregs[PFB_OV0_VID_BUF_PITCH1_VALUE] = pfb_deinterlace_en ? pfb_stride[1]*2 : pfb_stride[1];
- pfb_vregs[PFB_OV0_DEINTERLACE_PATTERN] = 0x000aaaaa;
- pfb_vregs[PFB_OV0_H_INC] = ((h_inc / 2) << 16) | h_inc;
- pfb_vregs[PFB_OV0_STEP_BY] = (h_step << 8) | h_step;
- pfb_vregs[PFB_OV0_P1_H_ACCUM_INIT] = (((0x00005000 + h_inc) << 7) & 0x000f8000) | (((0x00005000 + h_inc) << 15) & 0xf0000000);
- pfb_vregs[PFB_OV0_P23_H_ACCUM_INIT] = (((0x0000A000 + h_inc) << 6) & 0x000f8000) | (((0x0000A000 + h_inc) << 14) & 0x70000000);
- pfb_vregs[PFB_OV0_P1_X_START_END] = pfb_srcwidth - 1;
- pfb_vregs[PFB_OV0_P2_X_START_END] = (pfb_srcwidth / 2) - 1;
- pfb_vregs[PFB_OV0_P3_X_START_END] = (pfb_srcwidth / 2) - 1;
- pfb_vregs[PFB_OV0_FILTER_CNTL] = PFB_OV0_FILTER_EN;
-
- if (pfb_usecolorkey) {
- pfb_vregs[PFB_OV0_GRPH_KEY_CLR_LOW] = pfb_colorkey;
- pfb_vregs[PFB_OV0_GRPH_KEY_CLR_HIGH] = pfb_colorkey | 0xff000000;
- pfb_vregs[PFB_OV0_KEY_CNTL] = PFB_OV0_KEY_EN;
- } else {
- pfb_vregs[PFB_OV0_KEY_CNTL] = 0x010;
- }
-
- pfb_vregs[PFB_OV0_SCALE_CNTL] = PFB_OV0_SCALE_EN | pfb_native_format;
-
- pfb_vregs[PFB_OV0_REG_LOAD_CNTL] = 0;
-
- pfb_vregs[PFB_OV0_BUF0_BASE_ADRS] = pfb_buffer[0];
- pfb_vregs[PFB_OV0_BUF1_BASE_ADRS] = pfb_buffer[1] | 0x00000001;
- pfb_vregs[PFB_OV0_BUF2_BASE_ADRS] = pfb_buffer[2] | 0x00000001;
-
- pfb_vregs[PFB_OV0_AUTO_FLIP_CNTL] = PFB_OV0_AUTO_FLIP_BUF0;
-}
-
-void pfb_overlay_off(void) {
- pfb_vregs[PFB_OV0_SCALE_CNTL] = 0;
-}
-
-void center_overlay(void) {
- if (pfb_xres > pfb_dstwidth) {
- pfb_wx0 = (pfb_xres - pfb_dstwidth) / 2;
- pfb_wx1 = pfb_wx0 + pfb_dstwidth;
- }
- else {
- pfb_wx0 = 0;
- pfb_wx1 = pfb_xres;
- }
-
- if (pfb_yres > pfb_dstheight) {
- pfb_wy0 = (pfb_yres - pfb_dstheight) / 2;
- pfb_wy1 = pfb_wy0 + pfb_dstheight;
- }
- else {
- pfb_wy0 = 0;
- pfb_wy1 = pfb_yres;
- }
-}
-
-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) {
- int memsize;
-
- pfb_srcwidth=width;
- pfb_srcheight=height;
-
- if (pfb_srcwidth>1536)
- mp_msg(MSGT_VO, MSGL_WARN, "vo_xvr100: XVR-100 can not handle width greater than 1536 pixels!\n");
-
- if (!(flags & VOFLAG_XOVERLAY_SUB_VO)) {
- aspect_save_orig(width,height);
- aspect_save_prescale(d_width,d_height);
- aspect_save_screenres(pfb_xres,pfb_yres);
- if( flags&VOFLAG_FULLSCREEN) { /* -fs */
- aspect(&pfb_dstwidth,&pfb_dstheight, A_ZOOM);
- pfb_fs = 1;
- } else {
- aspect(&pfb_dstwidth,&pfb_dstheight, A_NOZOOM);
- pfb_fs = 0;
- }
- } else {
- pfb_dstwidth=d_width;
- pfb_dstheight=d_height;
- }
-
- center_overlay();
-
- pfb_stride[0]=(pfb_srcwidth+15) & ~15;
- pfb_stride[1]=pfb_stride[2]=(((pfb_srcwidth+1)>>1)+15) & ~15;
- memsize = (pfb_stride[0]*pfb_srcheight+pfb_stride[1]*((pfb_srcheight+1) & ~1));
- if (memsize > pfb_free_top) {
- mp_msg(MSGT_VO, MSGL_FATAL, "vo_xvr100: out of VRAM! \n");
- return 1;
- }
- pfb_buffer[0] = pfb_free_top - memsize;
- pfb_buffer[1] = pfb_buffer[0] + pfb_stride[0]*pfb_srcheight;
- pfb_buffer[2] = pfb_buffer[1] + pfb_stride[1]*((pfb_srcheight+1)>>1);
-
- pfb_overlay_on();
-
- return 0;
-}
-
-static int preinit(const char *arg) {
- struct vis_identifier ident;
- struct fbgattr attr;
-
- if ((pfb_devfd = open(pfb_devname, O_RDWR)) < 0) {
- mp_msg(MSGT_VO, MSGL_ERR, "vo_xvr100: Error: can't open framebuffer device '%s'\n", pfb_devname);
- return 1;
- }
-
- if (ioctl(pfb_devfd, VIS_GETIDENTIFIER, &ident) < 0) {
- mp_msg(MSGT_VO, MSGL_ERR, "vo_xvr100: Error: ioctl failed (VIS_GETIDENTIFIER), bad device (%s)\n", pfb_devname);
- return 1;
- }
-
- if (strcmp("SUNWpfb", ident.name) == 0) {
- mp_msg(MSGT_VO, MSGL_INFO, "vo_xvr100: SUNWpfb (XVR-100/ATI Radeon 7000) detected \n");
- }
- else {
- mp_msg(MSGT_VO, MSGL_ERR, "vo_xvr100: Error: '%s' is not a SUN XVR-100 framebuffer device\n", pfb_devname);
- return 1;
- }
-
- if (ioctl(pfb_devfd, FBIOGATTR, &attr) < 0) {
- mp_msg(MSGT_VO, MSGL_ERR, "vo_xvr100: Error: ioctl failed (FBIOGATTR)\n");
- close(pfb_devfd);
- return 1;
- }
-
- pfb_free_top = attr.fbtype.fb_size - 0x2000;
- pfb_xres = attr.fbtype.fb_width;
- pfb_yres = attr.fbtype.fb_height;
-
- if ((pfb_vbase = mmap(NULL, PFB_VRAM_MMAPLEN, PROT_READ | PROT_WRITE,
- MAP_SHARED, pfb_devfd, PFB_VRAM_MMAPBASE)) == MAP_FAILED) {
- mp_msg(MSGT_VO, MSGL_ERR, "vo_xvr100: Error: unable to memory map framebuffer\n");
- close(pfb_devfd);
- return 1;
- }
-
- if ((pfb_vregs = (uint32_t *)(void *)mmap(NULL, PFB_REGS_MMAPLEN, PROT_READ | PROT_WRITE,
- MAP_SHARED, pfb_devfd, PFB_REGS_MMAPBASE)) == MAP_FAILED) {
- mp_msg(MSGT_VO, MSGL_ERR, "vo_xvr100: Error: unable to memory map framebuffer\n");
- munmap(pfb_vbase, PFB_VRAM_MMAPLEN);
- close(pfb_devfd);
- return 1;
- }
-
- return 0;
-}
-
-static void uninit(void)
-{
- if (!vo_config_count)
- return;
-
- pfb_overlay_off();
- munmap(pfb_vbase, PFB_VRAM_MMAPLEN);
- munmap(pfb_vregs, PFB_REGS_MMAPLEN);
-}
-
-static uint32_t pfb_fullscreen(void) {
- if (!pfb_fs) {
- aspect(&pfb_dstwidth,&pfb_dstheight, A_ZOOM);
- pfb_fs = 1;
- } else {
- aspect(&pfb_dstwidth,&pfb_dstheight, A_NOZOOM);
- pfb_fs = 0;
- }
-
- center_overlay();
-
- pfb_overlay_on();
-
- return VO_TRUE;
-}
-
-static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
- vo_draw_alpha_yv12(w,h,src,srca,stride,pfb_vbase+pfb_buffer[0]+pfb_stride[0]*y0+x0,pfb_stride[0]);
-}
-
-static void draw_osd(void)
-{
- vo_draw_text(pfb_srcwidth, pfb_srcheight,draw_alpha);
-}
-
-static void check_events(void)
-{
-}
-
-static void flip_page(void)
-{
-}
-
-static uint32_t get_image(mp_image_t *mpi){
- if (mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE;
- if (!(mpi->flags&MP_IMGFLAG_PLANAR)) return VO_FALSE; // FIXME: impossible for YV12, right?
- if (!(mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE)) return VO_FALSE;
-
- mpi->planes[0]=pfb_vbase + pfb_buffer[0];
- mpi->planes[1]=pfb_vbase + pfb_buffer[1];
- mpi->planes[2]=pfb_vbase + pfb_buffer[2];
- mpi->stride[0]=pfb_stride[0];
- mpi->stride[1]=mpi->stride[2]=pfb_stride[1];
- mpi->flags|=MP_IMGFLAG_DIRECT;
-
- return VO_TRUE;
-}
-
-static int draw_frame(uint8_t *src[])
-{
- mp_msg(MSGT_VO,MSGL_WARN,"!!! vo_xvr100::draw_frame() called !!!\n");
- return 0;
-}
-
-
-static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y)
-{
- mem2agpcpy_pic(pfb_vbase + pfb_buffer[0] + pfb_stride[0] * y + x, src[0], w, h, pfb_stride[0], stride[0]);
- w>>=1; h>>=1; x>>=1; y>>=1;
- mem2agpcpy_pic(pfb_vbase + pfb_buffer[1] + pfb_stride[1] * y + x, src[1], w, h, pfb_stride[1], stride[1]);
- mem2agpcpy_pic(pfb_vbase + pfb_buffer[2] + pfb_stride[1] * y + x, src[2], w, h, pfb_stride[1], stride[2]);
-
- return 0;
-}
-
-
-static uint32_t draw_image(mp_image_t *mpi){
- // if -dr or -slices then do nothing:
- if (mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK)) return VO_TRUE;
-
- draw_slice(mpi->planes,mpi->stride,mpi->w,mpi->h,0,0);
-
- return VO_TRUE;
-}
-
-static uint32_t pfb_set_colorkey(mp_colorkey_t* colork) {
- pfb_colorkey = colork->x11;
- pfb_usecolorkey = 1;
-
- pfb_overlay_on();
-
- return VO_TRUE;
-}
-
-static uint32_t pfb_set_window(mp_win_t* w) {
- pfb_dstwidth = w->w;
- pfb_dstheight = w->h;
- pfb_wx0 = w->x;
- pfb_wy0 = w->y;
- pfb_wx1 = w->x + pfb_dstwidth;
- pfb_wy1 = w->y + pfb_dstheight;
-
- pfb_overlay_on();
-
- return VO_TRUE;
-}
-
-static int query_format(uint32_t format)
-{
- switch(format){
- case IMGFMT_YV12:
- case IMGFMT_I420:
- return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW |VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN|VFCAP_ACCEPT_STRIDE;
- }
- return 0;
-}
-
-static int control(uint32_t request, void *data)
-{
- switch (request) {
- case VOCTRL_GET_IMAGE:
- return get_image(data);
- case VOCTRL_QUERY_FORMAT:
- return query_format(*((uint32_t*)data));
- case VOCTRL_DRAW_IMAGE:
- return draw_image(data);
- case VOCTRL_FULLSCREEN:
- return pfb_fullscreen();
- case VOCTRL_XOVERLAY_SUPPORT:
- return VO_TRUE;
- case VOCTRL_XOVERLAY_SET_COLORKEY:
- return pfb_set_colorkey(data);
- case VOCTRL_XOVERLAY_SET_WIN:
- return pfb_set_window(data);
- }
-
- return VO_NOTIMPL;
-}
diff --git a/libvo/x11_common.c b/libvo/x11_common.c
index 074e97bfed..3390c52d76 100644
--- a/libvo/x11_common.c
+++ b/libvo/x11_common.c
@@ -969,8 +969,7 @@ void vo_x11_sizehint(struct vo *vo, int x, int y, int width, int height, int max
x11->vo_hint.max_height = 0;
}
- // Set minimum height/width to 4 to avoid off-by-one errors
- // and because mga_vid requires a minimal size of 4 pixels.
+ // Set minimum height/width to 4 to avoid off-by-one errors.
x11->vo_hint.flags |= PMinSize;
x11->vo_hint.min_width = x11->vo_hint.min_height = 4;