query_ stuff replaced by new control() - patch by David Holm

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4593 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2002-02-09 00:47:26 +00:00
parent 73fb8576e4
commit 7c51652a1b
31 changed files with 247 additions and 117 deletions

View File

@ -40,6 +40,7 @@ static uint8_t next_frame;
static mga_vid_config_t mga_vid_config; static mga_vid_config_t mga_vid_config;
static unsigned image_bpp,image_height,image_width,src_format; static unsigned image_bpp,image_height,image_width,src_format;
extern int verbose; extern int verbose;
uint32_t vlvo_control(uint32_t request, void *data, ...);
#define PIXEL_SIZE() ((video_mode_info.BitsPerPixel+7)/8) #define PIXEL_SIZE() ((video_mode_info.BitsPerPixel+7)/8)
#define SCREEN_LINE_SIZE(pixel_size) (video_mode_info.XResolution*(pixel_size) ) #define SCREEN_LINE_SIZE(pixel_size) (video_mode_info.XResolution*(pixel_size) )
@ -69,8 +70,7 @@ int vlvo_preinit(const char *drvname)
video_out_vesa.draw_frame=vlvo_draw_frame; video_out_vesa.draw_frame=vlvo_draw_frame;
video_out_vesa.flip_page=vlvo_flip_page; video_out_vesa.flip_page=vlvo_flip_page;
video_out_vesa.draw_osd=vlvo_draw_osd; video_out_vesa.draw_osd=vlvo_draw_osd;
video_out_vesa.query_format=vlvo_query_info; video_out_vesa.control=vlvo_control;
video_out_vesa.query_vaa=vlvo_query_vaa;
return 0; return 0;
} }
@ -296,3 +296,15 @@ uint32_t vlvo_query_info(uint32_t format)
if(verbose > 1) printf("vesa_lvo: query_format was called: %x (%s)\n",format,vo_format_name(format)); if(verbose > 1) printf("vesa_lvo: query_format was called: %x (%s)\n",format,vo_format_name(format));
return 1; return 1;
} }
uint32_t vlvo_control(uint32_t request, void *data, ...)
{
switch (request) {
case VOCTRL_QUERY_VAA:
vlvo_query_vaa((vo_vaa_t*)data);
return VO_TRUE;
case VOCTRL_QUERY_FORMAT:
return vlvo_query_info(*((uint32_t*)data));
}
return VO_NOTIMPL;
}

View File

@ -7,6 +7,7 @@
*/ */
#include <inttypes.h> #include <inttypes.h>
#include <stdarg.h>
#include "font_load.h" #include "font_load.h"
#include "img_format.h" #include "img_format.h"
@ -16,6 +17,19 @@
#define VO_EVENT_RESIZE 2 #define VO_EVENT_RESIZE 2
#define VO_EVENT_KEYPRESS 4 #define VO_EVENT_KEYPRESS 4
/* takes a pointer to a vo_vaa_s struct */
#define VOCTRL_QUERY_VAA 1
/* takes a pointer to uint32_t fourcc */
#define VOCTRL_QUERY_FORMAT 2
/* signal a device reset (seek/paus) */
#define VOCTRL_RESET 3
#define VO_TRUE 1
#define VO_FALSE 0
#define VO_ERROR -1
#define VO_NOTAVAIL -2
#define VO_NOTIMPL -3
typedef struct vo_info_s typedef struct vo_info_s
{ {
/* driver name ("Matrox Millennium G200/G400" */ /* driver name ("Matrox Millennium G200/G400" */
@ -93,13 +107,10 @@ typedef struct vo_functions_s
uint32_t d_height, uint32_t fullscreen, char *title, uint32_t d_height, uint32_t fullscreen, char *title,
uint32_t format,const vo_tune_info_t *); uint32_t format,const vo_tune_info_t *);
/* /*
* Query that given pixel format is supported or not. * Control interface
* params: */
* format: fourcc of pixel format uint32_t (*control)(uint32_t request, void *data, ...);
* returns : 1 if supported, 0 if unsupported
*/
uint32_t (*query_format)(uint32_t format);
/* /*
* Return driver information. * Return driver information.
@ -145,14 +156,6 @@ typedef struct vo_functions_s
*/ */
void (*uninit)(void); void (*uninit)(void);
/*
* Query Video Accelerated Architecture information.
* params:
* vaa: address of struct to be filled.
* (Note: driver should memset it to ZERO if it doesn't support vaa.)
*/
void (*query_vaa)(vo_vaa_t *vaa);
} vo_functions_t; } vo_functions_t;
char *vo_format_name(int format); char *vo_format_name(int format);

View File

@ -21,6 +21,7 @@
* *
*/ */
static uint32_t control(uint32_t request, void *data, ...);
static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
uint32_t d_height, uint32_t fullscreen, char *title, uint32_t d_height, uint32_t fullscreen, char *title,
uint32_t format,const vo_tune_info_t *); uint32_t format,const vo_tune_info_t *);
@ -39,15 +40,14 @@ static void query_vaa(vo_vaa_t *);
{\ {\
preinit,\ preinit,\
config,\ config,\
query_format,\ control,\
get_info,\ get_info,\
draw_frame,\ draw_frame,\
draw_slice,\ draw_slice,\
draw_osd,\ draw_osd,\
flip_page,\ flip_page,\
check_events,\ check_events,\
uninit,\ uninit\
query_vaa\
}; };
#include "osd.h" #include "osd.h"

View File

@ -493,8 +493,11 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -757,7 +757,11 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -23,6 +23,9 @@
* - works only on x86 architectures * - works only on x86 architectures
* *
* $Log$ * $Log$
* Revision 1.40 2002/02/09 00:47:26 arpi
* query_ stuff replaced by new control() - patch by David Holm
*
* Revision 1.39 2002/01/31 11:45:25 alex * Revision 1.39 2002/01/31 11:45:25 alex
* removed obsoleted Terminate_Display_Process * removed obsoleted Terminate_Display_Process
* *
@ -1176,9 +1179,13 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }
//--------------------------------------------------------- //---------------------------------------------------------

View File

@ -888,7 +888,11 @@ static void uninit(void)
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -92,6 +92,39 @@ static vo_info_t vo_info =
"" ""
}; };
uint32_t control(uint32_t request, void *data, ...)
{
uint32_t flag = 0;
switch (request) {
case VOCTRL_RESET:
fsync(fd_video);
return VO_TRUE;
case VOCTRL_QUERY_FORMAT:
switch (*((uint32_t*)data)) {
case IMGFMT_MPEGPES:
/* Hardware accelerated | Hardware supports subpics */
flag = 0x2 | 0x8;
break;
#ifdef USE_LIBAVCODEC
case IMGFMT_YV12:
case IMGFMT_YUY2:
case IMGFMT_RGB24:
case IMGFMT_BGR24:
/* Conversion needed | OSD Supported */
flag = 0x1 | 0x4;
break;
default:
printf("VO: [dxr3] Format unsupported, mail dholm@iname.com\n");
#else
default:
printf("VO: [dxr3] You have enable libavcodec support (Read DOCS/codecs.html)!\n");
#endif
}
return flag;
}
return VO_NOTIMPL;
}
static uint32_t config(uint32_t scr_width, uint32_t scr_height, uint32_t width, uint32_t height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *info) static uint32_t config(uint32_t scr_width, uint32_t scr_height, uint32_t width, uint32_t height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *info)
{ {
int tmp1, tmp2; int tmp1, tmp2;
@ -288,13 +321,6 @@ static uint32_t draw_frame(uint8_t * src[])
static void flip_page(void) static void flip_page(void)
{ {
/* Flush the device if a seek occured */ /* Flush the device if a seek occured */
if (!vo_pts) {
/* Flush video */
/*ioval = EM8300_SUBDEVICE_VIDEO;
ioctl(fd_control, EM8300_IOCTL_FLUSH, &ioval);
*/
fsync(fd_video);
}
#ifdef USE_LIBAVCODEC #ifdef USE_LIBAVCODEC
if (img_format == IMGFMT_YV12) { if (img_format == IMGFMT_YV12) {
int out_size = avcodec_encode_video(avc_context, avc_outbuf, avc_outbuf_size, &avc_picture); int out_size = avcodec_encode_video(avc_context, avc_outbuf, avc_outbuf_size, &avc_picture);
@ -352,36 +378,6 @@ static uint32_t draw_slice(uint8_t *srcimg[], int stride[], int w, int h, int x0
return -1; return -1;
} }
static uint32_t query_format(uint32_t format)
{
uint32_t flag = 0;
if (format == IMGFMT_MPEGPES) {
/* Hardware accelerated | Hardware supports subpics */
flag = 0x2 | 0x8;
#ifdef USE_LIBAVCODEC
} else if (format == IMGFMT_YV12) {
/* Conversion needed | OSD Supported */
flag = 0x1 | 0x4;
} else if (format == IMGFMT_YUY2) {
/* Conversion needed | OSD Supported */
flag = 0x1 | 0x4;
} else if (format == IMGFMT_RGB24) {
/* Conversion needed | OSD Supported */
flag = 0x1 | 0x4;
} else if (format == IMGFMT_BGR24) {
/* Conversion needed | OSD Supported */
flag = 0x1 | 0x4;
} else {
printf("VO: [dxr3] Format unsupported, mail dholm@iname.com\n");
#else
} else {
printf("VO: [dxr3] You have enable libavcodec support (Read DOCS/codecs.html)!\n");
#endif
}
return flag;
}
static void uninit(void) static void uninit(void)
{ {
printf("VO: [dxr3] Uninitializing\n"); printf("VO: [dxr3] Uninitializing\n");
@ -484,8 +480,3 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa)
{
memset(vaa, 0, sizeof(vo_vaa_t));
}

View File

@ -1339,7 +1339,11 @@ static uint32_t preinit(const char *arg)
if(!pre_init_err) return (pre_init_err=(fb_preinit()?0:-1)); if(!pre_init_err) return (pre_init_err=(fb_preinit()?0:-1));
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -461,7 +461,11 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -771,7 +771,11 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -474,7 +474,11 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -1101,7 +1101,11 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -87,7 +87,7 @@ static uint32_t draw_frame(uint8_t * src[])
static uint32_t static uint32_t
query_format(uint32_t format) query_format(uint32_t format)
{ {
return video_out_pgm.query_format(format); return video_out_pgm.control(VOCTRL_QUERY_FORMAT, &format);
} }
@ -108,7 +108,11 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -151,7 +151,11 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -516,7 +516,11 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -95,7 +95,11 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -270,7 +270,11 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -140,7 +140,11 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -330,7 +330,11 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -1326,7 +1326,11 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -575,7 +575,11 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -453,7 +453,11 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -828,7 +828,11 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -944,7 +944,11 @@ static uint32_t preinit(const char *arg)
return pre_init_err; return pre_init_err;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -624,8 +624,11 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -400,7 +400,11 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -770,3 +770,15 @@ static void query_vaa(vo_vaa_t *vaa)
vaa->get_video_eq = xv_get_video_eq; vaa->get_video_eq = xv_get_video_eq;
vaa->set_video_eq = xv_set_video_eq; vaa->set_video_eq = xv_set_video_eq;
} }
uint32_t control(uint32_t request, void *data, ...)
{
switch (request) {
case VOCTRL_QUERY_VAA:
query_vaa((vo_vaa_t*)data);
return VO_TRUE;
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
}

View File

@ -463,7 +463,11 @@ static uint32_t preinit(const char *arg)
return(0); return(0);
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -634,7 +634,11 @@ static uint32_t preinit(const char *arg)
return 0; return 0;
} }
static void query_vaa(vo_vaa_t *vaa) uint32_t control(uint32_t request, void *data, ...)
{ {
memset(vaa,0,sizeof(vo_vaa_t)); switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
}
return VO_NOTIMPL;
} }

View File

@ -627,6 +627,18 @@ int vidix_init(unsigned src_width,unsigned src_height,
return 0; return 0;
} }
uint32_t vidix_control(uint32_t request, void *data, ...)
{
switch (request) {
case VOCTRL_QUERY_VAA:
vidix_query_vaa((vo_vaa_t*)data);
return VO_TRUE;
case VOCTRL_QUERY_FORMAT:
return vidix_query_fourcc(*((uint32_t*)data));
}
return VO_NOTIMPL;
}
int vidix_preinit(const char *drvname,void *server) int vidix_preinit(const char *drvname,void *server)
{ {
int err; int err;
@ -656,8 +668,7 @@ int vidix_preinit(const char *drvname,void *server)
((vo_functions_t *)server)->draw_frame=vidix_draw_frame; ((vo_functions_t *)server)->draw_frame=vidix_draw_frame;
((vo_functions_t *)server)->flip_page=vidix_flip_page; ((vo_functions_t *)server)->flip_page=vidix_flip_page;
((vo_functions_t *)server)->draw_osd=vidix_draw_osd; ((vo_functions_t *)server)->draw_osd=vidix_draw_osd;
((vo_functions_t *)server)->query_format=vidix_query_fourcc; ((vo_functions_t *)server)->control=vidix_control;
((vo_functions_t *)server)->query_vaa=vidix_query_vaa;
vo_server = server; vo_server = server;
return 0; return 0;
} }