| 1645 | } |
| 1646 | |
| 1647 | static void filter_video(hb_work_private_t *pv) |
| 1648 | { |
| 1649 | // Make sure every frame is tagged |
| 1650 | if (pv->job) |
| 1651 | { |
| 1652 | pv->frame->color_primaries = pv->title->color_prim; |
| 1653 | pv->frame->color_trc = pv->title->color_transfer; |
| 1654 | pv->frame->colorspace = pv->title->color_matrix; |
| 1655 | pv->frame->color_range = pv->title->color_range; |
| 1656 | } |
| 1657 | |
| 1658 | // J pixel formats are mostly deprecated, however |
| 1659 | // they are still set by decoders, breaking some filters |
| 1660 | sanitize_deprecated_pix_fmts(pv->frame); |
| 1661 | |
| 1662 | reinit_video_filters(pv); |
| 1663 | if (pv->video_filters.graph != NULL) |
| 1664 | { |
| 1665 | int result; |
| 1666 | |
| 1667 | hb_avfilter_add_frame(pv->video_filters.graph, pv->frame); |
| 1668 | result = hb_avfilter_get_frame(pv->video_filters.graph, pv->frame); |
| 1669 | while (result >= 0) |
| 1670 | { |
| 1671 | hb_buffer_t * buf = copy_frame(pv); |
| 1672 | hb_buffer_list_append(&pv->list, buf); |
| 1673 | av_frame_unref(pv->frame); |
| 1674 | ++pv->nframes; |
| 1675 | result = hb_avfilter_get_frame(pv->video_filters.graph, pv->frame); |
| 1676 | } |
| 1677 | } |
| 1678 | else |
| 1679 | { |
| 1680 | hb_buffer_t * buf = copy_frame(pv); |
| 1681 | hb_buffer_list_append(&pv->list, buf); |
| 1682 | av_frame_unref(pv->frame); |
| 1683 | ++pv->nframes; |
| 1684 | } |
| 1685 | } |
| 1686 | |
| 1687 | /* |
| 1688 | * Decodes a video frame from the specified raw packet data |
no test coverage detected