| 81 | } |
| 82 | |
| 83 | static 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 | |
| 108 | static int run_test(const AVCodec *enc, const AVCodec *dec, |
| 109 | AVCodecContext *enc_ctx, AVCodecContext *dec_ctx) |
no test coverage detected