diff mbox

[FFmpeg-devel,2/2] opus_parser: replace ff_parse_close with opus_parse_close

Message ID 88cef9b9-cd19-6056-2163-0c91e13ef5b9@googlemail.com
State Superseded
Headers show

Commit Message

Andreas Cadhalpun Dec. 8, 2016, 11:09 p.m. UTC
The former expects priv_data to be the ParseContext directly, so using
it does not work.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
---
 libavcodec/opus_parser.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Hendrik Leppkes Dec. 9, 2016, 2:02 p.m. UTC | #1
On Fri, Dec 9, 2016 at 12:09 AM, Andreas Cadhalpun
<andreas.cadhalpun@googlemail.com> wrote:
> The former expects priv_data to be the ParseContext directly, so using
> it does not work.
>

As an alternative re-order the OpusParseContext so that ParseContext
comes first, it then would work, and thats basically how its done in
the other parsers from what I can tell.

- Hendrik
diff mbox

Patch

diff --git a/libavcodec/opus_parser.c b/libavcodec/opus_parser.c
index 21a73ee..95f5725 100644
--- a/libavcodec/opus_parser.c
+++ b/libavcodec/opus_parser.c
@@ -180,9 +180,16 @@  static int opus_parse(AVCodecParserContext *ctx, AVCodecContext *avctx,
     return next;
 }
 
+static void opus_parse_close(AVCodecParserContext *ctx)
+{
+    OpusParseContext *s = ctx->priv_data;
+    ParseContext *pc    = &s->pc;
+    av_freep(&pc->buffer);
+}
+
 AVCodecParser ff_opus_parser = {
     .codec_ids      = { AV_CODEC_ID_OPUS },
     .priv_data_size = sizeof(OpusParseContext),
     .parser_parse   = opus_parse,
-    .parser_close   = ff_parse_close
+    .parser_close   = opus_parse_close
 };