Example #1
0
HRESULT CWavPackDSDecoder::StopStreaming()
{
    HRESULT hr = CTransformFilter::StopStreaming();

    if(m_Codec)
    {
        wavpack_buffer_decoder_free(m_Codec);
        m_Codec = NULL;
    }

    if(m_MainFrame)
    {
        frame_buffer_free(m_MainFrame);
        m_MainFrame = NULL;
    }

    if(m_CorrectionFrame)
    {
        frame_buffer_free(m_CorrectionFrame);
        m_CorrectionFrame = NULL;
    }

    return hr;
}
Example #2
0
HRESULT CWavPackDSDecoder::StartStreaming()
{
    HRESULT hr = CTransformFilter::StartStreaming();

    m_DecodedFrames = 0;
    m_CrcError = 0;

    if(m_Codec)
    {
        wavpack_buffer_decoder_free(m_Codec);
        m_Codec = NULL;
    }
    
    if(m_MainFrame)
    {
        frame_buffer_free(m_MainFrame);
        m_MainFrame = NULL;
    }
    
    if(m_CorrectionFrame)
    {
        frame_buffer_free(m_CorrectionFrame);
        m_CorrectionFrame = NULL;
    }

    m_Codec = wavpack_buffer_decoder_new();
    m_MainFrame = frame_buffer_new();
    m_CorrectionFrame = frame_buffer_new();
    
    if(m_Codec == NULL || m_MainFrame == NULL || m_CorrectionFrame == NULL)
    {
        hr = E_OUTOFMEMORY;
    }

    return hr;
}
void Connection::frameReceiveCallback(void* arg) {

    Connection *connection;
    connection = static_cast<Connection*> (arg);

    if (connection->wscon->frame->payload_len > 0) {
        connection->msg += string(connection->wscon->frame->payload_data, connection->wscon->frame->payload_len);
    }
    if (connection->wscon->frame->fin == 1) {

        std::cout << connection->msg.c_str() << std::endl;

        frame_buffer_t *fb = frame_buffer_new(1, 1, connection->wscon->frame->payload_len, connection->wscon->frame->payload_data);

        if (fb) {
            frame_buffer_free(fb);
        }

        connection->msg = "";
    }


}