[FFmpeg-soc] [soc] G.723.1 Encoder: Encoder wireframe + highpass filter

Stefano Sabatini stefano.sabatini-lala at poste.it
Sat Aug 14 02:28:47 CEST 2010


On date Wednesday 2010-08-11 22:05:02 +0530, Mohamed Naufal encoded:
> ---
>  libavcodec/Makefile    |    1 +
>  libavcodec/allcodecs.c |    2 +-
>  libavcodec/g723_1.c    |   68 ++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 70 insertions(+), 1 deletions(-)
[...]
> --- a/libavcodec/g723_1.c
> +++ b/libavcodec/g723_1.c
> @@ -1075,3 +1075,71 @@ AVCodec g723_1_decoder = {
>      .long_name      = NULL_IF_CONFIG_SMALL("G.723.1"),
>      .capabilities   = CODEC_CAP_SUBFRAMES,
>  };
> +
> +#if CONFIG_G723_1_ENCODER
> +static av_cold int g723_1_encode_init(AVCodecContext *avctx)
> +{
> +    G723_1_Context *p = avctx->priv_data;
> +
> +    if (avctx->sample_rate != 8000) {
> +        av_log(avctx, AV_LOG_ERROR, "Only 8000Hz sample rate supported\n");
> +        return -1;
> +    }
> +
> +    if (avctx->channels != 1) {
> +        av_log(avctx, AV_LOG_ERROR, "Only mono supported\n");
> +        return -1;
> +    }
> +
> +    if (avctx->bit_rate == 6300) {
> +        p->cur_rate = Rate6k3;
> +    } else if (avctx->bit_rate == 5300) {
> +        p->cur_rate = Rate5k3;
> +    } else {
> +        av_log(avctx, AV_LOG_ERROR,
> +               "Bitrate not supported, use either 5.3k or 6.3k\n");
> +        return -1;

Uhm, please use AVERROR(EINVAL)/AVERROR_PATCHWELCOME rather than -1.

Regards.


More information about the FFmpeg-soc mailing list