mirror of
https://github.com/mpv-player/mpv
synced 2024-10-18 10:25:02 +02:00
Add new video driver API
Create new video driver API that has a per-instance context structure and does not rely on keeping status in global or static variables. Existing drivers are not yet converted to this API; instead there is a wrapper which translates calls to them. In the new API, an old API call vo_functions->xyz(args) is generally replaced by vo_xyz(vo_instance, args). The changes to keep the vesa, dxr2 and xover drivers compiling have not been tested.
This commit is contained in:
parent
3bb140d847
commit
2bcfe1e077
10
command.c
10
command.c
@ -976,7 +976,7 @@ static int mp_property_fullscreen(m_option_t * prop, int action, void *arg,
|
||||
else
|
||||
#endif
|
||||
if (vo_config_count)
|
||||
mpctx->video_out->control(VOCTRL_FULLSCREEN, 0);
|
||||
vo_control(mpctx->video_out, VOCTRL_FULLSCREEN, 0);
|
||||
return M_PROPERTY_OK;
|
||||
default:
|
||||
return m_property_flag(prop, action, arg, &vo_fs);
|
||||
@ -1019,7 +1019,7 @@ static int mp_property_panscan(m_option_t * prop, int action, void *arg,
|
||||
{
|
||||
|
||||
if (!mpctx->video_out
|
||||
|| mpctx->video_out->control(VOCTRL_GET_PANSCAN, NULL) != VO_TRUE)
|
||||
|| vo_control(mpctx->video_out, VOCTRL_GET_PANSCAN, NULL) != VO_TRUE)
|
||||
return M_PROPERTY_UNAVAILABLE;
|
||||
|
||||
switch (action) {
|
||||
@ -1028,7 +1028,7 @@ static int mp_property_panscan(m_option_t * prop, int action, void *arg,
|
||||
return M_PROPERTY_ERROR;
|
||||
M_PROPERTY_CLAMP(prop, *(float *) arg);
|
||||
vo_panscan = *(float *) arg;
|
||||
mpctx->video_out->control(VOCTRL_SET_PANSCAN, NULL);
|
||||
vo_control(mpctx->video_out, VOCTRL_SET_PANSCAN, NULL);
|
||||
return M_PROPERTY_OK;
|
||||
case M_PROPERTY_STEP_UP:
|
||||
case M_PROPERTY_STEP_DOWN:
|
||||
@ -1038,7 +1038,7 @@ static int mp_property_panscan(m_option_t * prop, int action, void *arg,
|
||||
vo_panscan = 1;
|
||||
else if (vo_panscan < 0)
|
||||
vo_panscan = 0;
|
||||
mpctx->video_out->control(VOCTRL_SET_PANSCAN, NULL);
|
||||
vo_control(mpctx->video_out, VOCTRL_SET_PANSCAN, NULL);
|
||||
return M_PROPERTY_OK;
|
||||
default:
|
||||
return m_property_float_range(prop, action, arg, &vo_panscan);
|
||||
@ -1065,7 +1065,7 @@ static int mp_property_vo_flag(m_option_t * prop, int action, void *arg,
|
||||
case M_PROPERTY_STEP_UP:
|
||||
case M_PROPERTY_STEP_DOWN:
|
||||
if (vo_config_count)
|
||||
mpctx->video_out->control(vo_ctrl, 0);
|
||||
vo_control(mpctx->video_out, vo_ctrl, 0);
|
||||
return M_PROPERTY_OK;
|
||||
default:
|
||||
return m_property_flag(prop, action, arg, vo_var);
|
||||
|
@ -44,12 +44,12 @@ struct vf_priv_s {
|
||||
static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts);
|
||||
|
||||
void vf_menu_pause_update(struct vf_instance_s* vf) {
|
||||
const vo_functions_t *video_out = mpctx_get_video_out(vf->priv->current->ctx);
|
||||
const struct vo *video_out = mpctx_get_video_out(vf->priv->current->ctx);
|
||||
if(pause_mpi) {
|
||||
put_image(vf,pause_mpi, MP_NOPTS_VALUE);
|
||||
// Don't draw the osd atm
|
||||
//vf->control(vf,VFCTRL_DRAW_OSD,NULL);
|
||||
video_out->flip_page();
|
||||
vo_flip_page(video_out);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ extern float sub_delay;
|
||||
|
||||
struct vf_priv_s {
|
||||
double pts;
|
||||
const vo_functions_t *vo;
|
||||
struct vo *vo;
|
||||
#ifdef USE_ASS
|
||||
ass_renderer_t* ass_priv;
|
||||
int prev_visibility;
|
||||
@ -43,8 +43,7 @@ static int config(struct vf_instance_s* vf,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(video_out->info)
|
||||
{ const vo_info_t *info = video_out->info;
|
||||
const vo_info_t *info = video_out->driver->info;
|
||||
mp_msg(MSGT_CPLAYER,MSGL_INFO,"VO: [%s] %dx%d => %dx%d %s %s%s%s%s\n",info->short_name,
|
||||
width, height,
|
||||
d_width, d_height,
|
||||
@ -57,12 +56,11 @@ static int config(struct vf_instance_s* vf,
|
||||
mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Author: %s\n", info->author);
|
||||
if(info->comment && strlen(info->comment) > 0)
|
||||
mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Comment: %s\n", info->comment);
|
||||
}
|
||||
|
||||
// save vo's stride capability for the wanted colorspace:
|
||||
vf->default_caps=query_format(vf,outfmt);
|
||||
|
||||
if(config_video_out(video_out,width,height,d_width,d_height,flags,"MPlayer",outfmt))
|
||||
if (vo_config(video_out, width, height, d_width, d_height, flags, "MPlayer", outfmt))
|
||||
return 0;
|
||||
|
||||
#ifdef USE_ASS
|
||||
@ -80,23 +78,21 @@ static int control(struct vf_instance_s* vf, int request, void* data)
|
||||
case VFCTRL_GET_DEINTERLACE:
|
||||
{
|
||||
if(!video_out) return CONTROL_FALSE; // vo not configured?
|
||||
return(video_out->control(VOCTRL_GET_DEINTERLACE, data)
|
||||
== VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE;
|
||||
return vo_control(video_out, VOCTRL_GET_DEINTERLACE, data) == VO_TRUE;
|
||||
}
|
||||
case VFCTRL_SET_DEINTERLACE:
|
||||
{
|
||||
if(!video_out) return CONTROL_FALSE; // vo not configured?
|
||||
return(video_out->control(VOCTRL_SET_DEINTERLACE, data)
|
||||
== VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE;
|
||||
return vo_control(video_out, VOCTRL_SET_DEINTERLACE, data) == VO_TRUE;
|
||||
}
|
||||
case VFCTRL_DRAW_OSD:
|
||||
if(!vo_config_count) return CONTROL_FALSE; // vo not configured?
|
||||
video_out->draw_osd();
|
||||
vo_draw_osd(video_out);
|
||||
return CONTROL_TRUE;
|
||||
case VFCTRL_FLIP_PAGE:
|
||||
{
|
||||
if(!vo_config_count) return CONTROL_FALSE; // vo not configured?
|
||||
video_out->flip_page();
|
||||
vo_flip_page(video_out);
|
||||
return CONTROL_TRUE;
|
||||
}
|
||||
case VFCTRL_SET_EQUALIZER:
|
||||
@ -104,14 +100,14 @@ static int control(struct vf_instance_s* vf, int request, void* data)
|
||||
vf_equalizer_t *eq=data;
|
||||
if(!vo_config_count) return CONTROL_FALSE; // vo not configured?
|
||||
struct voctrl_set_equalizer_args param = {eq->item, eq->value};
|
||||
return video_out->control(VOCTRL_SET_EQUALIZER, ¶m) == VO_TRUE;
|
||||
return vo_control(video_out, VOCTRL_SET_EQUALIZER, ¶m) == VO_TRUE;
|
||||
}
|
||||
case VFCTRL_GET_EQUALIZER:
|
||||
{
|
||||
vf_equalizer_t *eq=data;
|
||||
if(!vo_config_count) return CONTROL_FALSE; // vo not configured?
|
||||
struct voctrl_get_equalizer_args param = {eq->item, &eq->value};
|
||||
return video_out->control(VOCTRL_GET_EQUALIZER, ¶m) == VO_TRUE;
|
||||
return vo_control(video_out, VOCTRL_GET_EQUALIZER, ¶m) == VO_TRUE;
|
||||
}
|
||||
#ifdef USE_ASS
|
||||
case VFCTRL_INIT_EOSD:
|
||||
@ -130,7 +126,7 @@ static int control(struct vf_instance_s* vf, int request, void* data)
|
||||
if (sub_visibility && vf->priv->ass_priv && ass_track && (pts != MP_NOPTS_VALUE)) {
|
||||
mp_eosd_res_t res;
|
||||
memset(&res, 0, sizeof(res));
|
||||
if (video_out->control(VOCTRL_GET_EOSD_RES, &res) == VO_TRUE) {
|
||||
if (vo_control(video_out, VOCTRL_GET_EOSD_RES, &res) == VO_TRUE) {
|
||||
ass_set_frame_size(vf->priv->ass_priv, res.w, res.h);
|
||||
ass_set_margins(vf->priv->ass_priv, res.mt, res.mb, res.ml, res.mr);
|
||||
ass_set_aspect_ratio(vf->priv->ass_priv, (double)res.w / res.h);
|
||||
@ -143,7 +139,7 @@ static int control(struct vf_instance_s* vf, int request, void* data)
|
||||
} else
|
||||
vf->priv->prev_visibility = 0;
|
||||
vf->priv->prev_visibility = sub_visibility;
|
||||
return (video_out->control(VOCTRL_DRAW_EOSD, &images) == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE;
|
||||
return vo_control(video_out, VOCTRL_DRAW_EOSD, &images) == VO_TRUE;
|
||||
}
|
||||
#endif
|
||||
case VFCTRL_GET_PTS:
|
||||
@ -152,12 +148,11 @@ static int control(struct vf_instance_s* vf, int request, void* data)
|
||||
return CONTROL_TRUE;
|
||||
}
|
||||
}
|
||||
// return video_out->control(request,data);
|
||||
return CONTROL_UNKNOWN;
|
||||
}
|
||||
|
||||
static int query_format(struct vf_instance_s* vf, unsigned int fmt){
|
||||
int flags=video_out->control(VOCTRL_QUERY_FORMAT,&fmt);
|
||||
int flags = vo_control(video_out, VOCTRL_QUERY_FORMAT, &fmt);
|
||||
// draw_slice() accepts stride, draw_frame() doesn't:
|
||||
if(flags)
|
||||
if(fmt==IMGFMT_YV12 || fmt==IMGFMT_I420 || fmt==IMGFMT_IYUV)
|
||||
@ -168,7 +163,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
|
||||
static void get_image(struct vf_instance_s* vf,
|
||||
mp_image_t *mpi){
|
||||
if(vo_directrendering && vo_config_count)
|
||||
video_out->control(VOCTRL_GET_IMAGE,mpi);
|
||||
vo_control(video_out, VOCTRL_GET_IMAGE, mpi);
|
||||
}
|
||||
|
||||
static int put_image(struct vf_instance_s* vf,
|
||||
@ -177,15 +172,15 @@ static int put_image(struct vf_instance_s* vf,
|
||||
// record pts (potentially modified by filters) for main loop
|
||||
vf->priv->pts = pts;
|
||||
// first check, maybe the vo/vf plugin implements draw_image using mpi:
|
||||
if(video_out->control(VOCTRL_DRAW_IMAGE,mpi)==VO_TRUE) return 1; // done.
|
||||
if (vo_control(video_out, VOCTRL_DRAW_IMAGE,mpi)==VO_TRUE) return 1; // done.
|
||||
// nope, fallback to old draw_frame/draw_slice:
|
||||
if(!(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK))){
|
||||
// blit frame:
|
||||
// if(mpi->flags&MP_IMGFLAG_PLANAR)
|
||||
if(vf->default_caps&VFCAP_ACCEPT_STRIDE)
|
||||
video_out->draw_slice(mpi->planes,mpi->stride,mpi->w,mpi->h,mpi->x,mpi->y);
|
||||
vo_draw_slice(video_out, mpi->planes,mpi->stride,mpi->w,mpi->h,mpi->x,mpi->y);
|
||||
else
|
||||
video_out->draw_frame(mpi->planes);
|
||||
vo_draw_frame(video_out, mpi->planes);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -193,13 +188,13 @@ static int put_image(struct vf_instance_s* vf,
|
||||
static void start_slice(struct vf_instance_s* vf,
|
||||
mp_image_t *mpi) {
|
||||
if(!vo_config_count) return; // vo not configured?
|
||||
video_out->control(VOCTRL_START_SLICE,mpi);
|
||||
vo_control(video_out, VOCTRL_START_SLICE,mpi);
|
||||
}
|
||||
|
||||
static void draw_slice(struct vf_instance_s* vf,
|
||||
unsigned char** src, int* stride, int w,int h, int x, int y){
|
||||
if(!vo_config_count) return; // vo not configured?
|
||||
video_out->draw_slice(src,stride,w,h,x,y);
|
||||
vo_draw_slice(video_out, src,stride,w,h,x,y);
|
||||
}
|
||||
|
||||
static void uninit(struct vf_instance_s* vf)
|
||||
@ -224,9 +219,8 @@ static int open(vf_instance_t *vf, char* args){
|
||||
vf->start_slice=start_slice;
|
||||
vf->uninit=uninit;
|
||||
vf->priv=calloc(1, sizeof(struct vf_priv_s));
|
||||
vf->priv->vo = (const vo_functions_t *)args;
|
||||
vf->priv->vo = (struct vo *)args;
|
||||
if(!video_out) return 0; // no vo ?
|
||||
// if(video_out->preinit(args)) return 0; // preinit failed
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ LIBNAME_MPLAYER = libvo.a
|
||||
|
||||
SRCS_MPLAYER = aspect.c \
|
||||
geometry.c \
|
||||
old_vo_wrapper.c \
|
||||
spuenc.c \
|
||||
video_out.c \
|
||||
vo_mpegpes.c \
|
||||
|
80
libvo/old_vo_wrapper.c
Normal file
80
libvo/old_vo_wrapper.c
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* This file is part of MPlayer.
|
||||
*
|
||||
* MPlayer is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* MPlayer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include "old_vo_wrapper.h"
|
||||
#include "video_out.h"
|
||||
|
||||
int old_vo_preinit(struct vo *vo, const char *arg)
|
||||
{
|
||||
return vo->driver->old_functions->preinit(arg);
|
||||
}
|
||||
|
||||
|
||||
int old_vo_config(struct vo *vo, uint32_t width, uint32_t height,
|
||||
uint32_t d_width, uint32_t d_height,
|
||||
uint32_t flags, char *title, uint32_t format)
|
||||
{
|
||||
return vo->driver->old_functions->config(width, height, d_width,
|
||||
d_height, flags, title, format);
|
||||
}
|
||||
|
||||
|
||||
int old_vo_control(struct vo *vo, uint32_t request, void *data)
|
||||
{
|
||||
return vo->driver->old_functions->control(request, data);
|
||||
}
|
||||
|
||||
|
||||
int old_vo_draw_frame(struct vo *vo, uint8_t *src[])
|
||||
{
|
||||
return vo->driver->old_functions->draw_frame(src);
|
||||
}
|
||||
|
||||
|
||||
int old_vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[],
|
||||
int w, int h, int x, int y)
|
||||
{
|
||||
return vo->driver->old_functions->draw_slice(src, stride, w, h, x, y);
|
||||
}
|
||||
|
||||
|
||||
void old_vo_draw_osd(struct vo *vo)
|
||||
{
|
||||
vo->driver->old_functions->draw_osd();
|
||||
}
|
||||
|
||||
|
||||
void old_vo_flip_page(struct vo *vo)
|
||||
{
|
||||
vo->driver->old_functions->flip_page();
|
||||
}
|
||||
|
||||
|
||||
void old_vo_check_events(struct vo *vo)
|
||||
{
|
||||
vo->driver->old_functions->check_events();
|
||||
}
|
||||
|
||||
|
||||
void old_vo_uninit(struct vo *vo)
|
||||
{
|
||||
vo->driver->old_functions->uninit();
|
||||
}
|
||||
|
20
libvo/old_vo_wrapper.h
Normal file
20
libvo/old_vo_wrapper.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef MPLAYER_OLD_VO_WRAPPER_H
|
||||
#define MPLAYER_OLD_VO_WRAPPER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "video_out.h"
|
||||
|
||||
int old_vo_preinit(struct vo *vo, const char *);
|
||||
int old_vo_config(struct vo *vo, uint32_t width, uint32_t height,
|
||||
uint32_t d_width, uint32_t d_height,
|
||||
uint32_t flags, char *title, uint32_t format);
|
||||
int old_vo_control(struct vo *vo, uint32_t request, void *data);
|
||||
int old_vo_draw_frame(struct vo *vo, uint8_t *src[]);
|
||||
int old_vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[],
|
||||
int w, int h, int x, int y);
|
||||
void old_vo_draw_osd(struct vo *vo);
|
||||
void old_vo_flip_page(struct vo *vo);
|
||||
void old_vo_check_events(struct vo *vo);
|
||||
void old_vo_uninit(struct vo *vo);
|
||||
|
||||
#endif
|
@ -43,13 +43,13 @@ 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;
|
||||
uint32_t vlvo_control(uint32_t request, void *data);
|
||||
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))
|
||||
|
||||
extern vo_functions_t video_out_vesa;
|
||||
extern struct vo_old_functions video_out_vesa;
|
||||
|
||||
int vlvo_preinit(const char *drvname)
|
||||
{
|
||||
@ -155,7 +155,7 @@ void vlvo_term( void )
|
||||
if(lvo_handler != -1) close(lvo_handler);
|
||||
}
|
||||
|
||||
uint32_t vlvo_draw_slice_420(uint8_t *image[], int stride[], int w,int h,int x,int y)
|
||||
int vlvo_draw_slice_420(uint8_t *image[], int stride[], int w,int h,int x,int y)
|
||||
{
|
||||
uint8_t *src;
|
||||
uint8_t *dest;
|
||||
@ -195,7 +195,7 @@ uint32_t vlvo_draw_slice_420(uint8_t *image[], int stride[], int w,int h,int x,i
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t vlvo_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
|
||||
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");}
|
||||
@ -213,7 +213,7 @@ uint32_t vlvo_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t vlvo_draw_frame(uint8_t *image[])
|
||||
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);
|
||||
@ -303,7 +303,7 @@ uint32_t vlvo_query_info(uint32_t format)
|
||||
return VFCAP_CSP_SUPPORTED;
|
||||
}
|
||||
|
||||
uint32_t vlvo_control(uint32_t request, void *data)
|
||||
int vlvo_control(uint32_t request, void *data)
|
||||
{
|
||||
switch (request) {
|
||||
case VOCTRL_QUERY_FORMAT:
|
||||
|
@ -21,8 +21,8 @@ int vlvo_init(unsigned src_width,unsigned src_height,
|
||||
void vlvo_term( void );
|
||||
uint32_t vlvo_query_info(uint32_t format);
|
||||
|
||||
uint32_t vlvo_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y);
|
||||
uint32_t vlvo_draw_frame(uint8_t *src[]);
|
||||
int vlvo_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y);
|
||||
int vlvo_draw_frame(uint8_t *src[]);
|
||||
void vlvo_flip_page(void);
|
||||
void vlvo_draw_osd(void);
|
||||
|
||||
|
@ -66,54 +66,54 @@ int vo_colorkey = 0x0000ff00; // default colorkey is green
|
||||
//
|
||||
// Externally visible list of all vo drivers
|
||||
//
|
||||
extern vo_functions_t video_out_mga;
|
||||
extern vo_functions_t video_out_xmga;
|
||||
extern vo_functions_t video_out_x11;
|
||||
extern vo_functions_t video_out_xover;
|
||||
extern vo_functions_t video_out_xvmc;
|
||||
extern vo_functions_t video_out_xv;
|
||||
extern vo_functions_t video_out_gl;
|
||||
extern vo_functions_t video_out_gl2;
|
||||
extern vo_functions_t video_out_dga;
|
||||
extern vo_functions_t video_out_sdl;
|
||||
extern vo_functions_t video_out_3dfx;
|
||||
extern vo_functions_t video_out_tdfxfb;
|
||||
extern vo_functions_t video_out_s3fb;
|
||||
extern vo_functions_t video_out_null;
|
||||
extern vo_functions_t video_out_zr;
|
||||
extern vo_functions_t video_out_zr2;
|
||||
extern vo_functions_t video_out_bl;
|
||||
extern vo_functions_t video_out_fbdev;
|
||||
extern vo_functions_t video_out_fbdev2;
|
||||
extern vo_functions_t video_out_svga;
|
||||
extern vo_functions_t video_out_png;
|
||||
extern vo_functions_t video_out_ggi;
|
||||
extern vo_functions_t video_out_aa;
|
||||
extern vo_functions_t video_out_caca;
|
||||
extern vo_functions_t video_out_mpegpes;
|
||||
extern vo_functions_t video_out_yuv4mpeg;
|
||||
extern vo_functions_t video_out_directx;
|
||||
extern vo_functions_t video_out_dxr2;
|
||||
extern vo_functions_t video_out_dxr3;
|
||||
extern vo_functions_t video_out_ivtv;
|
||||
extern vo_functions_t video_out_v4l2;
|
||||
extern vo_functions_t video_out_jpeg;
|
||||
extern vo_functions_t video_out_gif89a;
|
||||
extern vo_functions_t video_out_vesa;
|
||||
extern vo_functions_t video_out_directfb;
|
||||
extern vo_functions_t video_out_dfbmga;
|
||||
extern vo_functions_t video_out_xvidix;
|
||||
extern vo_functions_t video_out_winvidix;
|
||||
extern vo_functions_t video_out_cvidix;
|
||||
extern vo_functions_t video_out_tdfx_vid;
|
||||
extern vo_functions_t video_out_xvr100;
|
||||
extern vo_functions_t video_out_tga;
|
||||
extern vo_functions_t video_out_macosx;
|
||||
extern vo_functions_t video_out_quartz;
|
||||
extern vo_functions_t video_out_pnm;
|
||||
extern vo_functions_t video_out_md5sum;
|
||||
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_xvmc;
|
||||
extern struct vo_driver video_out_xv;
|
||||
extern struct vo_driver video_out_gl;
|
||||
extern struct vo_driver video_out_gl2;
|
||||
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_null;
|
||||
extern struct vo_driver video_out_zr;
|
||||
extern struct vo_driver video_out_zr2;
|
||||
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_directx;
|
||||
extern struct vo_driver video_out_dxr2;
|
||||
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_xvidix;
|
||||
extern struct vo_driver video_out_winvidix;
|
||||
extern struct vo_driver video_out_cvidix;
|
||||
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_macosx;
|
||||
extern struct vo_driver video_out_quartz;
|
||||
extern struct vo_driver video_out_pnm;
|
||||
extern struct vo_driver video_out_md5sum;
|
||||
|
||||
const vo_functions_t* const video_out_drivers[] =
|
||||
const struct vo_driver *video_out_drivers[] =
|
||||
{
|
||||
#ifdef HAVE_XVR100
|
||||
&video_out_xvr100,
|
||||
@ -243,6 +243,48 @@ const vo_functions_t* const video_out_drivers[] =
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
static int vo_preinit(struct vo *vo, const char *arg)
|
||||
{
|
||||
return vo->driver->preinit(vo, arg);
|
||||
}
|
||||
|
||||
int vo_control(struct vo *vo, uint32_t request, void *data)
|
||||
{
|
||||
return vo->driver->control(vo, request, data);
|
||||
}
|
||||
|
||||
int vo_draw_frame(struct vo *vo, uint8_t *src[])
|
||||
{
|
||||
return vo->driver->draw_frame(vo, src);
|
||||
}
|
||||
|
||||
int vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[], int w, int h, int x, int y)
|
||||
{
|
||||
return vo->driver->draw_slice(vo, src, stride, w, h, x, y);
|
||||
}
|
||||
|
||||
void vo_draw_osd(struct vo *vo)
|
||||
{
|
||||
vo->driver->draw_osd(vo);
|
||||
}
|
||||
|
||||
void vo_flip_page(struct vo *vo)
|
||||
{
|
||||
vo->driver->flip_page(vo);
|
||||
}
|
||||
|
||||
void vo_check_events(struct vo *vo)
|
||||
{
|
||||
vo->driver->check_events(vo);
|
||||
}
|
||||
|
||||
void vo_destroy(struct vo *vo)
|
||||
{
|
||||
vo->driver->uninit(vo);
|
||||
free(vo);
|
||||
}
|
||||
|
||||
void list_video_out(void)
|
||||
{
|
||||
int i = 0;
|
||||
@ -255,9 +297,10 @@ void list_video_out(void)
|
||||
mp_msg(MSGT_GLOBAL, MSGL_INFO,"\n");
|
||||
}
|
||||
|
||||
const vo_functions_t *init_best_video_out(char **vo_list)
|
||||
struct vo *init_best_video_out(char **vo_list)
|
||||
{
|
||||
int i;
|
||||
struct vo *vo = malloc(sizeof *vo);
|
||||
// first try the preferred drivers, with their optional subdevice param:
|
||||
if (vo_list && vo_list[0])
|
||||
while (vo_list[0][0]) {
|
||||
@ -272,13 +315,15 @@ const vo_functions_t *init_best_video_out(char **vo_list)
|
||||
++vo_subdevice;
|
||||
}
|
||||
for (i = 0; video_out_drivers[i]; i++) {
|
||||
const vo_functions_t *video_driver = video_out_drivers[i];
|
||||
const struct vo_driver *video_driver = video_out_drivers[i];
|
||||
const vo_info_t *info = video_driver->info;
|
||||
if (!strcmp(info->short_name, name)) {
|
||||
// name matches, try it
|
||||
if (!video_driver->preinit(vo_subdevice)) {
|
||||
memset(vo, 0, sizeof *vo);
|
||||
vo->driver = video_driver;
|
||||
if (!vo_preinit(vo, vo_subdevice)) {
|
||||
free(name);
|
||||
return video_driver; // success!
|
||||
return vo; // success!
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -291,14 +336,17 @@ const vo_functions_t *init_best_video_out(char **vo_list)
|
||||
// now try the rest...
|
||||
vo_subdevice = NULL;
|
||||
for (i = 0; video_out_drivers[i]; i++) {
|
||||
const vo_functions_t *video_driver = video_out_drivers[i];
|
||||
if (!video_driver->preinit(vo_subdevice))
|
||||
return video_driver; // success!
|
||||
const struct vo_driver *video_driver = video_out_drivers[i];
|
||||
memset(vo, 0, sizeof *vo);
|
||||
vo->driver = video_driver;
|
||||
if (!vo_preinit(vo, vo_subdevice))
|
||||
return vo; // success!
|
||||
}
|
||||
free(vo);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int config_video_out(const vo_functions_t *vo, uint32_t width, uint32_t height,
|
||||
int vo_config(struct vo *vo, uint32_t width, uint32_t height,
|
||||
uint32_t d_width, uint32_t d_height, uint32_t flags,
|
||||
char *title, uint32_t format)
|
||||
{
|
||||
@ -306,7 +354,7 @@ int config_video_out(const vo_functions_t *vo, uint32_t width, uint32_t height,
|
||||
aspect_save_orig(width, height);
|
||||
aspect_save_prescale(d_width, d_height);
|
||||
|
||||
if (vo->control(VOCTRL_UPDATE_SCREENINFO, NULL) == VO_TRUE) {
|
||||
if (vo_control(vo, VOCTRL_UPDATE_SCREENINFO, NULL) == VO_TRUE) {
|
||||
aspect(&d_width, &d_height, A_NOZOOM);
|
||||
vo_dx = (int)(vo_screenwidth - d_width) / 2;
|
||||
vo_dy = (int)(vo_screenheight - d_height) / 2;
|
||||
@ -318,7 +366,8 @@ int config_video_out(const vo_functions_t *vo, uint32_t width, uint32_t height,
|
||||
vo_dheight = d_height;
|
||||
}
|
||||
|
||||
return vo->config(width, height, d_width, d_height, flags, title, format);
|
||||
return vo->driver->config(vo, width, height, d_width, d_height, flags,
|
||||
title, format);
|
||||
}
|
||||
|
||||
#if defined(HAVE_FBDEV)||defined(HAVE_VESA)
|
||||
|
@ -116,15 +116,23 @@ typedef struct vo_info_s
|
||||
const char *comment;
|
||||
} vo_info_t;
|
||||
|
||||
typedef struct vo_functions_s
|
||||
{
|
||||
struct vo;
|
||||
|
||||
struct vo_driver {
|
||||
// Driver uses new API
|
||||
int is_new;
|
||||
|
||||
// This is set if the driver is not new and contains pointers to
|
||||
// old-API functions to be used instead of the ones below.
|
||||
struct vo_old_functions *old_functions;
|
||||
|
||||
const vo_info_t *info;
|
||||
/*
|
||||
* Preinitializes driver (real INITIALIZATION)
|
||||
* arg - currently it's vo_subdevice
|
||||
* returns: zero on successful initialization, non-zero on error.
|
||||
*/
|
||||
int (*preinit)(const char *arg);
|
||||
int (*preinit)(struct vo *vo, const char *arg);
|
||||
/*
|
||||
* Initialize (means CONFIGURE) the display driver.
|
||||
* params:
|
||||
@ -135,21 +143,21 @@ typedef struct vo_functions_s
|
||||
* format: fourcc of pixel format
|
||||
* returns : zero on successful initialization, non-zero on error.
|
||||
*/
|
||||
int (*config)(uint32_t width, uint32_t height, uint32_t d_width,
|
||||
uint32_t d_height, uint32_t fullscreen, char *title,
|
||||
uint32_t format);
|
||||
int (*config)(struct vo *vo, uint32_t width, uint32_t height,
|
||||
uint32_t d_width, uint32_t d_height, uint32_t fullscreen,
|
||||
char *title, uint32_t format);
|
||||
|
||||
/*
|
||||
* Control interface
|
||||
*/
|
||||
int (*control)(uint32_t request, void *data);
|
||||
int (*control)(struct vo *vo, uint32_t request, void *data);
|
||||
|
||||
/*
|
||||
* Display a new RGB/BGR frame of the video to the screen.
|
||||
* params:
|
||||
* src[0] - pointer to the image
|
||||
*/
|
||||
int (*draw_frame)(uint8_t *src[]);
|
||||
int (*draw_frame)(struct vo *vo, uint8_t *src[]);
|
||||
|
||||
/*
|
||||
* Draw a planar YUV slice to the buffer:
|
||||
@ -159,39 +167,67 @@ typedef struct vo_functions_s
|
||||
* w,h = width*height of area to be copied (in Y pixels)
|
||||
* x,y = position at the destination image (in Y pixels)
|
||||
*/
|
||||
int (*draw_slice)(uint8_t *src[], int stride[], int w,int h, int x,int y);
|
||||
int (*draw_slice)(struct vo *vo, uint8_t *src[], int stride[], int w,
|
||||
int h, int x, int y);
|
||||
|
||||
/*
|
||||
* Draws OSD to the screen buffer
|
||||
*/
|
||||
void (*draw_osd)(void);
|
||||
void (*draw_osd)(struct vo *vo);
|
||||
|
||||
/*
|
||||
* Blit/Flip buffer to the screen. Must be called after each frame!
|
||||
*/
|
||||
void (*flip_page)(void);
|
||||
void (*flip_page)(struct vo *vo);
|
||||
|
||||
/*
|
||||
* This func is called after every frames to handle keyboard and
|
||||
* other events. It's called in PAUSE mode too!
|
||||
*/
|
||||
void (*check_events)(void);
|
||||
void (*check_events)(struct vo *vo);
|
||||
|
||||
/*
|
||||
* Closes driver. Should restore the original state of the system.
|
||||
*/
|
||||
void (*uninit)(void);
|
||||
void (*uninit)(struct vo *vo);
|
||||
};
|
||||
|
||||
} vo_functions_t;
|
||||
struct vo_old_functions {
|
||||
int (*preinit)(const char *arg);
|
||||
int (*config)(uint32_t width, uint32_t height, uint32_t d_width,
|
||||
uint32_t d_height, uint32_t fullscreen, char *title,
|
||||
uint32_t format);
|
||||
int (*control)(uint32_t request, void *data);
|
||||
int (*draw_frame)(uint8_t *src[]);
|
||||
int (*draw_slice)(uint8_t *src[], int stride[], int w,int h, int x,int y);
|
||||
void (*draw_osd)(void);
|
||||
void (*flip_page)(void);
|
||||
void (*check_events)(void);
|
||||
void (*uninit)(void);
|
||||
};
|
||||
|
||||
const vo_functions_t* init_best_video_out(char** vo_list);
|
||||
int config_video_out(const vo_functions_t *vo, uint32_t width, uint32_t height,
|
||||
struct vo {
|
||||
const struct vo_driver *driver;
|
||||
void *priv;
|
||||
};
|
||||
|
||||
struct vo *init_best_video_out(char **vo_list);
|
||||
int vo_config(struct vo *vo, uint32_t width, uint32_t height,
|
||||
uint32_t d_width, uint32_t d_height, uint32_t flags,
|
||||
char *title, uint32_t format);
|
||||
void list_video_out(void);
|
||||
|
||||
int vo_control(struct vo *vo, uint32_t request, void *data);
|
||||
int vo_draw_frame(struct vo *vo, uint8_t *src[]);
|
||||
int vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[], int w, int h, int x, int y);
|
||||
void vo_draw_osd(struct vo *vo);
|
||||
void vo_flip_page(struct vo *vo);
|
||||
void vo_check_events(struct vo *vo);
|
||||
void vo_destroy(struct vo *vo);
|
||||
|
||||
|
||||
// NULL terminated array of all drivers
|
||||
extern const vo_functions_t* const video_out_drivers[];
|
||||
extern const struct vo_driver *video_out_drivers[];
|
||||
|
||||
extern int vo_flags;
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "libmpcodecs/vfcap.h"
|
||||
#include "libmpcodecs/mp_image.h"
|
||||
#include "geometry.h"
|
||||
#include "old_vo_wrapper.h"
|
||||
|
||||
static int control(uint32_t request, void *data);
|
||||
static int config(uint32_t width, uint32_t height, uint32_t d_width,
|
||||
@ -43,9 +44,20 @@ static void uninit(void);
|
||||
static int query_format(uint32_t format);
|
||||
static int preinit(const char *);
|
||||
|
||||
#define LIBVO_EXTERN(x) vo_functions_t video_out_##x =\
|
||||
#define LIBVO_EXTERN(x) struct vo_driver video_out_##x =\
|
||||
{\
|
||||
&info,\
|
||||
.is_new = 0,\
|
||||
.info = &info,\
|
||||
.preinit = old_vo_preinit,\
|
||||
.config = old_vo_config,\
|
||||
.control = old_vo_control,\
|
||||
.draw_frame = old_vo_draw_frame,\
|
||||
.draw_slice = old_vo_draw_slice,\
|
||||
.draw_osd = old_vo_draw_osd,\
|
||||
.flip_page = old_vo_flip_page,\
|
||||
.check_events = old_vo_check_events,\
|
||||
.uninit = old_vo_uninit,\
|
||||
.old_functions = &(struct vo_old_functions){\
|
||||
preinit,\
|
||||
config,\
|
||||
control,\
|
||||
@ -54,7 +66,8 @@ static int preinit(const char *);
|
||||
draw_osd,\
|
||||
flip_page,\
|
||||
check_events,\
|
||||
uninit\
|
||||
uninit,\
|
||||
}\
|
||||
};
|
||||
|
||||
#include "osd.h"
|
||||
|
@ -152,7 +152,7 @@ static int preinit(const char *arg){
|
||||
mp_msg(MSGT_VO, MSGL_INFO, "vo_cvidix: No vidix driver name provided, probing available ones (-v option for details)!\n");
|
||||
vidix_name = NULL;
|
||||
}
|
||||
if(vidix_preinit(vidix_name, &video_out_cvidix))return 1;
|
||||
if (vidix_preinit(vidix_name, video_out_cvidix.old_functions))return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,8 @@ static int movie_w,movie_h;
|
||||
static int playing = 0;
|
||||
|
||||
// vo device used to blank the screen for the overlay init
|
||||
static const vo_functions_t* sub_vo = NULL;
|
||||
static const struct vo_old_functions *sub_vo = NULL;
|
||||
static const struct vo_info_s *sub_info;
|
||||
|
||||
static uint8_t* sub_img = NULL;
|
||||
static int sub_x,sub_y,sub_w,sub_h;
|
||||
@ -432,7 +433,7 @@ static int dxr2_load_vga_params(dxr2_vgaParams_t* vga,char* name) {
|
||||
}
|
||||
|
||||
static int dxr2_setup_vga_params(void) {
|
||||
const vo_info_t* vi = sub_vo->info;
|
||||
const vo_info_t* vi = sub_info;
|
||||
dxr2_vgaParams_t vga;
|
||||
|
||||
int loaded = dxr2_load_vga_params(&vga,(char*)vi->short_name);
|
||||
@ -646,7 +647,7 @@ static int config(uint32_t s_width, uint32_t s_height, uint32_t width, uint32_t
|
||||
}
|
||||
// Does the sub vo support the x11 stuff
|
||||
// Fix me : test the other x11 vo's and enable them
|
||||
if(strcmp(sub_vo->info->short_name,"x11") == 0)
|
||||
if(strcmp(sub_info->short_name,"x11") == 0)
|
||||
sub_vo_win = 1;
|
||||
else
|
||||
sub_vo_win = 0;
|
||||
@ -820,10 +821,11 @@ static int preinit(const char *arg) {
|
||||
const vo_info_t* vi = video_out_drivers[n]->info;
|
||||
if(!vi)
|
||||
continue;
|
||||
if(strcasecmp(arg,vi->short_name) == 0)
|
||||
if(!video_out_drivers[n]->is_new && strcasecmp(arg,vi->short_name) == 0)
|
||||
break;
|
||||
}
|
||||
sub_vo = video_out_drivers[n];
|
||||
sub_vo = video_out_drivers[n]->old_functions;
|
||||
sub_info = video_out_drivers[n]->info;
|
||||
} else {
|
||||
mp_msg(MSGT_VO,MSGL_WARN,"VO: [dxr2] We need a sub driver to initialize the overlay\n");
|
||||
use_ol = 0;
|
||||
|
@ -1132,7 +1132,8 @@ static int preinit(const char *vo_subdevice)
|
||||
if (memcmp(vo_subdevice, "vidix", 5) == 0)
|
||||
vidix_name = &vo_subdevice[5];
|
||||
if(vidix_name)
|
||||
pre_init_err = vidix_preinit(vidix_name,&video_out_fbdev);
|
||||
pre_init_err = vidix_preinit(vidix_name,
|
||||
video_out_fbdev.old_functions);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
|
@ -135,7 +135,7 @@ char s[64];
|
||||
vidix_name[i-5]=0;
|
||||
if(arg[i]==':')i++;
|
||||
arg+=i;
|
||||
vidix_preinit(vidix_name, &video_out_svga);
|
||||
vidix_preinit(vidix_name, video_out_svga.old_functions);
|
||||
}
|
||||
#endif
|
||||
if(!strncmp(arg,"sq",2)) {
|
||||
|
@ -1076,7 +1076,8 @@ static int preinit(const char *arg)
|
||||
if(arg) subdev_flags = parseSubDevice(arg);
|
||||
if(lvo_name) pre_init_err = vlvo_preinit(lvo_name);
|
||||
#ifdef CONFIG_VIDIX
|
||||
else if(vidix_name) pre_init_err = vidix_preinit(vidix_name,&video_out_vesa);
|
||||
else if(vidix_name) pre_init_err = vidix_preinit(vidix_name,
|
||||
video_out_vesa.old_functions);
|
||||
#endif
|
||||
// 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)
|
||||
|
@ -323,7 +323,7 @@ static int preinit(const char *arg){
|
||||
vidix_name = NULL;
|
||||
}
|
||||
|
||||
if (vidix_preinit(vidix_name, &video_out_winvidix) != 0)
|
||||
if (vidix_preinit(vidix_name, video_out_winvidix.old_functions) != 0)
|
||||
return(1);
|
||||
|
||||
return(0);
|
||||
|
@ -67,8 +67,8 @@ static uint32_t window_width, window_height;
|
||||
static uint32_t drwX, drwY, drwWidth, drwHeight, drwBorderWidth,
|
||||
drwDepth, drwcX, drwcY, dwidth, dheight;
|
||||
|
||||
static const vo_functions_t* sub_vo = NULL;
|
||||
|
||||
static const struct vo_old_functions *sub_vo = NULL;
|
||||
static const struct vo_info_s *sub_info;
|
||||
|
||||
static void set_window(int force_update)
|
||||
{
|
||||
@ -211,7 +211,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
|
||||
mp_colorkey_t colork;
|
||||
char _title[255];
|
||||
|
||||
sprintf(_title,"MPlayer %s X11 Overlay",sub_vo->info->name);
|
||||
sprintf(_title,"MPlayer %s X11 Overlay", sub_info->name);
|
||||
title = _title;
|
||||
|
||||
panscan_init();
|
||||
@ -384,10 +384,10 @@ static void uninit(void)
|
||||
sub_vo = NULL;
|
||||
vo_x11_uninit();
|
||||
// Restore our callbacks
|
||||
video_out_xover.draw_frame = draw_frame;
|
||||
video_out_xover.draw_slice = draw_slice;
|
||||
video_out_xover.flip_page = flip_page;
|
||||
video_out_xover.draw_osd = draw_osd;
|
||||
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)
|
||||
@ -399,31 +399,34 @@ static int preinit(const char *arg)
|
||||
return 1;
|
||||
}
|
||||
|
||||
for(i = 0 ; video_out_drivers[i] != NULL ; i++) {
|
||||
if(!strcmp(video_out_drivers[i]->info->short_name,arg) &&
|
||||
strcmp(video_out_drivers[i]->info->short_name,"xover"))
|
||||
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(!video_out_drivers[i]) {
|
||||
if (!candidate) {
|
||||
mp_msg(MSGT_VO, MSGL_ERR, "VO XOverlay: Subdriver %s not found\n", arg);
|
||||
return 1;
|
||||
}
|
||||
if(video_out_drivers[i]->control(VOCTRL_XOVERLAY_SUPPORT,NULL) != VO_TRUE) {
|
||||
|
||||
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(video_out_drivers[i]->preinit(NULL)) {
|
||||
if(functions->preinit(NULL)) {
|
||||
mp_msg(MSGT_VO, MSGL_ERR, "VO XOverlay: Subvo init failed\n");
|
||||
return 1;
|
||||
}
|
||||
sub_vo = video_out_drivers[i];
|
||||
sub_vo = functions;
|
||||
sub_info = candidate->info;
|
||||
// Setup the sub vo callbacks
|
||||
video_out_xover.draw_frame = sub_vo->draw_frame;
|
||||
video_out_xover.draw_slice = sub_vo->draw_slice;
|
||||
video_out_xover.flip_page = sub_vo->flip_page;
|
||||
video_out_xover.draw_osd = sub_vo->draw_osd;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -464,7 +464,7 @@ static int preinit(const char *arg)
|
||||
if (!vo_init())
|
||||
return (-1);
|
||||
|
||||
if (vidix_preinit(vidix_name, &video_out_xvidix) != 0)
|
||||
if (vidix_preinit(vidix_name, video_out_xvidix.old_functions) != 0)
|
||||
return (1);
|
||||
|
||||
return (0);
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "video_out.h"
|
||||
#include "sub.h"
|
||||
#include "vosub_vidix.h"
|
||||
#include "old_vo_wrapper.h"
|
||||
|
||||
#include "libmpcodecs/vfcap.h"
|
||||
#include "libmpcodecs/mp_image.h"
|
||||
@ -48,7 +49,7 @@ static int video_on=0;
|
||||
static vidix_capability_t vidix_cap;
|
||||
static vidix_playback_t vidix_play;
|
||||
static vidix_fourcc_t vidix_fourcc;
|
||||
static vo_functions_t * vo_server;
|
||||
static struct vo_old_functions *vo_server;
|
||||
static vidix_yuv_t dstrides;
|
||||
/*static uint32_t (*server_control)(uint32_t request, void *data, ...);*/
|
||||
|
||||
@ -85,7 +86,7 @@ void vidix_term( void )
|
||||
// vo_server->control=server_control;
|
||||
}
|
||||
|
||||
static uint32_t vidix_draw_slice_420(uint8_t *image[], int stride[], int w,int h,int x,int y)
|
||||
static int vidix_draw_slice_420(uint8_t *image[], int stride[], int w,int h,int x,int y)
|
||||
{
|
||||
uint8_t *src;
|
||||
uint8_t *dest;
|
||||
@ -149,7 +150,7 @@ static uint32_t vidix_draw_slice_420(uint8_t *image[], int stride[], int w,int h
|
||||
return -1;
|
||||
}
|
||||
|
||||
static uint32_t vidix_draw_slice_410(uint8_t *image[], int stride[], int w,int h,int x,int y)
|
||||
static int vidix_draw_slice_410(uint8_t *image[], int stride[], int w,int h,int x,int y)
|
||||
{
|
||||
uint8_t *src;
|
||||
uint8_t *dest;
|
||||
@ -195,7 +196,7 @@ static uint32_t vidix_draw_slice_410(uint8_t *image[], int stride[], int w,int h
|
||||
return -1;
|
||||
}
|
||||
|
||||
static uint32_t vidix_draw_slice_packed(uint8_t *image[], int stride[], int w,int h,int x,int y)
|
||||
static int vidix_draw_slice_packed(uint8_t *image[], int stride[], int w,int h,int x,int y)
|
||||
{
|
||||
uint8_t *src;
|
||||
uint8_t *dest;
|
||||
@ -212,7 +213,7 @@ static uint32_t vidix_draw_slice_packed(uint8_t *image[], int stride[], int w,in
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t vidix_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
|
||||
int vidix_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
|
||||
{
|
||||
mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SUB_VIDIX_DummyVidixdrawsliceWasCalled);
|
||||
return -1;
|
||||
@ -230,7 +231,7 @@ static uint32_t vidix_draw_image(mp_image_t *mpi){
|
||||
return VO_TRUE;
|
||||
}
|
||||
|
||||
uint32_t vidix_draw_frame(uint8_t *image[])
|
||||
int vidix_draw_frame(uint8_t *image[])
|
||||
{
|
||||
mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SUB_VIDIX_DummyVidixdrawframeWasCalled);
|
||||
return -1;
|
||||
@ -625,7 +626,7 @@ uint32_t vidix_control(uint32_t request, void *data)
|
||||
// return server_control(request,data); //VO_NOTIMPL;
|
||||
}
|
||||
|
||||
int vidix_preinit(const char *drvname,vo_functions_t *server)
|
||||
int vidix_preinit(const char *drvname, struct vo_old_functions *server)
|
||||
{
|
||||
int err;
|
||||
if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "video_out.h"
|
||||
|
||||
/* drvname can be NULL */
|
||||
int vidix_preinit(const char *drvname,vo_functions_t *server);
|
||||
int vidix_preinit(const char *drvname, struct vo_old_functions *server);
|
||||
int vidix_init(unsigned src_width,unsigned src_height,
|
||||
unsigned dest_x,unsigned dest_y,unsigned dst_width,
|
||||
unsigned dst_height,unsigned format,unsigned dest_bpp,
|
||||
@ -27,8 +27,8 @@ void vidix_term( void );
|
||||
uint32_t vidix_control(uint32_t request, void *data);
|
||||
uint32_t vidix_query_fourcc(uint32_t fourcc);
|
||||
|
||||
uint32_t vidix_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y);
|
||||
uint32_t vidix_draw_frame(uint8_t *src[]);
|
||||
int vidix_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y);
|
||||
int vidix_draw_frame(uint8_t *src[]);
|
||||
void vidix_flip_page(void);
|
||||
void vidix_draw_osd(void);
|
||||
|
||||
|
15
mencoder.c
15
mencoder.c
@ -209,11 +209,16 @@ char *info_sourceform=NULL;
|
||||
char *info_comment=NULL;
|
||||
|
||||
// Needed by libmpcodecs vf_vo.c
|
||||
int config_video_out(const vo_functions_t *vo, uint32_t width, uint32_t height,
|
||||
uint32_t d_width, uint32_t d_height, uint32_t flags,
|
||||
char *title, uint32_t format) {
|
||||
return 1;
|
||||
}
|
||||
int vo_config(struct vo *vo, uint32_t width, uint32_t height,
|
||||
uint32_t d_width, uint32_t d_height, uint32_t flags,
|
||||
char *title, uint32_t format) { abort(); }
|
||||
int vo_control(struct vo *vo, uint32_t request, void *data) { abort(); }
|
||||
int vo_draw_frame(struct vo *vo, uint8_t *src[]) { abort(); }
|
||||
int vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[], int w, int h, int x, int y) { abort(); }
|
||||
void vo_draw_osd(struct vo *vo) { abort(); }
|
||||
void vo_flip_page(struct vo *vo) { abort(); }
|
||||
void vo_check_events(struct vo *vo) { abort(); }
|
||||
|
||||
// Needed by libmpdemux.
|
||||
int mp_input_check_interrupt(int time) {
|
||||
usec_sleep(time);
|
||||
|
@ -59,7 +59,7 @@ typedef struct MPContext {
|
||||
demux_stream_t *d_video;
|
||||
demux_stream_t *d_sub;
|
||||
mixer_t mixer;
|
||||
const vo_functions_t *video_out;
|
||||
struct vo *video_out;
|
||||
// Frames buffered in the vo ready to flip. Currently always 0 or 1.
|
||||
// This is really a vo variable but currently there's no suitable vo
|
||||
// struct.
|
||||
|
19
mplayer.c
19
mplayer.c
@ -626,7 +626,7 @@ void uninit_player(unsigned int mask){
|
||||
if(mask&INITIALIZED_VO){
|
||||
initialized_flags&=~INITIALIZED_VO;
|
||||
current_module="uninit_vo";
|
||||
mpctx->video_out->uninit();
|
||||
vo_destroy(mpctx->video_out);
|
||||
mpctx->video_out=NULL;
|
||||
#ifdef USE_DVDNAV
|
||||
mp_dvdnav_context_free(mpctx);
|
||||
@ -2344,7 +2344,7 @@ static void pause_loop(void)
|
||||
guiGetEvent(guiCEvent, (char *)guiSetPause);
|
||||
#endif
|
||||
if (mpctx->video_out && mpctx->sh_video && vo_config_count)
|
||||
mpctx->video_out->control(VOCTRL_PAUSE, NULL);
|
||||
vo_control(mpctx->video_out, VOCTRL_PAUSE, NULL);
|
||||
|
||||
if (mpctx->audio_out && mpctx->sh_audio)
|
||||
mpctx->audio_out->pause(); // pause audio, keep data if possible
|
||||
@ -2357,7 +2357,7 @@ static void pause_loop(void)
|
||||
continue;
|
||||
}
|
||||
if (mpctx->sh_video && mpctx->video_out && vo_config_count)
|
||||
mpctx->video_out->check_events();
|
||||
vo_check_events(mpctx->video_out);
|
||||
#ifdef HAVE_NEW_GUI
|
||||
if (use_gui) {
|
||||
guiEventHandling();
|
||||
@ -2380,7 +2380,7 @@ static void pause_loop(void)
|
||||
if (mpctx->audio_out && mpctx->sh_audio)
|
||||
mpctx->audio_out->resume(); // resume audio
|
||||
if (mpctx->video_out && mpctx->sh_video && vo_config_count)
|
||||
mpctx->video_out->control(VOCTRL_RESUME, NULL); // resume video
|
||||
vo_control(mpctx->video_out, VOCTRL_RESUME, NULL); // resume video
|
||||
(void)GetRelativeTime(); // ignore time that passed during pause
|
||||
#ifdef HAVE_NEW_GUI
|
||||
if (use_gui) {
|
||||
@ -2498,7 +2498,7 @@ static int seek(MPContext *mpctx, double amount, int style)
|
||||
current_module = "seek_video_reset";
|
||||
resync_video_stream(mpctx->sh_video);
|
||||
if (vo_config_count)
|
||||
mpctx->video_out->control(VOCTRL_RESET, NULL);
|
||||
vo_control(mpctx->video_out, VOCTRL_RESET, NULL);
|
||||
mpctx->sh_video->num_buffered_pts = 0;
|
||||
mpctx->sh_video->last_pts = MP_NOPTS_VALUE;
|
||||
mpctx->num_buffered_frames = 0;
|
||||
@ -2997,7 +2997,8 @@ while (player_idle_mode && !filename) {
|
||||
play_tree_t * entry = NULL;
|
||||
mp_cmd_t * cmd;
|
||||
while (!(cmd = mp_input_get_cmd(0,1,0))) { // wait for command
|
||||
if (mpctx->video_out && vo_config_count) mpctx->video_out->check_events();
|
||||
if (mpctx->video_out && vo_config_count)
|
||||
vo_check_events(mpctx->video_out);
|
||||
usec_sleep(20000);
|
||||
}
|
||||
switch (cmd->id) {
|
||||
@ -3732,7 +3733,8 @@ if(!mpctx->sh_video) {
|
||||
#endif
|
||||
|
||||
current_module="vo_check_events";
|
||||
if (vo_config_count) mpctx->video_out->check_events();
|
||||
if (vo_config_count)
|
||||
vo_check_events(mpctx->video_out);
|
||||
|
||||
#ifdef HAVE_X11
|
||||
if (stop_xscreensaver) {
|
||||
@ -3757,7 +3759,8 @@ if(!mpctx->sh_video) {
|
||||
if (!frame_time_remaining && blit_frame) {
|
||||
unsigned int t2=GetTimer();
|
||||
|
||||
if(vo_config_count) mpctx->video_out->flip_page();
|
||||
if(vo_config_count)
|
||||
vo_flip_page(mpctx->video_out);
|
||||
mpctx->num_buffered_frames--;
|
||||
|
||||
vout_time_usage += (GetTimer() - t2) * 0.000001;
|
||||
|
10
spudec.c
10
spudec.c
@ -86,7 +86,7 @@ typedef struct {
|
||||
unsigned char *scaled_aimage;
|
||||
int auto_palette; /* 1 if we lack a palette and must use an heuristic. */
|
||||
int font_start_level; /* Darkest value used for the computed font */
|
||||
const vo_functions_t *hw_spu;
|
||||
struct vo *hw_spu;
|
||||
int spu_changed;
|
||||
unsigned int forced_subs_only; /* flag: 0=display all subtitle, !0 display only forced subtitles */
|
||||
unsigned int is_forced_sub; /* true if current subtitle is a forced subtitle */
|
||||
@ -490,7 +490,7 @@ static void spudec_decode(spudec_handle_t *this, int pts100)
|
||||
packet.data = this->packet;
|
||||
packet.size = this->packet_size;
|
||||
packet.timestamp = pts100;
|
||||
this->hw_spu->draw_frame((uint8_t**)&pkg);
|
||||
vo_draw_frame(this->hw_spu, (uint8_t**)&pkg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1104,7 +1104,7 @@ void spudec_update_palette(void * this, unsigned int *palette)
|
||||
if (spu && palette) {
|
||||
memcpy(spu->global_palette, palette, sizeof(spu->global_palette));
|
||||
if(spu->hw_spu)
|
||||
spu->hw_spu->control(VOCTRL_SET_SPU_PALETTE,spu->global_palette);
|
||||
vo_control(spu->hw_spu, VOCTRL_SET_SPU_PALETTE, spu->global_palette);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1174,11 +1174,11 @@ void spudec_free(void *this)
|
||||
}
|
||||
}
|
||||
|
||||
void spudec_set_hw_spu(void *this, const vo_functions_t *hw_spu)
|
||||
void spudec_set_hw_spu(void *this, struct vo *hw_spu)
|
||||
{
|
||||
spudec_handle_t *spu = (spudec_handle_t*)this;
|
||||
if (!spu)
|
||||
return;
|
||||
spu->hw_spu = hw_spu;
|
||||
hw_spu->control(VOCTRL_SET_SPU_PALETTE,spu->global_palette);
|
||||
vo_control(hw_spu, VOCTRL_SET_SPU_PALETTE, spu->global_palette);
|
||||
}
|
||||
|
2
spudec.h
2
spudec.h
@ -15,7 +15,7 @@ void spudec_free(void *this);
|
||||
void spudec_reset(void *this); // called after seek
|
||||
int spudec_visible(void *this); // check if spu is visible
|
||||
void spudec_set_font_factor(void * this, double factor); // sets the equivalent to ffactor
|
||||
void spudec_set_hw_spu(void *this, const vo_functions_t *hw_spu);
|
||||
void spudec_set_hw_spu(void *this, struct vo *hw_spu);
|
||||
int spudec_changed(void *this);
|
||||
void spudec_calc_bbox(void *me, unsigned int dxs, unsigned int dys, unsigned int* bbox);
|
||||
void spudec_set_forced_subs_only(void * const this, const unsigned int flag);
|
||||
|
Loading…
Reference in New Issue
Block a user