Re: [FFmpeg-devel] [PATCH] avcodec/libilbc: Support newer libiLBC versions

2021-03-10 Thread Timothy Gu
On Wed, Mar 10, 2021 at 7:49 PM Andreas Rheinhardt
 wrote:
> 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.
>
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/libilbc.c | 17 +
>  1 file changed, 17 insertions(+)

LGTM. Thanks!

[...]

Best,
Timothy
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] avcodec/libilbc: Support newer libiLBC versions

2021-03-10 Thread Andreas Rheinhardt
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.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/libilbc.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/libavcodec/libilbc.c b/libavcodec/libilbc.c
index 08f951ac2d..9c82589918 100644
--- a/libavcodec/libilbc.c
+++ b/libavcodec/libilbc.c
@@ -27,6 +27,10 @@
 #include "avcodec.h"
 #include "internal.h"
 
+#ifndef LIBILBC_VERSION_MAJOR
+#define LIBILBC_VERSION_MAJOR 2
+#endif
+
 static int get_mode(AVCodecContext *avctx)
 {
 if (avctx->block_align == 38)
@@ -41,7 +45,11 @@ static int get_mode(AVCodecContext *avctx)
 
 typedef struct ILBCDecContext {
 const AVClass *class;
+#if LIBILBC_VERSION_MAJOR < 3
 iLBC_Dec_Inst_t decoder;
+#else
+IlbcDecoder decoder;
+#endif
 int enhance;
 } ILBCDecContext;
 
@@ -87,7 +95,12 @@ static int ilbc_decode_frame(AVCodecContext *avctx, void 
*data,
 int ret;
 
 if (s->decoder.no_of_bytes > buf_size) {
+#if LIBILBC_VERSION_MAJOR < 3
 av_log(avctx, AV_LOG_ERROR, "iLBC frame too short (%u, should be 
%u)\n",
+#else
+av_log(avctx, AV_LOG_ERROR, "iLBC frame too short (%u, should be "
+"%"SIZE_SPECIFIER")\n",
+#endif
buf_size, s->decoder.no_of_bytes);
 return AVERROR_INVALIDDATA;
 }
@@ -117,7 +130,11 @@ AVCodec ff_libilbc_decoder = {
 
 typedef struct ILBCEncContext {
 const AVClass *class;
+#if LIBILBC_VERSION_MAJOR < 3
 iLBC_Enc_Inst_t encoder;
+#else
+IlbcEncoder encoder;
+#endif
 int mode;
 } ILBCEncContext;
 
-- 
2.27.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".