RDK Documentation (Open Sourced RDK Components)
TextStyleAttributes.h
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's license file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2022 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 /**
20  * @file TextStyleAttributes.h
21  *
22  * @brief This file provides class and other definition related to subtitle text attributes
23  *
24  */
25 
26 #pragma once
27 
28 #include <string.h>
29 #include <array>
30 #include "AampLogManager.h"
31 #include "AampConfig.h"
32 #include "SubtecAttribute.hpp"
33 
35 {
36 
37 public:
38  /**
39  * @enum FontSize
40  * @brief Available Fontsize
41  */
42  typedef enum FontSize {
43  FONT_SIZE_EMBEDDED = -1, /* Corresponds to Font size of auto */
44  FONT_SIZE_SMALL,
45  FONT_SIZE_STANDARD,
46  FONT_SIZE_LARGE,
47  FONT_SIZE_EXTRALARGE,
48  FONT_SIZE_MAX
49  } FontSize;
50  /**
51  * @enum AttribPosInArray
52  * @brief Provides the indexing postion in array for attributes
53  */
54  typedef enum AttribPosInArray {
55  FONT_SIZE_ARR_POSITION = 5,
57 
59 
60  /**
61  * @fn getAttributes
62  * @param[in] options - Json string containing the attributes
63  * @param[out] attributesValues - Extracted Attribute values (for now they are font size and position)
64  * @param[out] attributesMask - Mask corresponding to extracted attribute values
65  * @return int - 0 for success, -1 for failure
66  */
67  int getAttributes(std::string options, attributesType &attributesValues, uint32_t &attributesMask);
68 
69 private:
70  /**
71  * @struct Attributes
72  * @brief Attributes, so far fontSize only.
73  */
74  struct Attributes {
75  FontSize fontSize;
76  };
77 
78  /**
79  * @fn getFontSize
80  * @param[in] input - input font size value
81  * @param[out] fontSizeOut - font size option for the input value
82  * @return int - 0 for success, -1 for failure
83  */
84  int getFontSize(std::string input, FontSize *fontSizeOut);
85 
86  AampLogManager* mLogObj;
87 };
88 
AampLogManager.h
Log managed for Aamp.
SubtecAttribute.hpp
This file has been created to provide common definition related to Attribute.
TextStyleAttributes::Attributes
Attributes, so far fontSize only.
Definition: TextStyleAttributes.h:74
AampLogManager
AampLogManager Class.
Definition: AampLogManager.h:150
TextStyleAttributes::getFontSize
int getFontSize(std::string input, FontSize *fontSizeOut)
Get font size value from input string.
Definition: TextStyleAttributes.cpp:46
TextStyleAttributes::FontSize
FontSize
Available Fontsize.
Definition: TextStyleAttributes.h:42
TextStyleAttributes
Definition: TextStyleAttributes.h:34
TextStyleAttributes::getAttributes
int getAttributes(std::string options, attributesType &attributesValues, uint32_t &attributesMask)
Gets Attributes of the subtitle.
Definition: TextStyleAttributes.cpp:96
attributesType
std::array< uint32_t, 14 > attributesType
Definition: SubtecAttribute.hpp:30
AampConfig.h
Configurations for AAMP.
TextStyleAttributes::AttribPosInArray
AttribPosInArray
Provides the indexing postion in array for attributes.
Definition: TextStyleAttributes.h:54