| 436 | } |
| 437 | |
| 438 | AVStreamGroup *avformat_stream_group_create(AVFormatContext *s, |
| 439 | enum AVStreamGroupParamsType type, |
| 440 | AVDictionary **options) |
| 441 | { |
| 442 | AVStreamGroup **stream_groups; |
| 443 | AVStreamGroup *stg; |
| 444 | FFStreamGroup *stgi; |
| 445 | |
| 446 | stream_groups = av_realloc_array(s->stream_groups, s->nb_stream_groups + 1, |
| 447 | sizeof(*stream_groups)); |
| 448 | if (!stream_groups) |
| 449 | return NULL; |
| 450 | s->stream_groups = stream_groups; |
| 451 | |
| 452 | stgi = av_mallocz(sizeof(*stgi)); |
| 453 | if (!stgi) |
| 454 | return NULL; |
| 455 | stg = &stgi->pub; |
| 456 | |
| 457 | stg->av_class = &stream_group_class; |
| 458 | av_opt_set_defaults(stg); |
| 459 | stg->type = type; |
| 460 | switch (type) { |
| 461 | case AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT: |
| 462 | stg->params.iamf_audio_element = av_iamf_audio_element_alloc(); |
| 463 | if (!stg->params.iamf_audio_element) |
| 464 | goto fail; |
| 465 | break; |
| 466 | case AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION: |
| 467 | stg->params.iamf_mix_presentation = av_iamf_mix_presentation_alloc(); |
| 468 | if (!stg->params.iamf_mix_presentation) |
| 469 | goto fail; |
| 470 | break; |
| 471 | case AV_STREAM_GROUP_PARAMS_TILE_GRID: |
| 472 | stg->params.tile_grid = av_mallocz(sizeof(*stg->params.tile_grid)); |
| 473 | if (!stg->params.tile_grid) |
| 474 | goto fail; |
| 475 | stg->params.tile_grid->av_class = &tile_grid_class; |
| 476 | av_opt_set_defaults(stg->params.tile_grid); |
| 477 | break; |
| 478 | case AV_STREAM_GROUP_PARAMS_LCEVC: |
| 479 | stg->params.lcevc = av_mallocz(sizeof(*stg->params.lcevc)); |
| 480 | if (!stg->params.lcevc) |
| 481 | goto fail; |
| 482 | stg->params.lcevc->av_class = &lcevc_class; |
| 483 | av_opt_set_defaults(stg->params.lcevc); |
| 484 | break; |
| 485 | default: |
| 486 | goto fail; |
| 487 | } |
| 488 | |
| 489 | if (options) { |
| 490 | if (av_opt_set_dict2(stg, options, AV_OPT_SEARCH_CHILDREN)) |
| 491 | goto fail; |
| 492 | } |
| 493 | |
| 494 | stgi->fmtctx = s; |
| 495 | stg->index = s->nb_stream_groups; |
no test coverage detected