Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim:set ts=2 sw=2 sts=2 et cindent: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | #if !defined(OpusParser_h_) |
michael@0 | 7 | #define OpusParser_h_ |
michael@0 | 8 | |
michael@0 | 9 | #include <stdint.h> |
michael@0 | 10 | |
michael@0 | 11 | #include <opus/opus.h> |
michael@0 | 12 | #include "opus/opus_multistream.h" |
michael@0 | 13 | |
michael@0 | 14 | #include "nsTArray.h" |
michael@0 | 15 | #include "nsString.h" |
michael@0 | 16 | |
michael@0 | 17 | namespace mozilla { |
michael@0 | 18 | |
michael@0 | 19 | class OpusParser |
michael@0 | 20 | { |
michael@0 | 21 | public: |
michael@0 | 22 | OpusParser(); |
michael@0 | 23 | |
michael@0 | 24 | bool DecodeHeader(unsigned char* aData, size_t aLength); |
michael@0 | 25 | bool DecodeTags(unsigned char* aData, size_t aLength); |
michael@0 | 26 | |
michael@0 | 27 | // Various fields from the Ogg Opus header. |
michael@0 | 28 | int mRate; // Sample rate the decoder uses (always 48 kHz). |
michael@0 | 29 | uint32_t mNominalRate; // Original sample rate of the data (informational). |
michael@0 | 30 | int mChannels; // Number of channels the stream encodes. |
michael@0 | 31 | uint16_t mPreSkip; // Number of samples to strip after decoder reset. |
michael@0 | 32 | #ifdef MOZ_SAMPLE_TYPE_FLOAT32 |
michael@0 | 33 | float mGain; // Gain to apply to decoder output. |
michael@0 | 34 | #else |
michael@0 | 35 | int32_t mGain_Q16; // Gain to apply to the decoder output. |
michael@0 | 36 | #endif |
michael@0 | 37 | int mChannelMapping; // Channel mapping family. |
michael@0 | 38 | int mStreams; // Number of packed streams in each packet. |
michael@0 | 39 | int mCoupledStreams; // Number of packed coupled streams in each packet. |
michael@0 | 40 | unsigned char mMappingTable[255]; // Channel mapping table. |
michael@0 | 41 | |
michael@0 | 42 | // Granule position (end sample) of the last decoded Opus packet. This is |
michael@0 | 43 | // used to calculate the amount we should trim from the last packet. |
michael@0 | 44 | int64_t mPrevPacketGranulepos; |
michael@0 | 45 | |
michael@0 | 46 | nsTArray<nsCString> mTags; // Unparsed comment strings from the header. |
michael@0 | 47 | |
michael@0 | 48 | nsCString mVendorString; // Encoder vendor string from the header. |
michael@0 | 49 | |
michael@0 | 50 | }; |
michael@0 | 51 | |
michael@0 | 52 | } // namespace mozilla |
michael@0 | 53 | |
michael@0 | 54 | #endif |