Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c
- index 95241c30b3..79b878b5c3 100644
- --- a/libavcodec/pnm_parser.c
- +++ b/libavcodec/pnm_parser.c
- @@ -24,12 +24,17 @@
- #include "parser.h" //for ParseContext
- #include "pnm.h"
- +typedef struct PNMParseContext {
- + ParseContext pc;
- + uint32_t skip;
- +} PNMParseContext;
- static int pnm_parse(AVCodecParserContext *s, AVCodecContext *avctx,
- const uint8_t **poutbuf, int *poutbuf_size,
- const uint8_t *buf, int buf_size)
- {
- - ParseContext *pc = s->priv_data;
- + PNMParseContext *ppc = s->priv_data;
- + ParseContext *pc = &ppc->pc;
- PNMContext pnmctx;
- int next;
- int skip = 0;
- @@ -60,7 +65,7 @@ retry:
- goto retry;
- }
- } else if (pnmctx.type < 4) {
- - uint8_t *bs = pnmctx.bytestream;
- + uint8_t *bs = pnmctx.bytestream + ppc->skip;
- const uint8_t *end = pnmctx.bytestream_end;
- while (bs < end) {
- @@ -73,6 +78,7 @@ retry:
- break;
- }
- }
- + ppc->skip = end - pnmctx.bytestream;
- } else {
- next = pnmctx.bytestream - pnmctx.bytestream_start + skip
- + av_image_get_buffer_size(avctx->pix_fmt, avctx->width, avctx->height, 1);
- @@ -95,7 +101,7 @@ retry:
- AVCodecParser ff_pnm_parser = {
- .codec_ids = { AV_CODEC_ID_PGM, AV_CODEC_ID_PGMYUV, AV_CODEC_ID_PPM,
- AV_CODEC_ID_PBM, AV_CODEC_ID_PAM },
- - .priv_data_size = sizeof(ParseContext),
- + .priv_data_size = sizeof(PNMParseContext),
- .parser_parse = pnm_parse,
- .parser_close = ff_parse_close,
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement