| 1534 | } |
| 1535 | |
| 1536 | static int comb_detect_work(hb_filter_object_t *filter, |
| 1537 | hb_buffer_t **buf_in, |
| 1538 | hb_buffer_t **buf_out ) |
| 1539 | { |
| 1540 | hb_filter_private_t *pv = filter->private_data; |
| 1541 | hb_buffer_t *in = *buf_in; |
| 1542 | |
| 1543 | // Input buffer is always consumed. |
| 1544 | *buf_in = NULL; |
| 1545 | if (in->s.flags & HB_BUF_FLAG_EOF) |
| 1546 | { |
| 1547 | // Duplicate last frame and process refs |
| 1548 | store_ref(pv, hb_buffer_shallow_dup(pv->ref[2])); |
| 1549 | if (pv->ref[0] != NULL) |
| 1550 | { |
| 1551 | pv->force_exaustive_check = 1; |
| 1552 | process_frame(pv); |
| 1553 | } |
| 1554 | hb_buffer_list_append(&pv->out_list, in); |
| 1555 | *buf_out = hb_buffer_list_clear(&pv->out_list); |
| 1556 | return HB_FILTER_DONE; |
| 1557 | } |
| 1558 | |
| 1559 | // comb detect requires 3 buffers, prev, cur, and next. For the first |
| 1560 | // frame, there can be no prev, so we duplicate the first frame. |
| 1561 | if (!pv->comb_detect_ready) |
| 1562 | { |
| 1563 | // If not ready, store duplicate ref and return HB_FILTER_DELAY |
| 1564 | store_ref(pv, hb_buffer_shallow_dup(in)); |
| 1565 | store_ref(pv, in); |
| 1566 | pv->comb_detect_ready = 1; |
| 1567 | // Wait for next |
| 1568 | return HB_FILTER_DELAY; |
| 1569 | } |
| 1570 | |
| 1571 | store_ref(pv, in); |
| 1572 | process_frame(pv); |
| 1573 | |
| 1574 | // Output buffers may also be in comb detect's internal ref list. |
| 1575 | // Since buffers are not reference counted, we must wait until |
| 1576 | // we are certain they are no longer in the ref list before sending |
| 1577 | // down the pipeline where they will ultimately get closed. |
| 1578 | if (hb_buffer_list_count(&pv->out_list) > 3) |
| 1579 | { |
| 1580 | *buf_out = hb_buffer_list_rem_head(&pv->out_list); |
| 1581 | } |
| 1582 | return HB_FILTER_OK; |
| 1583 | } |
nothing calls this directly
no test coverage detected