RDK Documentation (Open Sourced RDK Components)
fragmentcollector_hls.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_hls.h
22  * @brief This file handles HLS Streaming functionality for AAMP player
23  *
24  * @section DESCRIPTION
25  *
26  * This file handles HLS Streaming functionality for AAMP player. Class/structures
27  * required for hls fragment collector is defined here.
28  * Major functionalities include
29  * a) Manifest / fragment collector and trick play handling
30  * b) DRM Initialization / Key acquisition
31  * c) Decrypt and inject fragments for playback
32  * d) Synchronize audio/video tracks .
33  *
34  */
35 #ifndef FRAGMENTCOLLECTOR_HLS_H
36 #define FRAGMENTCOLLECTOR_HLS_H
37 
38 #include <memory>
39 #include "StreamAbstractionAAMP.h"
40 #include "mediaprocessor.h"
41 #include <sys/time.h>
42 #include "HlsDrmBase.h"
43 
44 #define MAX_PROFILE 128 // TODO: remove limitation
45 #define FOG_FRAG_BW_IDENTIFIER "bandwidth-"
46 #define FOG_FRAG_BW_IDENTIFIER_LEN 10
47 #define FOG_FRAG_BW_DELIMITER "-"
48 #define CHAR_CR 0x0d // '\r'
49 #define CHAR_LF 0x0a // '\n'
50 #define BOOLSTR(boolValue) (boolValue?"true":"false")
51 #define PLAYLIST_TIME_DIFF_THRESHOLD_SECONDS (0.1f)
52 #define MAX_MANIFEST_DOWNLOAD_RETRY 3
53 #define MAX_DELAY_BETWEEN_PLAYLIST_UPDATE_MS (6*1000)
54 #define MIN_DELAY_BETWEEN_PLAYLIST_UPDATE_MS (500) // 500mSec
55 #define DRM_IV_LEN 16
56 
57 #define MAX_SEQ_NUMBER_LAG_COUNT 50 /*!< Configured sequence number max count to avoid continuous looping for an edge case scenario, which leads crash due to hung */
58 #define MAX_SEQ_NUMBER_DIFF_FOR_SEQ_NUM_BASED_SYNC 2 /*!< Maximum difference in sequence number to sync tracks using sequence number.*/
59 #define MAX_PLAYLIST_REFRESH_FOR_DISCONTINUITY_CHECK_EVENT 5 /*!< Maximum playlist refresh count for discontinuity check for TSB/cDvr*/
60 #define MAX_PLAYLIST_REFRESH_FOR_DISCONTINUITY_CHECK_LIVE 3 /*!< Maximum playlist refresh count for discontinuity check for live without TSB*/
61 #define MAX_PDT_DISCONTINUITIY_DELTA_LIMIT 1.0f /*!< maximum audio/video track PDT delta to determine discontiuity using PDT*/
62 
63 
64 
65 /**
66 * \struct HlsProtectionInfo
67 * \brief HlsStreamInfo structure for stream related information
68 */
69 typedef struct HlsProtectionInfo
70 {
71  struct DrmSessionParams* drmData; /**< Session data */
72  HlsProtectionInfo *next; /**< pointer to access next element of Queue */
74 
75 /**
76 * \struct HlsStreamInfo
77 * \brief HlsStreamInfo structure for stream related information
78 */
79 typedef struct HlsStreamInfo: public StreamInfo
80 { // #EXT-X-STREAM-INFs
81  long program_id; /**< Program Id */
82  const char *audio; /**< Audio */
83  const char *codecs; /**< Codec String */
84  const char *uri; /**< URI Information */
85 
86  // rarely present
87  long averageBandwidth; /**< Average Bandwidth */
88  const char *closedCaptions; /**< CC if present */
89  const char *subtitles; /**< Subtitles */
90  StreamOutputFormat audioFormat; /**< Audio codec format*/
92 
93 /**
94 * \struct MediaInfo
95 * \brief MediaInfo structure for Media related information
96 */
97 typedef struct MediaInfo
98 { // #EXT-X-MEDIA
99  MediaType type; /**< Media Type */
100  const char *group_id; /**< Group ID */
101  const char *name; /**< Name of Media */
102  const char *language; /**< Language */
103  bool autoselect; /**< AutoSelect */
104  bool isDefault; /**< IsDefault */
105  const char *uri; /**< URI Information */
106  StreamOutputFormat audioFormat; /**< Audio codec format*/
107  // rarely present
108  int channels; /**< Channel */
109  const char *instreamID; /**< StreamID */
110  bool forced; /**< Forced Flag */
111  const char *characteristics; /**< Characteristics */
112  bool isCC; /**< True if the text track is closed-captions */
113 } MediaInfo;
114 
115 /**
116 * \struct IndexNode
117 * \brief IndexNode structure for Node/DRM Index
118 */
119 struct IndexNode
120 {
121  double completionTimeSecondsFromStart; /**< Time of index from start */
122  const char *pFragmentInfo; /**< Fragment Information pointer */
123  int drmMetadataIdx; /**< DRM Index for Fragment */
124  const char *initFragmentPtr; /**< Fragmented MP4 specific pointer to associated (preceding) initialization fragment */
125 };
126 
127 /**
128 * \struct KeyTagStruct
129 * \brief KeyTagStruct structure to store all Keytags with Hash
130 */
132 {
134  {
135  }
136  std::string mShaID; /**< ShaID of Key tag */
137  double mKeyStartDuration; /**< duration in playlist where Keytag starts */
138  std::string mKeyTagStr; /**< String to store key tag,needed for trickplay */
139 };
140 
141 /**
142 * \struct DiscontinuityIndexNode
143 * \brief Index Node structure for Discontinuity Index
144 */
146 {
147  int fragmentIdx; /**< Idx of fragment in index table*/
148  double position; /**< Time of index from start */
149  double fragmentDuration; /**< Fragment duration of current discontinuity index */
150  double discontinuityPDT; /**< Program Date time value */
151 };
152 
153 /**
154 * \enum DrmKeyMethod
155 * \brief Enum for various EXT-X-KEY:METHOD= values
156 */
157 typedef enum
158 {
159  eDRM_KEY_METHOD_NONE, /**< DRM key is none */
160  eDRM_KEY_METHOD_AES_128, /**< DRM key is AES 128 Method */
161  eDRM_KEY_METHOD_SAMPLE_AES, /**< DRM key is Sample AES method */
162  eDRM_KEY_METHOD_SAMPLE_AES_CTR, /**< DRM key is Sample AES CTR method */
163  eDRM_KEY_METHOD_UNKNOWN /**< DRM key is unkown method */
164 } DrmKeyMethod;
165 
166 /**
167  * @}
168  */
169 
170 /**
171  * \class TrackState
172  * \brief State Machine for each Media Track
173  *
174  * This class is meant to handle each media track of stream
175  */
176 class TrackState : public MediaTrack
177 {
178 public:
179  /***************************************************************************
180  * @fn TrackState
181  *
182  * @param[in] type Type of the track
183  * @param[in] parent StreamAbstractionAAMP_HLS instance
184  * @param[in] aamp PrivateInstanceAAMP pointer
185  * @param[in] name Name of the track
186  * @return void
187  ***************************************************************************/
189  /***************************************************************************
190  * @fn ~TrackState
191  * @brief copy constructor function
192  *
193  * @return void
194  ***************************************************************************/
195  TrackState(const TrackState&) = delete;
196  /***************************************************************************
197  * @fn ~TrackState
198  *
199  * @return void
200  ***************************************************************************/
201  ~TrackState();
202  /*************************************************************************
203  * @brief Assignment operator Overloading
204  *************************************************************************/
205  TrackState& operator=(const TrackState&) = delete;
206  /***************************************************************************
207  * @fn Start
208  *
209  * @return void
210  **************************************************************************/
211  void Start();
212  /***************************************************************************
213  * @fn Stop
214  *
215  * @return void
216  ***************************************************************************/
217  void Stop(bool clearDRM = false);
218  /***************************************************************************
219  * @fn RunFetchLoop
220  *
221  * @return void
222  ***************************************************************************/
223  void RunFetchLoop();
224  /***************************************************************************
225  * @fn IndexPlaylist
226  * @brief Function to parse playlist
227  *
228  * @return double total duration from playlist
229  ***************************************************************************/
230  void IndexPlaylist(bool IsRefresh, double &culledSec);
231  /***************************************************************************
232  * @fn ABRProfileChanged
233  *
234  * @return void
235  ***************************************************************************/
236  void ABRProfileChanged(void);
237  /***************************************************************************
238  * @fn GetNextFragmentUriFromPlaylist
239  * @param ignoreDiscontinuity Ignore discontinuity
240  * @return string fragment URI pointer
241  ***************************************************************************/
242  char *GetNextFragmentUriFromPlaylist(bool ignoreDiscontinuity=false);
243  /***************************************************************************
244  * @fn UpdateDrmIV
245  *
246  * @param[in] ptr IV string from DRM attribute
247  * @return void
248  ***************************************************************************/
249  void UpdateDrmIV(const char *ptr);
250  /***************************************************************************
251  * @fn UpdateDrmCMSha1Hash
252  *
253  * @param[in] ptr ShaID string from DRM attribute
254  * @return void
255  ***************************************************************************/
256  void UpdateDrmCMSha1Hash(const char *ptr);
257  /***************************************************************************
258  * @fn DrmDecrypt
259  *
260  * @param[in] cachedFragment CachedFragment struction pointer
261  * @param[in] bucketTypeFragmentDecrypt ProfilerBucketType enum
262  * @return bool true if successfully decrypted
263  ***************************************************************************/
265  /***************************************************************************
266  * @fn CreateInitVectorByMediaSeqNo
267  *
268  * @param[in] ui32Seqno Current fragment's sequence number
269  * @return bool true if successfully created, false otherwise.
270  ***************************************************************************/
271  bool CreateInitVectorByMediaSeqNo( unsigned int ui32Seqno );
272  /***************************************************************************
273  * @fn FetchPlaylist
274  *
275  * @return void
276  ***************************************************************************/
277  void FetchPlaylist();
278  /****************************************************************************
279  * @fn GetNextFragmentPeriodInfo
280  *
281  * @param[out] periodIdx Index of the period in which next fragment belongs
282  * @param[out] offsetFromPeriodStart Offset from start position of the period
283  * @param[out] fragmentIdx Fragment index
284  ****************************************************************************/
285  void GetNextFragmentPeriodInfo(int &periodIdx, double &offsetFromPeriodStart, int &fragmentIdx);
286 
287  /***************************************************************************
288  * @fn GetPeriodStartPosition
289  * @param[in] periodIdx Period Index
290  * @return void
291  ***************************************************************************/
292  double GetPeriodStartPosition(int periodIdx);
293 
294  /***************************************************************************
295  * @fn GetNumberOfPeriods
296  *
297  * @return int number of periods
298  ***************************************************************************/
299  int GetNumberOfPeriods();
300 
301  /***************************************************************************
302  * @fn HasDiscontinuityAroundPosition
303  * @param[in] position Position to check for discontinuity
304  * @param[in] useStartTime starting time to search discontinuity
305  * @param[out] diffBetweenDiscontinuities discontinuity position minus input position
306  * @param[in] playPosition playback position
307  * @param[in] inputCulledSec culled seconds
308  * @param [in] inputProgramDateTime prorgram date and time in epoc format
309  * @param [out] isDiffChkReq indicates is diffBetweenDiscontinuities check required
310  * @return true if discontinuity present around given position
311  ***************************************************************************/
312  bool HasDiscontinuityAroundPosition(double position, bool useStartTime, double &diffBetweenDiscontinuities, double playPosition,double inputCulledSec,double inputProgramDateTime,bool &isDiffChkReq);
313 
314  /***************************************************************************
315  * @fn StartInjection
316  *
317  * @return void
318  ***************************************************************************/
319  void StartInjection();
320 
321  /**
322  * @fn StopInjection
323  * @return void
324  */
325  void StopInjection( void );
326 
327  /***************************************************************************
328  * @fn StopWaitForPlaylistRefresh
329  *
330  * @return void
331  ***************************************************************************/
333 
334  /***************************************************************************
335  * @fn CancelDrmOperation
336  *
337  * @param[in] clearDRM flag indicating if DRM resources to be freed or not
338  * @return void
339  ***************************************************************************/
340  void CancelDrmOperation(bool clearDRM);
341 
342  /***************************************************************************
343  * @fn StopDiscontinuityCheck
344  *
345  * @return void
346  ***************************************************************************/
348 
349  /***************************************************************************
350  * @fn RestoreDrmState
351  *
352  * @return void
353  ***************************************************************************/
354  void RestoreDrmState();
355  /***************************************************************************
356  * @fn IsLive
357  * @brief Function to check the IsLive status of track. Kept Public as its called from StreamAbstraction
358  *
359  * @return True if both or any track in live mode
360  ***************************************************************************/
361  bool IsLive() { return (ePLAYLISTTYPE_VOD != mPlaylistType);}
362  /***************************************************************************
363  * @fn FindTimedMetadata
364  *
365  * @return void
366  ***************************************************************************/
367  void FindTimedMetadata(bool reportbulk=false, bool bInitCall = false);
368  /***************************************************************************
369  * @fn SetXStartTimeOffset
370  * @brief Function to set XStart Time Offset Value
371  *
372  * @return void
373  ***************************************************************************/
374  void SetXStartTimeOffset(double offset) { mXStartTimeOFfset = offset; }
375  /***************************************************************************
376  * @fn SetXStartTimeOffset
377  * @brief Function to retune XStart Time Offset
378  *
379  * @return Start time
380  ***************************************************************************/
381  double GetXStartTimeOffset() { return mXStartTimeOFfset;}
382  /***************************************************************************
383  * @fn GetBufferedDuration
384  *
385  * @return Buffer Duration
386  ***************************************************************************/
387  double GetBufferedDuration();
388 private:
389  /***************************************************************************
390  * @fn GetFragmentUriFromIndex
391  *
392  * @return string fragment URI pointer
393  ***************************************************************************/
394  char *GetFragmentUriFromIndex(bool &bSegmentRepeated);
395  /***************************************************************************
396  * @fn FlushIndex
397  *
398  * @return void
399  ***************************************************************************/
400  void FlushIndex();
401  /***************************************************************************
402  * @fn FetchFragment
403  *
404  * @return void
405  ***************************************************************************/
406  void FetchFragment();
407  /***************************************************************************
408  * @fn FetchFragmentHelper
409  *
410  * @param[out] http_error http error string
411  * @param[out] decryption_error decryption error
412  * @return bool true on success else false
413  ***************************************************************************/
414  bool FetchFragmentHelper(long &http_error, bool &decryption_error, bool & bKeyChanged, int * fogError, double &downloadTime);
415  /***************************************************************************
416  * @fn RefreshPlaylist
417  *
418  * @return void
419  ***************************************************************************/
420  void RefreshPlaylist(void);
421  /***************************************************************************
422  * @fn GetContext
423  *
424  * @return StreamAbstractionAAMP instance
425  ***************************************************************************/
427  /***************************************************************************
428  * @fn InjectFragmentInternal
429  *
430  * @param[in] cachedFragment CachedFragment structure
431  * @param[out] fragmentDiscarded bool to indicate fragment successfully injected
432  * @return void
433  ***************************************************************************/
434  void InjectFragmentInternal(CachedFragment* cachedFragment, bool &fragmentDiscarded);
435  /***************************************************************************
436  * @fn FindMediaForSequenceNumber
437  * @return string fragment tag line pointer
438  ***************************************************************************/
440  /***************************************************************************
441  * @fn FetchInitFragment
442  *
443  * @return void
444  ***************************************************************************/
445  void FetchInitFragment();
446  /***************************************************************************
447  * @fn FetchInitFragmentHelper
448  * @return true if success
449  ***************************************************************************/
450  bool FetchInitFragmentHelper(long &http_code, bool forcePushEncryptedHeader = false);
451  /***************************************************************************
452  * @fn ProcessDrmMetadata
453  ***************************************************************************/
454  void ProcessDrmMetadata();
455  /***************************************************************************
456  * @fn ComputeDeferredKeyRequestTime
457  ***************************************************************************/
458  void ComputeDeferredKeyRequestTime();
459  /***************************************************************************
460  * @fn InitiateDRMKeyAcquisition
461  ***************************************************************************/
462  void InitiateDRMKeyAcquisition(int indexPosn=-1);
463  /***************************************************************************
464  * @fn SetDrmContext
465  * @return None
466  ***************************************************************************/
467  void SetDrmContext();
468  /***************************************************************************
469  * @fn SwitchSubtitleTrack
470  *
471  * @return void
472  ***************************************************************************/
473  void SwitchSubtitleTrack();
474 
475 public:
476  std::string mEffectiveUrl; /**< uri associated with downloaded playlist (takes into account 302 redirect) */
477  std::string mPlaylistUrl; /**< uri associated with downloaded playlist */
478  GrowableBuffer playlist; /**< downloaded playlist contents */
479 
480  double mProgramDateTime;
481  GrowableBuffer index; /**< packed IndexNode records for associated playlist */
482  int indexCount; /**< number of indexed fragments in currently indexed playlist */
483  int currentIdx; /**< index for currently-presenting fragment used during FF/REW (-1 if undefined) */
484  std::string mFragmentURIFromIndex; /**< storage for uri generated by GetFragmentUriFromIndex */
485  long long indexFirstMediaSequenceNumber; /**< first media sequence number from indexed manifest */
486 
487  char *fragmentURI; /**< pointer (into playlist) to URI of current fragment-of-interest */
488  long long lastPlaylistDownloadTimeMS; /**< UTC time at which playlist was downloaded */
489  size_t byteRangeLength; /**< state for \#EXT-X-BYTERANGE fragments */
490  size_t byteRangeOffset; /**< state for \#EXT-X-BYTERANGE fragments */
491 
492  long long nextMediaSequenceNumber; /**< media sequence number following current fragment-of-interest */
493  double playlistPosition; /**< playlist-relative time of most recent fragment-of-interest; -1 if undefined */
494  double playTarget; /**< initially relative seek time (seconds) based on playlist window, but updated as a play_target */
495  double playTargetBufferCalc;
496  double lastDownloadedIFrameTarget; /**< stores last downloaded iframe segment target value for comparison */
497  double targetDurationSeconds; /**< copy of \#EXT-X-TARGETDURATION to manage playlist refresh frequency */
498  int mDeferredDrmKeyMaxTime; /**< copy of \#EXT-X-X1-LIN DRM refresh randomization Max time interval */
499  StreamOutputFormat streamOutputFormat; /**< type of data encoded in each fragment */
500  MediaProcessor* playContext; /**< state for s/w demuxer / pts/pcr restamper module */
501  double startTimeForPlaylistSync; /**< used for time-based track synchronization when switching between playlists */
502  double playTargetOffset; /**< For correcting timestamps of streams with audio and video tracks */
503  bool discontinuity; /**< Set when discontinuity is found in track*/
504  StreamAbstractionAAMP_HLS* context; /**< To get settings common across tracks*/
505  bool fragmentEncrypted; /**< In DAI, ad fragments can be clear. Set if current fragment is encrypted*/
506  bool mKeyTagChanged; /**< Flag to indicate Key tag got changed for decryption context setting */
507  int mLastKeyTagIdx ; /**< Variable to hold the last keyTag index,to check if key tag changed */
508  struct DrmInfo mDrmInfo; /**< Structure variable to hold Drm Information */
509  char* mCMSha1Hash; /**< variable to store ShaID*/
510  long long mDrmTimeStamp; /**< variable to store Drm Time Stamp */
511  int mDrmMetaDataIndexPosition; /**< Variable to store Drm Meta data Index position*/
512  GrowableBuffer mDrmMetaDataIndex; /**< DrmMetadata records for associated playlist */
513  int mDrmMetaDataIndexCount; /**< number of DrmMetadata records in currently indexed playlist */
514  int mDrmKeyTagCount; /**< number of EXT-X-KEY tags present in playlist */
515  bool mIndexingInProgress; /**< indicates if indexing is in progress*/
516  GrowableBuffer mDiscontinuityIndex; /**< discontinuity start position mapping of associated playlist */
517  int mDiscontinuityIndexCount; /**< number of records in discontinuity position index */
518  bool mDiscontinuityCheckingOn;
519  double mDuration; /** Duration of the track*/
520  typedef std::vector<KeyTagStruct> KeyHashTable;
521  typedef std::vector<KeyTagStruct>::iterator KeyHashTableIter;
522  KeyHashTable mKeyHashTable;
523  bool mCheckForInitialFragEnc; /**< Flag that denotes if we should check for encrypted init header and push it to GStreamer*/
524  DrmKeyMethod mDrmMethod; /**< denotes the X-KEY method for the fragment of interest */
525  CMCDHeaders *pCMCDMetrics; /**<pointer object to class CMCDHeaders*/
526 
527 private:
528  bool refreshPlaylist; /**< bool flag to indicate if playlist refresh required or not */
529  pthread_t fragmentCollectorThreadID; /**< Thread Id for Fragment collector Thread */
530  bool fragmentCollectorThreadStarted; /**< Flag indicating if fragment collector thread started or not*/
531  int manifestDLFailCount; /**< Manifest Download fail count for retry*/
532  bool firstIndexDone; /**< Indicates if first indexing is done*/
533  std::shared_ptr<HlsDrmBase> mDrm; /**< DRM decrypt context*/
534  bool mDrmLicenseRequestPending; /**< Indicates if DRM License Request is Pending*/
535  bool mInjectInitFragment; /**< Indicates if init fragment injection is required*/
536  const char* mInitFragmentInfo; /**< Holds init fragment Information index*/
537  bool mForceProcessDrmMetadata; /**< Indicates if processing drm metadata to be forced on indexing*/
538  pthread_mutex_t mPlaylistMutex; /**< protect playlist update */
539  pthread_cond_t mPlaylistIndexed; /**< Notifies after a playlist indexing operation */
540  pthread_mutex_t mTrackDrmMutex; /**< protect DRM Interactions for the track */
541  pthread_mutex_t mDiscoCheckMutex; /**< protect playlist discontinuity check */
542  pthread_cond_t mDiscoCheckComplete; /**< Notifies after a discontinuity check */
543  double mLastMatchedDiscontPosition; /**< Holds discontinuity position last matched by other track */
544  double mCulledSeconds; /**< Total culled duration in this streamer instance*/
545  double mCulledSecondsOld; /**< Total culled duration in this streamer instance*/
546  bool mSyncAfterDiscontinuityInProgress; /**< Indicates if a synchronization after discontinuity tag is in progress*/
547  PlaylistType mPlaylistType; /**< Playlist Type */
548  bool mReachedEndListTag; /**< Flag indicating if End list tag reached in parser */
549  bool mByteOffsetCalculation; /**< Flag used to calculte byte offset from byte length for fragmented streams */
550  bool mSkipAbr; /**< Flag that denotes if previous cached fragment is init fragment or not */
551  const char* mFirstEncInitFragmentInfo; /**< Holds first encrypted init fragment Information index*/
552  double mXStartTimeOFfset; /**< Holds value of time offset from X-Start tag */
553  double mCulledSecondsAtStart; /**< Total culled duration with this asset prior to streamer instantiation*/
554  bool mSkipSegmentOnError; /**< Flag used to enable segment skip on fetch error */
555 };
556 
558 class PrivateInstanceAAMP;
559 /**
560  * \class StreamAbstractionAAMP_HLS
561  *
562  * \brief HLS Stream handler class
563  *
564  * This class is meant to handle download of HLS manifest and interface play controls
565  */
567 {
568 public:
569  /**************************************************************************
570  * @fn IndexPlaylist
571  * @return void
572  *************************************************************************/
573  void IndexPlaylist(TrackState *trackState);
574  /***************************************************************************
575  * @fn StreamAbstractionAAMP_HLS
576  *
577  * @param[in] aamp PrivateInstanceAAMP pointer
578  * @param[in] seekpos Seek position
579  * @param[in] rate Rate of playback
580  * @return void
581  ***************************************************************************/
582  StreamAbstractionAAMP_HLS(AampLogManager *logObj, class PrivateInstanceAAMP *aamp,double seekpos, float rate);
583  /*************************************************************************
584  * @brief Copy constructor disabled
585  *
586  *************************************************************************/
588  /***************************************************************************
589  * @fn ~StreamAbstractionAAMP_HLS
590  *
591  * @return void
592  ***************************************************************************/
594  /*****************************************************************************
595  * @brief assignment operator disabled
596  *
597  ****************************************************************************/
598  StreamAbstractionAAMP_HLS& operator=(const StreamAbstractionAAMP_HLS&) = delete;
599  /***************************************************************************
600  * @fn DumpProfiles
601  *
602  * @return void
603  ***************************************************************************/
604  void DumpProfiles(void) override;
605  /***************************************************************************
606  * @fn Start
607  *
608  * @return void
609  ***************************************************************************/
610  void Start() override;
611  /***************************************************************************
612  * @fn Stop
613  * @param[in] clearChannelData flag indicating to full stop or temporary stop
614  * @return void
615  ***************************************************************************/
616  void Stop(bool clearChannelData) override;
617  /***************************************************************************
618  * @fn Init
619  *
620  * @param[in] tuneType Tune type
621  * @return bool true on success
622  ***************************************************************************/
623  AAMPStatusType Init(TuneType tuneType) override;
624  /***************************************************************************
625  * @fn GetStreamFormat
626  *
627  * @param[out] primaryOutputFormat video format
628  * @param[out] audioOutputFormat audio format
629  * @param[out] auxOutputFormat auxiliary audio format
630  * @param[out] subFormat subtitle format
631  * @return void
632  ***************************************************************************/
633  void GetStreamFormat(StreamOutputFormat &primaryOutputFormat, StreamOutputFormat &audioOutputFormat, StreamOutputFormat &auxOutputFormat, StreamOutputFormat &subOutputFormat) override;
634  /***************************************************************************
635  * @fn GetStreamPosition
636  * @brief Function to return current playing position of stream
637  *
638  * @return seek position
639  ***************************************************************************/
640  double GetStreamPosition() override { return seekPosition; }
641  /***************************************************************************
642  * @fn GetFirstPTS
643  *
644  * @return double PTS value
645  ***************************************************************************/
646  double GetFirstPTS() override;
647  /***************************************************************************
648  * @fn GetStartTimeOfFirstPTS
649  * @brief Function to return start time of first PTS
650  *
651  * @return double start time of first PTS value
652  ***************************************************************************/
653  double GetStartTimeOfFirstPTS() override { return 0.0; }
654  /***************************************************************************
655  * @fn GetMediaTrack
656  *
657  * @param[in] type TrackType input
658  * @return MediaTrack structure pointer
659  ***************************************************************************/
660  MediaTrack* GetMediaTrack(TrackType type) override;
661  /***************************************************************************
662  * @fn GetBWIndex
663  *
664  * @param bitrate Bitrate in bits per second
665  * @return bandwidth index
666  ***************************************************************************/
667  int GetBWIndex(long bitrate) override;
668  /***************************************************************************
669  * @fn GetVideoBitrates
670  *
671  * @return available video bitrates
672  ***************************************************************************/
673  std::vector<long> GetVideoBitrates(void) override;
674  /***************************************************************************
675  * @fn GetAudioBitrates
676  *
677  * @return available audio bitrates
678  ***************************************************************************/
679  std::vector<long> GetAudioBitrates(void) override;
680  /***************************************************************************
681  * @fn GetMediaCount
682  * @brief Function to get the Media count
683  *
684  * @return Number of media count
685  ***************************************************************************/
686  int GetMediaCount(void) { return mMediaCount;}
687  /***************************************************************************
688  * @fn FilterAudioCodecBasedOnConfig
689  *
690  * @param[in] audioFormat Audio codec type
691  * @return bool false if the audio codec type is allowed to process
692  ***************************************************************************/
694  /***************************************************************************
695  * @fn SeekPosUpdate
696  *
697  * @param[in] secondsRelativeToTuneTime seek position time
698  ***************************************************************************/
699  void SeekPosUpdate(double secondsRelativeToTuneTime) override;
700  /***************************************************************************
701  * @fn PreCachePlaylist
702  *
703  * @return none
704  ***************************************************************************/
705  void PreCachePlaylist();
706  /***************************************************************************
707  * @fn GetBufferedDuration
708  *
709  * @return buffer value
710  **************************************************************************/
711  double GetBufferedDuration() override;
712  /***************************************************************************
713  * @fn GetLanguageCode
714  *
715  * @return Language code in string format
716  ***************************************************************************/
717  std::string GetLanguageCode( int iMedia );
718  /***************************************************************************
719  * @fn GetBestAudioTrackByLanguage
720  *
721  * @return int index of the audio track selected
722  ***************************************************************************/
723  int GetBestAudioTrackByLanguage( void );
724  /***************************************************************************
725  * @fn GetAvailableThumbnailTracks
726  *
727  * @return vector of available thumbnail tracks.
728  ***************************************************************************/
729  std::vector<StreamInfo*> GetAvailableThumbnailTracks(void) override;
730  /***************************************************************************
731  * @fn SetThumbnailTrack
732  *
733  * @param thumbIndex thumbnail index value indicating the track to select
734  * @return bool true on success.
735  ***************************************************************************/
736  bool SetThumbnailTrack(int) override;
737  /***************************************************************************
738  * @fn GetThumbnailRangeData
739  *
740  * @param tStart start duration of thumbnail data.
741  * @param tEnd end duration of thumbnail data.
742  * @param baseurl base url of thumbnail images.
743  * @param raw_w absolute width of the thumbnail spritesheet.
744  * @param raw_h absolute height of the thumbnail spritesheet.
745  * @param width width of each thumbnail tile.
746  * @param height height of each thumbnail tile.
747  * @return Updated vector of available thumbnail data.
748  ***************************************************************************/
749  std::vector<ThumbnailData> GetThumbnailRangeData(double,double, std::string*, int*, int*, int*, int*) override;
750  /***************************************************************************
751  * @brief Function to parse the Thumbnail Manifest and extract Tile information
752  *
753  *************************************************************************/
754  std::map<std::string,double> GetImageRangeString(double*, std::string, TileInfo*, double);
755  GrowableBuffer thumbnailManifest; /**< Thumbnail manifest buffer holder */
756  std::vector<TileInfo> indexedTileInfo; /**< Indexed Thumbnail information */
757  /***************************************************************************
758  * @brief Function to get the total number of profiles
759  *
760  ***************************************************************************/
761  int GetTotalProfileCount() { return mProfileCount;}
762  /***************************************************************************
763  * @fn GetAvailableVideoTracks
764  * @return list of available video tracks
765  *
766  **************************************************************************/
767  std::vector<StreamInfo*> GetAvailableVideoTracks(void) override;
768 
769  /**
770  * @fn Is4KStream
771  * @brief check if current stream have 4K content
772  * @param height - resolution of 4K stream if found
773  * @param bandwidth - bandwidth of 4K stream if foudd
774  * @return true on success
775  */
776  virtual bool Is4KStream(int &height, long &bandwidth) override;
777 
778 //private:
779  // TODO: following really should be private, but need to be accessible from callbacks
780 
781  TrackState* trackState[AAMP_TRACK_COUNT]; /**< array to store all tracks of a stream */
782  float rate; /**< Rate of playback */
783  float maxIntervalBtwPlaylistUpdateMs; /**< Interval between playlist update */
784  GrowableBuffer mainManifest; /**< Main manifest buffer holder */
785  bool allowsCache; /**< Flag indicating if playlist needs to be cached or not */
786  HlsStreamInfo streamInfo[MAX_PROFILE]; /**< Array to store multiple stream information */
787  MediaInfo mediaInfo[MAX_PROFILE]; /**< Array to store multiple media within stream */
788 
789  double seekPosition; /**< Seek position for playback */
790  double midSeekPtsOffset; /**< PTS offset for Mid Fragment seek */
791  int mTrickPlayFPS; /**< Trick play frames per stream */
792  bool enableThrottle; /**< Flag indicating throttle enable/disable */
793  bool firstFragmentDecrypted; /**< Flag indicating if first fragment is decrypted for stream */
794  bool mStartTimestampZero; /**< Flag indicating if timestamp to start is zero or not (No audio stream) */
795  int mNumberOfTracks; /**< Number of media tracks.*/
796  CMCDHeaders *pCMCDMetrics; /**<pointer object to class CMCDHeaders*/
797  /***************************************************************************
798  * @fn ParseMainManifest
799  *
800  * @return AAMPStatusType
801  ***************************************************************************/
803  /***************************************************************************
804  * @fn GetPlaylistURI
805  *
806  * @param[in] trackType Track type
807  * @param[in] format stream output type
808  * @return string playlist URI
809  ***************************************************************************/
810  const char *GetPlaylistURI(TrackType trackType, StreamOutputFormat* format = NULL);
811  int lastSelectedProfileIndex; /**< Variable to restore in case of playlist download failure */
812  /***************************************************************************
813  * @fn StopInjection
814  *
815  * @return void
816  ***************************************************************************/
817  void StopInjection(void) override;
818  /***************************************************************************
819  * @fn StartInjection
820  *
821  * @return void
822  ***************************************************************************/
823  void StartInjection(void) override;
824  /***************************************************************************
825  * @fn IsLive
826  * @return True if both or any track in live mode
827  ***************************************************************************/
828  bool IsLive();
829  /***************************************************************************
830  * @fn NotifyFirstVideoPTS
831  * @param[in] pts base pts
832  * @param[in] timeScale time scale
833  * @return void
834  ***************************************************************************/
835  void NotifyFirstVideoPTS(unsigned long long pts, unsigned long timeScale) override;
836  /**
837  * @fn StartSubtitleParser
838  * @return void
839  */
840  void StartSubtitleParser() override;
841  /**
842  * @fn PauseSubtitleParser
843  * @return void
844  */
845  void PauseSubtitleParser(bool pause) override;
846  /***************************************************************************
847  * @fn GetMediaIndexForLanguage
848  *
849  * @param[in] lang language
850  * @param[in] type track type
851  * @return int mediaInfo index of track with matching language
852  ***************************************************************************/
853  int GetMediaIndexForLanguage(std::string lang, TrackType type);
854  /***************************************************************************
855  * @fn GetStreamOutputFormatForTrack
856  *
857  * @param[in] type track type
858  * @return StreamOutputFormat for the audio codec selected
859  ***************************************************************************/
861  /***************************************************************************
862  * @brief Function to get output format for audio/aux track
863  *
864  *************************************************************************/
865  StreamOutputFormat GetStreamOutputFormatForAudio(void);
866  /****************************************************************************
867  * @brief Change muxed audio track index
868  *
869  * @param[in] string index
870  * @return void
871  ****************************************************************************/
872  void ChangeMuxedAudioTrackIndex(std::string& index) override;
873 
874 protected:
875  /***************************************************************************
876  * @fn GetStreamInfo
877  *
878  * @param[in] idx profileIndex
879  * @return StreamInfo for the index
880  ***************************************************************************/
881  StreamInfo* GetStreamInfo(int idx) override;
882 private:
883  /***************************************************************************
884  * @fn SyncTracks
885  * @param useProgramDateTimeIfAvailable use program date time tag to sync if available
886  * @return eAAMPSTATUS_OK on success
887  ***************************************************************************/
889  /***************************************************************************
890  * @fn CheckDiscontinuityAroundPlaytarget
891  *
892  * @return void
893  ***************************************************************************/
895  /***************************************************************************
896  * @fn SyncTracksForDiscontinuity
897  *
898  * @return eAAMPSTATUS_OK on success
899  ***************************************************************************/
901  /***************************************************************************
902  * @fn PopulateAudioAndTextTracks
903  *
904  * @return void
905  ***************************************************************************/
907  /***************************************************************************
908  * @fn ConfigureAudioTrack
909  *
910  * @return void
911  ***************************************************************************/
912  void ConfigureAudioTrack();
913  /***************************************************************************
914  * @fn ConfigureVideoProfiles
915  *
916  * @return void
917  ***************************************************************************/
918  void ConfigureVideoProfiles();
919  /***************************************************************************
920  * @fn ConfigureTextTrack
921  *
922  * @return void
923  ***************************************************************************/
924  void ConfigureTextTrack();
925 
926  int segDLFailCount; /**< Segment Download fail count */
927  int segDrmDecryptFailCount; /**< Segment Decrypt fail count */
928  int mMediaCount; /**< Number of media in the stream */
929  int mProfileCount; /**< Number of Video/Iframe in the stream */
930  bool mIframeAvailable; /**< True if iframe available in the stream */
931  std::set<std::string> mLangList;/**< Available language list */
932  double mFirstPTS; /**< First video PTS in seconds */
933 };
934 
935 #endif // FRAGMENTCOLLECTOR_HLS_H
StreamAbstractionAAMP_HLS::GetPlaylistURI
const char * GetPlaylistURI(TrackType trackType, StreamOutputFormat *format=NULL)
Function to get playlist URI based on media selection.
Definition: fragmentcollector_hls.cpp:2993
eDRM_KEY_METHOD_UNKNOWN
@ eDRM_KEY_METHOD_UNKNOWN
Definition: fragmentcollector_hls.h:163
TrackState::mDrmMetaDataIndexPosition
int mDrmMetaDataIndexPosition
Definition: fragmentcollector_hls.h:511
DrmReturn
DrmReturn
Return values of various functions.
Definition: HlsDrmBase.h:35
StreamAbstractionAAMP_HLS::mainManifest
GrowableBuffer mainManifest
Definition: fragmentcollector_hls.h:784
TrackState::byteRangeLength
size_t byteRangeLength
Definition: fragmentcollector_hls.h:489
TrackState::mSyncAfterDiscontinuityInProgress
bool mSyncAfterDiscontinuityInProgress
Definition: fragmentcollector_hls.h:546
TrackState::FetchPlaylist
void FetchPlaylist()
Function to fetch playlist file.
Definition: fragmentcollector_hls.cpp:6287
TrackState::StopDiscontinuityCheckWait
void StopDiscontinuityCheckWait()
Stop the wait for discontinuity check in each track.
Definition: fragmentcollector_hls.cpp:6952
StreamOutputFormat
StreamOutputFormat
Media output format.
Definition: main_aamp.h:106
MediaInfo
MediaInfo structure for Media related information.
Definition: fragmentcollector_hls.h:97
HlsProtectionInfo
HlsStreamInfo structure for stream related information.
Definition: fragmentcollector_hls.h:69
TrackState::FindMediaForSequenceNumber
char * FindMediaForSequenceNumber()
Get fragment tag based on media sequence number Function to find the media sequence after refresh for...
Definition: fragmentcollector_hls.cpp:1591
StreamInfo
Structure holding the information of a stream.
Definition: StreamAbstractionAAMP.h:69
HlsStreamInfo
HlsStreamInfo structure for stream related information.
Definition: fragmentcollector_hls.h:79
HlsStreamInfo::subtitles
const char * subtitles
Definition: fragmentcollector_hls.h:89
StreamAbstractionAAMP_HLS::mTrickPlayFPS
int mTrickPlayFPS
Definition: fragmentcollector_hls.h:791
TrackState::GetNextFragmentUriFromPlaylist
char * GetNextFragmentUriFromPlaylist(bool ignoreDiscontinuity=false)
Function to get next fragment URI from playlist based on playtarget.
Definition: fragmentcollector_hls.cpp:1205
StreamAbstractionAAMP_HLS::ChangeMuxedAudioTrackIndex
void ChangeMuxedAudioTrackIndex(std::string &index) override
Change muxed audio track index.
Definition: fragmentcollector_hls.cpp:7764
StreamAbstractionAAMP_HLS::allowsCache
bool allowsCache
Definition: fragmentcollector_hls.h:785
TrackState::ABRProfileChanged
void ABRProfileChanged(void)
Function to handle Profile change after ABR.
Definition: fragmentcollector_hls.cpp:2702
TrackState::mDiscoCheckMutex
pthread_mutex_t mDiscoCheckMutex
Definition: fragmentcollector_hls.h:541
MediaTrack::cachedFragment
CachedFragment * cachedFragment
Definition: StreamAbstractionAAMP.h:535
StreamAbstractionAAMP_HLS::Init
AAMPStatusType Init(TuneType tuneType) override
Function to initialize member variables,download main manifest and parse.
Definition: fragmentcollector_hls.cpp:3732
StreamAbstractionAAMP_HLS::segDrmDecryptFailCount
int segDrmDecryptFailCount
Definition: fragmentcollector_hls.h:927
MediaInfo::isDefault
bool isDefault
Definition: fragmentcollector_hls.h:104
TrackState::FetchFragment
void FetchFragment()
Function to Fetch the fragment and inject for playback.
Definition: fragmentcollector_hls.cpp:1931
eDRM_KEY_METHOD_AES_128
@ eDRM_KEY_METHOD_AES_128
Definition: fragmentcollector_hls.h:160
DrmSessionParams
Holds data regarding drm session.
Definition: AampDRMSessionManager.h:101
TuneType
TuneType
Tune Typea.
Definition: priv_aamp.h:190
StreamAbstractionAAMP_HLS::enableThrottle
bool enableThrottle
Definition: fragmentcollector_hls.h:792
TrackState::playContext
MediaProcessor * playContext
Definition: fragmentcollector_hls.h:500
StreamAbstractionAAMP_HLS
HLS Stream handler class.
Definition: fragmentcollector_hls.h:566
StreamAbstractionAAMP::aamp
PrivateInstanceAAMP * aamp
Definition: StreamAbstractionAAMP.h:727
mediaprocessor.h
Header file for base class of media container processor.
eDRM_KEY_METHOD_NONE
@ eDRM_KEY_METHOD_NONE
Definition: fragmentcollector_hls.h:159
StreamAbstractionAAMP_HLS::GetBufferedDuration
double GetBufferedDuration() override
Function to get the buffer duration of stream.
Definition: fragmentcollector_hls.cpp:5132
MediaInfo::channels
int channels
Definition: fragmentcollector_hls.h:108
StreamAbstractionAAMP_HLS::SeekPosUpdate
void SeekPosUpdate(double secondsRelativeToTuneTime) override
Function to update seek position.
Definition: fragmentcollector_hls.cpp:7640
StreamAbstractionAAMP.h
Base classes of HLS/MPD collectors. Implements common caching/injection logic.
TrackState::GetFragmentUriFromIndex
char * GetFragmentUriFromIndex(bool &bSegmentRepeated)
Function to get fragment URI from index count.
Definition: fragmentcollector_hls.cpp:1020
StreamAbstractionAAMP_HLS::StartInjection
void StartInjection(void) override
starts fragment injection
Definition: fragmentcollector_hls.cpp:6925
StreamAbstractionAAMP_HLS::GetLanguageCode
std::string GetLanguageCode(int iMedia)
Function to get the language code.
Definition: fragmentcollector_hls.cpp:3722
StreamAbstractionAAMP_HLS::Start
void Start() override
Function to start track initiaziation.
Definition: fragmentcollector_hls.cpp:5623
TrackState::UpdateDrmCMSha1Hash
void UpdateDrmCMSha1Hash(const char *ptr)
Function to Update SHA1 Id for DRM Metadata.
Definition: fragmentcollector_hls.cpp:6139
HlsStreamInfo::averageBandwidth
long averageBandwidth
Definition: fragmentcollector_hls.h:87
TrackState::KeyHashTable
std::vector< KeyTagStruct > KeyHashTable
Definition: fragmentcollector_hls.h:520
eDRM_KEY_METHOD_SAMPLE_AES_CTR
@ eDRM_KEY_METHOD_SAMPLE_AES_CTR
Definition: fragmentcollector_hls.h:162
TrackState::firstIndexDone
bool firstIndexDone
Definition: fragmentcollector_hls.h:532
MediaInfo::forced
bool forced
Definition: fragmentcollector_hls.h:110
TrackState::targetDurationSeconds
double targetDurationSeconds
Definition: fragmentcollector_hls.h:497
HlsStreamInfo::program_id
long program_id
Definition: fragmentcollector_hls.h:81
TrackState::lastDownloadedIFrameTarget
double lastDownloadedIFrameTarget
Definition: fragmentcollector_hls.h:496
MediaTrack::type
TrackType type
Definition: StreamAbstractionAAMP.h:523
TrackState::mDrm
std::shared_ptr< HlsDrmBase > mDrm
Definition: fragmentcollector_hls.h:533
TrackState::RestoreDrmState
void RestoreDrmState()
Restore DRM states.
Definition: fragmentcollector_hls.cpp:6985
IndexNode::drmMetadataIdx
int drmMetadataIdx
Definition: fragmentcollector_hls.h:123
TrackState::SetDrmContext
void SetDrmContext()
Function to set DRM Context when KeyTag changes.
Definition: fragmentcollector_hls.cpp:2221
StreamAbstractionAAMP_HLS::GetStreamPosition
double GetStreamPosition() override
Get current stream position.
Definition: fragmentcollector_hls.h:640
StreamAbstractionAAMP_HLS::segDLFailCount
int segDLFailCount
Definition: fragmentcollector_hls.h:926
StreamAbstractionAAMP_HLS::maxIntervalBtwPlaylistUpdateMs
float maxIntervalBtwPlaylistUpdateMs
Definition: fragmentcollector_hls.h:783
TrackState::mDrmInfo
struct DrmInfo mDrmInfo
Definition: fragmentcollector_hls.h:508
HlsStreamInfo::audioFormat
StreamOutputFormat audioFormat
Definition: fragmentcollector_hls.h:90
TrackState::mFirstEncInitFragmentInfo
const char * mFirstEncInitFragmentInfo
Definition: fragmentcollector_hls.h:551
TrackState::HasDiscontinuityAroundPosition
bool HasDiscontinuityAroundPosition(double position, bool useStartTime, double &diffBetweenDiscontinuities, double playPosition, double inputCulledSec, double inputProgramDateTime, bool &isDiffChkReq)
Check if discontinuity present around given position.
Definition: fragmentcollector_hls.cpp:6467
StreamAbstractionAAMP_HLS::mFirstPTS
double mFirstPTS
Definition: fragmentcollector_hls.h:932
MediaInfo::uri
const char * uri
Definition: fragmentcollector_hls.h:105
TrackState::SwitchSubtitleTrack
void SwitchSubtitleTrack()
Flushes out all old segments and sets up new playlist Used to switch subtitle tracks without restarti...
Definition: fragmentcollector_hls.cpp:5157
MediaInfo::audioFormat
StreamOutputFormat audioFormat
Definition: fragmentcollector_hls.h:106
StreamAbstractionAAMP_HLS::PreCachePlaylist
void PreCachePlaylist()
Function to initiate precaching of playlist.
Definition: fragmentcollector_hls.cpp:5056
HlsStreamInfo::codecs
const char * codecs
Definition: fragmentcollector_hls.h:83
StreamAbstractionAAMP_HLS::lastSelectedProfileIndex
int lastSelectedProfileIndex
Definition: fragmentcollector_hls.h:811
HlsStreamInfo::audio
const char * audio
Definition: fragmentcollector_hls.h:82
StreamAbstractionAAMP_HLS::GetStreamInfo
StreamInfo * GetStreamInfo(int idx) override
Get stream information of a profile from subclass.
Definition: fragmentcollector_hls.cpp:7740
TrackState::FetchInitFragmentHelper
bool FetchInitFragmentHelper(long &http_code, bool forcePushEncryptedHeader=false)
Helper to fetch init fragment for fragmented mp4 format.
Definition: fragmentcollector_hls.cpp:6720
StreamAbstractionAAMP_HLS::ConfigureAudioTrack
void ConfigureAudioTrack()
Function to select the audio track and update AudioProfileIndex.
Definition: fragmentcollector_hls.cpp:7046
TrackState::GetPeriodStartPosition
double GetPeriodStartPosition(int periodIdx)
Function to get Period start position for given period index,to handle discontinuity.
Definition: fragmentcollector_hls.cpp:6422
TrackState::mLastMatchedDiscontPosition
double mLastMatchedDiscontPosition
Definition: fragmentcollector_hls.h:543
AampLogManager
AampLogManager Class.
Definition: AampLogManager.h:150
TrackState::GetBufferedDuration
double GetBufferedDuration()
Function to retune buffered duration.
Definition: fragmentcollector_hls.cpp:5147
TrackState::mByteOffsetCalculation
bool mByteOffsetCalculation
Definition: fragmentcollector_hls.h:549
TrackState::mDrmKeyTagCount
int mDrmKeyTagCount
Definition: fragmentcollector_hls.h:514
TrackState::indexCount
int indexCount
Definition: fragmentcollector_hls.h:482
TrackState::CreateInitVectorByMediaSeqNo
bool CreateInitVectorByMediaSeqNo(unsigned int ui32Seqno)
Function to create init vector using current media sequence number.
Definition: fragmentcollector_hls.cpp:6082
TileInfo
TileInfo structure for Thumbnail data.
Definition: StreamAbstractionAAMP.h:84
TrackState::mKeyTagChanged
bool mKeyTagChanged
Definition: fragmentcollector_hls.h:506
StreamAbstractionAAMP_HLS::StartSubtitleParser
void StartSubtitleParser() override
Signal start of subtitle renderering - should be sent at start of video presentation.
Definition: fragmentcollector_hls.cpp:6018
StreamAbstractionAAMP_HLS::GetStreamOutputFormatForTrack
StreamOutputFormat GetStreamOutputFormatForTrack(TrackType type)
Function to get output format for audio track.
Definition: fragmentcollector_hls.cpp:7689
TrackState::playlist
GrowableBuffer playlist
Definition: fragmentcollector_hls.h:478
TrackState::mForceProcessDrmMetadata
bool mForceProcessDrmMetadata
Definition: fragmentcollector_hls.h:537
DiscontinuityIndexNode::fragmentIdx
int fragmentIdx
Definition: fragmentcollector_hls.h:147
TrackState::mDrmMetaDataIndex
GrowableBuffer mDrmMetaDataIndex
Definition: fragmentcollector_hls.h:512
MediaTrack
Base Class for Media Track.
Definition: StreamAbstractionAAMP.h:159
MediaInfo::name
const char * name
Definition: fragmentcollector_hls.h:101
StreamAbstractionAAMP
StreamAbstraction class of AAMP.
Definition: StreamAbstractionAAMP.h:577
StreamAbstractionAAMP_HLS::GetStreamFormat
void GetStreamFormat(StreamOutputFormat &primaryOutputFormat, StreamOutputFormat &audioOutputFormat, StreamOutputFormat &auxOutputFormat, StreamOutputFormat &subOutputFormat) override
Get output format of stream.
Definition: fragmentcollector_hls.cpp:5769
TrackState::mDrmTimeStamp
long long mDrmTimeStamp
Definition: fragmentcollector_hls.h:510
TrackState::CancelDrmOperation
void CancelDrmOperation(bool clearDRM)
Cancel all DRM operations.
Definition: fragmentcollector_hls.cpp:6963
StreamAbstractionAAMP_HLS::Stop
void Stop(bool clearChannelData) override
Function to stop the HLS streaming Function to handle stop processing of all tracks within stream.
Definition: fragmentcollector_hls.cpp:5643
StreamAbstractionAAMP_HLS::DumpProfiles
void DumpProfiles(void) override
Function to log all debug information on Stream/Media information.
Definition: fragmentcollector_hls.cpp:5713
MediaInfo::group_id
const char * group_id
Definition: fragmentcollector_hls.h:100
TrackState::playTargetOffset
double playTargetOffset
Definition: fragmentcollector_hls.h:502
StreamAbstractionAAMP_HLS::CheckDiscontinuityAroundPlaytarget
void CheckDiscontinuityAroundPlaytarget(void)
Function to update play target based on audio video exact discontinuity positions.
Definition: fragmentcollector_hls.cpp:3174
TrackState::fragmentCollectorThreadStarted
bool fragmentCollectorThreadStarted
Definition: fragmentcollector_hls.h:530
TrackState::mCulledSeconds
double mCulledSeconds
Definition: fragmentcollector_hls.h:544
TrackState::DrmDecrypt
DrmReturn DrmDecrypt(CachedFragment *cachedFragment, ProfilerBucketType bucketType)
Function to decrypt the fragment for playback.
Definition: fragmentcollector_hls.cpp:6046
StreamAbstractionAAMP_HLS::mLangList
std::set< std::string > mLangList
Definition: fragmentcollector_hls.h:931
TrackState::mSkipSegmentOnError
bool mSkipSegmentOnError
Definition: fragmentcollector_hls.h:554
TrackState::mDeferredDrmKeyMaxTime
int mDeferredDrmKeyMaxTime
Definition: fragmentcollector_hls.h:498
StreamAbstractionAAMP_HLS::indexedTileInfo
std::vector< TileInfo > indexedTileInfo
Definition: fragmentcollector_hls.h:756
DrmInfo
DRM information required to decrypt.
Definition: AampDrmInfo.h:47
TrackState::byteRangeOffset
size_t byteRangeOffset
Definition: fragmentcollector_hls.h:490
TrackState::refreshPlaylist
bool refreshPlaylist
Definition: fragmentcollector_hls.h:528
TrackState::StopInjection
void StopInjection(void)
Stop fragment injection.
Definition: fragmentcollector_hls.cpp:6896
TrackType
TrackType
Media Track Types.
Definition: StreamAbstractionAAMP.h:48
StreamAbstractionAAMP_HLS::PauseSubtitleParser
void PauseSubtitleParser(bool pause) override
Set subtitle pause state.
Definition: fragmentcollector_hls.cpp:6032
TrackState::mCulledSecondsAtStart
double mCulledSecondsAtStart
Definition: fragmentcollector_hls.h:553
MediaType
MediaType
Media types.
Definition: AampMediaType.h:37
TrackState::playlistPosition
double playlistPosition
Definition: fragmentcollector_hls.h:493
TrackState::StopWaitForPlaylistRefresh
void StopWaitForPlaylistRefresh()
Stop wait for playlist refresh.
Definition: fragmentcollector_hls.cpp:6941
TrackState::mIndexingInProgress
bool mIndexingInProgress
Definition: fragmentcollector_hls.h:515
TrackState::mDrmMetaDataIndexCount
int mDrmMetaDataIndexCount
Definition: fragmentcollector_hls.h:513
TrackState::mSkipAbr
bool mSkipAbr
Definition: fragmentcollector_hls.h:550
StreamAbstractionAAMP_HLS::mStartTimestampZero
bool mStartTimestampZero
Definition: fragmentcollector_hls.h:794
HlsStreamInfo::closedCaptions
const char * closedCaptions
Definition: fragmentcollector_hls.h:88
TrackState::mDiscontinuityIndex
GrowableBuffer mDiscontinuityIndex
Definition: fragmentcollector_hls.h:516
AAMP_TRACK_COUNT
#define AAMP_TRACK_COUNT
Definition: priv_aamp.h:67
TrackState::mDrmMethod
DrmKeyMethod mDrmMethod
Definition: fragmentcollector_hls.h:524
MediaTrack::name
const char * name
Definition: StreamAbstractionAAMP.h:518
StreamAbstractionAAMP_HLS::thumbnailManifest
GrowableBuffer thumbnailManifest
Definition: fragmentcollector_hls.h:755
TrackState::pCMCDMetrics
CMCDHeaders * pCMCDMetrics
Definition: fragmentcollector_hls.h:525
TrackState::mCheckForInitialFragEnc
bool mCheckForInitialFragEnc
Definition: fragmentcollector_hls.h:523
KeyTagStruct::mKeyTagStr
std::string mKeyTagStr
Definition: fragmentcollector_hls.h:138
TrackState::mLastKeyTagIdx
int mLastKeyTagIdx
Definition: fragmentcollector_hls.h:507
StreamAbstractionAAMP_HLS::GetBestAudioTrackByLanguage
int GetBestAudioTrackByLanguage(void)
Function to get best audio track based on the profile availability and language setting.
Definition: fragmentcollector_hls.cpp:2934
DiscontinuityIndexNode::position
double position
Definition: fragmentcollector_hls.h:148
MediaInfo::autoselect
bool autoselect
Definition: fragmentcollector_hls.h:103
StreamAbstractionAAMP_HLS::streamInfo
HlsStreamInfo streamInfo[128]
Definition: fragmentcollector_hls.h:786
TrackState::streamOutputFormat
StreamOutputFormat streamOutputFormat
Definition: fragmentcollector_hls.h:499
StreamAbstractionAAMP_HLS::mIframeAvailable
bool mIframeAvailable
Definition: fragmentcollector_hls.h:930
TrackState::FindTimedMetadata
void FindTimedMetadata(bool reportbulk=false, bool bInitCall=false)
Function to search playlist for subscribed tags.
Definition: fragmentcollector_hls.cpp:6996
TrackState::context
StreamAbstractionAAMP_HLS * context
Definition: fragmentcollector_hls.h:504
MediaInfo::type
MediaType type
Definition: fragmentcollector_hls.h:99
StreamAbstractionAAMP_HLS::IsLive
bool IsLive()
Function to check if both tracks in demuxed HLS are in live mode Function to check for live status co...
Definition: fragmentcollector_hls.cpp:3153
StreamAbstractionAAMP_HLS::SetThumbnailTrack
bool SetThumbnailTrack(int) override
Function to set thumbnail track for processing.
Definition: fragmentcollector_hls.cpp:5891
TrackState::RefreshPlaylist
void RefreshPlaylist(void)
Function to redownload playlist after refresh interval .
Definition: fragmentcollector_hls.cpp:2731
MediaInfo::isCC
bool isCC
Definition: fragmentcollector_hls.h:112
TrackState::GetNextFragmentPeriodInfo
void GetNextFragmentPeriodInfo(int &periodIdx, double &offsetFromPeriodStart, int &fragmentIdx)
Function to get next playback position from start, to handle discontinuity.
Definition: fragmentcollector_hls.cpp:6363
StreamAbstractionAAMP_HLS::firstFragmentDecrypted
bool firstFragmentDecrypted
Definition: fragmentcollector_hls.h:793
StreamAbstractionAAMP_HLS::trackState
TrackState * trackState[4]
Definition: fragmentcollector_hls.h:781
TrackState::mPlaylistIndexed
pthread_cond_t mPlaylistIndexed
Definition: fragmentcollector_hls.h:539
StreamAbstractionAAMP_HLS::mProfileCount
int mProfileCount
Definition: fragmentcollector_hls.h:929
TrackState::GetContext
StreamAbstractionAAMP * GetContext()
Function to get current StreamAbstractionAAMP instance value.
Definition: fragmentcollector_hls.cpp:6123
TrackState::GetNumberOfPeriods
int GetNumberOfPeriods()
Function to return number of periods stored in playlist.
Definition: fragmentcollector_hls.cpp:6458
StreamAbstractionAAMP_HLS::ConfigureTextTrack
void ConfigureTextTrack()
Function to select the text track and update TextTrackProfileIndex.
Definition: fragmentcollector_hls.cpp:7544
HlsProtectionInfo::drmData
struct DrmSessionParams * drmData
Definition: fragmentcollector_hls.h:71
TrackState::FetchFragmentHelper
bool FetchFragmentHelper(long &http_error, bool &decryption_error, bool &bKeyChanged, int *fogError, double &downloadTime)
Helper function to download fragment.
Definition: fragmentcollector_hls.cpp:1656
StreamAbstractionAAMP_HLS::GetBWIndex
int GetBWIndex(long bitrate) override
Function to get bandwidth index corresponding to bitrate.
Definition: fragmentcollector_hls.cpp:6342
TrackState::fragmentEncrypted
bool fragmentEncrypted
Definition: fragmentcollector_hls.h:505
TrackState::mPlaylistMutex
pthread_mutex_t mPlaylistMutex
Definition: fragmentcollector_hls.h:538
TrackState::RunFetchLoop
void RunFetchLoop()
Fragment collector thread execution function to download fragments.
Definition: fragmentcollector_hls.cpp:5183
TrackState::lastPlaylistDownloadTimeMS
long long lastPlaylistDownloadTimeMS
Definition: fragmentcollector_hls.h:488
StreamAbstractionAAMP_HLS::mMediaCount
int mMediaCount
Definition: fragmentcollector_hls.h:928
StreamAbstractionAAMP_HLS::StreamAbstractionAAMP_HLS
StreamAbstractionAAMP_HLS(AampLogManager *logObj, class PrivateInstanceAAMP *aamp, double seekpos, float rate)
Constructor function.
Definition: fragmentcollector_hls.cpp:5405
TrackState::FlushIndex
void FlushIndex()
Function to flush all stored data before refresh and stop.
Definition: fragmentcollector_hls.cpp:2166
TrackState::currentIdx
int currentIdx
Definition: fragmentcollector_hls.h:483
GrowableBuffer
Structure of GrowableBuffer.
Definition: AampMemoryUtils.h:39
HlsProtectionInfo::next
HlsProtectionInfo * next
Definition: fragmentcollector_hls.h:72
PrivateInstanceAAMP
Class representing the AAMP player's private instance, which is not exposed to outside world.
Definition: priv_aamp.h:640
StreamAbstractionAAMP_HLS::seekPosition
double seekPosition
Definition: fragmentcollector_hls.h:789
IndexNode::pFragmentInfo
const char * pFragmentInfo
Definition: fragmentcollector_hls.h:122
TrackState::mInitFragmentInfo
const char * mInitFragmentInfo
Definition: fragmentcollector_hls.h:536
StreamAbstractionAAMP_HLS::GetAvailableThumbnailTracks
std::vector< StreamInfo * > GetAvailableThumbnailTracks(void) override
Function to get available thumbnail tracks.
Definition: fragmentcollector_hls.cpp:5827
TrackState::fragmentCollectorThreadID
pthread_t fragmentCollectorThreadID
Definition: fragmentcollector_hls.h:529
KeyTagStruct
KeyTagStruct structure to store all Keytags with Hash.
Definition: fragmentcollector_hls.h:131
StreamAbstractionAAMP_HLS::pCMCDMetrics
CMCDHeaders * pCMCDMetrics
Definition: fragmentcollector_hls.h:796
StreamAbstractionAAMP_HLS::mNumberOfTracks
int mNumberOfTracks
Definition: fragmentcollector_hls.h:795
ProfilerBucketType
ProfilerBucketType
Bucket types of AAMP profiler.
Definition: AampProfiler.h:43
StreamAbstractionAAMP_HLS::GetFirstPTS
double GetFirstPTS() override
Function to return first PTS.
Definition: fragmentcollector_hls.cpp:5104
TrackState::nextMediaSequenceNumber
long long nextMediaSequenceNumber
Definition: fragmentcollector_hls.h:492
AAMPStatusType
AAMPStatusType
AAMP Function return values.
Definition: priv_aamp.h:205
TrackState::mXStartTimeOFfset
double mXStartTimeOFfset
Definition: fragmentcollector_hls.h:552
TrackState::mCulledSecondsOld
double mCulledSecondsOld
Definition: fragmentcollector_hls.h:545
StreamAbstractionAAMP_HLS::StopInjection
void StopInjection(void) override
Function to stop fragment injection.
Definition: fragmentcollector_hls.cpp:6877
StreamAbstractionAAMP_HLS::FilterAudioCodecBasedOnConfig
bool FilterAudioCodecBasedOnConfig(StreamOutputFormat audioFormat)
Function to filter the audio codec based on the configuration.
Definition: fragmentcollector_hls.cpp:2892
MediaProcessor
Base Class for Media Container Processor.
Definition: mediaprocessor.h:47
TrackState::mTrackDrmMutex
pthread_mutex_t mTrackDrmMutex
Definition: fragmentcollector_hls.h:540
DiscontinuityIndexNode::discontinuityPDT
double discontinuityPDT
Definition: fragmentcollector_hls.h:150
KeyTagStruct::mKeyStartDuration
double mKeyStartDuration
Definition: fragmentcollector_hls.h:137
StreamAbstractionAAMP_HLS::GetVideoBitrates
std::vector< long > GetVideoBitrates(void) override
Get available video bitrates.
Definition: fragmentcollector_hls.cpp:5779
TrackState::mInjectInitFragment
bool mInjectInitFragment
Definition: fragmentcollector_hls.h:535
StreamAbstractionAAMP_HLS::GetAudioBitrates
std::vector< long > GetAudioBitrates(void) override
Function to get available audio bitrates.
Definition: fragmentcollector_hls.cpp:5801
MediaInfo::characteristics
const char * characteristics
Definition: fragmentcollector_hls.h:111
HlsDrmBase.h
Declaration common to various HLS DRM implementations.
StreamAbstractionAAMP_HLS::mediaInfo
MediaInfo mediaInfo[128]
Definition: fragmentcollector_hls.h:787
StreamAbstractionAAMP_HLS::rate
float rate
Definition: fragmentcollector_hls.h:782
StreamAbstractionAAMP_HLS::midSeekPtsOffset
double midSeekPtsOffset
Definition: fragmentcollector_hls.h:790
TrackState::mDiscoCheckComplete
pthread_cond_t mDiscoCheckComplete
Definition: fragmentcollector_hls.h:542
KeyTagStruct::mShaID
std::string mShaID
Definition: fragmentcollector_hls.h:136
StreamAbstractionAAMP_HLS::PopulateAudioAndTextTracks
void PopulateAudioAndTextTracks()
Function to populate available audio and text tracks info from manifest.
Definition: fragmentcollector_hls.cpp:7566
TrackState::startTimeForPlaylistSync
double startTimeForPlaylistSync
Definition: fragmentcollector_hls.h:501
TrackState::mPlaylistUrl
std::string mPlaylistUrl
Definition: fragmentcollector_hls.h:477
StreamAbstractionAAMP_HLS::GetThumbnailRangeData
std::vector< ThumbnailData > GetThumbnailRangeData(double, double, std::string *, int *, int *, int *, int *) override
Function to fetch the thumbnail data.
Definition: fragmentcollector_hls.cpp:5939
IndexNode::initFragmentPtr
const char * initFragmentPtr
Definition: fragmentcollector_hls.h:124
TrackState::mEffectiveUrl
std::string mEffectiveUrl
Definition: fragmentcollector_hls.h:476
HlsStreamInfo::uri
const char * uri
Definition: fragmentcollector_hls.h:84
StreamAbstractionAAMP_HLS::SyncTracksForDiscontinuity
AAMPStatusType SyncTracksForDiscontinuity()
Function to synchronize time between audio & video for VOD stream with discontinuities and uneven tra...
Definition: fragmentcollector_hls.cpp:3207
TrackState::IndexPlaylist
void IndexPlaylist(bool IsRefresh, double &culledSec)
Function to to handle parse and indexing of individual tracks.
Definition: fragmentcollector_hls.cpp:2311
StreamAbstractionAAMP_HLS::Is4KStream
virtual bool Is4KStream(int &height, long &bandwidth) override
Check whether stream is 4K stream or not.
Definition: fragmentcollector_hls.cpp:7069
TrackState::fragmentURI
char * fragmentURI
Definition: fragmentcollector_hls.h:487
TrackState::playTarget
double playTarget
Definition: fragmentcollector_hls.h:494
TrackState::~TrackState
~TrackState()
Destructor function.
Definition: fragmentcollector_hls.cpp:5493
TrackState::indexFirstMediaSequenceNumber
long long indexFirstMediaSequenceNumber
Definition: fragmentcollector_hls.h:485
MediaTrack::aamp
PrivateInstanceAAMP * aamp
Definition: StreamAbstractionAAMP.h:534
IndexNode::completionTimeSecondsFromStart
double completionTimeSecondsFromStart
Definition: fragmentcollector_hls.h:121
MediaInfo::language
const char * language
Definition: fragmentcollector_hls.h:102
TrackState::discontinuity
bool discontinuity
Definition: fragmentcollector_hls.h:503
PlaylistType
PlaylistType
Playlist Types.
Definition: StreamAbstractionAAMP.h:128
TrackState
State Machine for each Media Track.
Definition: fragmentcollector_hls.h:176
IndexNode
IndexNode structure for Node/DRM Index.
Definition: fragmentcollector_hls.h:119
StreamAbstractionAAMP_HLS::SyncTracks
AAMPStatusType SyncTracks(void)
Function to synchronize time between A/V for Live/Event assets.
Definition: fragmentcollector_hls.cpp:3411
CachedFragment
Structure of cached fragment data Holds information about a cached fragment.
Definition: StreamAbstractionAAMP.h:99
StreamAbstractionAAMP_HLS::NotifyFirstVideoPTS
void NotifyFirstVideoPTS(unsigned long long pts, unsigned long timeScale) override
Function to notify first video pts value from tsprocessor/demux Kept public as its called from outsid...
Definition: fragmentcollector_hls.cpp:6009
StreamAbstractionAAMP_HLS::ConfigureVideoProfiles
void ConfigureVideoProfiles()
Function to select the best match video profiles based on audio and filters.
Definition: fragmentcollector_hls.cpp:7089
StreamAbstractionAAMP_HLS::GetMediaTrack
MediaTrack * GetMediaTrack(TrackType type) override
Function to get Media information for track type.
Definition: fragmentcollector_hls.cpp:6131
StreamAbstractionAAMP_HLS::GetStartTimeOfFirstPTS
double GetStartTimeOfFirstPTS() override
Get Start time PTS of first sample.
Definition: fragmentcollector_hls.h:653
DrmKeyMethod
DrmKeyMethod
Enum for various EXT-X-KEY:METHOD= values.
Definition: fragmentcollector_hls.h:157
DiscontinuityIndexNode
Index Node structure for Discontinuity Index.
Definition: fragmentcollector_hls.h:145
TrackState::FetchInitFragment
void FetchInitFragment()
Function to fetch init fragment.
Definition: fragmentcollector_hls.cpp:6619
StreamAbstractionAAMP_HLS::GetMediaIndexForLanguage
int GetMediaIndexForLanguage(std::string lang, TrackType type)
Function to get matching mediaInfo index for a language and track type.
Definition: fragmentcollector_hls.cpp:7648
TrackState::UpdateDrmIV
void UpdateDrmIV(const char *ptr)
Function to update IV from DRM.
Definition: fragmentcollector_hls.cpp:6255
TrackState::TrackState
TrackState(AampLogManager *logObj, TrackType type, class StreamAbstractionAAMP_HLS *parent, PrivateInstanceAAMP *aamp, const char *name)
TrackState Constructor.
Definition: fragmentcollector_hls.cpp:5439
TrackState::StartInjection
void StartInjection()
Function to start fragment injection.
Definition: fragmentcollector_hls.cpp:6911
ePLAYLISTTYPE_VOD
@ ePLAYLISTTYPE_VOD
Definition: StreamAbstractionAAMP.h:132
DiscontinuityIndexNode::fragmentDuration
double fragmentDuration
Definition: fragmentcollector_hls.h:149
TrackState::InjectFragmentInternal
void InjectFragmentInternal(CachedFragment *cachedFragment, bool &fragmentDiscarded)
Injected decrypted fragment for playback.
Definition: fragmentcollector_hls.cpp:2086
TrackState::Stop
void Stop(bool clearDRM=false)
Function to stop track download/playback.
Definition: fragmentcollector_hls.cpp:5528
TrackState::mFragmentURIFromIndex
std::string mFragmentURIFromIndex
Definition: fragmentcollector_hls.h:484
TrackState::mPlaylistType
PlaylistType mPlaylistType
Definition: fragmentcollector_hls.h:547
TrackState::index
GrowableBuffer index
Definition: fragmentcollector_hls.h:481
StreamAbstractionAAMP_HLS::ParseMainManifest
AAMPStatusType ParseMainManifest()
Function to parse main manifest.
Definition: fragmentcollector_hls.cpp:764
TrackState::mDrmLicenseRequestPending
bool mDrmLicenseRequestPending
Definition: fragmentcollector_hls.h:534
TrackState::manifestDLFailCount
int manifestDLFailCount
Definition: fragmentcollector_hls.h:531
TrackState::Start
void Start()
Function to create threads for track donwload.
Definition: fragmentcollector_hls.cpp:5597
TrackState::mReachedEndListTag
bool mReachedEndListTag
Definition: fragmentcollector_hls.h:548
eDRM_KEY_METHOD_SAMPLE_AES
@ eDRM_KEY_METHOD_SAMPLE_AES
Definition: fragmentcollector_hls.h:161
TrackState::mDiscontinuityIndexCount
int mDiscontinuityIndexCount
Definition: fragmentcollector_hls.h:517
StreamAbstractionAAMP_HLS::~StreamAbstractionAAMP_HLS
~StreamAbstractionAAMP_HLS()
Destructor function for StreamAbstractionAAMP_HLS.
Definition: fragmentcollector_hls.cpp:5576
MediaInfo::instreamID
const char * instreamID
Definition: fragmentcollector_hls.h:109
TrackState::mCMSha1Hash
char * mCMSha1Hash
Definition: fragmentcollector_hls.h:509