| 77 | } |
| 78 | |
| 79 | static int sbc_parse(AVCodecParserContext *s, AVCodecContext *avctx, |
| 80 | const uint8_t **poutbuf, int *poutbuf_size, |
| 81 | const uint8_t *buf, int buf_size) |
| 82 | { |
| 83 | SBCParseContext *pc = s->priv_data; |
| 84 | int next; |
| 85 | |
| 86 | if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { |
| 87 | next = buf_size; |
| 88 | } else { |
| 89 | if (pc->header_size) { |
| 90 | memcpy(pc->header + pc->header_size, buf, |
| 91 | sizeof(pc->header) - pc->header_size); |
| 92 | next = sbc_parse_header(s, avctx, pc->header, sizeof(pc->header)) |
| 93 | - pc->buffered_size; |
| 94 | pc->header_size = 0; |
| 95 | } else { |
| 96 | next = sbc_parse_header(s, avctx, buf, buf_size); |
| 97 | if (next >= buf_size) |
| 98 | next = -1; |
| 99 | } |
| 100 | |
| 101 | if (next < 0) { |
| 102 | pc->header_size = FFMIN(sizeof(pc->header), buf_size); |
| 103 | memcpy(pc->header, buf, pc->header_size); |
| 104 | pc->buffered_size = buf_size; |
| 105 | next = END_NOT_FOUND; |
| 106 | } |
| 107 | |
| 108 | if (ff_combine_frame(&pc->pc, next, &buf, &buf_size) < 0) { |
| 109 | *poutbuf = NULL; |
| 110 | *poutbuf_size = 0; |
| 111 | return buf_size; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | *poutbuf = buf; |
| 116 | *poutbuf_size = buf_size; |
| 117 | return next; |
| 118 | } |
| 119 | |
| 120 | const FFCodecParser ff_sbc_parser = { |
| 121 | PARSER_CODEC_LIST(AV_CODEC_ID_SBC), |
nothing calls this directly
no test coverage detected