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

Function libshine_encode_init

libavcodec/libshine.c:43–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41} SHINEContext;
42
43static av_cold int libshine_encode_init(AVCodecContext *avctx)
44{
45 SHINEContext *s = avctx->priv_data;
46
47 shine_set_config_mpeg_defaults(&s->config.mpeg);
48 if (avctx->bit_rate)
49 s->config.mpeg.bitr = avctx->bit_rate / 1000;
50 s->config.mpeg.mode = avctx->ch_layout.nb_channels == 2 ? STEREO : MONO;
51 s->config.wave.samplerate = avctx->sample_rate;
52 s->config.wave.channels = avctx->ch_layout.nb_channels == 2 ? PCM_STEREO : PCM_MONO;
53 if (shine_check_config(s->config.wave.samplerate, s->config.mpeg.bitr) < 0) {
54 av_log(avctx, AV_LOG_ERROR, "invalid configuration\n");
55 return AVERROR(EINVAL);
56 }
57 s->shine = shine_initialise(&s->config);
58 if (!s->shine)
59 return AVERROR(ENOMEM);
60 avctx->frame_size = shine_samples_per_pass(s->shine);
61 ff_af_queue_init(avctx, &s->afq);
62 return 0;
63}
64
65static int libshine_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
66 const AVFrame *frame, int *got_packet_ptr)

Callers

nothing calls this directly

Calls 2

av_logFunction · 0.85
ff_af_queue_initFunction · 0.85

Tested by

no test coverage detected