| 305 | } |
| 306 | |
| 307 | static int dca_parse(AVCodecParserContext *s, AVCodecContext *avctx, |
| 308 | const uint8_t **poutbuf, int *poutbuf_size, |
| 309 | const uint8_t *buf, int buf_size) |
| 310 | { |
| 311 | DCAParseContext *pc1 = s->priv_data; |
| 312 | ParseContext *pc = &pc1->pc; |
| 313 | int next, duration, sample_rate; |
| 314 | |
| 315 | if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { |
| 316 | next = buf_size; |
| 317 | } else { |
| 318 | next = dca_find_frame_end(pc1, buf, buf_size); |
| 319 | |
| 320 | if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { |
| 321 | *poutbuf = NULL; |
| 322 | *poutbuf_size = 0; |
| 323 | return buf_size; |
| 324 | } |
| 325 | |
| 326 | /* skip initial padding */ |
| 327 | if (buf_size > pc1->startpos) { |
| 328 | buf += pc1->startpos; |
| 329 | buf_size -= pc1->startpos; |
| 330 | } |
| 331 | pc1->startpos = 0; |
| 332 | } |
| 333 | |
| 334 | /* read the duration and sample rate from the frame header */ |
| 335 | if (!dca_parse_params(pc1, buf, buf_size, &duration, &sample_rate, &avctx->profile)) { |
| 336 | if (!avctx->sample_rate) |
| 337 | avctx->sample_rate = sample_rate; |
| 338 | s->duration = av_rescale(duration, avctx->sample_rate, sample_rate); |
| 339 | } else |
| 340 | s->duration = 0; |
| 341 | |
| 342 | *poutbuf = buf; |
| 343 | *poutbuf_size = buf_size; |
| 344 | return next; |
| 345 | } |
| 346 | |
| 347 | const FFCodecParser ff_dca_parser = { |
| 348 | PARSER_CODEC_LIST(AV_CODEC_ID_DTS), |
nothing calls this directly
no test coverage detected