diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-10-03 20:48:09 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-10-05 02:04:41 +0200 |
commit | 4fc2531fff112836026aad2bdaf128c9d15a72e3 (patch) | |
tree | 9e33638c4af0c03e5880bcca60a3d806cea7b788 /libavcodec/opus_parser.c | |
parent | 6658028482cf3bda2a05ae7a9bf183c81f75d4bd (diff) | |
download | ffmpeg-4fc2531fff112836026aad2bdaf128c9d15a72e3.tar.gz |
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_parser.c')
-rw-r--r-- | libavcodec/opus_parser.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libavcodec/opus_parser.c b/libavcodec/opus_parser.c index 726c010f67..e6df34abab 100644 --- a/libavcodec/opus_parser.c +++ b/libavcodec/opus_parser.c @@ -28,15 +28,16 @@ #include "avcodec.h" #include "bytestream.h" #include "opus.h" +#include "opus_parse.h" #include "parser.h" -typedef struct OpusParseContext { +typedef struct OpusParserContext { ParseContext pc; - OpusContext ctx; + OpusParseContext ctx; OpusPacket pkt; int extradata_parsed; int ts_framing; -} OpusParseContext; +} OpusParserContext; static const uint8_t *parse_opus_ts_header(const uint8_t *start, int *payload_len, int buf_len) { @@ -83,7 +84,7 @@ static const uint8_t *parse_opus_ts_header(const uint8_t *start, int *payload_le static int opus_find_frame_end(AVCodecParserContext *ctx, AVCodecContext *avctx, const uint8_t *buf, int buf_size, int *header_len) { - OpusParseContext *s = ctx->priv_data; + OpusParserContext *s = ctx->priv_data; ParseContext *pc = &s->pc; int ret, start_found, i = 0, payload_len = 0; const uint8_t *payload; @@ -166,7 +167,7 @@ static int opus_parse(AVCodecParserContext *ctx, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { - OpusParseContext *s = ctx->priv_data; + OpusParserContext *s = ctx->priv_data; ParseContext *pc = &s->pc; int next, header_len; @@ -192,7 +193,7 @@ static int opus_parse(AVCodecParserContext *ctx, AVCodecContext *avctx, const AVCodecParser ff_opus_parser = { .codec_ids = { AV_CODEC_ID_OPUS }, - .priv_data_size = sizeof(OpusParseContext), + .priv_data_size = sizeof(OpusParserContext), .parser_parse = opus_parse, .parser_close = ff_parse_close }; |