Lines Matching defs:avctx
46 static av_cold int libgsm_encode_close(AVCodecContext *avctx) {
47 gsm_destroy(avctx->priv_data);
48 avctx->priv_data = NULL;
52 static av_cold int libgsm_encode_init(AVCodecContext *avctx) {
53 if (avctx->sample_rate != 8000) {
54 av_log(avctx, AV_LOG_ERROR, "Sample rate 8000Hz required for GSM, got %dHz\n",
55 avctx->sample_rate);
56 if (avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL)
59 if (avctx->bit_rate != 13000 /* Official */ &&
60 avctx->bit_rate != 13200 /* Very common */ &&
61 avctx->bit_rate != 0 /* Unknown; a.o. mov does not set bitrate when decoding */ ) {
62 av_log(avctx, AV_LOG_ERROR, "Bitrate 13000bps required for GSM, got %"PRId64"bps\n",
63 avctx->bit_rate);
64 if (avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL)
68 avctx->priv_data = gsm_create();
69 if (!avctx->priv_data)
72 switch(avctx->codec_id) {
74 avctx->frame_size = GSM_FRAME_SIZE;
75 avctx->block_align = GSM_BLOCK_SIZE;
79 gsm_option(avctx->priv_data, GSM_OPT_WAV49, &one);
80 avctx->frame_size = 2*GSM_FRAME_SIZE;
81 avctx->block_align = GSM_MS_BLOCK_SIZE;
87 libgsm_encode_close(avctx);
91 static int libgsm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
96 struct gsm_state *state = avctx->priv_data;
98 if ((ret = ff_get_encode_buffer(avctx, avpkt, avctx->block_align, 0)) < 0)
101 switch(avctx->codec_id) {