| 370 | } |
| 371 | |
| 372 | static hb_buffer_t * splice_discontinuity( hb_work_private_t *r, hb_buffer_t *buf ) |
| 373 | { |
| 374 | // Handle buffers that were split across a PCR discontinuity. |
| 375 | // Rejoin them into a single buffer. |
| 376 | hb_buffer_list_t * list = get_splice_list(r, buf->s.id); |
| 377 | if (list != NULL) |
| 378 | { |
| 379 | hb_buffer_list_append(list, buf); |
| 380 | if (buf->s.split) |
| 381 | { |
| 382 | return NULL; |
| 383 | } |
| 384 | |
| 385 | int count = hb_buffer_list_count(list); |
| 386 | if (count > 1) |
| 387 | { |
| 388 | int size = hb_buffer_list_size(list); |
| 389 | hb_buffer_t * b = hb_buffer_init(size); |
| 390 | buf = hb_buffer_list_head(list); |
| 391 | b->s = buf->s; |
| 392 | |
| 393 | int pos = 0; |
| 394 | while ((buf = hb_buffer_list_rem_head(list)) != NULL) |
| 395 | { |
| 396 | memcpy(b->data + pos, buf->data, buf->size); |
| 397 | pos += buf->size; |
| 398 | hb_buffer_close(&buf); |
| 399 | } |
| 400 | buf = b; |
| 401 | } |
| 402 | else |
| 403 | { |
| 404 | buf = hb_buffer_list_clear(list); |
| 405 | } |
| 406 | } |
| 407 | return buf; |
| 408 | } |
| 409 | |
| 410 | static void push_buf( hb_work_private_t *r, hb_fifo_t *fifo, hb_buffer_t *buf ) |
| 411 | { |
no test coverage detected