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