1 /* 2 * WavPack shared functions 3 * 4 * This file is part of FFmpeg. 5 * 6 * FFmpeg is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * FFmpeg is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with FFmpeg; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 21 #ifndef AVFORMAT_WV_H 22 #define AVFORMAT_WV_H 23 24 #include <stdint.h> 25 26 #define WV_HEADER_SIZE 32 27 28 #define WV_FLAG_INITIAL_BLOCK (1 << 11) 29 #define WV_FLAG_FINAL_BLOCK (1 << 12) 30 31 // specs say that maximum block size is 1Mb 32 #define WV_BLOCK_LIMIT 1048576 33 34 typedef struct WvHeader { 35 uint32_t blocksize; //< size of the block data (excluding the header) 36 uint16_t version; //< bitstream version 37 uint32_t total_samples; //< total number of samples in the stream 38 uint32_t block_idx; //< index of the first sample in this block 39 uint32_t samples; //< number of samples in this block 40 uint32_t flags; 41 uint32_t crc; 42 43 int initial, final; 44 } WvHeader; 45 46 /** 47 * Parse a WavPack block header. 48 * 49 * @param wv this struct will be filled with parse header information 50 * @param data header data, must be WV_HEADER_SIZE bytes long 51 * 52 * @return 0 on success, a negative AVERROR code on failure 53 */ 54 int ff_wv_parse_header(WvHeader *wv, const uint8_t *data); 55 56 #endif /* AVFORMAT_WV_H */ 57