RDK Documentation (Open Sourced RDK Components)
videoin_shim.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 2021 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 videoin_shim.h
22  * @brief shim for dispatching UVE Video input playback
23  */
24 
25 #ifndef VIDEOIN_SHIM_H_
26 #define VIDEOIN_SHIM_H_
27 
28 #include "StreamAbstractionAAMP.h"
29 #include <string>
30 #include <stdint.h>
31 #ifdef USE_CPP_THUNDER_PLUGIN_ACCESS
32 #include "Module.h"
33 #include <core/core.h>
34 #include "ThunderAccess.h"
35 #endif
36 using namespace std;
37 
38 /**
39  * @class StreamAbstractionAAMP_VIDEOIN
40  * @brief Fragment collector for MPEG DASH
41  */
43 {
44 public:
45  /**
46  * @fn StreamAbstractionAAMP_VIDEOIN
47  * @param aamp pointer to PrivateInstanceAAMP object associated with player
48  * @param seekpos Seek position
49  * @param rate playback rate
50  */
51  StreamAbstractionAAMP_VIDEOIN(const std::string name, const std::string callSign, AampLogManager *logObj, class PrivateInstanceAAMP *aamp,double seekpos, float rate);
52  /**
53  * @fn ~StreamAbstractionAAMP_VIDEOIN
54  */
56  /**
57  * @brief Copy constructor disabled
58  *
59  */
61  /**
62  * @brief assignment operator disabled
63  *
64  */
66  /**
67  * @brief Stub implementation
68  */
69  void DumpProfiles(void) override;
70  /**
71  * @fn Start
72  */
73  void Start() override;
74  /**
75  * @fn Stop
76  */
77  void Stop(bool clearChannelData) override;
78  /**
79  * @fn SetVideoRectangle
80  *
81  * @param[in] x,y - position coordinates of video rectangle
82  * @param[in] w,h - width & height of video rectangle
83  */
84  void SetVideoRectangle(int x, int y, int w, int h) override;
85  /**
86  * @fn Init
87  * @note To be implemented by sub classes
88  * @param tuneType to set type of object.
89  * @retval eAAMPSTATUS_OK
90  */
91  AAMPStatusType Init(TuneType tuneType) override;
92  /**
93  * @fn GetStreamFormat
94  * @param[out] primaryOutputFormat - format of primary track
95  * @param[out] audioOutputFormat - format of audio track
96  * @param[out] auxOutputFormat - format of aux audio track
97  * @param[out] subtitleOutputFormat - format of sutbtile track
98  */
99  void GetStreamFormat(StreamOutputFormat &primaryOutputFormat, StreamOutputFormat &audioOutputFormat, StreamOutputFormat &auxOutputFormat, StreamOutputFormat &subtitleOutputFormat) override;
100 
101  /**
102  * @fn Is4KStream
103  * @brief check if current stream have 4K content
104  * @param height - resolution of 4K stream if found
105  * @param bandwidth - bandwidth of 4K stream if foudd
106  * @return true on success
107  */
108  virtual bool Is4KStream(int &height, long &bandwidth) override {return false; };
109 
110  /**
111  * @fn GetStreamPosition
112  *
113  * @retval current position of stream.
114  */
115  double GetStreamPosition() override;
116  /**
117  * @fn GetMediaTrack
118  * @param[in] type - track type
119  * @retval MediaTrack pointer.
120  */
121  MediaTrack* GetMediaTrack(TrackType type) override;
122  /**
123  * @fn GetFirstPTS
124  *
125  * @retval PTS of first sample
126  */
127  double GetFirstPTS() override;
128  /**
129  * @fn GetStartTimeOfFirstPTS
130  *
131  * @retval start time of first sample
132  */
133  double GetStartTimeOfFirstPTS() override;
134  /**
135  * @fn GetBufferedDuration
136  */
137  double GetBufferedDuration() override;
138  /**
139  * @fn IsInitialCachingSupported
140  * @return true if yes
141  */
142  bool IsInitialCachingSupported() override;
143  /**
144  * @fn GetBWIndex
145  * @param[in] bitrate Bitrate to lookup profile
146  * @retval profile index
147  */
148  int GetBWIndex(long bitrate) override;
149  /**
150  * @fn GetVideoBitrates
151  * @return available video bitrates
152  */
153  std::vector<long> GetVideoBitrates(void) override;
154  /**
155  * @fn GetAudioBitrates
156  * @return available audio bitrates
157  */
158  std::vector<long> GetAudioBitrates(void) override;
159  /**
160  * @fn GetMaxBitrate
161  * @return long MAX video bitrates
162  */
163  long GetMaxBitrate(void) override;
164  /**
165  * @fn StopInjection
166  */
167  void StopInjection(void) override;
168  /**
169  * @fn StartInjection
170  */
171  void StartInjection(void) override;
172  void SeekPosUpdate(double) { };
173 protected:
174  /**
175  * @fn GetStreamInfo
176  *
177  * @param[in] idx - profile index.
178  * @retval stream information corresponding to index.
179  */
180  StreamInfo* GetStreamInfo(int idx) override;
181  AAMPStatusType InitHelper(TuneType tuneType);
182  /**
183  * @fn StartHelper
184  */
185  void StartHelper(int port, const std::string & methodName);
186  /**
187  * @fn StopHelper
188  */
189  void StopHelper(const std::string & methodName) ;
190  bool mTuned;
191 
192 #ifdef USE_CPP_THUNDER_PLUGIN_ACCESS
193  /**
194  * @fn RegisterEvent
195  * @param[in] eventName : Event name
196  * @param[in] functionHandler : Event funciton pointer
197  */
198  void RegisterEvent (string eventName, std::function<void(const WPEFramework::Core::JSON::VariantContainer&)> functionHandler);
199  /**
200  * @fn RegisterAllEvents
201  */
202  void RegisterAllEvents ();
203 #endif
204 
205 private:
206 #ifdef USE_CPP_THUNDER_PLUGIN_ACCESS
207  ThunderAccessAAMP thunderAccessObj;
208  ThunderAccessAAMP thunderRDKShellObj;
209 
210  /**
211  * @fn OnInputStatusChanged
212  * @return void
213  */
214  void OnInputStatusChanged(const JsonObject& parameters);
215  /**
216  * @fn OnSignalChanged
217  * @param parameters Json object
218  * @return void
219  */
220  void OnSignalChanged(const JsonObject& parameters);
221 #endif
222  bool GetScreenResolution(int & screenWidth, int & screenHeight);
223  int videoInputPort;
224  std::string mName; // Used for logging
225  std::list<std::string> mRegisteredEvents;
226 };
227 
228 #endif // VIDEOIN_SHIM_H_
229 /**
230  * @}
231  */
232 
ThunderAccess.h
shim for dispatching UVE HDMI input playback
StreamOutputFormat
StreamOutputFormat
Media output format.
Definition: main_aamp.h:106
StreamInfo
Structure holding the information of a stream.
Definition: StreamAbstractionAAMP.h:69
TuneType
TuneType
Tune Typea.
Definition: priv_aamp.h:190
StreamAbstractionAAMP.h
Base classes of HLS/MPD collectors. Implements common caching/injection logic.
AampLogManager
AampLogManager Class.
Definition: AampLogManager.h:150
MediaTrack
Base Class for Media Track.
Definition: StreamAbstractionAAMP.h:159
StreamAbstractionAAMP
StreamAbstraction class of AAMP.
Definition: StreamAbstractionAAMP.h:577
TrackType
TrackType
Media Track Types.
Definition: StreamAbstractionAAMP.h:48
StreamAbstractionAAMP_VIDEOIN::SeekPosUpdate
void SeekPosUpdate(double)
Update seek position when player is initialized.
Definition: videoin_shim.h:172
PrivateInstanceAAMP
Class representing the AAMP player's private instance, which is not exposed to outside world.
Definition: priv_aamp.h:640
StreamAbstractionAAMP_VIDEOIN::Is4KStream
virtual bool Is4KStream(int &height, long &bandwidth) override
check if current stream have 4K content
Definition: videoin_shim.h:108
AAMPStatusType
AAMPStatusType
AAMP Function return values.
Definition: priv_aamp.h:205
ThunderAccessAAMP
Support Thunder Plugin Access from AAMP.
Definition: ThunderAccess.h:41
Module.h
Declaration of module name aamp.
StreamAbstractionAAMP_VIDEOIN
Fragment collector for MPEG DASH.
Definition: videoin_shim.h:42