static av_cold int uninit(AVCodecContext *avctx)
{
	CHDContext *priv = avctx->priv_data;
	HANDLE device;

	device = priv->dev;
	DtsStopDecoder(device);
	DtsCloseDecoder(device);
	DtsDeviceClose(device);

	av_free(priv->sps_pps_buf);

	if (priv->pic.data[0])
		avctx->release_buffer(avctx, &priv->pic);

	if (priv->head)
	{
		OpaqueList *node = priv->head;
		while (node)
		{
			OpaqueList *next = node->next;
			av_free(node);
			node = next;
		}
	}

	return 0;
}
static av_cold int uninit(AVCodecContext *avctx)
{
    CHDContext *priv = avctx->priv_data;
    HANDLE device;

    device = priv->dev;
    DtsStopDecoder(device);
    DtsCloseDecoder(device);
    DtsDeviceClose(device);

    /*
     * Restore original extradata, so that if the decoder is
     * reinitialised, the bitstream detection and filtering
     * will work as expected.
     */
    if (priv->orig_extradata) {
        av_free(avctx->extradata);
        avctx->extradata = priv->orig_extradata;
        avctx->extradata_size = priv->orig_extradata_size;
        priv->orig_extradata = NULL;
        priv->orig_extradata_size = 0;
    }

    av_parser_close(priv->parser);
    if (priv->bsfc) {
        av_bitstream_filter_close(priv->bsfc);
    }

    av_free(priv->sps_pps_buf);

    if (priv->pic.data[0])
        avctx->release_buffer(avctx, &priv->pic);

    if (priv->head) {
       OpaqueList *node = priv->head;
       while (node) {
          OpaqueList *next = node->next;
          av_free(node);
          node = next;
       }
    }

    return 0;
}
PrivateDecoderCrystalHD::~PrivateDecoderCrystalHD()
{
    if (m_fetcher_thread)
    {
        m_fetcher_pause = true;
        m_fetcher_stop = true;
        int tries = 0;
        while (!m_fetcher_thread->wait(100) && (tries++ < 50))
            LOG(VB_PLAYBACK, LOG_WARNING, LOC +
                "Waited 100ms for Fetcher to stop");

        if (m_fetcher_thread->isRunning())
            LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to stop Fetcher.");
        else
            LOG(VB_PLAYBACK, LOG_INFO, LOC + "Stopped frame Fetcher.");
        delete m_fetcher_thread;
    }

    if (m_filter)
        av_bitstream_filter_close(m_filter);

    Reset();
    if (!m_device)
        return;

    INIT_ST;
    if (m_device_type != BC_70015)
    {
        st = DtsFlushRxCapture(m_device, false);
        CHECK_ST;
    }
    st = DtsStopDecoder(m_device);
    CHECK_ST;
    st = DtsCloseDecoder(m_device);
    CHECK_ST;
    DtsDeviceClose(m_device);
}
示例#4
0
    }

    if (m_filter)
        av_bitstream_filter_close(m_filter);

    Reset();
    if (!m_device)
        return;

    INIT_ST
    if (m_device_type != BC_70015)
    {
        st = DtsFlushRxCapture(m_device, false);
        CHECK_ST
    }
    st = DtsStopDecoder(m_device);
    CHECK_ST
    st = DtsCloseDecoder(m_device);
    CHECK_ST
    DtsDeviceClose(m_device);
}

bool PrivateDecoderCrystalHD::Init(const QString &decoder,
                                   bool no_hardware_decode,
                                   AVCodecContext *avctx)
{
    if ((decoder != "crystalhd") || no_hardware_decode || !avctx)
        return false;
    if (getenv("NO_CRYSTALHD"))
        return false;