如何使用OpenAL播放FFMPEG声音样本?

时间:2013-04-16 14:18:55

标签: c++ audio ffmpeg openal

我正在使用FFMPEG从文件加载音频视频。它适用于视频,但我不知道如何播放音频样本。

以下是获取音频样本的代码:

m_AdotimeBase = (int64_t(m_Adocdec_ctx->time_base.num) * AV_TIME_BASE) / int64_t(m_Adocdec_ctx->time_base.den);   
if(!m_Adofmt_ctx)
{
    //AfxMessageBox(L"m_timeBase");
    return FALSE ;
}
int64_t seekAdoTarget = int64_t(m_currFrame) * m_AdotimeBase;   


if(av_seek_frame(m_Adofmt_ctx, -1, seekAdoTarget, AVSEEK_FLAG_ANY) < 0)
{
    /*CString st;
    st.Format(L"%d",m_currFrame);
    AfxMessageBox(L"av_seek_frame "+st);*/
    m_currFrame = m_totalFrames-1;
    return FALSE ;
}

if ((ret = av_read_frame(m_Adofmt_ctx, &packet)) < 0)
        return FALSE;
if (packet.stream_index == 0)       
{
    ret = avcodec_decode_audio4(m_Adocdec_ctx, &in_AdeoFrame, &got_frame, &packet);
    if (ret < 0) 
    {
        av_free_packet(&packet);
        return FALSE;
    }
}

我的问题是我想使用OPENAL听这个样本。

我很感激有关该主题的任何教程或参考资料。

0 个答案:

没有答案