wv.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. #ifndef AVFORMAT_WV_H
  21. #define AVFORMAT_WV_H
  22. #include <stdint.h>
  23. #define WV_HEADER_SIZE 32
  24. #define WV_FLAG_INITIAL_BLOCK (1 << 11)
  25. #define WV_FLAG_FINAL_BLOCK (1 << 12)
  26. // specs say that maximum block size is 1Mb
  27. #define WV_BLOCK_LIMIT 1048576
  28. typedef struct WvHeader {
  29. uint32_t blocksize; //< size of the block data (excluding the header)
  30. uint16_t version; //< bitstream version
  31. uint32_t total_samples; //< total number of samples in the stream
  32. uint32_t block_idx; //< index of the first sample in this block
  33. uint32_t samples; //< number of samples in this block
  34. uint32_t flags;
  35. uint32_t crc;
  36. int initial, final;
  37. } WvHeader;
  38. /**
  39. * Parse a WavPack block header.
  40. *
  41. * @param wv this struct will be filled with parse header information
  42. * @param data header data, must be WV_HEADER_SIZE bytes long
  43. *
  44. * @return 0 on success, a negative AVERROR code on failure
  45. */
  46. int ff_wv_parse_header(WvHeader *wv, const uint8_t *data);
  47. #endif /* AVFORMAT_WV_H */