* Adds a job to the job list. * @param h Handle to hb_handle_t. * @param job Handle to hb_job_t. */
| 1777 | * @param job Handle to hb_job_t. |
| 1778 | */ |
| 1779 | static void hb_add_internal( hb_handle_t * h, hb_job_t * job, hb_list_t *list_pass ) |
| 1780 | { |
| 1781 | hb_job_t * job_copy; |
| 1782 | hb_audio_t * audio; |
| 1783 | hb_subtitle_t * subtitle; |
| 1784 | int i; |
| 1785 | char audio_lang[4]; |
| 1786 | |
| 1787 | /* Copy the job */ |
| 1788 | job_copy = calloc( sizeof( hb_job_t ), 1 ); |
| 1789 | memcpy(job_copy, job, sizeof(hb_job_t)); |
| 1790 | job_copy->json = NULL; |
| 1791 | job_copy->encoder_preset = NULL; |
| 1792 | job_copy->encoder_tune = NULL; |
| 1793 | job_copy->encoder_profile = NULL; |
| 1794 | job_copy->encoder_level = NULL; |
| 1795 | job_copy->encoder_options = NULL; |
| 1796 | job_copy->file = NULL; |
| 1797 | job_copy->list_chapter = NULL; |
| 1798 | job_copy->list_audio = NULL; |
| 1799 | job_copy->list_subtitle = NULL; |
| 1800 | job_copy->list_filter = NULL; |
| 1801 | job_copy->list_attachment = NULL; |
| 1802 | job_copy->metadata = NULL; |
| 1803 | |
| 1804 | #if HB_PROJECT_FEATURE_QSV |
| 1805 | job_copy->qsv_ctx = hb_qsv_context_dup(job->qsv_ctx); |
| 1806 | #endif |
| 1807 | |
| 1808 | /* If we're doing Foreign Audio Search, copy all subtitles matching the |
| 1809 | * first audio track language we find in the audio list. |
| 1810 | * |
| 1811 | * Otherwise, copy all subtitles found in the input job (which can be |
| 1812 | * manually selected by the user, or added after the Foreign Audio |
| 1813 | * Search pass). */ |
| 1814 | memset( audio_lang, 0, sizeof( audio_lang ) ); |
| 1815 | |
| 1816 | if( job->indepth_scan ) |
| 1817 | { |
| 1818 | |
| 1819 | /* Find the first audio language that is being encoded, then add all the |
| 1820 | * matching subtitles for that language. */ |
| 1821 | for( i = 0; i < hb_list_count( job->list_audio ); i++ ) |
| 1822 | { |
| 1823 | if( ( audio = hb_list_item( job->list_audio, i ) ) ) |
| 1824 | { |
| 1825 | strncpy( audio_lang, audio->config.lang.iso639_2, sizeof( audio_lang ) ); |
| 1826 | break; |
| 1827 | } |
| 1828 | } |
| 1829 | |
| 1830 | /* |
| 1831 | * If doing a subtitle scan then add all the matching subtitles for this |
| 1832 | * language. |
| 1833 | */ |
| 1834 | job_copy->list_subtitle = hb_list_init(); |
| 1835 | |
| 1836 | for( i = 0; i < hb_list_count( job->title->list_subtitle ); i++ ) |
no test coverage detected