diff mbox series

[FFmpeg-devel,2/3] avcodec/dvbsub_parser: Don't allocate buffer separately

Message ID 20200629173309.4871-2-andreas.rheinhardt@gmail.com
State Accepted
Commit 3d0dca2856ecf46f8f26512a94931a32e9f18649
Headers show
Series [FFmpeg-devel,1/3] fate: Update fate refs after cca982ee018aad54214e94f2a0a5921c8bbf1328
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt June 29, 2020, 5:33 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/dvbsub_parser.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

Comments

Andreas Rheinhardt July 3, 2020, 12:12 a.m. UTC | #1
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/dvbsub_parser.c | 18 +-----------------
>  1 file changed, 1 insertion(+), 17 deletions(-)
> 
> diff --git a/libavcodec/dvbsub_parser.c b/libavcodec/dvbsub_parser.c
> index 8ced3c4c34..b7a3d6154c 100644
> --- a/libavcodec/dvbsub_parser.c
> +++ b/libavcodec/dvbsub_parser.c
> @@ -35,20 +35,12 @@
>  
>  /* parser definition */
>  typedef struct DVBSubParseContext {
> -    uint8_t *packet_buf;
>      int packet_start;
>      int packet_index;
>      int in_packet;
> +    uint8_t packet_buf[PARSE_BUF_SIZE];
>  } DVBSubParseContext;
>  
> -static av_cold int dvbsub_parse_init(AVCodecParserContext *s)
> -{
> -    DVBSubParseContext *pc = s->priv_data;
> -    pc->packet_buf = av_malloc(PARSE_BUF_SIZE);
> -
> -    return 0;
> -}
> -
>  static int dvbsub_parse(AVCodecParserContext *s,
>                          AVCodecContext *avctx,
>                          const uint8_t **poutbuf, int *poutbuf_size,
> @@ -173,16 +165,8 @@ static int dvbsub_parse(AVCodecParserContext *s,
>      return buf_size;
>  }
>  
> -static av_cold void dvbsub_parse_close(AVCodecParserContext *s)
> -{
> -    DVBSubParseContext *pc = s->priv_data;
> -    av_freep(&pc->packet_buf);
> -}
> -
>  AVCodecParser ff_dvbsub_parser = {
>      .codec_ids      = { AV_CODEC_ID_DVB_SUBTITLE },
>      .priv_data_size = sizeof(DVBSubParseContext),
> -    .parser_init    = dvbsub_parse_init,
>      .parser_parse   = dvbsub_parse,
> -    .parser_close   = dvbsub_parse_close,
>  };
> 
Will apply the patchset tomorrow unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavcodec/dvbsub_parser.c b/libavcodec/dvbsub_parser.c
index 8ced3c4c34..b7a3d6154c 100644
--- a/libavcodec/dvbsub_parser.c
+++ b/libavcodec/dvbsub_parser.c
@@ -35,20 +35,12 @@ 
 
 /* parser definition */
 typedef struct DVBSubParseContext {
-    uint8_t *packet_buf;
     int packet_start;
     int packet_index;
     int in_packet;
+    uint8_t packet_buf[PARSE_BUF_SIZE];
 } DVBSubParseContext;
 
-static av_cold int dvbsub_parse_init(AVCodecParserContext *s)
-{
-    DVBSubParseContext *pc = s->priv_data;
-    pc->packet_buf = av_malloc(PARSE_BUF_SIZE);
-
-    return 0;
-}
-
 static int dvbsub_parse(AVCodecParserContext *s,
                         AVCodecContext *avctx,
                         const uint8_t **poutbuf, int *poutbuf_size,
@@ -173,16 +165,8 @@  static int dvbsub_parse(AVCodecParserContext *s,
     return buf_size;
 }
 
-static av_cold void dvbsub_parse_close(AVCodecParserContext *s)
-{
-    DVBSubParseContext *pc = s->priv_data;
-    av_freep(&pc->packet_buf);
-}
-
 AVCodecParser ff_dvbsub_parser = {
     .codec_ids      = { AV_CODEC_ID_DVB_SUBTITLE },
     .priv_data_size = sizeof(DVBSubParseContext),
-    .parser_init    = dvbsub_parse_init,
     .parser_parse   = dvbsub_parse,
-    .parser_close   = dvbsub_parse_close,
 };