Lines Matching defs:avctx

1797 int ff_ac3_encode_frame_common_end(AVCodecContext *avctx, AVPacket *avpkt,
1800 AC3EncodeContext *const s = avctx->priv_data;
1809 av_log(avctx, AV_LOG_ERROR, "Bit allocation failed. Try increasing the bitrate.\n");
1817 ret = ff_get_encode_buffer(avctx, avpkt, s->frame_size, 0);
1823 avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding);
1832 AVCodecContext *avctx = s->avctx;
1844 ff_dlog(avctx, "bitstream_id: %s (%d)\n", strbuf, s->bitstream_id);
1845 ff_dlog(avctx, "sample_fmt: %s\n", av_get_sample_fmt_name(avctx->sample_fmt));
1846 av_channel_layout_describe(&avctx->ch_layout, strbuf, sizeof(strbuf));
1847 ff_dlog(avctx, "channel_layout: %s\n", strbuf);
1848 ff_dlog(avctx, "sample_rate: %d\n", s->sample_rate);
1849 ff_dlog(avctx, "bit_rate: %d\n", s->bit_rate);
1850 ff_dlog(avctx, "blocks/frame: %d (code=%d)\n", s->num_blocks, s->num_blks_code);
1852 ff_dlog(avctx, "cutoff: %d\n", s->cutoff);
1854 ff_dlog(avctx, "per_frame_metadata: %s\n",
1857 ff_dlog(avctx, "center_mixlev: %0.3f (%d)\n", opt->center_mix_level,
1860 ff_dlog(avctx, "center_mixlev: {not written}\n");
1862 ff_dlog(avctx, "surround_mixlev: %0.3f (%d)\n", opt->surround_mix_level,
1865 ff_dlog(avctx, "surround_mixlev: {not written}\n");
1867 ff_dlog(avctx, "mixing_level: %ddB\n", opt->mixing_level);
1874 ff_dlog(avctx, "room_type: %s\n", strbuf);
1876 ff_dlog(avctx, "mixing_level: {not written}\n");
1877 ff_dlog(avctx, "room_type: {not written}\n");
1879 ff_dlog(avctx, "copyright: %s\n", opt->copyright?"on":"off");
1880 ff_dlog(avctx, "dialnorm: %ddB\n", opt->dialogue_level);
1888 ff_dlog(avctx, "dsur_mode: %s\n", strbuf);
1890 ff_dlog(avctx, "dsur_mode: {not written}\n");
1892 ff_dlog(avctx, "original: %s\n", opt->original?"on":"off");
1902 ff_dlog(avctx, "dmix_mode: %s\n", strbuf);
1903 ff_dlog(avctx, "ltrt_cmixlev: %0.3f (%d)\n",
1905 ff_dlog(avctx, "ltrt_surmixlev: %0.3f (%d)\n",
1907 ff_dlog(avctx, "loro_cmixlev: %0.3f (%d)\n",
1909 ff_dlog(avctx, "loro_surmixlev: %0.3f (%d)\n",
1912 ff_dlog(avctx, "extended bitstream info 1: {not written}\n");
1921 ff_dlog(avctx, "dsurex_mode: %s\n", strbuf);
1928 ff_dlog(avctx, "dheadphone_mode: %s\n", strbuf);
1935 ff_dlog(avctx, "ad_conv_type: %s\n", strbuf);
1937 ff_dlog(avctx, "extended bitstream info 2: {not written}\n");
1988 AVCodecContext *avctx = s->avctx;
2015 if (avctx->audio_service_type != AV_AUDIO_SERVICE_TYPE_MAIN)
2046 validate_mix_level(avctx, "center_mix_level", &opt->center_mix_level,
2051 validate_mix_level(avctx, "surround_mix_level", &opt->surround_mix_level,
2064 validate_mix_level(avctx, "ltrt_center_mix_level",
2069 validate_mix_level(avctx, "loro_center_mix_level",
2076 validate_mix_level(avctx, "ltrt_surround_mix_level",
2081 validate_mix_level(avctx, "loro_surround_mix_level",
2089 if ((avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_KARAOKE &&
2090 avctx->ch_layout.nb_channels == 1) ||
2091 ((avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_COMMENTARY ||
2092 avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_EMERGENCY ||
2093 avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_VOICE_OVER)
2094 && avctx->ch_layout.nb_channels > 1)) {
2095 av_log(avctx, AV_LOG_ERROR, "invalid audio service type for the "
2132 av_log(avctx, AV_LOG_ERROR, "mixing_level must be set if "
2137 av_log(avctx, AV_LOG_ERROR, "invalid mixing level. must be between "
2150 av_log(avctx, AV_LOG_WARNING, "alternate bitstream syntax is "
2167 * @param avctx Codec context
2169 av_cold int ff_ac3_encode_close(AVCodecContext *avctx)
2172 AC3EncodeContext *s = avctx->priv_data;
2216 static av_cold int set_channel_info(AVCodecContext *avctx)
2218 AC3EncodeContext *s = avctx->priv_data;
2219 int channels = avctx->ch_layout.nb_channels;
2220 uint64_t mask = avctx->ch_layout.u.mask;
2228 av_channel_layout_default(&avctx->ch_layout, channels);
2229 mask = avctx->ch_layout.u.mask;
2257 av_channel_layout_from_mask(&avctx->ch_layout, mask);
2265 AVCodecContext *avctx = s->avctx;
2269 if (!avctx->ch_layout.nb_channels) {
2270 av_log(avctx, AV_LOG_WARNING, "No channel layout specified. The "
2274 ret = set_channel_info(avctx);
2276 av_log(avctx, AV_LOG_ERROR, "invalid channel layout\n");
2286 if ((ff_ac3_sample_rate_tab[i % 3] >> (i / 3)) == avctx->sample_rate)
2290 av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n");
2293 s->sample_rate = avctx->sample_rate;
2299 if (!avctx->bit_rate) {
2301 case 1: avctx->bit_rate = 96000; break;
2302 case 2: avctx->bit_rate = 192000; break;
2303 case 3: avctx->bit_rate = 320000; break;
2304 case 4: avctx->bit_rate = 384000; break;
2305 case 5: avctx->bit_rate = 448000; break;
2324 if (avctx->bit_rate <= max_br)
2327 if (avctx->bit_rate < min_br || avctx->bit_rate > max_br) {
2328 av_log(avctx, AV_LOG_ERROR, "invalid bit rate. must be %d to %d "
2336 wpf = (avctx->bit_rate / 16) * frame_samples / s->sample_rate;
2345 long long br_dist = llabs(ff_ac3_bitrate_tab[i] * 1000 - avctx->bit_rate);
2354 while (wpf > 1 && wpf * s->sample_rate / AC3_FRAME_SIZE * 16 > avctx->bit_rate)
2362 long long diff = llabs(br - avctx->bit_rate);
2371 avctx->bit_rate = best_br;
2377 s->bit_rate = avctx->bit_rate;
2381 if (avctx->cutoff < 0) {
2382 av_log(avctx, AV_LOG_ERROR, "invalid cutoff frequency\n");
2385 s->cutoff = avctx->cutoff;
2564 av_cold int ff_ac3_encode_init(AVCodecContext *avctx)
2567 AC3EncodeContext *s = avctx->priv_data;
2570 s->avctx = avctx;
2572 s->eac3 = avctx->codec_id == AV_CODEC_ID_EAC3;
2578 avctx->frame_size = AC3_BLOCK_SIZE * s->num_blocks;
2579 avctx->initial_padding = AC3_BLOCK_SIZE;
2581 s->bitstream_mode = avctx->audio_service_type;
2616 ff_me_cmp_init(&s->mecc, avctx);
2617 ff_ac3dsp_init(&s->ac3dsp, avctx->flags & AV_CODEC_FLAG_BITEXACT);