| 1 | /******************************************************************** |
| 2 | * * |
| 3 | * THIS FILE IS PART OF THE libopusfile SOFTWARE CODEC SOURCE CODE. * |
| 4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * |
| 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * |
| 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * |
| 7 | * * |
| 8 | * THE libopusfile SOURCE CODE IS (C) COPYRIGHT 2012-2020 * |
| 9 | * by the Xiph.Org Foundation and contributors https://xiph.org/ * |
| 10 | * * |
| 11 | ********************************************************************/ |
| 12 | #if !defined(_opusfile_internal_h) |
| 13 | # define _opusfile_internal_hcxx . . $ `external/opusfile/opusfile_internal.h:13:10`! (1) |
| 14 | |
| 15 | # if !defined(_REENTRANTcxx . . $ `<built-in>:465:9`!) |
| 16 | # define _REENTRANT |
| 17 | # endif |
| 18 | # if !defined(_GNU_SOURCEcxx . . $ `<built-in>:466:9`!) |
| 19 | # define _GNU_SOURCE |
| 20 | # endif |
| 21 | # if !defined(_LARGEFILE_SOURCEcxx . . $ `<external>/18206667465210621810/features.h:383:11`!) |
| 22 | # define _LARGEFILE_SOURCEcxx . . $ `external/opusfile/opusfile_internal.h:22:11`! |
| 23 | # endif |
| 24 | # if !defined(_LARGEFILE64_SOURCEcxx . . $ `<external>/18206667465210621810/features.h:232:10`!) |
| 25 | # define _LARGEFILE64_SOURCEcxx . . $ `external/opusfile/opusfile_internal.h:25:11`! |
| 26 | # endif |
| 27 | # if !defined(_FILE_OFFSET_BITScxx . . $ `<built-in>:481:9`!) |
| 28 | # define _FILE_OFFSET_BITS 64 |
| 29 | # endif |
| 30 | |
| 31 | //# include <stdlib.h> |
| 32 | # include "opusfile.h"cxx . . $ `<file>/external/opusfile/opusfile.h`/ |
| 33 | |
| 34 | typedef struct OggOpusLinkcxx . . $ OggOpusLink# OggOpusLinkcxx . . $ OggOpusLink#; |
| 35 | |
| 36 | # if defined(OP_FIXED_POINT) |
| 37 | |
| 38 | typedef opus_int16 op_sample; |
| 39 | |
| 40 | # else |
| 41 | |
| 42 | typedef float op_samplecxx . . $ op_sample#; |
| 43 | |
| 44 | /*We're using this define to test for libopus 1.1 or later until libopus |
| 45 | provides a better mechanism.*/ |
| 46 | # if defined(OPUS_GET_EXPERT_FRAME_DURATION_REQUESTcxx . . $ `external/opusfile/opus/opus_defines.h:165:9`!) |
| 47 | /*Enable soft clipping prevention in 16-bit decodes.*/ |
| 48 | # define OP_SOFT_CLIPcxx . . $ `external/opusfile/opusfile_internal.h:48:12`! (1) |
| 49 | # endif |
| 50 | |
| 51 | # endif |
| 52 | |
| 53 | # if OP_GNUC_PREREQcxx . . $ `external/opusfile/opusfile.h:118:12`!(4,2) |
| 54 | /*Disable excessive warnings about the order of operations.*/ |
| 55 | # pragma GCC diagnostic ignored "-Wparentheses" |
| 56 | # elif defined(_MSC_VER) |
| 57 | /*Disable excessive warnings about the order of operations.*/ |
| 58 | # pragma warning(disable:4554) |
| 59 | /*Disable warnings about "deprecated" POSIX functions.*/ |
| 60 | # pragma warning(disable:4996) |
| 61 | # endif |
| 62 | |
| 63 | # if OP_GNUC_PREREQcxx . . $ `external/opusfile/opusfile.h:118:12`!(3,0) |
| 64 | /*Another alternative is |
| 65 | (__builtin_constant_p(_x)?!!(_x):__builtin_expect(!!(_x),1)) |
| 66 | but that evaluates _x multiple times, which may be bad.*/ |
| 67 | # define OP_LIKELYcxx . . $ `external/opusfile/opusfile_internal.h:67:11`!(_x) (__builtin_expect(!!(_x),1)) |
| 68 | # define OP_UNLIKELYcxx . . $ `external/opusfile/opusfile_internal.h:68:11`!(_x) (__builtin_expect(!!(_x),0)) |
| 69 | # else |
| 70 | # define OP_LIKELY(_x) (!!(_x)) |
| 71 | # define OP_UNLIKELY(_x) (!!(_x)) |
| 72 | # endif |
| 73 | |
| 74 | # if defined(OP_ENABLE_ASSERTIONS) |
| 75 | # if OP_GNUC_PREREQ(2,5)||__SUNPRO_C>=0x590 |
| 76 | __attribute__((noreturn)) |
| 77 | # endif |
| 78 | void op_fatal_impl(const char *_str,const char *_file,int _line); |
| 79 | |
| 80 | # define OP_FATAL(_str) (op_fatal_impl(_str,__FILE__,__LINE__)) |
| 81 | |
| 82 | # define OP_ASSERT(_cond) \ |
| 83 | do{ \ |
| 84 | if(OP_UNLIKELY(!(_cond)))OP_FATAL("assertion failed: " #_cond); \ |
| 85 | } \ |
| 86 | while(0) |
| 87 | # define OP_ALWAYS_TRUE(_cond) OP_ASSERT(_cond) |
| 88 | |
| 89 | # else |
| 90 | # define OP_FATALcxx . . $ `external/opusfile/opusfile_internal.h:90:11`!(_str) abort() |
| 91 | # define OP_ASSERTcxx . . $ `external/opusfile/opusfile_internal.h:91:11`!(_cond) |
| 92 | # define OP_ALWAYS_TRUEcxx . . $ `external/opusfile/opusfile_internal.h:92:11`!(_cond) ((void)(_cond)) |
| 93 | # endif |
| 94 | |
| 95 | # define OP_INT64_MAXcxx . . $ `external/opusfile/opusfile_internal.h:95:10`! (2*(((ogg_int64_t)1<<62)-1)|1) |
| 96 | # define OP_INT64_MINcxx . . $ `external/opusfile/opusfile_internal.h:96:10`! (-OP_INT64_MAXcxx . . $ `external/opusfile/opusfile_internal.h:95:10`!-1) |
| 97 | # define OP_INT32_MAXcxx . . $ `external/opusfile/opusfile_internal.h:97:10`! (2*(((ogg_int32_t)1<<30)-1)|1) |
| 98 | # define OP_INT32_MINcxx . . $ `external/opusfile/opusfile_internal.h:98:10`! (-OP_INT32_MAX-1) |
| 99 | |
| 100 | # define OP_MINcxx . . $ `external/opusfile/opusfile_internal.h:100:10`!(_a,_b) ((_a)<(_b)?(_a):(_b)) |
| 101 | # define OP_MAXcxx . . $ `external/opusfile/opusfile_internal.h:101:10`!(_a,_b) ((_a)>(_b)?(_a):(_b)) |
| 102 | # define OP_CLAMPcxx . . $ `external/opusfile/opusfile_internal.h:102:10`!(_lo,_x,_hi) (OP_MAXcxx . . $ `external/opusfile/opusfile_internal.h:101:10`!(_lo,OP_MINcxx . . $ `external/opusfile/opusfile_internal.h:100:10`!(_x,_hi))) |
| 103 | |
| 104 | /*Advance a file offset by the given amount, clamping against OP_INT64_MAX. |
| 105 | This is used to advance a known offset by things like OP_CHUNK_SIZE or |
| 106 | OP_PAGE_SIZE_MAX, while making sure to avoid signed overflow. |
| 107 | It assumes that both _offset and _amount are non-negative.*/ |
| 108 | #define OP_ADV_OFFSETcxx . . $ `external/opusfile/opusfile_internal.h:108:9`!(_offset,_amount) \ |
| 109 | (OP_MINcxx . . $ `external/opusfile/opusfile_internal.h:100:10`!(_offset,OP_INT64_MAXcxx . . $ `external/opusfile/opusfile_internal.h:95:10`!-(_amount))+(_amount)) |
| 110 | |
| 111 | /*The maximum channel count for any mapping we'll actually decode.*/ |
| 112 | # define OP_NCHANNELS_MAXcxx . . $ `external/opusfile/opusfile_internal.h:112:10`! (8) |
| 113 | |
| 114 | /*Initial state.*/ |
| 115 | # define OP_NOTOPENcxx . . $ `external/opusfile/opusfile_internal.h:115:11`! (0) |
| 116 | /*We've found the first Opus stream in the first link.*/ |
| 117 | # define OP_PARTOPENcxx . . $ `external/opusfile/opusfile_internal.h:117:11`! (1) |
| 118 | # define OP_OPENEDcxx . . $ `external/opusfile/opusfile_internal.h:118:11`! (2) |
| 119 | /*We've found the first Opus stream in the current link.*/ |
| 120 | # define OP_STREAMSETcxx . . $ `external/opusfile/opusfile_internal.h:120:11`! (3) |
| 121 | /*We've initialized the decoder for the chosen Opus stream in the current |
| 122 | link.*/ |
| 123 | # define OP_INITSETcxx . . $ `external/opusfile/opusfile_internal.h:123:11`! (4) |
| 124 | |
| 125 | /*Information cached for a single link in a chained Ogg Opus file. |
| 126 | We choose the first Opus stream encountered in each link to play back (and |
| 127 | require at least one).*/ |
| 128 | struct OggOpusLinkcxx . . $ OggOpusLink#{ |
| 129 | /*The byte offset of the first header page in this link.*/ |
| 130 | opus_int64cxx . . $ opus_int64# offsetcxx . . $ OggOpusLink#offset.; |
| 131 | /*The byte offset of the first data page from the chosen Opus stream in this |
| 132 | link (after the headers).*/ |
| 133 | opus_int64cxx . . $ opus_int64# data_offsetcxx . . $ OggOpusLink#data_offset.; |
| 134 | /*The byte offset of the last page from the chosen Opus stream in this link. |
| 135 | This is used when seeking to ensure we find a page before the last one, so |
| 136 | that end-trimming calculations work properly. |
| 137 | This is only valid for seekable sources.*/ |
| 138 | opus_int64cxx . . $ opus_int64# end_offsetcxx . . $ OggOpusLink#end_offset.; |
| 139 | /*The total duration of all prior links. |
| 140 | This is always zero for non-seekable sources.*/ |
| 141 | ogg_int64_tcxx . . $ ogg_int64_t# pcm_file_offsetcxx . . $ OggOpusLink#pcm_file_offset.; |
| 142 | /*The granule position of the last sample. |
| 143 | This is only valid for seekable sources.*/ |
| 144 | ogg_int64_tcxx . . $ ogg_int64_t# pcm_endcxx . . $ OggOpusLink#pcm_end.; |
| 145 | /*The granule position before the first sample.*/ |
| 146 | ogg_int64_tcxx . . $ ogg_int64_t# pcm_startcxx . . $ OggOpusLink#pcm_start.; |
| 147 | /*The serial number.*/ |
| 148 | ogg_uint32_tcxx . . $ ogg_uint32_t# serialnocxx . . $ OggOpusLink#serialno.; |
| 149 | /*The contents of the info header.*/ |
| 150 | OpusHeadcxx . . $ OpusHead# headcxx . . $ OggOpusLink#head.; |
| 151 | /*The contents of the comment header.*/ |
| 152 | OpusTagscxx . . $ OpusTags# tagscxx . . $ OggOpusLink#tags.; |
| 153 | }; |
| 154 | |
| 155 | struct OggOpusFilecxx . . $ OggOpusFile#{ |
| 156 | /*The callbacks used to access the stream.*/ |
| 157 | OpusFileCallbackscxx . . $ OpusFileCallbacks# callbackscxx . . $ OggOpusFile#callbacks.; |
| 158 | /*A FILE *, memory buffer, etc.*/ |
| 159 | void *streamcxx . . $ OggOpusFile#stream.; |
| 160 | /*Whether or not we can seek with this stream.*/ |
| 161 | int seekablecxx . . $ OggOpusFile#seekable.; |
| 162 | /*The number of links in this chained Ogg Opus file.*/ |
| 163 | int nlinkscxx . . $ OggOpusFile#nlinks.; |
| 164 | /*The cached information from each link in a chained Ogg Opus file. |
| 165 | If stream isn't seekable (e.g., it's a pipe), only the current link |
| 166 | appears.*/ |
| 167 | OggOpusLinkcxx . . $ OggOpusLink# *linkscxx . . $ OggOpusFile#links.; |
| 168 | /*The number of serial numbers from a single link.*/ |
| 169 | int nserialnoscxx . . $ OggOpusFile#nserialnos.; |
| 170 | /*The capacity of the list of serial numbers from a single link.*/ |
| 171 | int cserialnoscxx . . $ OggOpusFile#cserialnos.; |
| 172 | /*Storage for the list of serial numbers from a single link. |
| 173 | This is a scratch buffer used when scanning the BOS pages at the start of |
| 174 | each link.*/ |
| 175 | ogg_uint32_tcxx . . $ ogg_uint32_t# *serialnoscxx . . $ OggOpusFile#serialnos.; |
| 176 | /*This is the current offset of the data processed by the ogg_sync_state. |
| 177 | After a seek, this should be set to the target offset so that we can track |
| 178 | the byte offsets of subsequent pages. |
| 179 | After a call to op_get_next_page(), this will point to the first byte after |
| 180 | that page.*/ |
| 181 | opus_int64cxx . . $ opus_int64# offsetcxx . . $ OggOpusFile#offset.; |
| 182 | /*The total size of this stream, or -1 if it's unseekable.*/ |
| 183 | opus_int64cxx . . $ opus_int64# endcxx . . $ OggOpusFile#end.; |
| 184 | /*Used to locate pages in the stream.*/ |
| 185 | ogg_sync_statecxx . . $ ogg_sync_state# oycxx . . $ OggOpusFile#oy.; |
| 186 | /*One of OP_NOTOPEN, OP_PARTOPEN, OP_OPENED, OP_STREAMSET, OP_INITSET.*/ |
| 187 | int ready_statecxx . . $ OggOpusFile#ready_state.; |
| 188 | /*The current link being played back.*/ |
| 189 | int cur_linkcxx . . $ OggOpusFile#cur_link.; |
| 190 | /*The number of decoded samples to discard from the start of decoding.*/ |
| 191 | opus_int32cxx . . $ opus_int32# cur_discard_countcxx . . $ OggOpusFile#cur_discard_count.; |
| 192 | /*The granule position of the previous packet (current packet start time).*/ |
| 193 | ogg_int64_tcxx . . $ ogg_int64_t# prev_packet_gpcxx . . $ OggOpusFile#prev_packet_gp.; |
| 194 | /*The stream offset of the most recent page with completed packets, or -1. |
| 195 | This is only needed to recover continued packet data in the seeking logic, |
| 196 | when we use the current position as one of our bounds, only to later |
| 197 | discover it was the correct starting point.*/ |
| 198 | opus_int64cxx . . $ opus_int64# prev_page_offsetcxx . . $ OggOpusFile#prev_page_offset.; |
| 199 | /*The number of bytes read since the last bitrate query, including framing.*/ |
| 200 | opus_int64cxx . . $ opus_int64# bytes_trackedcxx . . $ OggOpusFile#bytes_tracked.; |
| 201 | /*The number of samples decoded since the last bitrate query.*/ |
| 202 | ogg_int64_tcxx . . $ ogg_int64_t# samples_trackedcxx . . $ OggOpusFile#samples_tracked.; |
| 203 | /*Takes physical pages and welds them into a logical stream of packets.*/ |
| 204 | ogg_stream_statecxx . . $ ogg_stream_state# oscxx . . $ OggOpusFile#os.; |
| 205 | /*Re-timestamped packets from a single page. |
| 206 | Buffering these relies on the undocumented libogg behavior that ogg_packet |
| 207 | pointers remain valid until the next page is submitted to the |
| 208 | ogg_stream_state they came from.*/ |
| 209 | ogg_packetcxx . . $ ogg_packet# opcxx . . $ OggOpusFile#op.[255]; |
| 210 | /*The index of the next packet to return.*/ |
| 211 | int op_poscxx . . $ OggOpusFile#op_pos.; |
| 212 | /*The total number of packets available.*/ |
| 213 | int op_countcxx . . $ OggOpusFile#op_count.; |
| 214 | /*Central working state for the packet-to-PCM decoder.*/ |
| 215 | OpusMSDecoder *odcxx . . $ OggOpusFile#od.; |
| 216 | /*The application-provided packet decode callback.*/ |
| 217 | op_decode_cb_funccxx . . $ op_decode_cb_func# decode_cbcxx . . $ OggOpusFile#decode_cb.; |
| 218 | /*The application-provided packet decode callback context.*/ |
| 219 | void *decode_cb_ctxcxx . . $ OggOpusFile#decode_cb_ctx.; |
| 220 | /*The stream count used to initialize the decoder.*/ |
| 221 | int od_stream_countcxx . . $ OggOpusFile#od_stream_count.; |
| 222 | /*The coupled stream count used to initialize the decoder.*/ |
| 223 | int od_coupled_countcxx . . $ OggOpusFile#od_coupled_count.; |
| 224 | /*The channel count used to initialize the decoder.*/ |
| 225 | int od_channel_countcxx . . $ OggOpusFile#od_channel_count.; |
| 226 | /*The channel mapping used to initialize the decoder.*/ |
| 227 | unsigned char od_mappingcxx . . $ OggOpusFile#od_mapping.[OP_NCHANNELS_MAXcxx . . $ `external/opusfile/opusfile_internal.h:112:10`!]; |
| 228 | /*The buffered data for one decoded packet.*/ |
| 229 | op_samplecxx . . $ op_sample# *od_buffercxx . . $ OggOpusFile#od_buffer.; |
| 230 | /*The current position in the decoded buffer.*/ |
| 231 | int od_buffer_poscxx . . $ OggOpusFile#od_buffer_pos.; |
| 232 | /*The number of valid samples in the decoded buffer.*/ |
| 233 | int od_buffer_sizecxx . . $ OggOpusFile#od_buffer_size.; |
| 234 | /*The type of gain offset to apply. |
| 235 | One of OP_HEADER_GAIN, OP_ALBUM_GAIN, OP_TRACK_GAIN, or OP_ABSOLUTE_GAIN.*/ |
| 236 | int gain_typecxx . . $ OggOpusFile#gain_type.; |
| 237 | /*The offset to apply to the gain.*/ |
| 238 | opus_int32cxx . . $ opus_int32# gain_offset_q8cxx . . $ OggOpusFile#gain_offset_q8.; |
| 239 | /*Internal state for soft clipping and dithering float->short output.*/ |
| 240 | #if !defined(OP_FIXED_POINT) |
| 241 | # if defined(OP_SOFT_CLIPcxx . . $ `external/opusfile/opusfile_internal.h:48:12`!) |
| 242 | float clip_statecxx . . $ OggOpusFile#clip_state.[OP_NCHANNELS_MAXcxx . . $ `external/opusfile/opusfile_internal.h:112:10`!]; |
| 243 | # endif |
| 244 | float dither_acxx . . $ OggOpusFile#dither_a.[OP_NCHANNELS_MAXcxx . . $ `external/opusfile/opusfile_internal.h:112:10`!*4]; |
| 245 | float dither_bcxx . . $ OggOpusFile#dither_b.[OP_NCHANNELS_MAXcxx . . $ `external/opusfile/opusfile_internal.h:112:10`!*4]; |
| 246 | opus_uint32cxx . . $ opus_uint32# dither_seedcxx . . $ OggOpusFile#dither_seed.; |
| 247 | int dither_mutecxx . . $ OggOpusFile#dither_mute.; |
| 248 | int dither_disabledcxx . . $ OggOpusFile#dither_disabled.; |
| 249 | /*The number of channels represented by the internal state. |
| 250 | This gets set to 0 whenever anything that would prevent state propagation |
| 251 | occurs (switching between the float/short APIs, or between the |
| 252 | stereo/multistream APIs).*/ |
| 253 | int state_channel_countcxx . . $ OggOpusFile#state_channel_count.; |
| 254 | #endif |
| 255 | }; |
| 256 | |
| 257 | int op_strncasecmpcxx . . $ op_strncasecmp(f0be30763a490cce).(const char *_a,const char *_b,int _n); |
| 258 | |
| 259 | #endif |