MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / hb_avcodec_open

Function hb_avcodec_open

libhb/hb.c:79–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77static void thread_func( void * );
78
79int hb_avcodec_open(AVCodecContext *avctx, const AVCodec *codec,
80 AVDictionary **av_opts, int thread_count)
81{
82 int ret;
83
84 if ((thread_count == HB_FFMPEG_THREADS_AUTO || thread_count > 0) &&
85 (codec->type == AVMEDIA_TYPE_VIDEO))
86 {
87#if defined (__aarch64__) && defined(_WIN32)
88 avctx->thread_count = (thread_count == HB_FFMPEG_THREADS_AUTO) ?
89 hb_get_cpu_count() + 1 : thread_count;
90#else
91 avctx->thread_count = (thread_count == HB_FFMPEG_THREADS_AUTO) ?
92 hb_get_cpu_count() / 2 + 1 : thread_count;
93#endif
94 avctx->thread_type = FF_THREAD_FRAME|FF_THREAD_SLICE;
95 }
96 else
97 {
98 avctx->thread_count = 1;
99 }
100
101 if (codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL)
102 {
103 // "experimental" encoders will not open without this
104 avctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
105 }
106
107 ret = avcodec_open2(avctx, codec, av_opts);
108 return ret;
109}
110
111void hb_avcodec_free_context(AVCodecContext **avctx)
112{

Callers 9

encavcodecaInitFunction · 0.85
decavsubInitFunction · 0.85
do_deep_probeFunction · 0.85
decavcodecaInitFunction · 0.85
decavcodecaBSInfoFunction · 0.85
decavcodecvInitFunction · 0.85
decodePacketFunction · 0.85
encavsubInitFunction · 0.85
encavcodecInitFunction · 0.85

Calls 1

hb_get_cpu_countFunction · 0.85

Tested by

no test coverage detected