Example #1
0
static void qsv_frames_uninit(AVHWFramesContext *ctx)
{
    QSVFramesContext *s = ctx->internal->priv;

    if (s->session_download) {
        MFXVideoVPP_Close(s->session_download);
        MFXClose(s->session_download);
    }
    s->session_download = NULL;
    s->session_download_init = 0;

    if (s->session_upload) {
        MFXVideoVPP_Close(s->session_upload);
        MFXClose(s->session_upload);
    }
    s->session_upload = NULL;
    s->session_upload_init = 0;

#if HAVE_PTHREADS
    pthread_mutex_destroy(&s->session_lock);
    pthread_cond_destroy(&s->session_cond);
#endif

    av_freep(&s->mem_ids);
    av_freep(&s->surface_ptrs);
    av_freep(&s->surfaces_internal);
    av_buffer_unref(&s->child_frames_ref);
}
Example #2
0
static void
gst_msdkvpp_close (GstMsdkVPP * thiz)
{
  mfxStatus status;

  if (!thiz->context)
    return;

  GST_DEBUG_OBJECT (thiz, "Closing VPP 0x%p", thiz->context);
  status = MFXVideoVPP_Close (gst_msdk_context_get_session (thiz->context));
  if (status != MFX_ERR_NONE && status != MFX_ERR_NOT_INITIALIZED) {
    GST_WARNING_OBJECT (thiz, "Encoder close failed (%s)",
        msdk_status_to_string (status));
  }

  if (thiz->context)
    gst_object_replace ((GstObject **) & thiz->context, NULL);

  memset (&thiz->param, 0, sizeof (thiz->param));

  if (thiz->sinkpad_buffer_pool)
    gst_object_unref (thiz->sinkpad_buffer_pool);
  thiz->sinkpad_buffer_pool = NULL;
  if (thiz->srcpad_buffer_pool)
    gst_object_unref (thiz->srcpad_buffer_pool);
  thiz->srcpad_buffer_pool = NULL;

  thiz->buffer_duration = GST_CLOCK_TIME_NONE;
  gst_video_info_init (&thiz->sinkpad_info);
  gst_video_info_init (&thiz->srcpad_info);
}
Example #3
0
mfxStatus MFXVideoVPP_Init(mfxSession session, mfxVideoParam *par)
{
    mfxStatus mfxRes = MFX_ERR_UNSUPPORTED;
    MFX_AUTO_LTRACE_FUNC(MFX_TRACE_LEVEL_API);
    MFX_LTRACE_BUFFER(MFX_TRACE_LEVEL_API, par);

    try
    {
#ifdef MFX_ENABLE_USER_VPP
        if (session->m_plgVPP.get())
        {
            mfxRes = session->m_plgVPP->Init(par);
        }
        else
        {
#endif

#if !defined (MFX_RT)
#ifdef MFX_ENABLE_VPP
            // close the existing video processor,
            // if it is initialized.
            if (session->m_pVPP.get())
            {
                MFXVideoVPP_Close(session);
            }


            // create a new instance
            session->m_pVPP.reset(CreateVPPSpecificClass(0 ,session->m_pCORE.get()));
            MFX_CHECK(session->m_pVPP.get(), MFX_ERR_INVALID_VIDEO_PARAM);
            mfxRes = session->m_pVPP->Init(par);
#endif // MFX_ENABLE_VPP
#endif 
#ifdef MFX_ENABLE_USER_VPP
        }
#endif
    }
    // handle error(s)
    catch(MFX_CORE_CATCH_TYPE)
    {
        // set the default error value
        mfxRes = MFX_ERR_UNKNOWN;
        if (0 == session)
        {
            mfxRes = MFX_ERR_INVALID_HANDLE;
        }
        else if (0 == session->m_pVPP.get())
        {
            mfxRes = MFX_ERR_INVALID_VIDEO_PARAM;
        }
        else if (0 == par)
        {
            mfxRes = MFX_ERR_NULL_PTR;
        }
    }

    MFX_LTRACE_I(MFX_TRACE_LEVEL_API, mfxRes);
    return mfxRes;

} // mfxStatus MFXVideoVPP_Init(mfxSession session, mfxVideoParam *par)
Example #4
0
static void
gst_mfx_filter_finalize (GstMfxFilter * filter)
{
  guint i;

  MFXVideoVPP_Close (filter->session);

  for (i = 0; i < 2; i++) {
    if (!filter->vpp[i])
      continue;
    gst_mfx_surface_pool_replace (&filter->vpp_pool[i], NULL);
    g_slice_free (mfxFrameAllocRequest, filter->shared_request[i]);
    gst_mfx_task_frame_free (filter->vpp[i], &filter->response[i]);
    gst_mfx_task_aggregator_remove_current_task(filter->aggregator, filter->vpp[i]);
    gst_mfx_task_replace (&filter->vpp[i], NULL);
  }

  /* Free allocated memory for filters */
  g_slice_free1 ((sizeof (mfxU32) * filter->vpp_use.NumAlg),
      filter->vpp_use.AlgList);
  g_slice_free1 ((sizeof (mfxExtBuffer *) * filter->params.NumExtParam),
      filter->ext_buffer);
  g_ptr_array_free (filter->filter_op_data, TRUE);
  gst_mfx_task_aggregator_unref (filter->aggregator);
}
Example #5
0
static void qsv_frames_uninit(AVHWFramesContext *ctx)
{
    QSVFramesContext *s = ctx->internal->priv;

    if (s->session_download) {
        MFXVideoVPP_Close(s->session_download);
        MFXClose(s->session_download);
    }
    s->session_download = NULL;

    if (s->session_upload) {
        MFXVideoVPP_Close(s->session_upload);
        MFXClose(s->session_upload);
    }
    s->session_upload = NULL;

    av_freep(&s->mem_ids);
    av_freep(&s->surface_ptrs);
    av_freep(&s->surfaces_internal);
    av_buffer_unref(&s->child_frames_ref);
}