Advertisement
Guest User

Untitled

a guest
Apr 27th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c
  2. index 95241c30b3..79b878b5c3 100644
  3. --- a/libavcodec/pnm_parser.c
  4. +++ b/libavcodec/pnm_parser.c
  5. @@ -24,12 +24,17 @@
  6. #include "parser.h" //for ParseContext
  7. #include "pnm.h"
  8.  
  9. +typedef struct PNMParseContext {
  10. + ParseContext pc;
  11. + uint32_t skip;
  12. +} PNMParseContext;
  13.  
  14. static int pnm_parse(AVCodecParserContext *s, AVCodecContext *avctx,
  15. const uint8_t **poutbuf, int *poutbuf_size,
  16. const uint8_t *buf, int buf_size)
  17. {
  18. - ParseContext *pc = s->priv_data;
  19. + PNMParseContext *ppc = s->priv_data;
  20. + ParseContext *pc = &ppc->pc;
  21. PNMContext pnmctx;
  22. int next;
  23. int skip = 0;
  24. @@ -60,7 +65,7 @@ retry:
  25. goto retry;
  26. }
  27. } else if (pnmctx.type < 4) {
  28. - uint8_t *bs = pnmctx.bytestream;
  29. + uint8_t *bs = pnmctx.bytestream + ppc->skip;
  30. const uint8_t *end = pnmctx.bytestream_end;
  31.  
  32. while (bs < end) {
  33. @@ -73,6 +78,7 @@ retry:
  34. break;
  35. }
  36. }
  37. + ppc->skip = end - pnmctx.bytestream;
  38. } else {
  39. next = pnmctx.bytestream - pnmctx.bytestream_start + skip
  40. + av_image_get_buffer_size(avctx->pix_fmt, avctx->width, avctx->height, 1);
  41. @@ -95,7 +101,7 @@ retry:
  42. AVCodecParser ff_pnm_parser = {
  43. .codec_ids = { AV_CODEC_ID_PGM, AV_CODEC_ID_PGMYUV, AV_CODEC_ID_PPM,
  44. AV_CODEC_ID_PBM, AV_CODEC_ID_PAM },
  45. - .priv_data_size = sizeof(ParseContext),
  46. + .priv_data_size = sizeof(PNMParseContext),
  47. .parser_parse = pnm_parse,
  48. .parser_close = ff_parse_close,
  49. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement