History

avcodec/libilbc: Support newer libiLBC versions

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.

Andreas Rheinhardt committed 5 years ago

Commit f4f5da01 parent e36eb941 file · +17 −0Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/libilbc.c+17−0
@@ -27,6 +27,10 @@ · 26 unmodified lines
2727 #include "avcodec.h"
2828 #include "internal.h"
2929
30+#ifndef LIBILBC_VERSION_MAJOR
31+#define LIBILBC_VERSION_MAJOR 2
32+#endif
33+
3034 static int get_mode(AVCodecContext *avctx)
3135 {
3236 if (avctx->block_align == 38)
@@ -41,7 +45,11 @@ static int get_mode(AVCodecContext *avctx) · 8 unmodified lines
4145
4246 typedef struct ILBCDecContext {
4347 const AVClass *class;
48+#if LIBILBC_VERSION_MAJOR < 3
4449 iLBC_Dec_Inst_t decoder;
50+#else
51+ IlbcDecoder decoder;
52+#endif
4553 int enhance;
4654 } ILBCDecContext;
4755
@@ -87,7 +95,12 @@ static int ilbc_decode_frame(AVCodecContext *avctx, void *data, · 39 unmodified lines
8795 int ret;
8896
8997 if (s->decoder.no_of_bytes > buf_size) {
98+#if LIBILBC_VERSION_MAJOR < 3
9099 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
91104 buf_size, s->decoder.no_of_bytes);
92105 return AVERROR_INVALIDDATA;
93106 }
@@ -117,7 +130,11 @@ AVCodec ff_libilbc_decoder = { · 23 unmodified lines
117130
118131 typedef struct ILBCEncContext {
119132 const AVClass *class;
133+#if LIBILBC_VERSION_MAJOR < 3
120134 iLBC_Enc_Inst_t encoder;
135+#else
136+ IlbcEncoder encoder;
137+#endif
121138 int mode;
122139 } ILBCEncContext;
123140

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t