mpeghdec
FraunhoferIISMPEG-HDecoderLibrary
mpeghdecoder.h
Go to the documentation of this file.
1 /*-----------------------------------------------------------------------------
2 Software License for The Fraunhofer FDK MPEG-H Software
3 
4 Copyright (c) 2018 - 2023 Fraunhofer-Gesellschaft zur Förderung der angewandten
5 Forschung e.V. and Contributors
6 All rights reserved.
7 
8 1. INTRODUCTION
9 
10 The "Fraunhofer FDK MPEG-H Software" is software that implements the ISO/MPEG
11 MPEG-H 3D Audio standard for digital audio or related system features. Patent
12 licenses for necessary patent claims for the Fraunhofer FDK MPEG-H Software
13 (including those of Fraunhofer), for the use in commercial products and
14 services, may be obtained from the respective patent owners individually and/or
15 from Via LA (www.via-la.com).
16 
17 Fraunhofer supports the development of MPEG-H products and services by offering
18 additional software, documentation, and technical advice. In addition, it
19 operates the MPEG-H Trademark Program to ease interoperability testing of end-
20 products. Please visit www.mpegh.com for more information.
21 
22 2. COPYRIGHT LICENSE
23 
24 Redistribution and use in source and binary forms, with or without modification,
25 are permitted without payment of copyright license fees provided that you
26 satisfy the following conditions:
27 
28 * You must retain the complete text of this software license in redistributions
29 of the Fraunhofer FDK MPEG-H Software or your modifications thereto in source
30 code form.
31 
32 * You must retain the complete text of this software license in the
33 documentation and/or other materials provided with redistributions of
34 the Fraunhofer FDK MPEG-H Software or your modifications thereto in binary form.
35 You must make available free of charge copies of the complete source code of
36 the Fraunhofer FDK MPEG-H Software and your modifications thereto to recipients
37 of copies in binary form.
38 
39 * The name of Fraunhofer may not be used to endorse or promote products derived
40 from the Fraunhofer FDK MPEG-H Software without prior written permission.
41 
42 * You may not charge copyright license fees for anyone to use, copy or
43 distribute the Fraunhofer FDK MPEG-H Software or your modifications thereto.
44 
45 * Your modified versions of the Fraunhofer FDK MPEG-H Software must carry
46 prominent notices stating that you changed the software and the date of any
47 change. For modified versions of the Fraunhofer FDK MPEG-H Software, the term
48 "Fraunhofer FDK MPEG-H Software" must be replaced by the term "Third-Party
49 Modified Version of the Fraunhofer FDK MPEG-H Software".
50 
51 3. No PATENT LICENSE
52 
53 NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
54 limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
55 Fraunhofer provides no warranty of patent non-infringement with respect to this
56 software. You may use this Fraunhofer FDK MPEG-H Software or modifications
57 thereto only for purposes that are authorized by appropriate patent licenses.
58 
59 4. DISCLAIMER
60 
61 This Fraunhofer FDK MPEG-H Software is provided by Fraunhofer on behalf of the
62 copyright holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED
63 WARRANTIES, including but not limited to the implied warranties of
64 merchantability and fitness for a particular purpose. IN NO EVENT SHALL THE
65 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE for any direct, indirect,
66 incidental, special, exemplary, or consequential damages, including but not
67 limited to procurement of substitute goods or services; loss of use, data, or
68 profits, or business interruption, however caused and on any theory of
69 liability, whether in contract, strict liability, or tort (including
70 negligence), arising in any way out of the use of this software, even if
71 advised of the possibility of such damage.
72 
73 5. CONTACT INFORMATION
74 
75 Fraunhofer Institute for Integrated Circuits IIS
76 Attention: Division Audio and Media Technologies - MPEG-H FDK
77 Am Wolfsmantel 33
78 91058 Erlangen, Germany
79 www.iis.fraunhofer.de/amm
80 amm-info@iis.fraunhofer.de
81 -----------------------------------------------------------------------------*/
82 
83 #include <stdint.h>
84 #include <stdbool.h>
85 
86 #ifndef MPEGH_DECODER_TIMING_HANDLING_WRAPPER
87 #define MPEGH_DECODER_TIMING_HANDLING_WRAPPER
88 
94 #include "mpeghexport.h"
95 
96 #ifdef __cplusplus
97 extern "C" {
98 #endif
99 
103 typedef enum {
116 
120 typedef enum {
122  0x0000,
134  0x0001,
147  0x0002,
153  0x0003,
156  0x0004
164 
165 typedef struct MPEGH_DECODER_CONTEXT*
177  uint64_t ticks;
179  uint64_t pts;
181  int loudness;
187  bool isConcealed;
189 
196 MPEGHDEC_EXPORT HANDLE_MPEGH_DECODER_CONTEXT mpeghdecoder_init(int32_t cicpSetup);
197 
208 MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_setMhaConfig(HANDLE_MPEGH_DECODER_CONTEXT hCtx,
209  const uint8_t* config,
210  uint32_t configSize);
211 
218 MPEGHDEC_EXPORT void mpeghdecoder_destroy(HANDLE_MPEGH_DECODER_CONTEXT hCtx);
219 
233 MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_process(HANDLE_MPEGH_DECODER_CONTEXT hCtx,
234  const uint8_t* inData, uint32_t inLength,
235  uint64_t timestamp);
236 
252 MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_processTimescale(HANDLE_MPEGH_DECODER_CONTEXT hCtx,
253  const uint8_t* inData,
254  uint32_t inLength,
255  uint64_t timestamp,
256  uint32_t timescale);
257 
272 MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_getSamples(HANDLE_MPEGH_DECODER_CONTEXT hCtx,
273  int32_t* outData, uint32_t outLength,
274  MPEGH_DECODER_OUTPUT_INFO* outInfo);
275 
285 MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_flushAndGet(HANDLE_MPEGH_DECODER_CONTEXT hCtx);
286 
294 MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_flush(HANDLE_MPEGH_DECODER_CONTEXT hCtx);
295 
304 MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_setParam(HANDLE_MPEGH_DECODER_CONTEXT hCtx,
305  MPEGH_DECODER_PARAMETER param, int value);
306 
307 #ifdef __cplusplus
308 }
309 #endif
310 
311 #endif
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_flush(HANDLE_MPEGH_DECODER_CONTEXT hCtx)
Flush the decoder and discard all pending samples in the samples queue. This function should be used ...
This structure gives information about the currently decoded audio data. All fields are read-only...
Definition: mpeghdecoder.h:172
MPEGH_DECODER_PARAMETER
Options for handling of Dynamic Range Control (DRC) parameters.
Definition: mpeghdecoder.h:120
MPEGHDEC_EXPORT HANDLE_MPEGH_DECODER_CONTEXT mpeghdecoder_init(int32_t cicpSetup)
Open an MPEG-H decoder instance.
struct MPEGH_DECODER_OUTPUT_INFO MPEGH_DECODER_OUTPUT_INFO
This structure gives information about the currently decoded audio data. All fields are read-only...
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_setMhaConfig(HANDLE_MPEGH_DECODER_CONTEXT hCtx, const uint8_t *config, uint32_t configSize)
Explicitly configure the decoder by passing the MHA config contained in a binary buffer. This is required for MPEG-H MHA format bitstreams which have no in-band config.
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_setParam(HANDLE_MPEGH_DECODER_CONTEXT hCtx, MPEGH_DECODER_PARAMETER param, int value)
Set decoder parameter.
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_process(HANDLE_MPEGH_DECODER_CONTEXT hCtx, const uint8_t *inData, uint32_t inLength, uint64_t timestamp)
Fill MPEG-H decoder's internal input buffer with bitstream data from the external input buffer and ad...
MPEGH_DECODER_ERROR
MPEG-H decoder error codes.
Definition: mpeghdecoder.h:103
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_processTimescale(HANDLE_MPEGH_DECODER_CONTEXT hCtx, const uint8_t *inData, uint32_t inLength, uint64_t timestamp, uint32_t timescale)
Fill MPEG-H decoder's internal input buffer with bitstream data from the external input buffer and ad...
MPEGHDEC_EXPORT void mpeghdecoder_destroy(HANDLE_MPEGH_DECODER_CONTEXT hCtx)
De-allocate all resources of an MPEG-H decoder instance.
struct MPEGH_DECODER_CONTEXT * HANDLE_MPEGH_DECODER_CONTEXT
Definition: mpeghdecoder.h:165
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_flushAndGet(HANDLE_MPEGH_DECODER_CONTEXT hCtx)
Flush the decoder and push the flushed PCM samples into a samples queue. The decoded PCM samples can ...
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_getSamples(HANDLE_MPEGH_DECODER_CONTEXT hCtx, int32_t *outData, uint32_t outLength, MPEGH_DECODER_OUTPUT_INFO *outInfo)
Get a decoded audio frame.