RDK Documentation (Open Sourced RDK Components)
fragmentcollector_progressive.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 fragmentcollector_progressive.h
22  * @brief Streamer for progressive mp3/mp4 playback
23  */
24 
25 #ifndef FRAGMENTCOLLECTOR_PROGRESSIVE_H_
26 #define FRAGMENTCOLLECTOR_PROGRESSIVE_H_
27 
28 #include "StreamAbstractionAAMP.h"
29 #include <string>
30 #include <stdint.h>
31 using namespace std;
32 
33 /**
34  * @class StreamAbstractionAAMP_PROGRESSIVE
35  * @brief Streamer for progressive mp3/mp4 playback
36  */
38 {
39 public:
40  /**
41  * @fn StreamAbstractionAAMP_PROGRESSIVE
42  * @param aamp pointer to PrivateInstanceAAMP object associated with player
43  * @param seekpos Seek position
44  * @param rate playback rate
45  */
46  StreamAbstractionAAMP_PROGRESSIVE(AampLogManager *logObj, class PrivateInstanceAAMP *aamp,double seekpos, float rate);
47  /**
48  * @fn ~StreamAbstractionAAMP_PROGRESSIVE
49  */
51  /**
52  * @brief Copy constructor disabled
53  *
54  */
56  /**
57  * @brief assignment operator disabled
58  *
59  */
61  double seekPosition;
62  void DumpProfiles(void) override;
63  /**
64  * @fn Start
65  * @return void
66  */
67  void Start() override;
68  /**
69  * @fn Stop
70  * @return void
71  */
72  void Stop(bool clearChannelData) override;
73  /**
74  * @fn Init
75  * @note To be implemented by sub classes
76  * @param tuneType to set type of object.
77  * @retval true on success
78  * @retval false on failure
79  */
80  AAMPStatusType Init(TuneType tuneType) override;
81  /**
82  * @fn GetStreamFormat
83  * @param[out] primaryOutputFormat - format of primary track
84  * @param[out] audioOutputFormat - format of audio track
85  * @param[out] auxOutputFormat - format of aux audio track
86  * @param[out] subtitleOutputFormat - format of sutbtile track
87  */
88  void GetStreamFormat(StreamOutputFormat &primaryOutputFormat, StreamOutputFormat &audioOutputFormat, StreamOutputFormat &auxOutputFormat, StreamOutputFormat &subtitleOutputFormat) override;
89  /**
90  * @fn GetStreamPosition
91  *
92  * @retval current position of stream.
93  */
94  double GetStreamPosition() override;
95  /**
96  * @fn GetMediaTrack
97  *
98  * @param[in] type - track type
99  * @retval MediaTrack pointer.
100  */
101  MediaTrack* GetMediaTrack(TrackType type) override;
102  /**
103  * @fn GetFirstPTS
104  *
105  * @retval PTS of first sample
106  */
107  double GetFirstPTS() override;
108  /**
109  * @fn GetStartTimeOfFirstPTS
110  *
111  * @retval start time of first sample
112  */
113  double GetStartTimeOfFirstPTS() override;
114  /**
115  * @fn GetBufferedDuration
116  *
117  */
118  double GetBufferedDuration() override;
119  /**
120  * @fn IsInitialCachingSupported
121  *
122  */
123  bool IsInitialCachingSupported() override;
124  /**
125  * @param[in] bitrate Bitrate to lookup profile
126  * @retval profile index
127  */
128  int GetBWIndex(long bitrate) override;
129  /**
130  * @fn GetVideoBitrates
131  * @return available video bitrates
132  */
133  std::vector<long> GetVideoBitrates(void) override;
134  /**
135  * @fn GetAudioBitrates
136  * @return available audio bitrates
137  */
138  std::vector<long> GetAudioBitrates(void) override;
139  /**
140  * @fn GetMaxBitrate
141  * @return long MAX video bitrates
142  */
143  long GetMaxBitrate(void) override;
144  /**
145  * @fn StopInjection
146  */
147  void StopInjection(void) override;
148  /**
149  * @fn StartInjection
150  */
151  void StartInjection(void) override;
152  void SeekPosUpdate(double) { };
153  /**
154  * @fn FetcherLoop
155  * @return void
156  */
157  void FetcherLoop();
158  /**
159  * @fn GetAvailableVideoTracks
160  * @return available video tracks.
161  */
162  std::vector<StreamInfo*> GetAvailableVideoTracks(void) override;
163  /**
164  * @fn GetAvailableThumbnailTracks
165  * @return available thumbnail tracks.
166  */
167  std::vector<StreamInfo*> GetAvailableThumbnailTracks(void) override;
168  /**
169  * @fn SetThumbnailTrack
170  *
171  * @param thumbnailIndex thumbnail index value indicating the track to select
172  * @return bool true on success.
173  */
174  bool SetThumbnailTrack(int) override;
175  /**
176  * @fn GetThumbnailRangeData
177  * @return Updated vector of available thumbnail data.
178  */
179  std::vector<ThumbnailData> GetThumbnailRangeData(double,double, std::string*, int*, int*, int*, int*) override;
180 
181  /**
182  * @fn Is4KStream
183  * @brief check if current stream have 4K content
184  * @param height - resolution of 4K stream if found
185  * @param bandwidth - bandwidth of 4K stream if foudd
186  * @return true on success
187  */
188  bool Is4KStream(int &height, long &bandwidth) override { return false; };
189 protected:
190  /**
191  * @fn GetStreamInfo
192  *
193  * @param[in] idx - profile index.
194  * @retval stream information corresponding to index.
195  */
196  StreamInfo* GetStreamInfo(int idx) override;
197 private:
198  void StreamFile( const char *uri, long *http_error );
199  bool fragmentCollectorThreadStarted;
200  pthread_t fragmentCollectorThreadID;
201 };
202 
203 #endif //FRAGMENTCOLLECTOR_PROGRESSIVE_H_
204 /**
205  * @}
206  */
207 
208 
209 
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_PROGRESSIVE
Streamer for progressive mp3/mp4 playback.
Definition: fragmentcollector_progressive.h:37
StreamAbstractionAAMP_PROGRESSIVE::SeekPosUpdate
void SeekPosUpdate(double)
Update seek position when player is initialized.
Definition: fragmentcollector_progressive.h:152
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
StreamAbstractionAAMP_PROGRESSIVE::Is4KStream
bool Is4KStream(int &height, long &bandwidth) override
check if current stream have 4K content
Definition: fragmentcollector_progressive.h:188