[FFmpeg-devel] [PATCH 4/9] avcodec/opus: Use prefix for defines
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Fri Oct 7 23:25:03 EEST 2022
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
libavcodec/opus.h | 6 +++---
libavcodec/opus_parse.c | 12 ++++++------
libavcodec/opus_parse.h | 4 ++--
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/libavcodec/opus.h b/libavcodec/opus.h
index 4d061cf5f8..f87b63aaca 100644
--- a/libavcodec/opus.h
+++ b/libavcodec/opus.h
@@ -25,9 +25,9 @@
#include <stdint.h>
-#define MAX_FRAME_SIZE 1275
-#define MAX_FRAMES 48
-#define MAX_PACKET_DUR 5760
+#define OPUS_MAX_FRAME_SIZE 1275
+#define OPUS_MAX_FRAMES 48
+#define OPUS_MAX_PACKET_DUR 5760
#define OPUS_TS_HEADER 0x7FE0 // 0x3ff (11 bits)
#define OPUS_TS_MASK 0xFFE0 // top 11 bits
diff --git a/libavcodec/opus_parse.c b/libavcodec/opus_parse.c
index 39765c5b79..e922d1f304 100644
--- a/libavcodec/opus_parse.c
+++ b/libavcodec/opus_parse.c
@@ -128,7 +128,7 @@ int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size,
}
frame_bytes = end - ptr;
- if (frame_bytes > MAX_FRAME_SIZE)
+ if (frame_bytes > OPUS_MAX_FRAME_SIZE)
goto fail;
pkt->frame_offset[0] = ptr - buf;
pkt->frame_size[0] = frame_bytes;
@@ -147,7 +147,7 @@ int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size,
}
frame_bytes = end - ptr;
- if (frame_bytes & 1 || frame_bytes >> 1 > MAX_FRAME_SIZE)
+ if (frame_bytes & 1 || frame_bytes >> 1 > OPUS_MAX_FRAME_SIZE)
goto fail;
pkt->frame_offset[0] = ptr - buf;
pkt->frame_size[0] = frame_bytes >> 1;
@@ -177,7 +177,7 @@ int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size,
/* calculate 2nd frame size */
frame_bytes = end - ptr - pkt->frame_size[0];
- if (frame_bytes < 0 || frame_bytes > MAX_FRAME_SIZE)
+ if (frame_bytes < 0 || frame_bytes > OPUS_MAX_FRAME_SIZE)
goto fail;
pkt->frame_offset[1] = pkt->frame_offset[0] + pkt->frame_size[0];
pkt->frame_size[1] = frame_bytes;
@@ -189,7 +189,7 @@ int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size,
padding = (i >> 6) & 0x01;
pkt->vbr = (i >> 7) & 0x01;
- if (pkt->frame_count == 0 || pkt->frame_count > MAX_FRAMES)
+ if (pkt->frame_count == 0 || pkt->frame_count > OPUS_MAX_FRAMES)
goto fail;
/* read padding size */
@@ -239,7 +239,7 @@ int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size,
} else {
frame_bytes = end - ptr - padding;
if (frame_bytes % pkt->frame_count ||
- frame_bytes / pkt->frame_count > MAX_FRAME_SIZE)
+ frame_bytes / pkt->frame_count > OPUS_MAX_FRAME_SIZE)
goto fail;
frame_bytes /= pkt->frame_count;
}
@@ -258,7 +258,7 @@ int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size,
/* total packet duration cannot be larger than 120ms */
pkt->frame_duration = opus_frame_duration[pkt->config];
- if (pkt->frame_duration * pkt->frame_count > MAX_PACKET_DUR)
+ if (pkt->frame_duration * pkt->frame_count > OPUS_MAX_PACKET_DUR)
goto fail;
/* set mode and bandwidth */
diff --git a/libavcodec/opus_parse.h b/libavcodec/opus_parse.h
index 8e5c6a880c..83ed3c7887 100644
--- a/libavcodec/opus_parse.h
+++ b/libavcodec/opus_parse.h
@@ -37,8 +37,8 @@ typedef struct OpusPacket {
int config; /**< configuration: tells the audio mode,
** bandwidth, and frame duration */
int frame_count; /**< frame count */
- int frame_offset[MAX_FRAMES]; /**< frame offsets */
- int frame_size[MAX_FRAMES]; /**< frame sizes */
+ int frame_offset[OPUS_MAX_FRAMES]; /**< frame offsets */
+ int frame_size[OPUS_MAX_FRAMES]; /**< frame sizes */
int frame_duration; /**< frame duration, in samples @ 48kHz */
enum OpusMode mode; /**< mode */
enum OpusBandwidth bandwidth; /**< bandwidth */
--
2.34.1
More information about the ffmpeg-devel
mailing list