Beginning with version 3.0, libiLBC switched the types of some parts of their public API to size_t and renamed some types; the old names continue to work as typedefs, but are deprecated. It furthermore added version macros. This commit uses said version macro to use the new types when using newer libiLBC versions.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -27,6 +27,10 @@ · 26 unmodified lines | ||
| 27 | 27 | #include "avcodec.h" |
| 28 | 28 | #include "internal.h" |
| 29 | 29 | |
| 30 | +#ifndef LIBILBC_VERSION_MAJOR | |
| 31 | +#define LIBILBC_VERSION_MAJOR 2 | |
| 32 | +#endif | |
| 33 | + | |
| 30 | 34 | static int get_mode(AVCodecContext *avctx) |
| 31 | 35 | { |
| 32 | 36 | if (avctx->block_align == 38) |
| @@ -41,7 +45,11 @@ static int get_mode(AVCodecContext *avctx) · 8 unmodified lines | ||
| 41 | 45 | |
| 42 | 46 | typedef struct ILBCDecContext { |
| 43 | 47 | const AVClass *class; |
| 48 | +#if LIBILBC_VERSION_MAJOR < 3 | |
| 44 | 49 | iLBC_Dec_Inst_t decoder; |
| 50 | +#else | |
| 51 | + IlbcDecoder decoder; | |
| 52 | +#endif | |
| 45 | 53 | int enhance; |
| 46 | 54 | } ILBCDecContext; |
| 47 | 55 | |
| @@ -87,7 +95,12 @@ static int ilbc_decode_frame(AVCodecContext *avctx, void *data, · 39 unmodified lines | ||
| 87 | 95 | int ret; |
| 88 | 96 | |
| 89 | 97 | if (s->decoder.no_of_bytes > buf_size) { |
| 98 | +#if LIBILBC_VERSION_MAJOR < 3 | |
| 90 | 99 | av_log(avctx, AV_LOG_ERROR, "iLBC frame too short (%u, should be %u)\n", |
| 100 | +#else | |
| 101 | + av_log(avctx, AV_LOG_ERROR, "iLBC frame too short (%u, should be " | |
| 102 | + "%"SIZE_SPECIFIER")\n", | |
| 103 | +#endif | |
| 91 | 104 | buf_size, s->decoder.no_of_bytes); |
| 92 | 105 | return AVERROR_INVALIDDATA; |
| 93 | 106 | } |
| @@ -117,7 +130,11 @@ AVCodec ff_libilbc_decoder = { · 23 unmodified lines | ||
| 117 | 130 | |
| 118 | 131 | typedef struct ILBCEncContext { |
| 119 | 132 | const AVClass *class; |
| 133 | +#if LIBILBC_VERSION_MAJOR < 3 | |
| 120 | 134 | iLBC_Enc_Inst_t encoder; |
| 135 | +#else | |
| 136 | + IlbcEncoder encoder; | |
| 137 | +#endif | |
| 121 | 138 | int mode; |
| 122 | 139 | } ILBCEncContext; |
| 123 | 140 | |