//#define GNASH_DEBUG_AUDIO_DECODING
+#if LIBAVCODEC_VERSION_MAJOR >= 53
+#define AVCODEC_DECODE_AUDIO avcodec_decode_audio3
+#else
#define AVCODEC_DECODE_AUDIO avcodec_decode_audio2
+#endif
namespace gnash {
namespace media {
#endif
// older ffmpeg versions didn't accept a const input..
+#if LIBAVCODEC_VERSION_MAJOR >= 53
+ AVPacket pkt;
+ av_init_packet(&pkt);
+ pkt.data = (uint8_t*) input;
+ pkt.size = inputSize;
+#endif
int tmp = AVCODEC_DECODE_AUDIO(_audioCodecCtx, outPtr, &outSize,
+#if LIBAVCODEC_VERSION_MAJOR >= 53
+ &pkt);
+#else
input, inputSize);
+#endif
#ifdef GNASH_DEBUG_AUDIO_DECODING
log_debug(" avcodec_decode_audio[2](ctx, bufptr, %d, input, %d) "
{
if ( _needsParsing )
{
+#if LIBAVCODEC_VERSION_MAJOR >= 53
+ return av_parser_parse2(_parser, _audioCodecCtx,
+#else
return av_parser_parse(_parser, _audioCodecCtx,
+#endif
// as of 2008-10-28 SVN, ffmpeg doesn't
// accept a pointer to pointer to const..
const_cast<boost::uint8_t**>(outFrame),
outFrameSize,
input, inputSize,
+#if LIBAVCODEC_VERSION_MAJOR >= 53
+ 0, 0, AV_NOPTS_VALUE); // pts, dts, pos
+#else
0, 0); // pts & dts
+#endif
}
else
{
{
if ( (ctx->sample_rate != 44100) || (ctx->channels != 2) ) {
if ( ! _context ) {
- _context = audio_resample_init(
- 2, ctx->channels, 44100, ctx->sample_rate
+#if LIBAVCODEC_VERSION_MAJOR >= 53
+ _context = av_audio_resample_init(
+ 2, ctx->channels, 44100, ctx->sample_rate,
+ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16,
+ 16, 10, 0, 0.8
+#else
+ _context = audio_resample_init(
+ 2, ctx->channels, 44100, ctx->sample_rate
+#endif
);
}
}
switch (enc->codec_type) {
+#if LIBAVCODEC_VERSION_MAJOR >= 53
+ case AVMEDIA_TYPE_AUDIO:
+#else
case CODEC_TYPE_AUDIO:
+#endif
if (_audioStreamIndex < 0) {
_audioStreamIndex = i;
_audioStream = _formatCtx->streams[i];
}
break;
+#if LIBAVCODEC_VERSION_MAJOR >= 53
+ case AVMEDIA_TYPE_VIDEO:
+#else
case CODEC_TYPE_VIDEO:
+#endif
if (_videoStreamIndex < 0) {
_videoStreamIndex = i;
_videoStream = _formatCtx->streams[i];
int bytes = 0;
// no idea why avcodec_decode_video wants a non-const input...
+#if LIBAVCODEC_VERSION_MAJOR >= 53
+ AVPacket pkt;
+ av_init_packet(&pkt);
+ pkt.data = (uint8_t*) input;
+ pkt.size = input_size;
+ avcodec_decode_video2(_videoCodecCtx->getContext(), frame, &bytes,
+ &pkt);
+#else
avcodec_decode_video(_videoCodecCtx->getContext(), frame, &bytes,
input, input_size);
+#endif
if (!bytes) {
log_error("Decoding of a video frame failed");