theoradec.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* SPDX-License-Identifier: LGPL-2.1 OR BSD-3-Clause */
  2. /********************************************************************
  3. Copyright (C) 2002-2009 Xiph.org Foundation
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions
  6. are met:
  7. - Redistributions of source code must retain the above copyright
  8. notice, this list of conditions and the following disclaimer.
  9. - Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in the
  11. documentation and/or other materials provided with the distribution.
  12. - Neither the name of the Xiph.org Foundation nor the names of its
  13. contributors may be used to endorse or promote products derived from
  14. this software without specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  16. ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  17. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  18. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
  19. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  20. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  21. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  22. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  23. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  25. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. ********************************************************************/
  27. /**\file
  28. * The <tt>libtheoradec</tt> C decoding API.*/
  29. #if !defined(_O_THEORA_THEORADEC_H_)
  30. # define _O_THEORA_THEORADEC_H_ (1)
  31. # include <stddef.h>
  32. # include "codec.h"
  33. # include "decint.h"
  34. #if defined(__cplusplus)
  35. extern "C" {
  36. #endif
  37. /**The decoder context.*/
  38. typedef struct th_dec_ctx th_dec_ctx;
  39. typedef struct th_setup_info th_setup_info;
  40. typedef struct tho_ctx tho_ctx;
  41. struct tho_ctx
  42. {
  43. th_info ti;
  44. th_comment tc;
  45. th_setup_info *ts;
  46. th_dec_ctx *td;
  47. int32_t frame_skip_mode;
  48. };
  49. extern th_dec_ctx *th_decode_alloc(const th_info *_info, const th_setup_info *_setup);
  50. extern void th_setupsys_mem_free(th_setup_info *_setup);
  51. extern void th_decodesys_mem_free(th_dec_ctx *_dec);
  52. extern int32_t th_decode_headerin(th_info *_info,th_comment *_tc, th_setup_info **_setup,
  53. unsigned char *packet, int32_t packet_size);
  54. extern int32_t th_decode_packetin(th_dec_ctx *_dec,unsigned char *packet,
  55. int32_t packet_size, int64_t *_granpos);
  56. extern int32_t theora_parser_open(void *handle, unsigned char *header, int32_t header_size, int32_t* scaleInfo);
  57. extern int32_t theora_parser_end(void *handle);
  58. /* refer to 6.2.3.1 Stream Parsing in Programmer User Guide */
  59. extern int32_t theora_parser_frame(void *handle, unsigned char * chunkData,
  60. int32_t chunkSize);
  61. #if defined(__cplusplus)
  62. }
  63. #endif
  64. #endif