#define HAVE_AUBIO_LIBAVCODEC_DEPRECATED 1
#endif
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58,3,102)
+#define HAVE_AUBIO_LIBAVCODEC_TIMEBASE_FIX 1
+#endif
+
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1)
#warning "libavcodec < 56 is deprecated"
#define av_frame_alloc avcodec_alloc_frame
av_get_media_type_string(AVMEDIA_TYPE_AUDIO), s->path);
goto beach;
}
+#if HAVE_AUBIO_LIBAVCODEC_TIMEBASE_FIX
+ // avoids 'skipped frames warning' with avecodec < 58, deprecated after
+ av_codec_set_pkt_timebase(avCodecCtx,
+ avFormatCtx->streams[selected_stream]->time_base);
+#endif
#endif
if ( ( err = avcodec_open2(avCodecCtx, codec, NULL) ) < 0) {
int64_t output_layout = av_get_default_channel_layout(s->input_channels);
#ifdef HAVE_AVRESAMPLE
AVAudioResampleContext *avr = avresample_alloc_context();
- AVAudioResampleContext *oldavr = s->avr;
#elif defined(HAVE_SWRESAMPLE)
SwrContext *avr = swr_alloc();
- SwrContext *oldavr = s->avr;
#endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */
av_opt_set_int(avr, "in_channel_layout", input_layout, 0);
return;
}
s->avr = avr;
- if (oldavr != NULL) {
-#ifdef HAVE_AVRESAMPLE
- avresample_close( oldavr );
-#elif defined(HAVE_SWRESAMPLE)
- swr_close ( oldavr );
-#endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */
- av_free ( oldavr );
- oldavr = NULL;
- }
}
}