MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / oh_encode_init

Function oh_encode_init

libavcodec/ohenc.c:320–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

318}
319
320static av_cold int oh_encode_init(AVCodecContext *avctx)
321{
322 OHCodecEncContext *s = avctx->priv_data;
323
324 // Initialize these fields first, so oh_decode_close can destroy them safely
325 ff_mutex_init(&s->input_mutex, NULL);
326 ff_cond_init(&s->input_cond, NULL);
327 ff_mutex_init(&s->output_mutex, NULL);
328 ff_cond_init(&s->output_cond, NULL);
329
330 int ret = oh_encode_create(s, avctx);
331 if (ret < 0)
332 return ret;
333 ret = oh_encode_set_format(s, avctx);
334 if (ret < 0)
335 return ret;
336
337 size_t fifo_size = 16;
338 s->input_queue = av_fifo_alloc2(fifo_size, sizeof(OHBufferQueueItem),
339 AV_FIFO_FLAG_AUTO_GROW);
340 s->output_queue = av_fifo_alloc2(fifo_size, sizeof(OHBufferQueueItem),
341 AV_FIFO_FLAG_AUTO_GROW);
342 s->frame = av_frame_alloc();
343 if (!s->input_queue || !s->output_queue || !s->frame)
344 return AVERROR(ENOMEM);
345
346 ret = oh_encode_start(s, avctx);
347 if (ret < 0)
348 return ret;
349
350 return 0;
351}
352
353static av_cold int oh_encode_close(AVCodecContext *avctx)
354{

Callers

nothing calls this directly

Calls 7

ff_mutex_initFunction · 0.85
ff_cond_initFunction · 0.85
oh_encode_createFunction · 0.85
oh_encode_set_formatFunction · 0.85
av_fifo_alloc2Function · 0.85
av_frame_allocFunction · 0.85
oh_encode_startFunction · 0.85

Tested by

no test coverage detected