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

Function parameters_from_context

libavformat/demux.c:2566–2605  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2564}
2565
2566static int parameters_from_context(AVFormatContext *ic, AVCodecParameters *par,
2567 const AVCodecContext *avctx)
2568{
2569 AVCodecParameters *par_tmp;
2570 int ret;
2571
2572 par_tmp = avcodec_parameters_alloc();
2573 if (!par_tmp)
2574 return AVERROR(ENOMEM);
2575
2576 ret = avcodec_parameters_copy(par_tmp, par);
2577 if (ret < 0)
2578 goto fail;
2579
2580 ret = avcodec_parameters_from_context(par, avctx);
2581 if (ret < 0)
2582 goto fail;
2583
2584 /* Restore some values if they are signaled at the container level
2585 * given they may have been replaced by codec level values as read
2586 * internally by avformat_find_stream_info().
2587 */
2588 if (par_tmp->color_range != AVCOL_RANGE_UNSPECIFIED)
2589 par->color_range = par_tmp->color_range;
2590 if (par_tmp->color_primaries != AVCOL_PRI_UNSPECIFIED ||
2591 par_tmp->color_trc != AVCOL_TRC_UNSPECIFIED ||
2592 par_tmp->color_space != AVCOL_SPC_UNSPECIFIED) {
2593 par->color_primaries = par_tmp->color_primaries;
2594 par->color_trc = par_tmp->color_trc;
2595 par->color_space = par_tmp->color_space;
2596 }
2597 if (par_tmp->chroma_location != AVCHROMA_LOC_UNSPECIFIED)
2598 par->chroma_location = par_tmp->chroma_location;
2599
2600 ret = 0;
2601fail:
2602 avcodec_parameters_free(&par_tmp);
2603
2604 return ret;
2605}
2606
2607int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
2608{

Callers 1

Calls 4

avcodec_parameters_allocFunction · 0.85
avcodec_parameters_copyFunction · 0.85
avcodec_parameters_freeFunction · 0.85

Tested by

no test coverage detected