On Mon, 27 May 2013 19:36:43 +0200, Kostya Shishkov <[email protected]> wrote: > On Mon, May 27, 2013 at 07:20:38PM +0200, Anton Khirnov wrote: > > This way we don't require the caller to parse the block header. It also > > allows the sample rate to change mid-stream. > > --- > > libavcodec/wavpack.c | 68 > > ++++++++++++++++++++++++++++++++------------------ > > 1 file changed, 44 insertions(+), 24 deletions(-) > > > > diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c > > index 4cf9478..673c085 100644 > > --- a/libavcodec/wavpack.c > > +++ b/libavcodec/wavpack.c > > @@ -51,7 +51,7 @@ > > #define WV_FLT_ZERO_SIGN 0x10 > > > > enum WP_ID_Flags { > > - WP_IDF_MASK = 0x1F, > > + WP_IDF_MASK = 0x3F, > > ??? > > > WP_IDF_IGNORE = 0x20, > > WP_IDF_ODD = 0x40, > > WP_IDF_LONG = 0x80 > > @@ -71,7 +71,8 @@ enum WP_ID { > > WP_ID_DATA, > > WP_ID_CORR, > > WP_ID_EXTRABITS, > > - WP_ID_CHANINFO > > + WP_ID_CHANINFO, > > + WP_ID_SAMPLE_RATE = 0x27, > > }; > > > > typedef struct SavedContext { > > @@ -140,6 +141,11 @@ typedef struct WavpackContext { > > int ch_offset; > > } WavpackContext; > > > > +static const int wv_rates[16] = { > > + 6000, 8000, 9600, 11025, 12000, 16000, 22050, 24000, > > + 32000, 44100, 48000, 64000, 88200, 96000, 192000, 0 > > +}; > > + > > // exponent table copied from WavPack source > > static const uint8_t wp_exp2_table[256] = { > > 0x00, 0x01, 0x01, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x06, 0x07, > > 0x08, 0x08, 0x09, 0x0a, 0x0b, > > @@ -742,7 +748,7 @@ static av_cold int wavpack_decode_end(AVCodecContext > > *avctx) > > } > > > > static int wavpack_decode_block(AVCodecContext *avctx, int block_no, > > - uint8_t **data, const uint8_t *buf, int > > buf_size) > > + AVFrame *frame, const uint8_t *buf, int > > buf_size) > > { > > WavpackContext *wc = avctx->priv_data; > > WavpackFrameContext *s; > > @@ -752,7 +758,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, > > int block_no, > > int got_terms = 0, got_weights = 0, got_samples = 0, > > got_entropy = 0, got_bs = 0, got_float = 0, got_hybrid = 0; > > int i, j, id, size, ssize, weights, t; > > - int bpp, chan, chmask, orig_bpp; > > + int bpp, chan, chmask, orig_bpp, sample_rate = 0; > > > > if (block_no >= wc->fdec_num && wv_alloc_frame_context(wc) < 0) { > > av_log(avctx, AV_LOG_ERROR, "Error creating frame decode > > context\n"); > > @@ -794,12 +800,6 @@ static int wavpack_decode_block(AVCodecContext *avctx, > > int block_no, > > s->hybrid_minclip = ((-1LL << (orig_bpp - 1))); > > s->CRC = bytestream2_get_le32(&gb); > > > > - samples_l = data[wc->ch_offset]; > > - if (s->stereo) > > - samples_r = data[wc->ch_offset + 1]; > > - > > - wc->ch_offset += 1 + s->stereo; > > - > > // parse metadata blocks > > while (bytestream2_get_bytes_left(&gb)) { > > id = bytestream2_get_byte(&gb); > > @@ -822,11 +822,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, > > int block_no, > > "Block size %i is out of bounds\n", size); > > break; > > } > > - if (id & WP_IDF_IGNORE) { > > - bytestream2_skip(&gb, ssize); > > - continue; > > - } > > - switch (id & WP_IDF_MASK) { > > + switch (id & 0x3f) { > > ??? >
Indeed, excuse a brainfart. -- Anton Khirnov _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
