On Mon, Sep 24, 2012 at 09:02:42PM -0600, Nathan Caldwell wrote:
>  
> --- /dev/null
> +++ b/libavcodec/libopus.h
> @@ -0,0 +1,43 @@
> +
> +static int ff_opus_error_to_averror(int err)
> +{
> +    switch (err) {
> +        case OPUS_BAD_ARG:
> +            return AVERROR(EINVAL);
> +        case OPUS_BUFFER_TOO_SMALL:
> +            return AVERROR_UNKNOWN;
> +        case OPUS_INTERNAL_ERROR:
> +            return AVERROR(EFAULT);
> +        case OPUS_INVALID_PACKET:
> +            return AVERROR_INVALIDDATA;
> +        case OPUS_UNIMPLEMENTED:
> +            return AVERROR(ENOSYS);
> +        case OPUS_INVALID_STATE:
> +            return AVERROR_UNKNOWN;
> +        case OPUS_ALLOC_FAIL:
> +            return AVERROR(ENOMEM);
> +        default:
> +            return AVERROR(EINVAL);
> +    }
> --- a/libavcodec/libopusdec.c
> +++ b/libavcodec/libopusdec.c
> @@ -34,28 +35,6 @@ struct libopus_context {
>  
> -static int opus_error_to_averror(int err)
> -{
> -    switch (err) {
> -    case OPUS_BAD_ARG:
> -        return AVERROR(EINVAL);
> -    case OPUS_BUFFER_TOO_SMALL:
> -        return AVERROR_UNKNOWN;
> -    case OPUS_INTERNAL_ERROR:
> -        return AVERROR(EFAULT);
> -    case OPUS_INVALID_PACKET:
> -        return AVERROR_INVALIDDATA;
> -    case OPUS_UNIMPLEMENTED:
> -        return AVERROR(ENOSYS);
> -    case OPUS_INVALID_STATE:
> -        return AVERROR_UNKNOWN;
> -    case OPUS_ALLOC_FAIL:
> -        return AVERROR(ENOMEM);
> -    default:
> -        return AVERROR(EINVAL);
> -    }

Please keep the indentation as K&R as it was ...

> --- /dev/null
> +++ b/libavcodec/libopusenc.c
> @@ -0,0 +1,393 @@
> +
> +typedef struct {
> +    int vbr;
> +    int application;
> +    int packet_loss;
> +    int complexity;
> +    float frame_duration;
> +    int packet_size;
> +} LibOpusEncOpts;
> +
> +typedef struct {
> +    AVClass *class;
> +    OpusMSEncoder *enc;
> +    int stream_count;
> +    uint8_t *samples;
> +    LibOpusEncOpts opts;
> +    AudioFrameQueue afq;
> +} LibOpusEncContext;

I'd give the structs a name, but that may be just me...

> +    frame_size = opus->opts.frame_duration * 48000 / 1000;
> +    switch (frame_size) {
> +        case 120:
> +        case 240:

K&R please

Diego

P.S.: Feel free to ignore me ...
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to