1 /* 2 * Copyright 2015, The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef ANDROID_AUDIO_DTS_FRAME_SCANNER_H 18 #define ANDROID_AUDIO_DTS_FRAME_SCANNER_H 19 20 #include <stdint.h> 21 #include <audio_utils/spdif/FrameScanner.h> 22 23 namespace android { 24 25 #define DTS_NUM_SAMPLE_RATE_TABLE_ENTRIES 16 26 #define DTS_PCM_FRAMES_PER_BLOCK 32 27 #define DTS_MAX_BLOCKS_PER_SYNC_FRAME_BLOCK 128 28 29 class DTSFrameScanner : public FrameScanner 30 { 31 public: 32 DTSFrameScanner(); 33 virtual ~DTSFrameScanner(); 34 getMaxChannels()35 virtual int getMaxChannels() const { return 5 + 1; } 36 getMaxSampleFramesPerSyncFrame()37 virtual int getMaxSampleFramesPerSyncFrame() const { 38 return DTS_MAX_BLOCKS_PER_SYNC_FRAME_BLOCK * DTS_PCM_FRAMES_PER_BLOCK; 39 } 40 getSampleFramesPerSyncFrame()41 virtual int getSampleFramesPerSyncFrame() const { 42 return mSampleFramesPerSyncFrame; 43 } 44 isFirstInBurst()45 virtual bool isFirstInBurst() { return true; } isLastInBurst()46 virtual bool isLastInBurst() { return true; } resetBurst()47 virtual void resetBurst() { } 48 49 protected: 50 51 int mSampleFramesPerSyncFrame; 52 53 virtual bool parseHeader(); 54 55 static const uint8_t kSyncBytes[]; 56 static const int32_t kDTSSampleRateTable[]; 57 58 }; 59 60 } // namespace android 61 #endif // ANDROID_AUDIO_DTS_FRAME_SCANNER_H 62