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

Function init_decoder

tests/api/api-flac-test.c:83–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83static int init_decoder(const AVCodec *dec, AVCodecContext **dec_ctx,
84 const AVChannelLayout *ch_layout)
85{
86 AVCodecContext *ctx;
87 int result;
88
89 ctx = avcodec_alloc_context3(dec);
90 if (!ctx) {
91 av_log(NULL, AV_LOG_ERROR , "Can't allocate decoder context\n");
92 return AVERROR(ENOMEM);
93 }
94
95 ctx->request_sample_fmt = AV_SAMPLE_FMT_S16;
96 av_channel_layout_copy(&ctx->ch_layout, ch_layout);
97
98 result = avcodec_open2(ctx, dec, NULL);
99 if (result < 0) {
100 av_log(ctx, AV_LOG_ERROR, "Can't open decoder\n");
101 return result;
102 }
103
104 *dec_ctx = ctx;
105 return 0;
106}
107
108static int run_test(const AVCodec *enc, const AVCodec *dec,
109 AVCodecContext *enc_ctx, AVCodecContext *dec_ctx)

Callers 1

mainFunction · 0.70

Calls 4

avcodec_alloc_context3Function · 0.85
av_logFunction · 0.85
av_channel_layout_copyFunction · 0.85
avcodec_open2Function · 0.85

Tested by

no test coverage detected