summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Bornkessel <hd_brummy@gentoo.org>2014-11-08 21:59:17 +0100
committerJoerg Bornkessel <hd_brummy@gentoo.org>2014-11-08 21:59:17 +0100
commit7ce870bbfc0ebb32e811576f305c63e7d5a95439 (patch)
treef7ce3b5d35e587548c64dd89687447b476b42d11
parentb9eb1404f615159e8e32c55491b29b5e7f8a4328 (diff)
downloadvdr-plugin-audiorecorder-7ce870bbfc0ebb32e811576f305c63e7d5a95439.tar.gz
vdr-plugin-audiorecorder-7ce870bbfc0ebb32e811576f305c63e7d5a95439.tar.bz2
libav10 fixes
-rw-r--r--convert.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/convert.c b/convert.c
index 89adc08..70058f9 100644
--- a/convert.c
+++ b/convert.c
@@ -128,14 +128,25 @@ void cConvert::decode_mpa_frame(mpeg_audio_frame *mpa_frame)
AVCodecContext *decoder_ctx;
- AVFrame *frame = avcodec_alloc_frame(); //av_frame_alloc() # libav10
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,34,1)
+ AVFrame *frame = avcodec_alloc_frame(); // libav9
+#else
+ AVFrame *frame = av_frame_alloc(); // libav10
+#endif
+
int got_output;
int len = avcodec_decode_audio4(decoder_ctx, frame, &got_output, &avpkt);
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,34,1)
avcodec_free_frame(&frame); // av_free_frame(&frame); // libav10
// avcodec_close(decoder_ctx); // muss codec hier geschlossen werden?
+#else
+ av_frame_free(&frame); // libav10
+// avcodec_close(decoder_ctx); // muss codec hier geschlossen werden?
#endif
+
+#endif // AVCODEC_NEW
}
@@ -178,7 +189,11 @@ abuffer *cConvert::reencode_mpa_frame(mpeg_audio_frame *mpa_frame,
// https://www.ffmpeg.org/doxygen/1.0/group__lavc__encoding.html#gf12a9da0d33f50ff406e03572fab4763
// https://www.ffmpeg.org/doxygen/1.0/decoding__encoding_8c-source.html#l00102
AVCodecContext *encoder_ctx;
- AVFrame *frame = avcodec_alloc_frame(); // libav10 av_frame_alloc()
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,34,1)
+ AVFrame *frame = avcodec_alloc_frame(); // libav9
+#else
+ AVFrame *frame = av_frame_alloc(); // libav10
+#endif
AVPacket avpkt;
av_init_packet(&avpkt);
avpkt.data = mpa_frame->data;
@@ -187,6 +202,6 @@ abuffer *cConvert::reencode_mpa_frame(mpeg_audio_frame *mpa_frame,
encoder_buf.offset = avcodec_encode_audio2(encoder_ctx, &avpkt, frame, &got_output);
-#endif
+#endif // AVCODEC_NEW
return &encoder_buf;
}