| 1 | --- configure.orig 2015-07-13 03:00:56.000000000 -0700 |
| 2 | +++ configure 2016-04-22 15:22:53.000000000 -0700 |
| 3 | @@ -387,7 +387,7 @@ |
| 4 | fi |
| 5 | # ffmpeg api changes so frequently that it is best to compile the module |
| 6 | libs="$LDDLFLAGS $FFMPEG_LIBS" |
| 7 | - cflags="$SOFLAGS $FFMPEG_CFLAGS" |
| 8 | + cflags="-std=gnu99 $SOFLAGS $FFMPEG_CFLAGS" |
| 9 | if test "$HAVE_FFMPEG_AVCODEC_H" = y |
| 10 | then |
| 11 | cflags="$cflags -DHAVE_FFMPEG_AVCODEC_H" |
| 12 | --- ffmpeg.c.orig 2015-07-13 03:00:56.000000000 -0700 |
| 13 | +++ ffmpeg.c 2016-04-22 15:22:53.000000000 -0700 |
| 14 | @@ -39,7 +39,11 @@ |
| 15 | #include <libavformat/avio.h> |
| 16 | #include <libswresample/swresample.h> |
| 17 | #include <libavutil/opt.h> |
| 18 | +#if LIBAVUTIL_VERSION_MAJOR >= 53 |
| 19 | +#include <libavutil/channel_layout.h> |
| 20 | +#else |
| 21 | #include <libavutil/audioconvert.h> |
| 22 | +#endif |
| 23 | #ifndef AVUTIL_MATHEMATICS_H |
| 24 | #include <libavutil/mathematics.h> |
| 25 | #endif |
| 26 | @@ -115,7 +119,11 @@ |
| 27 | |
| 28 | static void ffmpeg_input_free(struct ffmpeg_input *input) |
| 29 | { |
| 30 | +#if LIBAVCODEC_VERSION_MAJOR >= 56 |
| 31 | + av_packet_unref(&input->pkt); |
| 32 | +#else |
| 33 | av_free_packet(&input->pkt); |
| 34 | +#endif |
| 35 | free(input); |
| 36 | } |
| 37 | |
| 38 | @@ -235,7 +243,11 @@ |
| 39 | |
| 40 | codec = avcodec_find_decoder(cc->codec_id); |
| 41 | if (!codec) { |
| 42 | +#if LIBAVCODEC_VERSION_MAJOR >= 54 |
| 43 | + d_print("codec not found: %d, %s\n", cc->codec_id, avcodec_get_name(cc->codec_id)); |
| 44 | +#else |
| 45 | d_print("codec not found: %d, %s\n", cc->codec_id, cc->codec_name); |
| 46 | +#endif |
| 47 | err = -IP_ERROR_UNSUPPORTED_FILE_TYPE; |
| 48 | break; |
| 49 | } |
| 50 | @@ -248,7 +260,11 @@ |
| 51 | #else |
| 52 | if (avcodec_open2(cc, codec, NULL) < 0) { |
| 53 | #endif |
| 54 | +#if LIBAVCODEC_VERSION_MAJOR >= 54 |
| 55 | + d_print("could not open codec: %d, %s\n", cc->codec_id, avcodec_get_name(cc->codec_id)); |
| 56 | +#else |
| 57 | d_print("could not open codec: %d, %s\n", cc->codec_id, cc->codec_name); |
| 58 | +#endif |
| 59 | err = -IP_ERROR_UNSUPPORTED_FILE_TYPE; |
| 60 | break; |
| 61 | } |
| 62 | @@ -347,7 +363,11 @@ |
| 63 | struct ffmpeg_output *output, SwrContext *swr) |
| 64 | { |
| 65 | #if (LIBAVCODEC_VERSION_INT >= ((53<<16) + (25<<8) + 0)) |
| 66 | +#if LIBAVCODEC_VERSION_MAJOR >= 56 |
| 67 | + AVFrame *frame = av_frame_alloc(); |
| 68 | +#else |
| 69 | AVFrame *frame = avcodec_alloc_frame(); |
| 70 | +#endif |
| 71 | int got_frame; |
| 72 | #endif |
| 73 | while (1) { |
| 74 | @@ -359,10 +379,16 @@ |
| 75 | int len; |
| 76 | |
| 77 | if (input->curr_pkt_size <= 0) { |
| 78 | +#if LIBAVCODEC_VERSION_MAJOR >= 56 |
| 79 | + av_packet_unref(&input->pkt); |
| 80 | +#else |
| 81 | av_free_packet(&input->pkt); |
| 82 | +#endif |
| 83 | if (av_read_frame(ic, &input->pkt) < 0) { |
| 84 | /* Force EOF once we can read no longer. */ |
| 85 | -#if (LIBAVCODEC_VERSION_INT >= ((53<<16) + (25<<8) + 0)) |
| 86 | +#if LIBAVCODEC_VERSION_MAJOR >= 56 |
| 87 | + av_frame_free(&frame); |
| 88 | +#elif (LIBAVCODEC_VERSION_INT >= ((53<<16) + (25<<8) + 0)) |
| 89 | avcodec_free_frame(&frame); |
| 90 | #endif |
| 91 | return 0; |
| 92 | @@ -399,7 +425,11 @@ |
| 93 | av_new_packet(&avpkt, input->curr_pkt_size); |
| 94 | memcpy(avpkt.data, input->curr_pkt_buf, input->curr_pkt_size); |
| 95 | len = avcodec_decode_audio4(cc, frame, &got_frame, &avpkt); |
| 96 | +#if LIBAVCODEC_VERSION_MAJOR >= 56 |
| 97 | + av_packet_unref(&avpkt); |
| 98 | +#else |
| 99 | av_free_packet(&avpkt); |
| 100 | +#endif |
| 101 | } |
| 102 | #endif |
| 103 | if (len < 0) { |
| 104 | @@ -426,7 +456,11 @@ |
| 105 | res = 0; |
| 106 | output->buffer_pos = output->buffer; |
| 107 | output->buffer_used_len = res * cc->channels * sizeof(int16_t); |
| 108 | +#if LIBAVCODEC_VERSION_MAJOR >= 56 |
| 109 | + av_frame_free(&frame); |
| 110 | +#else |
| 111 | avcodec_free_frame(&frame); |
| 112 | +#endif |
| 113 | return output->buffer_used_len; |
| 114 | } |
| 115 | #endif |
| 116 | @@ -566,7 +600,11 @@ |
| 117 | long bitrate = -1; |
| 118 | #if (LIBAVFORMAT_VERSION_INT > ((51<<16)+(43<<8)+0)) |
| 119 | /* ape codec returns silly numbers */ |
| 120 | +#if LIBAVCODEC_VERSION_MAJOR >= 55 |
| 121 | + if (priv->codec->id == AV_CODEC_ID_APE) |
| 122 | +#else |
| 123 | if (priv->codec->id == CODEC_ID_APE) |
| 124 | +#endif |
| 125 | return -1; |
| 126 | #endif |
| 127 | if (priv->input->curr_duration > 0) { |