Пример #1
0
void CVDPAU::FiniVDPAUOutput()
{
  FiniOutputMethod();

  if (vdp_device == VDP_INVALID_HANDLE || !vdpauConfigured) return;

  CLog::Log(LOGNOTICE, " (VDPAU) %s", __FUNCTION__);

  VdpStatus vdp_st;

  vdp_st = vdp_decoder_destroy(decoder);
  if (CheckStatus(vdp_st, __LINE__))
    return;
  decoder = VDP_INVALID_HANDLE;

  while (!m_videoSurfaces.empty())
  {
    vdpau_render_state *render = m_videoSurfaces.back();
    m_videoSurfaces.pop_back();
    if (render->bitstream_buffers_allocated)
      m_dllAvUtil.av_freep(&render->bitstream_buffers);
    render->bitstream_buffers_allocated = 0;
    vdp_st = vdp_video_surface_destroy(render->surface);
    render->surface = VDP_INVALID_HANDLE;
    free(render);
    if (CheckStatus(vdp_st, __LINE__))
      return;
  }
}
Пример #2
0
static void Deinit(vlc_va_t *va)
{
    vlc_va_sys_t *sys = va->sys;

    assert(sys->context->decoder != VDP_INVALID_HANDLE);
    vdp_decoder_destroy(sys->vdp, sys->context->decoder);
}
Пример #3
0
Файл: vdpau.c Проект: aib/mlt
static void vdpau_fini( producer_avformat self )
{
	if ( !self->vdpau )
		return;
	mlt_log_debug( NULL, "vdpau_fini (%x)\n", self->vdpau->device );
	if ( self->vdpau->decoder != VDP_INVALID_HANDLE )
		vdp_decoder_destroy( self->vdpau->decoder );
	if ( self->vdpau->device != VDP_INVALID_HANDLE )
		vdp_device_destroy( self->vdpau->device );
	free( self->vdpau );
	self->vdpau = NULL;
}
Пример #4
0
VDPAUDecoder::~VDPAUDecoder()
{
    if (m_VDPMixer != VDP_INVALID_HANDLE) {
        vdp_video_mixer_destroy(m_VDPMixer);
    }
    if (m_VDPDecoder != VDP_INVALID_HANDLE) {
        vdp_decoder_destroy(m_VDPDecoder);
    }
    for (unsigned i = 0; i < m_RenderStates.size(); i++) {
        vdp_video_surface_destroy(m_RenderStates[i]->surface);
        delete m_RenderStates[i];
    }
}
Пример #5
0
void CVDPAU::FiniVDPAUOutput()
{
  if (vdp_device == VDP_INVALID_HANDLE || !vdpauConfigured) return;

  CLog::Log(LOGNOTICE, " (VDPAU) %s", __FUNCTION__);

  VdpStatus vdp_st;

  vdp_st = vdp_decoder_destroy(decoder);
  CheckStatus(vdp_st, __LINE__);
  decoder = VDP_INVALID_HANDLE;

  vdp_st = vdp_presentation_queue_destroy(vdp_flip_queue);
  CheckStatus(vdp_st, __LINE__);
  vdp_flip_queue = VDP_INVALID_HANDLE;

  vdp_st = vdp_presentation_queue_target_destroy(vdp_flip_target);
  CheckStatus(vdp_st, __LINE__);
  vdp_flip_target = VDP_INVALID_HANDLE;

  outputSurface = presentSurface = VDP_INVALID_HANDLE;

  for (int i = 0; i < totalAvailableOutputSurfaces; i++)
  {
    vdp_st = vdp_output_surface_destroy(outputSurfaces[i]);
    CheckStatus(vdp_st, __LINE__);
    outputSurfaces[i] = VDP_INVALID_HANDLE;
  }

  vdp_st = vdp_video_mixer_destroy(videoMixer);
  CheckStatus(vdp_st, __LINE__);
  videoMixer = VDP_INVALID_HANDLE;

  for(unsigned int i = 0; i < m_videoSurfaces.size(); i++)
  {
    vdp_st = vdp_video_surface_destroy(m_videoSurfaces[i]->surface);
    CheckStatus(vdp_st, __LINE__);
    m_videoSurfaces[i]->surface = VDP_INVALID_HANDLE;
    free(m_videoSurfaces[i]);
  }
  m_videoSurfaces.clear();
  while (!m_DVDVideoPics.empty())
    m_DVDVideoPics.pop();
}
Пример #6
0
bool CVDPAU::Open(AVCodecContext* avctx, const enum PixelFormat, unsigned int surfaces)
{
  if(avctx->width  == 0
  || avctx->height == 0)
  {
    CLog::Log(LOGWARNING,"(VDPAU) no width/height available, can't init");
    return false;
  }

  if (!dl_handle)
  {
    dl_handle  = dlopen("libvdpau.so.1", RTLD_LAZY);
    if (!dl_handle)
    {
      const char* error = dlerror();
      if (!error)
        error = "dlerror() returned NULL";

      CLog::Log(LOGNOTICE,"(VDPAU) Unable to get handle to libvdpau: %s", error);
      //g_application.m_guiDialogKaiToast.QueueNotification(CGUIDialogKaiToast::Error, "VDPAU", error, 10000);

      return false;
    }
  }

  InitVDPAUProcs();

  if (vdp_device != VDP_INVALID_HANDLE)
  {
    SpewHardwareAvailable();

    VdpDecoderProfile profile = 0;
    if(avctx->codec_id == CODEC_ID_H264)
      profile = VDP_DECODER_PROFILE_H264_HIGH;
#ifdef VDP_DECODER_PROFILE_MPEG4_PART2_ASP
    else if(avctx->codec_id == CODEC_ID_MPEG4)
      profile = VDP_DECODER_PROFILE_MPEG4_PART2_ASP;
#endif
    if(profile)
    {
      if (!CDVDCodecUtils::IsVP3CompatibleWidth(avctx->width))
        CLog::Log(LOGWARNING,"(VDPAU) width %i might not be supported because of hardware bug", avctx->width);
   
      /* attempt to create a decoder with this width/height, some sizes are not supported by hw */
      VdpStatus vdp_st;
      vdp_st = vdp_decoder_create(vdp_device, profile, avctx->width, avctx->height, 5, &decoder);

      if(vdp_st != VDP_STATUS_OK)
      {
        CLog::Log(LOGERROR, " (VDPAU) Error: %s(%d) checking for decoder support\n", vdp_get_error_string(vdp_st), vdp_st);
        FiniVDPAUProcs();
        return false;
      }

      vdp_decoder_destroy(decoder);
      CheckStatus(vdp_st, __LINE__);
    }

    InitCSCMatrix(avctx->height);
    MakePixmap(avctx->width,avctx->height);

    /* finally setup ffmpeg */
    avctx->get_buffer      = CVDPAU::FFGetBuffer;
    avctx->release_buffer  = CVDPAU::FFReleaseBuffer;
    avctx->draw_horiz_band = CVDPAU::FFDrawSlice;
    avctx->slice_flags=SLICE_FLAG_CODED_ORDER|SLICE_FLAG_ALLOW_FIELD;
    return true;
  }
  return false;
}