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 TEXT_DESCRIPTIONS2_H_ 18 19 #define TEXT_DESCRIPTIONS2_H_ 20 21 #include <binder/Parcel.h> 22 #include <media/stagefright/foundation/ABase.h> 23 24 #include "mediaplayer2.pb.h" 25 26 using android::media::MediaPlayer2Proto::PlayerMessage; 27 28 namespace android { 29 30 class TextDescriptions2 { 31 public: 32 enum { 33 IN_BAND_TEXT_3GPP = 0x01, 34 OUT_OF_BAND_TEXT_SRT = 0x02, 35 36 GLOBAL_DESCRIPTIONS = 0x100, 37 LOCAL_DESCRIPTIONS = 0x200, 38 }; 39 40 static status_t getPlayerMessageOfDescriptions( 41 const uint8_t *data, ssize_t size, 42 uint32_t flags, int timeMs, PlayerMessage *playerMsg); 43 private: 44 TextDescriptions2(); 45 46 enum { 47 // These keys must be in sync with the keys in TimedText.java 48 KEY_DISPLAY_FLAGS = 1, // int 49 KEY_STYLE_FLAGS = 2, // int 50 KEY_BACKGROUND_COLOR_RGBA = 3, // int 51 KEY_HIGHLIGHT_COLOR_RGBA = 4, // int 52 KEY_SCROLL_DELAY = 5, // int 53 KEY_WRAP_TEXT = 6, // int 54 KEY_START_TIME = 7, // int 55 KEY_STRUCT_BLINKING_TEXT_LIST = 8, // List<CharPos> 56 KEY_STRUCT_FONT_LIST = 9, // List<Font> 57 KEY_STRUCT_HIGHLIGHT_LIST = 10, // List<CharPos> 58 KEY_STRUCT_HYPER_TEXT_LIST = 11, // List<HyperText> 59 KEY_STRUCT_KARAOKE_LIST = 12, // List<Karaoke> 60 KEY_STRUCT_STYLE_LIST = 13, // List<Style> 61 KEY_STRUCT_TEXT_POS = 14, // TextPos 62 KEY_STRUCT_JUSTIFICATION = 15, // Justification 63 KEY_STRUCT_TEXT = 16, // Text 64 65 KEY_GLOBAL_SETTING = 101, 66 KEY_LOCAL_SETTING = 102, 67 KEY_START_CHAR = 103, 68 KEY_END_CHAR = 104, 69 KEY_FONT_ID = 105, 70 KEY_FONT_SIZE = 106, 71 KEY_TEXT_COLOR_RGBA = 107, 72 }; 73 74 static status_t extractSRTLocalDescriptions( 75 const uint8_t *data, ssize_t size, 76 int timeMs, PlayerMessage *playerMsg); 77 static status_t extract3GPPGlobalDescriptions( 78 const uint8_t *data, ssize_t size, 79 PlayerMessage *playerMsg); 80 static status_t extract3GPPLocalDescriptions( 81 const uint8_t *data, ssize_t size, 82 int timeMs, PlayerMessage *playerMsg); 83 84 DISALLOW_EVIL_CONSTRUCTORS(TextDescriptions2); 85 }; 86 87 } // namespace android 88 #endif // TEXT_DESCRIPTIONS2_H_ 89