mirror of
https://github.com/mpv-player/mpv
synced 2025-03-20 10:17:31 +00:00
added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6551 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
6ce7a64fad
commit
c45d0b29f0
@ -64,7 +64,6 @@ static vo_tune_info_t vtune;
|
||||
static uint32_t image_width;
|
||||
static uint32_t image_height;
|
||||
static uint32_t image_format;
|
||||
static uint32_t image_depth;
|
||||
|
||||
/* Window parameters */
|
||||
static uint32_t window_x, window_y;
|
||||
@ -174,7 +173,7 @@ static void set_window(int force_update,const vo_tune_info_t *info)
|
||||
vidix_start();
|
||||
}
|
||||
|
||||
mp_msg(MSGT_VO, MSGL_INFO, "[xvidix] window properties: pos: %dx%d, size: %dx%d\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: */
|
||||
@ -215,42 +214,6 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
|
||||
image_format = format;
|
||||
vo_mouse_autohide=1;
|
||||
|
||||
if (IMGFMT_IS_RGB(format))
|
||||
{
|
||||
image_depth = IMGFMT_RGB_DEPTH(format);
|
||||
}
|
||||
else
|
||||
if (IMGFMT_IS_BGR(format))
|
||||
{
|
||||
image_depth = IMGFMT_BGR_DEPTH(format);
|
||||
}
|
||||
else
|
||||
switch(format)
|
||||
{
|
||||
case IMGFMT_IYUV:
|
||||
case IMGFMT_I420:
|
||||
case IMGFMT_YV12:
|
||||
image_depth = 12;
|
||||
break;
|
||||
case IMGFMT_UYVY:
|
||||
case IMGFMT_YUY2:
|
||||
image_depth = 16;
|
||||
break;
|
||||
case IMGFMT_YVU9:
|
||||
case IMGFMT_IF09:
|
||||
image_depth = 9;
|
||||
break;
|
||||
case IMGFMT_Y800:
|
||||
case IMGFMT_Y8:
|
||||
image_depth = 8;
|
||||
break;
|
||||
default:
|
||||
image_depth = 16;
|
||||
mp_msg(MSGT_VO, MSGL_FATAL, "Unknown image format: %s\n",
|
||||
vo_format_name(format));
|
||||
break;
|
||||
}
|
||||
|
||||
if (!vo_init())
|
||||
return(-1);
|
||||
|
||||
@ -297,6 +260,9 @@ else
|
||||
{
|
||||
#endif
|
||||
|
||||
/* destroy window before creating one */
|
||||
if (vo_window) XDestroyWindow(mDisplay, vo_window);
|
||||
|
||||
#ifdef X11_FULLSCREEN
|
||||
if ( ( flags&1 )||(flags & 0x04) ) aspect(&d_width, &d_height, A_ZOOM);
|
||||
#endif
|
||||
@ -355,9 +321,6 @@ else
|
||||
}
|
||||
#endif
|
||||
|
||||
mp_msg(MSGT_VO, MSGL_INFO, "[xvidix] image properties: %dx%d depth: %d\n",
|
||||
image_width, image_height, image_depth);
|
||||
|
||||
if ( ( !WinID )&&( flags&1 ) ) { vo_dx=0; vo_dy=0; vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; vo_fs=1; }
|
||||
|
||||
if (vidix_grkey_support())
|
||||
@ -425,14 +388,14 @@ static uint32_t draw_slice(uint8_t *src[], int stride[],
|
||||
UNUSED(x);
|
||||
UNUSED(y);
|
||||
mp_msg(MSGT_VO, MSGL_FATAL, "[xvidix] error: didn't used vidix draw_slice!\n");
|
||||
return(0);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
static uint32_t draw_frame(uint8_t *src[])
|
||||
{
|
||||
UNUSED(src);
|
||||
mp_msg(MSGT_VO, MSGL_FATAL, "[xvidix] error: didn't used vidix draw_frame!\n");
|
||||
return(0);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
static uint32_t query_format(uint32_t format)
|
||||
@ -486,6 +449,6 @@ static uint32_t control(uint32_t request, void *data, ...)
|
||||
}
|
||||
return VO_TRUE;
|
||||
}
|
||||
vidix_control(request, data);
|
||||
return vidix_control(request, data);
|
||||
// return VO_NOTIMPL;
|
||||
}
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "fastmemcpy.h"
|
||||
#include "osd.h"
|
||||
#include "video_out.h"
|
||||
#include "sub.h"
|
||||
|
||||
#include "../libmpcodecs/vfcap.h"
|
||||
#include "../libmpcodecs/mp_image.h"
|
||||
@ -142,7 +143,7 @@ void vidix_term( void )
|
||||
if(verbose > 1) printf("vosub_vidix: vidix_term() was called\n");
|
||||
vidix_stop();
|
||||
vdlClose(vidix_handler);
|
||||
((vo_functions_t *)vo_server)->control=server_control;
|
||||
// ((vo_functions_t *)vo_server)->control=server_control;
|
||||
}
|
||||
|
||||
static uint32_t vidix_draw_slice_swYV12(uint8_t *image[], int stride[], int w,int h,int x,int y)
|
||||
@ -215,6 +216,7 @@ static uint32_t vidix_draw_slice_420(uint8_t *image[], int stride[], int w,int h
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static uint32_t vidix_draw_slice_410(uint8_t *image[], int stride[], int w,int h,int x,int y)
|
||||
@ -260,12 +262,14 @@ static uint32_t vidix_draw_slice_410(uint8_t *image[], int stride[], int w,int h
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static uint32_t vidix_draw_slice_410_fast(uint8_t *image[], int stride[], int w, int h, int x, int y)
|
||||
{
|
||||
uint8_t *src;
|
||||
uint8_t *dest;
|
||||
|
||||
UNUSED(w);
|
||||
UNUSED(stride);
|
||||
dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y;
|
||||
@ -297,6 +301,7 @@ static uint32_t vidix_draw_slice_packed(uint8_t *image[], int stride[], int w,in
|
||||
uint8_t *src;
|
||||
uint8_t *dest;
|
||||
int i;
|
||||
|
||||
dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y;
|
||||
dest += dstrides.y*y + x;
|
||||
src = image[0];
|
||||
@ -312,7 +317,9 @@ static uint32_t vidix_draw_slice_packed_fast(uint8_t *image[], int stride[], int
|
||||
{
|
||||
uint8_t *src;
|
||||
uint8_t *dest;
|
||||
int i;
|
||||
|
||||
UNUSED(w);
|
||||
UNUSED(stride);
|
||||
dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y;
|
||||
dest += dstrides.y*y + x;
|
||||
src = image[0];
|
||||
@ -322,6 +329,12 @@ static uint32_t vidix_draw_slice_packed_fast(uint8_t *image[], int stride[], int
|
||||
|
||||
uint32_t vidix_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
|
||||
{
|
||||
UNUSED(image);
|
||||
UNUSED(stride);
|
||||
UNUSED(w);
|
||||
UNUSED(h);
|
||||
UNUSED(x);
|
||||
UNUSED(y);
|
||||
printf("vosub_vidix: Error unoptimized draw_slice was called\nExiting...");
|
||||
vidix_term();
|
||||
exit( EXIT_FAILURE );
|
||||
@ -379,6 +392,10 @@ static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned
|
||||
case IMGFMT_YV12:
|
||||
case IMGFMT_IYUV:
|
||||
case IMGFMT_I420:
|
||||
case IMGFMT_YVU9:
|
||||
case IMGFMT_IF09:
|
||||
case IMGFMT_Y8:
|
||||
case IMGFMT_Y800:
|
||||
bespitch = (vidix_play.src.w + apitch) & (~apitch);
|
||||
vo_draw_alpha_yv12(w,h,src,srca,stride,lvo_mem+bespitch*y0+x0,bespitch);
|
||||
break;
|
||||
@ -444,7 +461,7 @@ uint32_t vidix_query_fourcc(uint32_t format)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN;
|
||||
return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN|VFCAP_OSD;
|
||||
}
|
||||
|
||||
int vidix_grkey_support(void)
|
||||
@ -523,7 +540,7 @@ int vidix_init(unsigned src_width,unsigned src_height,
|
||||
unsigned dst_height,unsigned format,unsigned dest_bpp,
|
||||
unsigned vid_w,unsigned vid_h,const void *info)
|
||||
{
|
||||
size_t i,awidth;
|
||||
size_t i;
|
||||
int err;
|
||||
uint32_t sstride,apitch;
|
||||
if(verbose > 1)
|
||||
@ -642,7 +659,7 @@ int vidix_init(unsigned src_width,unsigned src_height,
|
||||
printf("vosub_vidix: Can't configure playback: %s\n",strerror(err));
|
||||
return -1;
|
||||
}
|
||||
printf("vosub_vidix: using %d buffers\n", vidix_play.num_frames);
|
||||
if (verbose) printf("vosub_vidix: using %d buffer(s)\n", vidix_play.num_frames);
|
||||
|
||||
vidix_mem = vidix_play.dga_addr;
|
||||
|
||||
@ -656,13 +673,13 @@ int vidix_init(unsigned src_width,unsigned src_height,
|
||||
vidix_play.frame_size);
|
||||
switch(format)
|
||||
{
|
||||
case IMGFMT_Y800:
|
||||
case IMGFMT_Y8:
|
||||
case IMGFMT_YVU9:
|
||||
case IMGFMT_IF09:
|
||||
case IMGFMT_YV12:
|
||||
case IMGFMT_I420:
|
||||
case IMGFMT_IYUV:
|
||||
case IMGFMT_YV12:
|
||||
case IMGFMT_YVU9:
|
||||
case IMGFMT_IF09:
|
||||
case IMGFMT_Y800:
|
||||
case IMGFMT_Y8:
|
||||
apitch = vidix_play.dest.pitch.y-1;
|
||||
dstrides.y = (image_width + apitch) & ~apitch;
|
||||
apitch = vidix_play.dest.pitch.v-1;
|
||||
@ -714,8 +731,8 @@ static uint32_t vidix_get_image(mp_image_t *mpi)
|
||||
{
|
||||
if(mpi->type==MP_IMGTYPE_STATIC && vidix_play.num_frames>1) return VO_FALSE;
|
||||
if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; /* slow video ram */
|
||||
if((is_422_planes_eq || (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH)) &&
|
||||
!forced_fourcc && !(vidix_play.flags & VID_PLAY_INTERLEAVED_UV)))
|
||||
if((is_422_planes_eq || (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH))) &&
|
||||
(!forced_fourcc && !(vidix_play.flags & VID_PLAY_INTERLEAVED_UV)))
|
||||
{
|
||||
if(mpi->flags&MP_IMGFLAG_ACCEPT_WIDTH){
|
||||
// check if only width is enough to represent strides:
|
||||
@ -795,8 +812,8 @@ int vidix_preinit(const char *drvname,void *server)
|
||||
((vo_functions_t *)server)->draw_frame=vidix_draw_frame;
|
||||
((vo_functions_t *)server)->flip_page=vidix_flip_page;
|
||||
((vo_functions_t *)server)->draw_osd=vidix_draw_osd;
|
||||
server_control = ((vo_functions_t *)server)->control;
|
||||
((vo_functions_t *)server)->control=vidix_control;
|
||||
// server_control = ((vo_functions_t *)server)->control;
|
||||
// ((vo_functions_t *)server)->control=vidix_control;
|
||||
vo_server = server;
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user