1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-13 22:21:11 +02:00

Bug 467 (P3) fix - Audacity fails to build with latest FFmpeg/libav. Main patch by Leland Lucius with modification from Benjamin Drung.

This commit is contained in:
mchinen
2012-01-21 08:01:32 +00:00
parent 40ff3fd0b8
commit 682759d965
4 changed files with 160 additions and 43 deletions

View File

@@ -808,9 +808,12 @@ int FFmpegImportFileHandle::DecodeFrame(streamContext *sc, bool flushing)
}
}
sc->m_decodedAudioSamplesValidSiz = sc->m_decodedAudioSamplesSiz;
#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(52, 25, 0)
// avcodec_decode_audio3() expects the size of the output buffer as the 3rd parameter but
// also returns the number of bytes it decoded in the same parameter.
sc->m_decodedAudioSamplesValidSiz = sc->m_decodedAudioSamplesSiz;
AVPacket avpkt;
av_init_packet(&avpkt);
avpkt.data = pDecode;
@@ -820,7 +823,16 @@ int FFmpegImportFileHandle::DecodeFrame(streamContext *sc, bool flushing)
(int16_t *)sc->m_decodedAudioSamples, // out
&sc->m_decodedAudioSamplesValidSiz, // in/out
&avpkt); // in
#else
// avcodec_decode_audio2() expects the size of the output buffer as the 3rd parameter but
// also returns the number of bytes it decoded in the same parameter.
nBytesDecoded =
avcodec_decode_audio2(sc->m_codecCtx,
(int16_t *) sc->m_decodedAudioSamples, // out
&sc->m_decodedAudioSamplesValidSiz, // in/out
pDecode, // in
nDecodeSiz); // in
#endif
if (nBytesDecoded < 0)
{
// Decoding failed. Don't stop.