2003-10-02 14:25:52 +00:00
|
|
|
/*
|
2009-02-08 03:27:30 +00:00
|
|
|
* VIDIX-accelerated overlay on (black) background
|
|
|
|
*
|
|
|
|
* should work on any OS
|
|
|
|
*
|
|
|
|
* copyright (C) 2003 Sascha Sommer
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2003-10-02 14:25:52 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "video_out.h"
|
|
|
|
#include "video_out_internal.h"
|
2003-10-22 18:32:04 +00:00
|
|
|
#include "aspect.h"
|
|
|
|
#include "geometry.h"
|
2003-10-02 14:25:52 +00:00
|
|
|
|
|
|
|
#include "mp_msg.h"
|
|
|
|
|
|
|
|
#include "vosub_vidix.h"
|
2008-06-20 20:16:34 +00:00
|
|
|
#include "vidix/vidix.h"
|
2003-10-02 14:25:52 +00:00
|
|
|
|
|
|
|
|
2007-12-02 14:06:03 +00:00
|
|
|
static const vo_info_t info = {
|
2004-07-09 15:29:40 +00:00
|
|
|
"console VIDIX",
|
2003-10-05 15:34:40 +00:00
|
|
|
"cvidix",
|
2003-10-02 14:25:52 +00:00
|
|
|
"Sascha Sommer",
|
|
|
|
""
|
|
|
|
};
|
|
|
|
|
2003-10-05 15:34:40 +00:00
|
|
|
LIBVO_EXTERN(cvidix)
|
2003-10-02 14:25:52 +00:00
|
|
|
|
|
|
|
#define UNUSED(x) ((void)(x)) /* Removes warning about unused arguments */
|
|
|
|
|
|
|
|
/* VIDIX related */
|
|
|
|
static char *vidix_name;
|
2003-10-22 18:32:04 +00:00
|
|
|
static uint32_t swidth,sheight,sformat;
|
2004-09-17 09:56:09 +00:00
|
|
|
/// center video only when screenw & height are set
|
|
|
|
static uint32_t center=0;
|
2003-10-02 14:25:52 +00:00
|
|
|
static vidix_grkey_t gr_key;
|
2003-10-22 18:32:04 +00:00
|
|
|
|
|
|
|
|
2006-02-09 14:08:03 +00:00
|
|
|
static uint32_t setup_vidix(void){
|
2003-10-22 18:32:04 +00:00
|
|
|
int x=vo_dx,y=vo_dy;
|
|
|
|
aspect(&vo_dwidth,&vo_dheight,vo_fs ? A_ZOOM : A_NOZOOM);
|
2004-09-17 09:56:09 +00:00
|
|
|
if(vo_fs || center){
|
2003-10-22 18:32:04 +00:00
|
|
|
if(vo_dwidth <= vo_screenwidth)x = (vo_screenwidth - vo_dwidth)/2;
|
|
|
|
else x=0;
|
|
|
|
if(vo_dheight <= vo_screenheight)y = (vo_screenheight - vo_dheight)/2;
|
|
|
|
else y=0;
|
|
|
|
}
|
|
|
|
if(vo_config_count)vidix_stop();
|
|
|
|
if(vidix_init(swidth, sheight, x, y, vo_dwidth, vo_dheight, sformat, 32, vo_screenwidth,vo_screenheight)){
|
|
|
|
mp_msg(MSGT_VO, MSGL_FATAL, "Can't setup VIDIX driver: %s\n", strerror(errno));
|
|
|
|
return 1;
|
|
|
|
}
|
2003-10-02 14:25:52 +00:00
|
|
|
vidix_start();
|
|
|
|
if(vidix_grkey_support()){
|
|
|
|
vidix_grkey_get(&gr_key);
|
|
|
|
gr_key.key_op = KEYS_PUT;
|
2003-10-22 18:32:04 +00:00
|
|
|
if (!vo_fs && !(vo_colorkey & 0xff000000)){
|
|
|
|
gr_key.ckey.op = CKEY_TRUE;
|
|
|
|
gr_key.ckey.red = (vo_colorkey & 0x00FF0000) >> 16;
|
|
|
|
gr_key.ckey.green = (vo_colorkey & 0x0000FF00) >> 8;
|
|
|
|
gr_key.ckey.blue = vo_colorkey & 0x000000FF;
|
2003-10-17 09:08:37 +00:00
|
|
|
}
|
2003-10-22 18:32:04 +00:00
|
|
|
else gr_key.ckey.op = CKEY_FALSE;
|
2003-10-02 14:25:52 +00:00
|
|
|
vidix_grkey_set(&gr_key);
|
2003-10-22 18:32:04 +00:00
|
|
|
}
|
2003-10-02 14:25:52 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-08-05 01:24:37 +00:00
|
|
|
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){
|
2005-04-18 15:52:38 +00:00
|
|
|
vo_fs = flags & VOFLAG_FULLSCREEN;
|
2004-09-17 09:56:09 +00:00
|
|
|
if(!vo_config_count){
|
2004-11-25 17:23:13 +00:00
|
|
|
if(vo_screenwidth && vo_screenheight){
|
|
|
|
if(!vo_geometry)center=1;
|
|
|
|
}
|
2004-09-17 09:56:09 +00:00
|
|
|
}
|
2008-10-19 11:47:46 +00:00
|
|
|
if(!vo_screenwidth){
|
|
|
|
mp_msg(MSGT_VO, MSGL_WARN, "vo_cvidix: Screen width not set (see -screenw), assuming 640 pixels.\n");
|
|
|
|
vo_screenwidth = 640;
|
|
|
|
}
|
|
|
|
if(!vo_screenheight){
|
|
|
|
mp_msg(MSGT_VO, MSGL_WARN, "vo_cvidix: Screen height not set (see -screenh), assuming 480 pixels.\n");
|
|
|
|
vo_screenheight = 480;
|
|
|
|
}
|
2003-10-22 18:32:04 +00:00
|
|
|
swidth = width;
|
|
|
|
sheight = height;
|
|
|
|
sformat = format;
|
|
|
|
vo_dwidth=d_width;
|
|
|
|
vo_dheight=d_height;
|
|
|
|
aspect_save_orig(width,height);
|
|
|
|
aspect_save_prescale(d_width,d_height);
|
|
|
|
aspect_save_screenres(vo_screenwidth,vo_screenheight);
|
|
|
|
if(!vo_geometry){
|
|
|
|
vo_dx=0;
|
|
|
|
vo_dy=0;
|
|
|
|
}
|
|
|
|
else geometry(&vo_dx, &vo_dy, &vo_dwidth, &vo_dheight,vo_screenwidth,vo_screenheight);
|
|
|
|
return setup_vidix();
|
|
|
|
}
|
|
|
|
|
2003-10-02 14:25:52 +00:00
|
|
|
static void check_events(void){
|
|
|
|
}
|
|
|
|
|
|
|
|
/* draw_osd, flip_page, draw_slice, draw_frame should be
|
|
|
|
overwritten with vidix functions (vosub_vidix.c) */
|
|
|
|
static void draw_osd(void){
|
2003-10-05 15:39:00 +00:00
|
|
|
mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix draw_osd!\n");
|
2003-10-02 14:25:52 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void flip_page(void){
|
2003-10-05 15:39:00 +00:00
|
|
|
mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix flip_page!\n");
|
2003-10-02 14:25:52 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-08-05 01:24:37 +00:00
|
|
|
static int draw_slice(uint8_t *src[], int stride[],int w, int h, int x, int y){
|
2003-10-02 14:25:52 +00:00
|
|
|
UNUSED(src);
|
|
|
|
UNUSED(stride);
|
|
|
|
UNUSED(w);
|
|
|
|
UNUSED(h);
|
|
|
|
UNUSED(x);
|
|
|
|
UNUSED(y);
|
2003-10-05 15:39:00 +00:00
|
|
|
mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix draw_slice!\n");
|
2003-10-02 14:25:52 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2005-08-05 01:24:37 +00:00
|
|
|
static int draw_frame(uint8_t *src[]){
|
2003-10-02 14:25:52 +00:00
|
|
|
UNUSED(src);
|
2003-10-05 15:39:00 +00:00
|
|
|
mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix draw_frame!\n");
|
2003-10-02 14:25:52 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2005-08-05 01:24:37 +00:00
|
|
|
static int query_format(uint32_t format){
|
2008-05-16 08:33:27 +00:00
|
|
|
return vidix_query_fourcc(format);
|
2003-10-02 14:25:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void uninit(void){
|
|
|
|
if(!vo_config_count) return;
|
|
|
|
vidix_term();
|
|
|
|
if(vidix_name){
|
|
|
|
free(vidix_name);
|
|
|
|
vidix_name = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-05 01:24:37 +00:00
|
|
|
static int preinit(const char *arg){
|
2003-10-02 14:25:52 +00:00
|
|
|
if(arg)vidix_name = strdup(arg);
|
|
|
|
else {
|
2003-11-15 09:58:15 +00:00
|
|
|
mp_msg(MSGT_VO, MSGL_INFO, "vo_cvidix: No vidix driver name provided, probing available ones (-v option for details)!\n");
|
2003-10-02 14:25:52 +00:00
|
|
|
vidix_name = NULL;
|
|
|
|
}
|
2003-10-05 15:39:00 +00:00
|
|
|
if(vidix_preinit(vidix_name, &video_out_cvidix))return 1;
|
2003-10-02 14:25:52 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-08-05 01:24:37 +00:00
|
|
|
static int control(uint32_t request, void *data, ...){
|
2003-10-02 14:25:52 +00:00
|
|
|
switch (request) {
|
|
|
|
case VOCTRL_QUERY_FORMAT:
|
|
|
|
return query_format(*((uint32_t*)data));
|
2003-10-22 18:32:04 +00:00
|
|
|
case VOCTRL_FULLSCREEN:
|
|
|
|
if(vo_fs)vo_fs=0;
|
|
|
|
else vo_fs=1;
|
|
|
|
setup_vidix();
|
|
|
|
return VO_TRUE;
|
2005-09-04 20:58:39 +00:00
|
|
|
case VOCTRL_SET_EQUALIZER:
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
int value;
|
|
|
|
va_start(ap, data);
|
|
|
|
value = va_arg(ap, int);
|
|
|
|
va_end(ap);
|
2006-10-08 16:40:11 +00:00
|
|
|
return vidix_control(request, data, value);
|
2005-09-04 20:58:39 +00:00
|
|
|
}
|
|
|
|
case VOCTRL_GET_EQUALIZER:
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
int *value;
|
|
|
|
va_start(ap, data);
|
|
|
|
value = va_arg(ap, int *);
|
|
|
|
va_end(ap);
|
|
|
|
return vidix_control(request, data, value);
|
|
|
|
}
|
2003-10-22 18:32:04 +00:00
|
|
|
}
|
2003-10-02 14:25:52 +00:00
|
|
|
return vidix_control(request, data);
|
|
|
|
}
|