* Job initialization routine. * * Initializes fifos. * Creates work objects for synchronizer, video decoder, video renderer, * video decoder, audio decoder, audio encoder, reader, muxer. * Launches thread for each work object with work_loop. * Waits for completion of last work object. * Closes threads and frees fifos. * @param job Handle work hb_job_t. */
| 1681 | * @param job Handle work hb_job_t. |
| 1682 | */ |
| 1683 | static void do_job(hb_job_t *job) |
| 1684 | { |
| 1685 | int i, result; |
| 1686 | hb_title_t * title; |
| 1687 | hb_interjob_t * interjob; |
| 1688 | hb_work_object_t * w; |
| 1689 | hb_audio_t * audio; |
| 1690 | hb_subtitle_t * subtitle; |
| 1691 | |
| 1692 | title = job->title; |
| 1693 | |
| 1694 | interjob = hb_interjob_get(job->h); |
| 1695 | if (job->sequence_id != interjob->sequence_id) |
| 1696 | { |
| 1697 | // New job sequence, clear interjob |
| 1698 | hb_subtitle_close(&interjob->select_subtitle); |
| 1699 | memset(interjob, 0, sizeof(*interjob)); |
| 1700 | interjob->sequence_id = job->sequence_id; |
| 1701 | } |
| 1702 | |
| 1703 | job->list_work = hb_list_init(); |
| 1704 | w = hb_get_work(job->h, WORK_READER); |
| 1705 | hb_list_add(job->list_work, w); |
| 1706 | |
| 1707 | if (job->indepth_scan) |
| 1708 | { |
| 1709 | hb_log( "Starting Task: Subtitle Scan" ); |
| 1710 | } |
| 1711 | else if (job->pass_id == HB_PASS_ENCODE_ANALYSIS) |
| 1712 | { |
| 1713 | hb_log( "Starting Task: Analysis Pass" ); |
| 1714 | } |
| 1715 | else |
| 1716 | { |
| 1717 | hb_log( "Starting Task: Encoding Pass" ); |
| 1718 | } |
| 1719 | |
| 1720 | // Allow the usage of the hardware decoder |
| 1721 | // only if it was marked as supported in the scan |
| 1722 | if ((title->video_decode_support & job->hw_decode) == 0) |
| 1723 | { |
| 1724 | job->hw_decode = 0; |
| 1725 | } |
| 1726 | if (job->hw_decode & HB_DECODE_QSV) |
| 1727 | { |
| 1728 | #if HB_PROJECT_FEATURE_QSV |
| 1729 | hb_qsv_setup_job(job); |
| 1730 | #endif |
| 1731 | } |
| 1732 | |
| 1733 | // This must be performed before initializing filters because |
| 1734 | // it can add the subtitle render filter. |
| 1735 | result = sanitize_subtitles(job); |
| 1736 | if (result) |
| 1737 | { |
| 1738 | *job->done_error = HB_ERROR_WRONG_INPUT; |
| 1739 | *job->die = 1; |
| 1740 | goto cleanup; |
no test coverage detected