Lines Matching defs:codec
42 static int check_sample_fmt(const AVCodec *codec, enum AVSampleFormat sample_fmt)
44 const enum AVSampleFormat *p = codec->sample_fmts;
55 static int select_sample_rate(const AVCodec *codec)
60 if (!codec->supported_samplerates)
63 p = codec->supported_samplerates;
73 static int select_channel_layout(const AVCodec *codec, AVChannelLayout *dst)
78 if (!codec->ch_layouts)
81 p = codec->ch_layouts;
125 const AVCodec *codec;
141 codec = avcodec_find_encoder(AV_CODEC_ID_MP2);
142 if (!codec) {
147 c = avcodec_alloc_context3(codec);
149 fprintf(stderr, "Could not allocate audio codec context\n");
158 if (!check_sample_fmt(codec, c->sample_fmt)) {
165 c->sample_rate = select_sample_rate(codec);
166 ret = select_channel_layout(codec, &c->ch_layout);
171 if (avcodec_open2(c, codec, NULL) < 0) {
172 fprintf(stderr, "Could not open codec\n");