summaryrefslogtreecommitdiff
path: root/libavcodec/opus.h
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-10-03 20:48:09 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-10-05 02:04:41 +0200
commit4fc2531fff112836026aad2bdaf128c9d15a72e3 (patch)
tree9e33638c4af0c03e5880bcca60a3d806cea7b788 /libavcodec/opus.h
parent6658028482cf3bda2a05ae7a9bf183c81f75d4bd (diff)
avcodec/opus: Move stuff shared by decoder and parser to a new file
opus.h (which is used by all the Opus code) currently includes several structures only used by the parser and the decoder; several elements of OpusContext are even only used by the decoder. This commit therefore moves the part of OpusContext that is shared between these two components (and used by ff_opus_parse_extradata()) out into a new structure and moves all the other accompanying structures and functions to a new header, opus_parse.h; the functions itself are also moved to a new file, opus_parse.c. (This also allows to remove several spurious dependencies of the Opus parser and encoder.) Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/opus.h')
-rw-r--r--libavcodec/opus.h56
1 files changed, 1 insertions, 55 deletions
diff --git a/libavcodec/opus.h b/libavcodec/opus.h
index 264128f09e..a7dbe7ea8a 100644
--- a/libavcodec/opus.h
+++ b/libavcodec/opus.h
@@ -1,5 +1,5 @@
/*
- * Opus decoder/demuxer common functions
+ * Opus common header
* Copyright (c) 2012 Andrew D'Addesio
* Copyright (c) 2013-2014 Mozilla Corporation
*
@@ -25,8 +25,6 @@
#include <stdint.h>
-#include "libavutil/float_dsp.h"
-
#include "avcodec.h"
#include "opus_rc.h"
@@ -77,58 +75,6 @@ typedef struct SilkContext SilkContext;
typedef struct CeltFrame CeltFrame;
-typedef struct OpusPacket {
- int packet_size; /**< packet size */
- int data_size; /**< size of the useful data -- packet size - padding */
- int code; /**< packet code: specifies the frame layout */
- int stereo; /**< whether this packet is mono or stereo */
- int vbr; /**< vbr flag */
- 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_duration; /**< frame duration, in samples @ 48kHz */
- enum OpusMode mode; /**< mode */
- enum OpusBandwidth bandwidth; /**< bandwidth */
-} OpusPacket;
-
-// a mapping between an opus stream and an output channel
-typedef struct ChannelMap {
- int stream_idx;
- int channel_idx;
-
- // when a single decoded channel is mapped to multiple output channels, we
- // write to the first output directly and copy from it to the others
- // this field is set to 1 for those copied output channels
- int copy;
- // this is the index of the output channel to copy from
- int copy_idx;
-
- // this channel is silent
- int silence;
-} ChannelMap;
-
-typedef struct OpusContext {
- AVClass *av_class;
- struct OpusStreamContext *streams;
- int apply_phase_inv;
-
- int nb_streams;
- int nb_stereo_streams;
-
- AVFloatDSPContext *fdsp;
- int16_t gain_i;
- float gain;
-
- ChannelMap *channel_maps;
-} OpusContext;
-
-int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size,
- int self_delimited);
-
-int ff_opus_parse_extradata(AVCodecContext *avctx, OpusContext *s);
-
int ff_silk_init(AVCodecContext *avctx, SilkContext **ps, int output_channels);
void ff_silk_free(SilkContext **ps);
void ff_silk_flush(SilkContext *s);