int vidix_start(void)
{
    int err;
    if((err=vdlPlaybackOn(vidix_handler))!=0)
    {
	mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_CantStartPlayback,strerror(err));
	return -1;
    }
    video_on=1;
    return 0;
}
示例#2
0
/* ----------------------------------------------------------------------------
 */
void cVidixVideoOut::AllocLayer(void)
{
    int       err;
    uint8_t   *dst;
    uint32_t  apitch;

  if (currentPixelFormat == 2)
    vidix_play.src.pitch.y *= 2;

  if ((err = vdlPlaybackOff(vidix_handler)) != 0)
  {
    softlog->Log(SOFT_LOG_ERROR, 0,
              "[cVidixVideoOut] Can't stop playback: %s exiting\n",
              strerror(err));
    exit(1);
  }

  if ((err = vdlConfigPlayback(vidix_handler, &vidix_play)) != 0)
  {
    softlog->Log(SOFT_LOG_ERROR, 0,
               "[cVidixVideoOut] Can't configure playback: %s exiting\n",
               strerror(err));
    exit(1);
  }

  if ((err = vdlPlaybackOn(vidix_handler)) != 0)
  {
    softlog->Log(SOFT_LOG_ERROR, 0,
              "[cVidixVideoOut] Can't start playback: %s exiting\n",
              strerror(err));
    exit(1);
  }

  if (vidix_fourcc.flags & VID_CAP_COLORKEY)
  {
    int res = 0;

    softlog->Log(SOFT_LOG_INFO, 0,
              "[cVidixVideoOut] set colorkey\n");
    vdlGetGrKeys(vidix_handler, &gr_key);

    gr_key.key_op = KEYS_PUT;
#ifdef CKEY_ALPHA
    if (vidix_fourcc.flags & VID_CAP_BLEND) {
      useVidixAlpha = true;
      gr_key.ckey.op = CKEY_ALPHA;
    } else {
      gr_key.ckey.op = CKEY_TRUE;
    }
#else
    gr_key.ckey.op = CKEY_TRUE;
#endif
    gr_key.ckey.red = gr_key.ckey.green = gr_key.ckey.blue = 0;
    res = vdlSetGrKeys(vidix_handler, &gr_key);
    softlog->Log(SOFT_LOG_INFO, 0,
              "[cVidixVideoOut] vdlSetGrKeys() = %d\n", res);

    if (res) {
      gr_key.ckey.op = CKEY_TRUE;
      res = vdlSetGrKeys(vidix_handler, &gr_key);
      softlog->Log(SOFT_LOG_INFO, 0,
                "[cVidixVideoOut] vdlSetGrKeys() = %d (noAlpha)\n", res);
      useVidixAlpha = false;
    }
  }

  next_frame = 0;

  apitch     = vidix_play.dest.pitch.y-1;
  dstrides.y = (swidth + apitch) & ~apitch;

  apitch     = vidix_play.dest.pitch.v-1;
  dstrides.v = (swidth + apitch) & ~apitch;

  apitch     = vidix_play.dest.pitch.u-1;
  dstrides.u = (swidth + apitch) & ~apitch;

  // clear every frame
  for (uint8_t i = 0; i < vidix_play.num_frames; i++)
  {
    dst = (uint8_t *) vidix_play.dga_addr + vidix_play.offsets[i] +
                      vidix_play.offset.y;
    if (currentPixelFormat == 2)
    {
        int *ldst = (int *) dst;

      for (unsigned int j = 0; j < dstrides.y * sheight/2; j++)
      {
        *ldst++ = 0x80008000;
      }
    }
    else
    {
      memset(dst, 0x00, dstrides.y * sheight);

      dst = (uint8_t *) vidix_play.dga_addr + vidix_play.offsets[i] +
                        vidix_play.offset.u;
      memset(dst, 0x80, (dstrides.u/2) * (sheight/2));

      dst = (uint8_t *) vidix_play.dga_addr + vidix_play.offsets[i] +
                        vidix_play.offset.v;
      memset(dst, 0x80, (dstrides.v/2) * (sheight/2));
    }
  }

}