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

Unified · Split

libavcodec/libilbc.c+17−0
@@ -27,6 +27,10 @@ · 26 unmodified lines
27#include "avcodec.h"27#include "avcodec.h"
28#include "internal.h"28#include "internal.h"
29 29
30#ifndef LIBILBC_VERSION_MAJOR
31#define LIBILBC_VERSION_MAJOR 2
32#endif
33
30static int get_mode(AVCodecContext *avctx)34static int get_mode(AVCodecContext *avctx)
31{35{
32 if (avctx->block_align == 38)36 if (avctx->block_align == 38)
@@ -41,7 +45,11 @@ static int get_mode(AVCodecContext *avctx) · 8 unmodified lines
41 45
42typedef struct ILBCDecContext {46typedef struct ILBCDecContext {
43 const AVClass *class;47 const AVClass *class;
48#if LIBILBC_VERSION_MAJOR < 3
44 iLBC_Dec_Inst_t decoder;49 iLBC_Dec_Inst_t decoder;
50#else
51 IlbcDecoder decoder;
52#endif
45 int enhance;53 int enhance;
46} ILBCDecContext;54} ILBCDecContext;
47 55
@@ -87,7 +95,12 @@ static int ilbc_decode_frame(AVCodecContext *avctx, void *data, · 39 unmodified lines
87 int ret;95 int ret;
88 96
89 if (s->decoder.no_of_bytes > buf_size) {97 if (s->decoder.no_of_bytes > buf_size) {
98#if LIBILBC_VERSION_MAJOR < 3
90 av_log(avctx, AV_LOG_ERROR, "iLBC frame too short (%u, should be %u)\n",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 buf_size, s->decoder.no_of_bytes);104 buf_size, s->decoder.no_of_bytes);
92 return AVERROR_INVALIDDATA;105 return AVERROR_INVALIDDATA;
93 }106 }
@@ -117,7 +130,11 @@ AVCodec ff_libilbc_decoder = { · 23 unmodified lines
117 130
118typedef struct ILBCEncContext {131typedef struct ILBCEncContext {
119 const AVClass *class;132 const AVClass *class;
133#if LIBILBC_VERSION_MAJOR < 3
120 iLBC_Enc_Inst_t encoder;134 iLBC_Enc_Inst_t encoder;
135#else
136 IlbcEncoder encoder;
137#endif
121 int mode;138 int mode;
122} ILBCEncContext;139} ILBCEncContext;
123 140

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