int ODFFmpegDecoder::DecodeFrame(streamContext *sc, bool flushing) { int ret = import_ffmpeg_decode_frame(sc, flushing); if (ret == 0 && sc->m_frameValid) { //stick it in the cache. //TODO- consider growing/unioning a few cache buffers like WaveCache does. //however we can't use wavecache as it isn't going to handle our stereo interleaved part, and isn't for samples //However if other ODDecode tasks need this, we should do a NEW class for caching. FFMpegDecodeCache* cache = new FFMpegDecodeCache; //len is number of samples per channel cache->numChannels = sc->m_stream->codec->channels; cache->len = (sc->m_decodedAudioSamplesValidSiz / sc->m_samplesize) / cache->numChannels; cache->start = mCurrentPos; cache->samplePtr = (uint8_t*) malloc(sc->m_decodedAudioSamplesValidSiz); cache->samplefmt = sc->m_samplefmt; memcpy(cache->samplePtr, sc->m_decodedAudioSamples, sc->m_decodedAudioSamplesValidSiz); InsertCache(cache); } return ret; }
int FFmpegImportFileHandle::DecodeFrame(streamContext *sc, bool flushing) { return import_ffmpeg_decode_frame(sc, flushing); }