RDK Documentation (Open Sourced RDK Components)
rmf_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 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 /**
21  * @file rmf_shim.h
22  * @brief shim for dispatching UVE RMF playback
23  */
24 
25 #ifndef RMF_SHIM_H_
26 #define RMF_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 using namespace std;
36 
37 /**
38  * @struct RMFSettings
39  * @brief Structure to save the ATSC settings
40  */
41 typedef struct RMFSettings
42 {
43  std::string preferredLanguages;
44 }RMFGlobalSettings;
45 
46 /**
47  * @class StreamAbstractionAAMP_RMF
48  * @brief Fragment collector for RMF
49  */
50 class StreamAbstractionAAMP_RMF : public StreamAbstractionAAMP
51 {
52  public:
53  /**
54  * @fn StreamAbstractionAAMP_RMF
55  * @param aamp pointer to PrivateInstanceAAMP object associated with player
56  * @param seek_pos Seek position
57  * @param rate playback rate
58  */
59  StreamAbstractionAAMP_RMF(AampLogManager *logObj, class PrivateInstanceAAMP *aamp,double seekpos, float rate);
60  /**
61  * @fn ~StreamAbstractionAAMP_RMF
62  */
63  ~StreamAbstractionAAMP_RMF();
64  /**
65  * @brief Copy constructor disabled
66  *
67  */
68  StreamAbstractionAAMP_RMF(const StreamAbstractionAAMP_RMF&) = delete;
69  /**
70  * @brief assignment operator disabled
71  *
72  */
73  StreamAbstractionAAMP_RMF& operator=(const StreamAbstractionAAMP_RMF&) = delete;
74 
75  /*Event Handlers*/
76  void onPlayerStatusHandler(const JsonObject& parameters);
77  void onPlayerErrorHandler(const JsonObject& parameters);
78  /**
79  * @fn DumpProfiles
80  */
81  void DumpProfiles(void) override;
82  /**
83  * @fn Start
84  */
85  void Start() override;
86  /**
87  * @fn Stop
88  */
89  void Stop(bool clearChannelData) override;
90  /**
91  * @fn Init
92  * @note To be implemented by sub classes
93  * @param tuneType to set type of object.
94  * @retval true on success
95  * @retval false on failure
96  */
97  AAMPStatusType Init(TuneType tuneType) override;
98  /**
99  * @fn GetStreamFormat
100  * @param[out] primaryOutputFormat - format of primary track
101  * @param[out] audioOutputFormat - format of audio track
102  * @param[out] auxOutputFormat - format of aux audio track
103  * @param[out] subtitleOutputFormat - format of sutbtile track
104  */
105  void GetStreamFormat(StreamOutputFormat &primaryOutputFormat, StreamOutputFormat &audioOutputFormat, StreamOutputFormat &auxOutputFormat, StreamOutputFormat &subtitleOutputFormat) override;
106  /**
107  * @fn GetStreamPosition
108  *
109  * @retval current position of stream.
110  */
111  double GetStreamPosition() override;
112  /**
113  * @fn GetMediaTrack
114  *
115  * @param[in] type - track type
116  * @retval MediaTrack pointer.
117  */
118  MediaTrack* GetMediaTrack(TrackType type) override;
119  /**
120  * @fn GetFirstPTS
121  *
122  * @retval PTS of first sample
123  */
124  double GetFirstPTS() override;
125  /**
126  * @fn GetStartTimeOfFirstPTS
127  *
128  * @retval start time of first sample
129  */
130  double GetStartTimeOfFirstPTS() override;
131  /**
132  * @fn GetBufferedDuration
133  *
134  */
135  double GetBufferedDuration() override;
136  /**
137  * @fn IsInitialCachingSupported
138  */
139  bool IsInitialCachingSupported() override;
140  /**
141  * @fn GetBWIndex
142  * @param[in] bitrate Bitrate to lookup profile
143  * @retval profile index
144  */
145  int GetBWIndex(long bitrate) override;
146  /**
147  * @fn GetVideoBitrates
148  * @return available video bitrates
149  */
150  std::vector<long> GetVideoBitrates(void) override;
151  /**
152  * @fn GetAudioBitrates
153  * @return available audio bitrates
154  */
155  std::vector<long> GetAudioBitrates(void) override;
156  /**
157  * @fn GetMaxBitrate
158  * @return long MAX video bitrates
159  */
160  long GetMaxBitrate(void) override;
161  /**
162  * @fn StopInjection
163  */
164  void StopInjection(void) override;
165  /**
166  * @fn StartInjection
167  */
168  void StartInjection(void) override;
169  /**
170  * @brief update the Seek position
171  */
172  void SeekPosUpdate(double) { };
173  /**
174  * @fn SetVideoRectangle
175  *
176  * @param[in] x,y - position coordinates of video rectangle
177  * @param[in] wxh - width & height of video rectangle
178  */
179  void SetVideoRectangle(int x, int y, int w, int h) override;
180  /**
181  * @fn SetAudioTrack
182  *
183  * @param[in] Index of the audio track.
184  */
185  void SetAudioTrack(int index) override;
186  /**
187  * @fn SetAudioTrackByLanguage
188  *
189  * @param[in] lang : Audio Language to be set
190  */
191  void SetAudioTrackByLanguage(const char* lang) override;
192  /**
193  * @fn GetAvailableAudioTracks
194  *
195  * @return std::vector<AudioTrackInfo> List of available audio tracks
196  */
197  std::vector<AudioTrackInfo> &GetAvailableAudioTracks(bool allTrack=false) override;
198  /**
199  * @fn GetAudioTrack
200  *
201  * @return int - index of current audio track
202  */
203  int GetAudioTrack() override;
204  /**
205  * @fn GetCurrentAudioTrack
206  * @return int - index of current audio track
207  */
208  bool GetCurrentAudioTrack(AudioTrackInfo &audioTrack) override;
209  /**
210  * @fn GetAvailableTextTracks
211  * @return std::vector<TextTrackInfo> List of available text tracks
212  */
213  std::vector<TextTrackInfo> &GetAvailableTextTracks(bool all=false) override;
214  /**
215  * @fn SetPreferredAudioLanguages
216  *
217  */
218  void SetPreferredAudioLanguages() override;
219  /**
220  * @fn DisableContentRestrictions
221  *
222  * @param[in] grace - seconds from current time, grace period, grace = -1 will allow an unlimited grace period
223  * @param[in] time - seconds from current time,time till which the channel need to be kept unlocked
224  * @param[in] eventChange - disable restriction handling till next program event boundary
225  */
226  void DisableContentRestrictions(long grace, long time, bool eventChange) override;
227  /**
228  * @fn EnableContentRestrictions
229  *
230  */
231  void EnableContentRestrictions() override;
232  /**
233  * @fn GetAvailableVideoTracks
234  * @return available video tracks
235  */
236  std::vector<StreamInfo*> GetAvailableVideoTracks(void) override;
237  /**
238  * @fn GetAvailableThumbnailTracks
239  * @return available thumbnail tracks
240  */
241  std::vector<StreamInfo*> GetAvailableThumbnailTracks(void) override;
242  /**
243  * @fn SetThumbnailTrack
244  *
245  * @param thumbnail index value indicating the track to select
246  * @return bool true on success.
247  */
248  bool SetThumbnailTrack(int) override;
249  /**
250  * @fn GetThumbnailRangeData
251  * @return available thumbnail tracks
252  */
253  std::vector<ThumbnailData> GetThumbnailRangeData(double,double, std::string*, int*, int*, int*, int*) override;
254  /**
255  * @fn Is4KStream
256  * @brief check if current stream have 4K content
257  * @param height - resolution of 4K stream if found
258  * @param bandwidth - bandwidth of 4K stream if foudd
259  * @return true on success
260  */
261  virtual bool Is4KStream(int &height, long &bandwidth) override {return false; };
262 
263  private:
264  ThunderAccessAAMP thunderAccessObj;
265  bool tuned;
266 
267  ThunderAccessAAMP thunderRDKShellObj;
268  bool GetScreenResolution(int & screenWidth, int & screenHeight);
269  /**
270  * @fn GetAudioTracks
271  * @return void
272  */
273  void GetAudioTracks();
274  /**
275  * @fn GetAudioTrackInternal
276  *
277  */
278  int GetAudioTrackInternal();
279 
280  /**
281  * @fn GetTextTracks
282  * @return voi @return void
283  */
284  void GetTextTracks();
285 
286  protected:
287  /**
288  * @fn GetStreamInfo
289  *
290  * @param[in] idx - profile index.
291  * @retval stream information corresponding to index.
292  */
293  StreamInfo* GetStreamInfo(int idx) override;
294 };
295 #endif //USE_CPP_THUNDER_PLUGIN_ACCESS
296 #endif //RMF_SHIM_H_
297 /**
298  * @}
299  */
300 
301 
302 
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
AudioTrackInfo
Structure for audio track information Holds information about an audio track in playlist.
Definition: main_aamp.h:178
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
PrivateInstanceAAMP
Class representing the AAMP player's private instance, which is not exposed to outside world.
Definition: priv_aamp.h:640
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.