Beispiel #1
0
OMX_ERRORTYPE OMXVideoDecoderVP9HWR::ProcessorDeinit(void)
{
    destroyDecoder();
    unsigned int i = 0;
    if (mWorkingMode == GRAPHICBUFFER_MODE) {
        for (i = 0; i < mOMXBufferHeaderTypePtrNum; i++) {
            if (extMIDs[i]->m_surface != NULL) {
                vaDestroySurfaces(mVADisplay, extMIDs[i]->m_surface, 1);
            }
        }

    } else if (mWorkingMode == RAWDATA_MODE) {
        for (i = 0; i < OUTPORT_ACTUAL_BUFFER_COUNT; i++ ) {
            if (extMIDs[i]->m_usrAddr != NULL) {
                free(extMIDs[i]->m_usrAddr);
                extMIDs[i]->m_usrAddr = NULL;
            }
        }
    }
    mOMXBufferHeaderTypePtrNum = 0;
    memset(&mGraphicBufferParam, 0, sizeof(mGraphicBufferParam));
    for (i = 0; i < MAX_NATIVE_BUFFER_COUNT; i++) {
        delete extMIDs[i]->m_surface;
        free(extMIDs[i]);
    }
    return OMXComponentCodecBase::ProcessorDeinit();
}
Beispiel #2
0
void VideoDecoderD3DPrivate::close()
{
    if (codec_ctx)
        codec_ctx->hwaccel_context = NULL;
    qDeleteAll(surfaces);
    surfaces.clear();
    restore();
    releaseUSWC();
    destroyDecoder();
    destroyDevice();
}
Beispiel #3
0
bool VideoDecoderD3DPrivate::setup(AVCodecContext *avctx)
{
    const int w = codedWidth(avctx);
    const int h = codedHeight(avctx);
    if (avctx->hwaccel_context && surface_width == aligned(w) && surface_height == aligned(h))
        return true;
    width = avctx->width; // not necessary. set in decode()
    height = avctx->height;
    codec_ctx->hwaccel_context = NULL;
    releaseUSWC();
    destroyDecoder();
    avctx->hwaccel_context = NULL;

    /* Allocates all surfaces needed for the decoder */
    if (surface_auto) {
        switch (codec_ctx->codec_id) {
        case QTAV_CODEC_ID(HEVC):
        case QTAV_CODEC_ID(H264):
            surface_count = 16 + 4;
            break;
        case QTAV_CODEC_ID(MPEG1VIDEO):
        case QTAV_CODEC_ID(MPEG2VIDEO):
            surface_count = 2 + 4;
        default:
            surface_count = 2 + 4;
            break;
        }
        if (avctx->active_thread_type & FF_THREAD_FRAME)
            surface_count += avctx->thread_count;
    }
    qDebug(">>>>>>>>>>>>>>>>>>>>>surfaces: %d, active_thread_type: %d, threads: %d, refs: %d", surface_count, avctx->active_thread_type, avctx->thread_count, avctx->refs);
    if (surface_count == 0) {
        qWarning("internal error: wrong surface count.  %u auto=%d", surface_count, surface_auto);
        surface_count = 16 + 4;
    }
    qDeleteAll(surfaces);
    surfaces.clear();
    hw_surfaces.clear();
    surfaces.resize(surface_count);
    if (!createDecoder(codec_ctx->codec_id, w, h, surfaces))
        return false;
    hw_surfaces.resize(surface_count);
    for (int i = 0; i < surfaces.size(); ++i) {
        hw_surfaces[i] = surfaces[i]->getSurface();
    }
    surface_order = 0;
    surface_width = aligned(w);
    surface_height = aligned(h);
    setupAVVAContext(avctx); //can not use codec_ctx for threaded mode!
    initUSWC(surface_width);
    return true;
}
void SpeexPlugin::endSession() {
	disablePreprocessing();
	destroyEncoder();
	destroyDecoder();
}
SpeexPlugin::~SpeexPlugin() {
	if (encoder)
		destroyEncoder();
	if (decoder)
		destroyDecoder();
}