RDK Documentation (Open Sourced RDK Components)
subtitleParser.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 2018 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 /**
21  * @file subtitleParser.h
22  *
23  * @brief This file provides interfaces for a subtitle parser in AAMP
24  *
25  */
26 
27 #ifndef __SUBTITLE_PARSER_H__
28 #define __SUBTITLE_PARSER_H__
29 
30 #include "priv_aamp.h"
31 
32 
33 /**
34 * \enum SubtitleMimeType
35 * \brief Subtitle data types
36 */
37 typedef enum
38 {
39  eSUB_TYPE_WEBVTT,
40  eSUB_TYPE_MP4,
41  eSUB_TYPE_TTML,
42  eSUB_TYPE_UNKNOWN
44 
45 
46 /**
47 * \class SubtitleParser
48 * \brief Subtitle parser class
49 *
50 * This is the base class for a subtitle parser impl in AAMP
51 */
53 {
54 public:
55 
56  SubtitleParser(AampLogManager* logObj, PrivateInstanceAAMP* aamp, SubtitleMimeType type) : mLogObj(logObj), mAamp(aamp),
57  mType(type)
58  {
59  }
60 
61  /// Copy Constructor
62  SubtitleParser(const SubtitleParser&) = delete;
63 
64  virtual ~SubtitleParser()
65  {
66  }
67 
68  /// Assignment operator Overloading
69  SubtitleParser& operator=(const SubtitleParser&) = delete;
70 
71  virtual bool init(double startPosSeconds, unsigned long long basePTS) { return false; }
72  virtual bool processData(char* buffer, size_t bufferLen, double position, double duration) = 0;
73  virtual bool close() = 0;
74  virtual void reset() = 0;
75  virtual void setProgressEventOffset(double offset) = 0;
76  virtual void updateTimestamp(unsigned long long positionMs) = 0;
77  virtual void pause(bool pause) {}
78  virtual void mute(bool mute) {}
79  virtual void isLinear(bool isLinear) {}
80  virtual void setTextStyle(const std::string &options){}
81 protected:
82 
83  SubtitleMimeType mType;
84  PrivateInstanceAAMP* mAamp;
85  AampLogManager* mLogObj;
86 };
87 
88 #endif /* __SUBTITLE_PARSER_H__ */
AampLogManager
AampLogManager Class.
Definition: AampLogManager.h:150
SubtitleParser::operator=
SubtitleParser & operator=(const SubtitleParser &)=delete
Assignment operator Overloading.
SubtitleMimeType
SubtitleMimeType
Subtitle data types.
Definition: subtitleParser.h:37
priv_aamp.h
Private functions and types used internally by AAMP.
PrivateInstanceAAMP
Class representing the AAMP player's private instance, which is not exposed to outside world.
Definition: priv_aamp.h:640
SubtitleParser
Subtitle parser class.
Definition: subtitleParser.h:52