On Fri, Dec 02, 2011 at 11:57:18AM +0200, Martin Storsjö wrote:
> From: Michael Niedermayer <[email protected]>
> 
> ---
>  libavcodec/nellymoserdec.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c
> index 278b6b3..aabd07b 100644
> --- a/libavcodec/nellymoserdec.c
> +++ b/libavcodec/nellymoserdec.c
> @@ -149,6 +149,7 @@ static int decode_tag(AVCodecContext * avctx,
>                        void *data, int *data_size,
>                        AVPacket *avpkt) {
>      const uint8_t *buf = avpkt->data;
> +    const uint8_t *side = av_packet_get_side_data(avpkt, 
> AV_PKT_DATA_FLV_FLAGS, NULL);
>      int buf_size = avpkt->size;
>      NellyMoserDecodeContext *s = avctx->priv_data;
>      int blocks, i, block_size;
> @@ -176,6 +177,16 @@ static int decode_tag(AVCodecContext * avctx,
>       * 22050 Hz - 4
>       * 44100 Hz - 8
>       */
> +    if (side) {
> +        if ((side[0] & 0xf0) == 0x60) { // Custom sample rate
> +            if (blocks > 1 && (1 << ((side[0] >> 2) & 3)) == blocks)
> +                avctx->sample_rate = 11025*(blocks/2);

Give operators some room to breathe.
Beside that the whole patchset LGTM

> +        } else if ((side[0] & 0xf0) == 0x50 && blocks == 1) {
> +            avctx->sample_rate = 8000;
> +        } else if ((side[0] & 0xf0) == 0x40 && blocks == 3) {
> +            avctx->sample_rate = 16000;
> +        }
> +    }
>  
>      for (i=0 ; i<blocks ; i++) {
>          if (avctx->sample_fmt == SAMPLE_FMT_FLT) {
> -- 
> 1.7.3.1
> 
> _______________________________________________
> libav-devel mailing list
> [email protected]
> https://lists.libav.org/mailman/listinfo/libav-devel
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to