mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-03-03 02:58:02 +00:00
avcodec/dvbsub_parser: Don't allocate buffer separately
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
ec33f7793e
commit
3d0dca2856
@ -35,20 +35,12 @@
|
|||||||
|
|
||||||
/* parser definition */
|
/* parser definition */
|
||||||
typedef struct DVBSubParseContext {
|
typedef struct DVBSubParseContext {
|
||||||
uint8_t *packet_buf;
|
|
||||||
int packet_start;
|
int packet_start;
|
||||||
int packet_index;
|
int packet_index;
|
||||||
int in_packet;
|
int in_packet;
|
||||||
|
uint8_t packet_buf[PARSE_BUF_SIZE];
|
||||||
} DVBSubParseContext;
|
} 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,
|
static int dvbsub_parse(AVCodecParserContext *s,
|
||||||
AVCodecContext *avctx,
|
AVCodecContext *avctx,
|
||||||
const uint8_t **poutbuf, int *poutbuf_size,
|
const uint8_t **poutbuf, int *poutbuf_size,
|
||||||
@ -173,16 +165,8 @@ static int dvbsub_parse(AVCodecParserContext *s,
|
|||||||
return buf_size;
|
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 = {
|
AVCodecParser ff_dvbsub_parser = {
|
||||||
.codec_ids = { AV_CODEC_ID_DVB_SUBTITLE },
|
.codec_ids = { AV_CODEC_ID_DVB_SUBTITLE },
|
||||||
.priv_data_size = sizeof(DVBSubParseContext),
|
.priv_data_size = sizeof(DVBSubParseContext),
|
||||||
.parser_init = dvbsub_parse_init,
|
|
||||||
.parser_parse = dvbsub_parse,
|
.parser_parse = dvbsub_parse,
|
||||||
.parser_close = dvbsub_parse_close,
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user