static int vidix_get_video_eq(vidix_video_eq_t *info) { if(!video_on) return EPERM; return vdlPlaybackGetEq(vidix_handler, info); }
/* --------------------------------------------------------------------------- */ cVidixVideoOut::cVidixVideoOut(cSetupStore *setupStore, cSetupSoftlog *Softlog) : cVideoOut(setupStore,Softlog) { int err; double displayRatio; char *fbName = getFBName(); if ((fbdev = open(fbName, O_RDWR)) == -1) { softlog->Log(SOFT_LOG_ERROR, 0, "[cVidixVideoOut] Can't open framebuffer exiting\n"); free(fbName); exit(1); } free(fbName); if (ioctl(fbdev, FBIOGET_VSCREENINFO, &fb_vinfo)) { softlog->Log(SOFT_LOG_ERROR, 0, "[cVidixVideoOut] Can't get VSCREENINFO exiting\n"); exit(1); } if (ioctl(fbdev, FBIOGET_FSCREENINFO, &fb_finfo)) { softlog->Log(SOFT_LOG_ERROR, 0, "[cVidixVideoOut] Can't get FSCREENINFO exiting\n"); exit(1); } switch (fb_finfo.visual) { case FB_VISUAL_TRUECOLOR: softlog->Log(SOFT_LOG_INFO, 0, "[cVidixVideoOut] Truecolor FB found\n"); break; case FB_VISUAL_DIRECTCOLOR: struct fb_cmap cmap; __u16 red[256], green[256], blue[256]; softlog->Log(SOFT_LOG_INFO, 0, "[cVidixVideoOut] DirectColor FB found\n"); orig_cmaplen = 256; orig_cmap = (__u16 *) malloc ( 3 * orig_cmaplen * sizeof(*orig_cmap) ); if ( orig_cmap == NULL ) { softlog->Log(SOFT_LOG_ERROR, 0, "[cVidixVideoOut] Can't alloc memory for cmap exiting\n"); exit(1); } cmap.start = 0; cmap.len = orig_cmaplen; cmap.red = &orig_cmap[0*orig_cmaplen]; cmap.green = &orig_cmap[1*orig_cmaplen]; cmap.blue = &orig_cmap[2*orig_cmaplen]; cmap.transp = NULL; if ( ioctl(fbdev, FBIOGETCMAP, &cmap)) { softlog->Log(SOFT_LOG_ERROR, 0, "[cVidixVideoOut] Can't get cmap\n"); } for ( int i=0; i < orig_cmaplen; ++i ) { red[i] = green[i] = blue[i] = (i<<8)|i; } cmap.start = 0; cmap.len = orig_cmaplen; cmap.red = red; cmap.green = green; cmap.blue = blue; cmap.transp = NULL; if ( ioctl(fbdev, FBIOPUTCMAP, &cmap)) { softlog->Log(SOFT_LOG_ERROR, 0, "[cVidixVideoOut] Can't put cmap\n"); } break; default: softlog->Log(SOFT_LOG_ERROR, 0, "[cVidixVideoOut] Unsupported FB. Don't know if it will work.\n"); } fb_line_len = fb_finfo.line_length; Xres = fb_vinfo.xres; Yres = fb_vinfo.yres; Bpp = fb_vinfo.bits_per_pixel; /* * default settings: source, destination and logical widht/height * are set to our well known dimensions. */ fwidth = lwidth = dwidth = Xres; fheight = lheight = dheight = Yres; useVidixAlpha = false; swidth = 720; sheight = 576; displayRatio = (double) Xres / (double) Yres; SetParValues(displayRatio, displayRatio); softlog->Log(SOFT_LOG_INFO, 0, "[cVidixVideoOut] xres = %d yres= %d \n", fb_vinfo.xres, fb_vinfo.yres); softlog->Log(SOFT_LOG_INFO, 0, "[cVidixVideoOut] line length = %d \n", fb_line_len); softlog->Log(SOFT_LOG_INFO, 0, "[cVidixVideoOut] bpp = %d\n", fb_vinfo.bits_per_pixel); fb = (uint8_t *) mmap(0, fb_finfo.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fbdev, 0); if ( fb == (uint8_t *) -1 ) { softlog->Log(SOFT_LOG_ERROR, 0, "[cVidixVideoOut] Can't mmap framebuffer memory exiting\n"); exit(1); } memset(fb, 0, fb_line_len * Yres ); vidix_version = vdlGetVersion(); softlog->Log(SOFT_LOG_INFO, 0, "[cVidixVideoOut] vidix version: %i\n", vidix_version); vidix_handler = vdlOpen(VIDIX_DIR, NULL, TYPE_OUTPUT, 0); if( !vidix_handler ) { softlog->Log(SOFT_LOG_ERROR, 0, "[cVidixVideoOut] Couldn't find working VIDIX driver exiting\n"); exit(1); } if( (err = vdlGetCapability(vidix_handler,&vidix_cap)) != 0) { softlog->Log(SOFT_LOG_ERROR, 0, "[cVidixVideoOut] Couldn't get capability: %s exiting\n", strerror(err) ); exit(1); } softlog->Log(SOFT_LOG_INFO, 0, "[cVidixVideoOut] capabilities: 0x%0x\n", vidix_cap.flags ); OSDpseudo_alpha = true; if (setupStore->pixelFormat == 0) vidix_fourcc.fourcc = IMGFMT_I420; else if(setupStore->pixelFormat == 1) vidix_fourcc.fourcc = IMGFMT_YV12; else if (setupStore->pixelFormat == 2) vidix_fourcc.fourcc = IMGFMT_YUY2; currentPixelFormat = setupStore->pixelFormat; screenPixelAspect = -1; if (vdlQueryFourcc(vidix_handler, &vidix_fourcc)) { if (!MatchPixelFormat()) { softlog->Log(SOFT_LOG_ERROR, 0, "[cVidixVideoOut] no matching pixel format found exiting\n"); exit(1); } } memset(&vidix_play, 0, sizeof(vidix_playback_t)); vidix_play.fourcc = vidix_fourcc.fourcc; vidix_play.capability = vidix_cap.flags; vidix_play.blend_factor = 0; vidix_play.src.x = 0; vidix_play.src.y = 0; vidix_play.src.w = swidth; vidix_play.src.h = sheight; vidix_play.src.pitch.y = swidth; vidix_play.src.pitch.u = swidth/2; vidix_play.src.pitch.v = swidth/2; vidix_play.dest.x = 0; vidix_play.dest.y = 0; vidix_play.dest.w = Xres; vidix_play.dest.h = Yres; vidix_play.num_frames = 2; softlog->Log(SOFT_LOG_INFO, 0, "[cVidixVideoOut] fourcc.flags: 0x%0x\n",vidix_fourcc.flags); AllocLayer(); /* ----------------------------------------------------------------------- * check presence of equalizer capability */ vidix_video_eq_t tmpeq; softlog->Log(SOFT_LOG_INFO, 0, "[cVidixVideoOut] capabilities\n"); if(!vdlPlaybackGetEq(vidix_handler, &tmpeq)) { vidix_curr_eq=tmpeq; softlog->Log(SOFT_LOG_INFO, 0, "[cVidixVideoOut] EQ cap: %x:\n", vidix_curr_eq.cap); if (vidix_curr_eq.cap & VEQ_CAP_BRIGHTNESS) { softlog->Log(SOFT_LOG_INFO, 0, "[cVidixVideoOut] brightness (%d)\n", vidix_curr_eq.brightness); setupStore->vidCaps |= CAP_BRIGHTNESS; } if (vidix_curr_eq.cap & VEQ_CAP_CONTRAST) { softlog->Log(SOFT_LOG_INFO, 0, "[cVidixVideoOut] contrast (%d)\n", vidix_curr_eq.contrast); setupStore->vidCaps |= CAP_CONTRAST; } if (vidix_curr_eq.cap & VEQ_CAP_SATURATION) { softlog->Log(SOFT_LOG_INFO, 0, "[cVidixVideoOut] saturation (%d)\n", vidix_curr_eq.saturation); setupStore->vidCaps |= CAP_SATURATION; } if (vidix_curr_eq.cap & VEQ_CAP_HUE) { softlog->Log(SOFT_LOG_INFO, 0, "[cVidixVideoOut] hue (%d)\n", vidix_curr_eq.hue); setupStore->vidCaps |= CAP_HUE; } if (vidix_curr_eq.cap & VEQ_CAP_RGB_INTENSITY) { softlog->Log(SOFT_LOG_INFO, 0, "[cVidixVideoOut] RGB-intensity (%d, %d, %d)\n", vidix_curr_eq.red_intensity, vidix_curr_eq.green_intensity, vidix_curr_eq.blue_intensity ); } } else { softlog->Log(SOFT_LOG_INFO, 0, "[cVidixVideoOut] Couldn't get EQ capability\n"); } /* ----------------------------------------------------------------------- * check presence of hw deinterlace capability */ vidix_deinterlace_t vidix_deint; if (!vdlPlaybackGetDeint(vidix_handler, &vidix_deint) && !vdlPlaybackSetDeint(vidix_handler, &vidix_deint)) { softlog->Log(SOFT_LOG_INFO, 0, "[cVidixVideoOut] HW-deinterlace (%x,%x)\n", vidix_deint.flags, vidix_deint.deinterlace_pattern); setupStore->vidCaps |= CAP_HWDEINTERLACE; } }