| 1811 | |
| 1812 | |
| 1813 | static int decavcodecvInit( hb_work_object_t * w, hb_job_t * job ) |
| 1814 | { |
| 1815 | |
| 1816 | hb_work_private_t *pv = calloc( 1, sizeof( hb_work_private_t ) ); |
| 1817 | |
| 1818 | w->private_data = pv; |
| 1819 | pv->job = job; |
| 1820 | pv->next_pts = (int64_t)AV_NOPTS_VALUE; |
| 1821 | pv->hw_pix_fmt = AV_PIX_FMT_NONE; |
| 1822 | if ( job ) |
| 1823 | pv->title = job->title; |
| 1824 | else |
| 1825 | pv->title = w->title; |
| 1826 | if (pv->title->flags & HBTF_RAW_VIDEO) |
| 1827 | pv->next_pts = 0; |
| 1828 | hb_buffer_list_clear(&pv->list); |
| 1829 | |
| 1830 | if( pv->job && pv->job->title && !pv->job->title->has_resolution_change ) |
| 1831 | { |
| 1832 | pv->threads = HB_FFMPEG_THREADS_AUTO; |
| 1833 | } |
| 1834 | |
| 1835 | if (w->hw_device_ctx) |
| 1836 | { |
| 1837 | pv->codec = w->hw_accel->find_decoder(w->codec_param); |
| 1838 | } |
| 1839 | else |
| 1840 | { |
| 1841 | pv->codec = avcodec_find_decoder(w->codec_param); |
| 1842 | } |
| 1843 | if ( pv->codec == NULL ) |
| 1844 | { |
| 1845 | hb_log( "decavcodecvInit: failed to find codec for id (%d)", w->codec_param ); |
| 1846 | return 1; |
| 1847 | } |
| 1848 | |
| 1849 | hb_deep_log(2, "decavcodecvInit: using decoder %s", pv->codec->name); |
| 1850 | |
| 1851 | pv->context = avcodec_alloc_context3( pv->codec ); |
| 1852 | pv->context->workaround_bugs = FF_BUG_AUTODETECT; |
| 1853 | pv->context->err_recognition = AV_EF_CRCCHECK; |
| 1854 | pv->context->error_concealment = FF_EC_GUESS_MVS|FF_EC_DEBLOCK; |
| 1855 | |
| 1856 | if (w->hw_device_ctx) |
| 1857 | { |
| 1858 | pv->context->get_format = hw_hwaccel_get_hw_format; |
| 1859 | pv->context->opaque = job; |
| 1860 | av_buffer_replace(&pv->context->hw_device_ctx, w->hw_device_ctx); |
| 1861 | |
| 1862 | if (job == NULL || |
| 1863 | (job->hw_pix_fmt == AV_PIX_FMT_NONE && job->hw_decode & HB_DECODE_FORCE_HW)) |
| 1864 | { |
| 1865 | pv->hw_frame = av_frame_alloc(); |
| 1866 | } |
| 1867 | } |
| 1868 | |
| 1869 | if ( pv->title->opaque_priv ) |
| 1870 | { |
nothing calls this directly
no test coverage detected