summaryrefslogtreecommitdiffstats
path: root/libvo/vo_dxr3.c
diff options
context:
space:
mode:
Diffstat (limited to 'libvo/vo_dxr3.c')
-rw-r--r--libvo/vo_dxr3.c118
1 files changed, 59 insertions, 59 deletions
diff --git a/libvo/vo_dxr3.c b/libvo/vo_dxr3.c
index f5df411a5a..4312c156f9 100644
--- a/libvo/vo_dxr3.c
+++ b/libvo/vo_dxr3.c
@@ -54,7 +54,7 @@
#define SPU_SUPPORT
-static const vo_info_t info =
+static const vo_info_t info =
{
"DXR3/H+ video out",
"dxr3",
@@ -70,7 +70,7 @@ static int osd_w, osd_h;
static int img_format;
/* Configuration values
- * Don't declare these static, they
+ * Don't declare these static, they
* should be accessible from the gui.
*/
int dxr3_prebuf = 0;
@@ -212,7 +212,7 @@ static int control(uint32_t request, void *data)
pts_offset = 0;
}
}
-
+
if (dxr3_prebuf) {
ioval = EM8300_PLAYMODE_PLAY;
if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) {
@@ -264,7 +264,7 @@ static int control(uint32_t request, void *data)
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;
@@ -273,10 +273,10 @@ static int control(uint32_t request, void *data)
{
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"))
@@ -284,7 +284,7 @@ static int control(uint32_t request, void *data)
else if (!strcasecmp(args->name, "saturation"))
*args->valueptr = (bcs.saturation/5)-100;
else return VO_FALSE;
-
+
return VO_TRUE;
}
}
@@ -296,12 +296,12 @@ 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;
@@ -329,7 +329,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
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;
@@ -362,7 +362,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
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) {
@@ -377,10 +377,10 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
} 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");
+ printf(".\n");
} else {
if (vo_fps > 28) {
ioval = EM8300_VIDEOMODE_NTSC;
@@ -390,17 +390,17 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
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");
+ 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);
@@ -415,7 +415,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
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));
@@ -464,7 +464,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
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 );
@@ -516,7 +516,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
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);
@@ -527,7 +527,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
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;
@@ -539,12 +539,12 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
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);
+ 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);
@@ -564,8 +564,8 @@ static void draw_alpha(int x, int y, int w, int h, unsigned char* src, unsigned
int by = 0;
register int lx, ly;
register int stride = 0;
-
- for (ly = 0; ly < h - 1; ly++)
+
+ 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;
@@ -585,7 +585,7 @@ static void draw_osd(void)
static int cleared = 0;
int changed = 0;
- if ((disposd % 15) == 0)
+ if ((disposd % 15) == 0)
{
{
mp_osd_obj_t* obj = vo_osd_list;
@@ -701,7 +701,7 @@ static void uninit(void)
if (dxr3_overlay) {
overlay_set_mode(overlay_data, EM8300_OVERLAY_MODE_OFF);
overlay_release(overlay_data);
-
+
#ifdef CONFIG_GUI
if (!use_gui) {
#endif
@@ -717,7 +717,7 @@ static void uninit(void)
mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed restoring TV norm!\n");
}
}
-
+
if (fd_video) {
close(fd_video);
}
@@ -767,7 +767,7 @@ static int preinit(const char *arg)
// 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");
@@ -790,18 +790,18 @@ static int preinit(const char *arg)
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);
@@ -836,7 +836,7 @@ static int preinit(const char *arg)
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);
@@ -854,10 +854,10 @@ static int preinit(const char *arg)
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
@@ -865,7 +865,7 @@ static int preinit(const char *arg)
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");
@@ -881,7 +881,7 @@ static int preinit(const char *arg)
overlay_release(ov);
XCloseDisplay(dpy);
/* End of fucked up hack */
-
+
/* Initialize overlay and X11 */
overlay_data = overlay_init(fd_control);
#ifdef CONFIG_GUI
@@ -922,7 +922,7 @@ static int update_parameters(overlay_t *o)
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)
@@ -1012,13 +1012,13 @@ static int overlay_read_state(overlay_t *o, char *p)
void *ptr;
int type;
int j;
-
+
if(!p) {
av_strlcpy(fname, getenv("HOME"), sizeof( fname ));
- av_strlcat(fname,"/.overlay", 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 ));
@@ -1026,7 +1026,7 @@ static int overlay_read_state(overlay_t *o, char *p)
return -1;
lut = new_lookuptable(o);
-
+
while(!feof(fp)) {
if(!fgets(line,256,fp))
break;
@@ -1050,14 +1050,14 @@ static int overlay_read_state(overlay_t *o, char *p)
sscanf(tok,"%f",&((struct coeff *)ptr)[j].m);
tok=strtok(NULL," ");
}
- break;
+ break;
}
-
- }
+
+ }
}
update_parameters(o);
-
+
free(lut);
fclose(fp);
return 0;
@@ -1067,7 +1067,7 @@ static void overlay_update_params(overlay_t *o) {
update_parameters(o);
}
-static int overlay_write_state(overlay_t *o, char *p)
+static int overlay_write_state(overlay_t *o, char *p)
{
char *a;
char path[128],fname[128],tmp[128];
@@ -1075,27 +1075,27 @@ static int overlay_write_state(overlay_t *o, char *p)
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 ));
+ 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++) {
+ for(i=0; lut[i].name; i++) {
fprintf(fp,"%s ",lut[i].name);
switch(lut[i].type) {
case TYPE_INT:
@@ -1108,11 +1108,11 @@ static int overlay_write_state(overlay_t *o, char *p)
fprintf(fp,"%f\n",*(float *)lut[i].ptr);
break;
case TYPE_COEFF:
- for(j=0;j<3;j++)
+ 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;
+ break;
}
}
@@ -1130,7 +1130,7 @@ static int overlay_set_screen(overlay_t *o, int xres, int yres, int 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");
@@ -1205,7 +1205,7 @@ static int overlay_set_keycolor(overlay_t *o, int color) {
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]));