On Mon, May 09, 2011 at 03:34:03PM +0200, Diego Biurrun wrote: > On Thu, May 05, 2011 at 09:41:27AM -0700, Aℓex Converse wrote: > > On Thu, May 5, 2011 at 2:39 AM, Diego Biurrun <di...@biurrun.de> wrote: > > > Please trim your quotes, thank you. > > > > Maybe if you sent a patch on top of the patch you hijacked there would > > be less to trim. > > For your perusal I attached the output of > > git diff -w s302m_alex:libavcodec/s302m.c s302m:libavcodec/s302m.c
Scratch that broken one, here comes the real deal. Diego
diff --git a/s302m_alex:libavcodec/s302m.c b/s302m:libavcodec/s302m.c index 3645aba..71bf002 100644 --- a/s302m_alex:libavcodec/s302m.c +++ b/s302m:libavcodec/s302m.c @@ -3,29 +3,30 @@ * Copyright (c) 2008 Laurent Aimar <fen...@videolan.org> * Copyright (c) 2009 Baptiste Coudurier <baptiste.coudur...@gmail.com> * - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * Libav is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * FFmpeg is distributed in the hope that it will be useful, + * Libav is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "avcodec.h" #include "libavutil/intreadwrite.h" +#include "avcodec.h" #define AES3_HEADER_LEN 4 -static int s302m_parse_frame_header(AVCodecContext *avctx, const uint8_t *buf, int buf_size) +static int s302m_parse_frame_header(AVCodecContext *avctx, const uint8_t *buf, + int buf_size) { uint32_t h; int frame_size, channels, id, bits; @@ -46,9 +47,9 @@ static int s302m_parse_frame_header(AVCodecContext *avctx, const uint8_t *buf, i h = AV_RB32(buf); frame_size = (h >> 16) & 0xffff; - channels = ((h >> 14) & 0x03) * 2 + 2; - id = (h >> 6) & 0xff; - bits = ((h >> 4) & 0x03) * 4 + 16; + channels = ((h >> 14) & 0x0003) * 2 + 2; + id = (h >> 6) & 0x00ff; + bits = ((h >> 4) & 0x0003) * 4 + 16; if (AES3_HEADER_LEN + frame_size != buf_size || bits > 24) { av_log(avctx, AV_LOG_ERROR, "frame has invalid header\n"); @@ -65,17 +66,18 @@ static int s302m_parse_frame_header(AVCodecContext *avctx, const uint8_t *buf, i avctx->channels = channels; avctx->sample_rate = 48000; avctx->bit_rate = 48000*avctx->channels*(avctx->bits_per_coded_sample+4) + - 32*(48000/(buf_size*8/(avctx->channels*(avctx->bits_per_coded_sample+4)))); + 32 * (48000 / (buf_size * 8 / + (avctx->channels * + (avctx->bits_per_coded_sample + 4)))); return frame_size; } -static int s302m_decode_frame(AVCodecContext *avctx, - void *data, int *data_size, - AVPacket *avpkt) +static int s302m_decode_frame(AVCodecContext *avctx, void *data, + int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; - int frame_size, buf_size = avpkt->size; + int buf_size = avpkt->size, frame_size; frame_size = s302m_parse_frame_header(avctx, buf, buf_size); if (frame_size < 0) @@ -134,8 +136,6 @@ AVCodec ff_s302m_decoder = { .type = AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_S302M, .priv_data_size = 0, - .init = NULL, - .close = NULL, .decode = s302m_decode_frame, .long_name = NULL_IF_CONFIG_SMALL("SMPTE 302M"), };
_______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel