| 372 | }; |
| 373 | |
| 374 | int ff_lcevc_alloc(FFLCEVCContext **plcevc, void *logctx) |
| 375 | { |
| 376 | FFLCEVCContext *lcevc = NULL; |
| 377 | int ret; |
| 378 | |
| 379 | lcevc = av_refstruct_alloc_ext(sizeof(*lcevc), 0, NULL, lcevc_free); |
| 380 | if (!lcevc) |
| 381 | return AVERROR(ENOMEM); |
| 382 | |
| 383 | lcevc->frag = av_mallocz(sizeof(*lcevc->frag)); |
| 384 | if (!lcevc->frag) { |
| 385 | ret = AVERROR(ENOMEM); |
| 386 | goto fail; |
| 387 | } |
| 388 | |
| 389 | ret = ff_cbs_init(&lcevc->cbc, AV_CODEC_ID_LCEVC, logctx); |
| 390 | if (ret < 0) |
| 391 | goto fail; |
| 392 | |
| 393 | lcevc->cbc->decompose_unit_types = decompose_unit_types; |
| 394 | lcevc->cbc->nb_decompose_unit_types = FF_ARRAY_ELEMS(decompose_unit_types); |
| 395 | |
| 396 | *plcevc = lcevc; |
| 397 | return 0; |
| 398 | fail: |
| 399 | av_refstruct_unref(&lcevc); |
| 400 | return ret; |
| 401 | } |
| 402 | |
| 403 | void ff_lcevc_unref(void *opaque) |
| 404 | { |
no test coverage detected