1 /* 2 * Copyright (C) 2018 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 AUDIO_PRESENTATION_INFO_H_ 18 #define AUDIO_PRESENTATION_INFO_H_ 19 20 #include <map> 21 #include <sstream> 22 #include <stdint.h> 23 #include <vector> 24 25 #include <utils/Errors.h> 26 27 namespace android { 28 29 enum AudioPresentationVersion { 30 PRESENTATION_VERSION_UNDEFINED = 0, 31 PRESENTATION_VERSION_1, 32 }; 33 34 enum MasteringIndication { 35 MASTERING_NOT_INDICATED, 36 MASTERED_FOR_STEREO, 37 MASTERED_FOR_SURROUND, 38 MASTERED_FOR_3D, 39 MASTERED_FOR_HEADPHONE, 40 }; 41 42 struct AudioPresentation { 43 uint32_t mVersion = PRESENTATION_VERSION_UNDEFINED; 44 int32_t mPresentationId = -1; 45 int32_t mProgramId = -1; 46 std::map<std::string, std::string> mLabels; 47 std::string mLanguage; 48 MasteringIndication mMasteringIndication = MASTERING_NOT_INDICATED; 49 bool mAudioDescriptionAvailable = false; 50 bool mSpokenSubtitlesAvailable = false; 51 bool mDialogueEnhancementAvailable = false; 52 }; 53 54 struct AudioPresentationV1 : public AudioPresentation { AudioPresentationV1AudioPresentationV155 AudioPresentationV1() { 56 mVersion = PRESENTATION_VERSION_1; 57 } 58 }; 59 60 typedef std::vector<AudioPresentation> AudioPresentationCollection; 61 62 void serializeAudioPresentations(const AudioPresentationCollection& presentations, 63 std::ostream* serializedOutput); 64 status_t deserializeAudioPresentations(std::istream* serializedInput, 65 AudioPresentationCollection *presentations); 66 } // namespace android 67 68 #endif // AUDIO_PRESENTATION_INFO_H_ 69