Repository navigation
Expand file tree
/
Copy pathmain_aamp.h
More file actions
1329 lines (1155 loc) · 33.5 KB
/
Copy pathmain_aamp.h
File metadata and controls
1329 lines (1155 loc) · 33.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* If not stated otherwise in this file or this component's license file the
* following copyright and licenses apply:
*
* Copyright 2018 RDK Management
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file main_aamp.h
* @brief Types and APIs exposed by the AAMP player.
*/
/**
@mainpage Advanced Adaptive Micro Player (AAMP)
<b>AAMP</b> is a native video engine build on top of gstreamer, optimized for
performance, memory use, and code size.
<br><b>AAMP</b> downloads and parses HLS/DASH manifests. <b>AAMP</b> has been
integrated with Adobe Access, PlayReady, CONSEC agnostic, and Widevine DRM
<b>AAMP</b> is fronted by JS PP (JavaScript Player Platform), which provides an
additional layer of functionality including player analytics, configuration
management, and ad insertion.
*/
#ifndef MAINAAMP_H
#define MAINAAMP_H
#include <memory>
#include <vector>
#include <string>
#include <string.h>
#include <stddef.h>
#include <functional>
#include "AampEvent.h"
#include "AampEventListener.h"
#include "AampDrmSystems.h"
#include "AampMediaType.h"
/*! \mainpage
*
* \section intro_sec Introduction
*
* See PlayerInstanceAAMP for libaamp public C++ API's
*
*/
/**
* @brief AAMP anomaly message types
*/
typedef enum
{
ANOMALY_ERROR,
ANOMALY_WARNING,
ANOMALY_TRACE
} AAMPAnomalyMessageType;
/**
* @brief Structure holding aamp tune failure code and corresponding application error code and description
*/
struct TuneFailureMap
{
AAMPTuneFailure tuneFailure; /**< Failure ID */
int code; /**< Error code */
const char* description; /**< Textual description */
};
#define MAX_ERROR_DESCRIPTION_LENGTH 128
#define MAX_ANOMALY_BUFF_SIZE 256
// Player supported play/trick-play rates.
#define AAMP_RATE_REW_1X -4
#define AAMP_RATE_REW_2X -16
#define AAMP_RATE_REW_3X -32
#define AAMP_RATE_REW_4X -64
#define AAMP_RATE_PAUSE 0
#define AAMP_NORMAL_PLAY_RATE 1
#define AAMP_RATE_FWD_1X 4
#define AAMP_RATE_FWD_2X 16
#define AAMP_RATE_FWD_3X 32
#define AAMP_RATE_FWD_4X 64
#define STRLEN_LITERAL(STRING) (sizeof(STRING)-1)
#define STARTS_WITH_IGNORE_CASE(STRING, PREFIX) (0 == strncasecmp(STRING, PREFIX, STRLEN_LITERAL(PREFIX)))
/**
* @brief Media types for telemetry
*/
enum MediaTypeTelemetry
{
eMEDIATYPE_TELEMETRY_AVS, /**< Type audio, video or subtitle */
eMEDIATYPE_TELEMETRY_DRM, /**< Type DRM license */
eMEDIATYPE_TELEMETRY_INIT, /**< Type audio or video init fragment */
eMEDIATYPE_TELEMETRY_MANIFEST, /**< Type main or sub manifest file */
eMEDIATYPE_TELEMETRY_UNKNOWN, /**< Type unknown*/
};
/**
* @brief Media output format
*/
enum StreamOutputFormat
{
FORMAT_INVALID, /**< Invalid format */
FORMAT_MPEGTS, /**< MPEG Transport Stream */
FORMAT_ISO_BMFF, /**< ISO Base Media File format */
FORMAT_AUDIO_ES_AAC, /**< AAC Audio Elementary Stream */
FORMAT_AUDIO_ES_AC3, /**< AC3 Audio Elementary Stream */
FORMAT_AUDIO_ES_EC3, /**< Dolby Digital Plus Elementary Stream */
FORMAT_AUDIO_ES_ATMOS, /**< ATMOS Audio stream */
FORMAT_VIDEO_ES_H264, /**< MPEG-4 Video Elementary Stream */
FORMAT_VIDEO_ES_HEVC, /**< HEVC video elementary stream */
FORMAT_VIDEO_ES_MPEG2, /**< MPEG-2 Video Elementary Stream */
FORMAT_SUBTITLE_WEBVTT, /**< WebVTT subtitle Stream */
FORMAT_UNKNOWN /**< Unknown Format */
};
/**
* @brief Video zoom mode
*/
enum VideoZoomMode
{
VIDEO_ZOOM_FULL, /**< Video Zoom Enabled */
VIDEO_ZOOM_NONE /**< Video Zoom Disabled */
};
using AdObject = std::pair<std::string, std::string>;
/**
* @brief Auth Token Failure codes
*/
enum AuthTokenErrors {
eAUTHTOKEN_TOKEN_PARSE_ERROR = -1,
eAUTHTOKEN_INVALID_STATUS_CODE = -2
};
typedef struct PreCacheUrlData
{
std::string url;
MediaType type;
PreCacheUrlData():url(""),type(eMEDIATYPE_VIDEO)
{
}
} PreCacheUrlStruct;
typedef std::vector < PreCacheUrlStruct> PreCacheUrlList;
/**
* @brief Language Code Preference types
*/
typedef enum
{
ISO639_NO_LANGCODE_PREFERENCE,
ISO639_PREFER_3_CHAR_BIBLIOGRAPHIC_LANGCODE,
ISO639_PREFER_3_CHAR_TERMINOLOGY_LANGCODE,
ISO639_PREFER_2_CHAR_LANGCODE
} LangCodePreference;
/**
* @brief Structure for audio track information
* Holds information about an audio track in playlist
*/
struct AudioTrackInfo
{
std::string index;
std::string language;
std::string rendition; //role for DASH, group-id for HLS
std::string name;
std::string codec;
std::string characteristics;
int channels;
long bandwidth;
int primaryKey; // used for ATSC to store key , this should not be exposed to app.
AudioTrackInfo() : index(), language(), rendition(), name(), codec(), characteristics(), channels(0), bandwidth(0),primaryKey(0)
{
}
AudioTrackInfo(std::string idx, std::string lang, std::string rend, std::string trackName, std::string codecStr, std::string cha, int ch):
index(idx), language(lang), rendition(rend), name(trackName),
codec(codecStr), characteristics(cha), channels(ch), bandwidth(-1), primaryKey(0)
{
}
AudioTrackInfo(std::string idx, std::string lang,std::string trackName, std::string codecStr,int pk):
index(idx), language(lang), rendition(), name(trackName),
codec(codecStr), characteristics(), channels(0), bandwidth(-1),primaryKey(pk)
{
}
AudioTrackInfo(std::string idx, std::string lang, std::string rend, std::string trackName, std::string codecStr, long bw):
index(idx), language(lang), rendition(rend), name(trackName),
codec(codecStr), characteristics(), channels(0), bandwidth(bw),primaryKey(0)
{
}
};
/**
* @brief Structure for text track information
* Holds information about a text track in playlist
*/
struct TextTrackInfo
{
std::string index;
std::string language;
bool isCC;
std::string rendition; //role for DASH, group-id for HLS
std::string name;
std::string instreamId;
std::string characteristics;
std::string codec;
TextTrackInfo() : index(), language(), isCC(false), rendition(), name(), instreamId(), characteristics(), codec()
{
}
TextTrackInfo(std::string idx, std::string lang, bool cc, std::string rend, std::string trackName, std::string id, std::string cha):
index(idx), language(lang), isCC(cc), rendition(rend),
name(trackName), instreamId(id), characteristics(cha),
codec()
{
}
TextTrackInfo(std::string idx, std::string lang, bool cc, std::string rend, std::string trackName, std::string codecStr):
index(idx), language(lang), isCC(cc), rendition(rend),
name(trackName), instreamId(), characteristics(),
codec(codecStr)
{
}
};
/**
* @brief GStreamer Abstraction class for the implementation of AAMPGstPlayer and gstaamp plugin
*/
class StreamSink
{
public:
/**
* @brief Configure output formats
*
* @param[in] format - Video output format.
* @param[in] audioFormat - Audio output format.
* @param[in] bESChangeStatus - Flag to keep force configure the pipeline value
* @return void
*/
virtual void Configure(StreamOutputFormat format, StreamOutputFormat audioFormat, bool bESChangeStatus)=0;
/**
* @brief API to send audio/video buffer into the sink.
*
* @param[in] mediaType - Type of the media.
* @param[in] ptr - Pointer to the buffer; caller responsible of freeing memory
* @param[in] len - Buffer length.
* @param[in] fpts - Presentation Time Stamp.
* @param[in] fdts - Decode Time Stamp
* @param[in] duration - Buffer duration.
* @return void
*/
virtual void Send( MediaType mediaType, const void *ptr, size_t len, double fpts, double fdts, double duration)= 0;
/**
* @brief API to send audio/video buffer into the sink.
*
* @param[in] mediaType - Type of the media.
* @param[in] buffer - Pointer to the GrowableBuffer; ownership is taken by the sink
* @param[in] fpts - Presentation Time Stamp.
* @param[in] fdts - Decode Time Stamp
* @param[in] duration - Buffer duration.
* @return void
*/
virtual void Send( MediaType mediaType, struct GrowableBuffer* buffer, double fpts, double fdts, double duration)= 0;
/**
* @brief Notifies EOS to sink
*
* @param[in] mediaType - Media Type
* @return void
*/
virtual void EndOfStreamReached(MediaType mediaType){}
/**
* @brief Start the stream
*
* @return void
*/
virtual void Stream(void){}
/**
* @brief Stop the stream
*
* @param[in] keepLastFrame - Keep the last frame on screen (true/false)
* @return void
*/
virtual void Stop(bool keepLastFrame){}
/**
* @brief Dump the sink status for debugging purpose
*
* @return void
*/
virtual void DumpStatus(void){}
/**
* @brief Flush the pipeline
*
* @param[in] position - playback position
* @param[in] rate - Speed
* @param[in] shouldTearDown - if pipeline is not in a valid state, tear down pipeline
* @return void
*/
virtual void Flush(double position = 0, int rate = AAMP_NORMAL_PLAY_RATE, bool shouldTearDown = true){}
/**
* @brief Enabled or disable playback pause
*
* @param[in] pause Enable/Disable
* @param[in] forceStopGstreamerPreBuffering - true for disabling bufferinprogress
* @return true if content successfully paused
*/
virtual bool Pause(bool pause, bool forceStopGstreamerPreBuffering){ return true; }
/**
* @brief Get playback duration in milliseconds
*
* @return duration in ms.
*/
virtual long GetDurationMilliseconds(void){ return 0; };
/**
* @brief Get playback position in milliseconds
*
* @return Position in ms.
*/
virtual long GetPositionMilliseconds(void){ return 0; };
/**
* @brief Get Video 90 KHz Video PTS
*
* @return video PTS
*/
virtual long long GetVideoPTS(void){ return 2; };
/**
* @brief Get closed caption handle
*
* @return Closed caption handle
*/
virtual unsigned long getCCDecoderHandle(void) { return 0; };
/**
* @brief Set video display rectangle co-ordinates
*
* @param[in] x - x position
* @param[in] y - y position
* @param[in] w - Width
* @param[in] h - Height
* @return void
*/
virtual void SetVideoRectangle(int x, int y, int w, int h){};
/**
* @brief Set video zoom state
*
* @param[in] zoom - Zoom mode
* @return void
*/
virtual void SetVideoZoom(VideoZoomMode zoom){};
/**
* @brief Set video mute state
*
* @param[in] muted - true: video muted, false: video unmuted
* @return void
*/
virtual void SetVideoMute(bool muted){};
/**
* @brief Set volume level
*
* @param[in] volume - Minimum 0, maximum 100.
* @return void
*/
virtual void SetAudioVolume(int volume){};
/**
* @brief StreamSink Dtor
*/
virtual ~StreamSink(){};
/**
* @brief Process PTS discontinuity for a stream type
*
* @param[in] mediaType - Media Type
* @return TRUE if discontinuity processed
*/
virtual bool Discontinuity( MediaType mediaType) = 0;
/**
* @brief Check if PTS is changing
* @retval true if PTS is changing
*/
virtual bool CheckForPTSChange() {return true;};
/**
* @brief Check whether cach is empty
*
* @param[in] mediaType - Media Type
* @return true: empty, false: not empty
*/
virtual bool IsCacheEmpty(MediaType mediaType){ return true; };
/**
* @brief API to notify that fragment caching done
*
* @return void
*/
virtual void NotifyFragmentCachingComplete(){};
/**
* @brief API to notify that fragment caching is ongoing
*
* @return void
*/
virtual void NotifyFragmentCachingOngoing(){};
/**
* @brief Get the video dimensions
*
* @param[out] w - Width
* @param[out] h - Height
* @return void
*/
virtual void GetVideoSize(int &w, int &h){};
/**
* @brief Queue-up the protection event.
*
* @param[in] protSystemId - DRM system ID.
* @param[in] ptr - Pointer to the protection data.
* @param[in] len - Length of the protection data.
* @return void
*/
virtual void QueueProtectionEvent(const char *protSystemId, const void *ptr, size_t len, MediaType type) {};
/**
* @brief Clear the protection event.
*
* @return void
*/
virtual void ClearProtectionEvent() {};
/**
* @brief Signal discontinuity on trickmode if restamping is done by stream sink.
*
* @return void
*/
virtual void SignalTrickModeDiscontinuity() {};
/**
* @brief Seek stream sink to desired position and playback rate with a flushing seek
*
* @param[in] position - desired playback position.
* @param[in] rate - desired playback rate.
* @return void
*/
virtual void SeekStreamSink(double position, double rate) {};
/**
* @brief Get the video window co-ordinates
*
* @return current video co-ordinates in x,y,w,h format
*/
virtual std::string GetVideoRectangle() { return std::string(); };
/**
* @brief Stop buffering in sink
*
* @param[in] forceStop - true if buffering to be stopped without any checks
* @return void
*/
virtual void StopBuffering(bool forceStop) { };
};
/**
* @brief Player interface class for the JS pluggin.
*/
class PlayerInstanceAAMP
{
public:
/**
* @brief PlayerInstanceAAMP Constructor.
*
* @param streamSink - custom stream sink, NULL for default.
*/
PlayerInstanceAAMP(StreamSink* streamSink = NULL
, std::function< void(uint8_t *, int, int, int) > exportFrames = nullptr
);
/**
* @brief PlayerInstanceAAMP Destructor.
*/
~PlayerInstanceAAMP();
/**
* @brief copy constructor
*
* @param other object to copy
*/
PlayerInstanceAAMP(const PlayerInstanceAAMP& other) = delete;
/**
* @brief To overload = operator for copying
*
* @param other object to copy
*/
PlayerInstanceAAMP& operator=(const PlayerInstanceAAMP& other) = delete;
/**
* @brief Tune to a URL.
* DEPRECATED! This is included for backwards compatibility with current Sky AS integration
* audioDecoderStreamSync is a broadcom-specific hack (for original xi6 POC build) - this doesn't belong in Tune API.
*
* @param[in] url - HTTP/HTTPS url to be played.
* @param[in] contentType - Content type of the asset
* @param[in] audioDecoderStreamSync - Enable or disable audio decoder stream sync,
* set to 'false' if audio fragments come with additional padding at the end (BCOM-4203)
* @return void
*/
void Tune(const char *mainManifestUrl, const char *contentType, bool bFirstAttempt, bool bFinalAttempt,const char *traceUUID,bool audioDecoderStreamSync);
/**
* @brief Tune to a URL.
*
* @param[in] url - HTTP/HTTPS url to be played.
* @param[in] autoPlay - Start playback immediately or not
* @param[in] contentType - Content type of the asset
* @param[in] audioDecoderStreamSync - Enable or disable audio decoder stream sync,
* set to 'false' if audio fragments come with additional padding at the end (BCOM-4203)
* @return void
*/
void Tune(const char *mainManifestUrl, bool autoPlay = true, const char *contentType = NULL, bool bFirstAttempt = true, bool bFinalAttempt = false,const char *traceUUID = NULL,bool audioDecoderStreamSync = true);
/**
* @brief Stop playback and release resources.
* @param[in] sendStateChangeEvent - true if state change events need to be sent for Stop operation
* @return void
*/
void Stop(bool sendStateChangeEvent = true);
/**
* @brief Check given rate is valid.
*
* @param[in] rate - Rate of playback.
* @retval return true if the given rate is valid.
*/
bool IsValidRate(int rate);
/**
* @brief Set playback rate.
*
* @param[in] rate - Rate of playback.
* @param[in] overshoot - overshoot correction in milliseconds.
* @return void
*/
void SetRate(int rate, int overshootcorrection=0);
/**
* @brief Seek to a time.
*
* @param[in] secondsRelativeToTuneTime - Seek position for VOD,
* relative position from first tune command.
* @param[in] keepPaused - set true if want to keep paused state after seek
*/
void Seek(double secondsRelativeToTuneTime, bool keepPaused = false);
/**
* @brief Seek to live point.
*
* @param[in] keepPaused - set true if want to keep paused state after seek
*/
void SeekToLive(bool keepPaused = false);
/**
* @brief Set seek position and speed.
*
* @param[in] rate - Rate of playback.
* @param[in] secondsRelativeToTuneTime - Seek position for VOD,
* relative position from first tune command.
*/
void SetRateAndSeek(int rate, double secondsRelativeToTuneTime);
/**
* @brief Soft stop the player instance.
*
*/
void detach();
/**
* @brief Register event handler.
*
* @param[in] eventListener - pointer to implementation of EventListener to receive events.
* @return void
*/
void RegisterEvents(EventListener* eventListener);
/**
* @brief Specify video rectangle.
*
* @param[in] x - horizontal start position.
* @param[in] y - vertical start position.
* @param[in] w - width.
* @param[in] h - height.
* @return void
*/
void SetVideoRectangle(int x, int y, int w, int h);
/**
* @brief Set video zoom.
*
* @param[in] zoom - zoom mode.
* @return void
*/
void SetVideoZoom(VideoZoomMode zoom);
/**
* @brief Enable/ Disable Video.
*
* @param[in] muted - true to disable video, false to enable video.
* @return void
*/
void SetVideoMute(bool muted);
/**
* @brief Set Audio Volume.
*
* @param[in] volume - Minimum 0, maximum 100.
* @return void
*/
void SetAudioVolume(int volume);
/**
* @brief Set Audio language.
*
* @param[in] language - Language of audio track.
* @return void
*/
void SetLanguage(const char* language);
/**
* @brief Set array of subscribed tags.
*
* @param[in] subscribedTags - Array of subscribed tags.
* @return void
*/
void SetSubscribedTags(std::vector<std::string> subscribedTags);
/**
* @brief Load AAMP JS object in the specified JS context.
*
* @param[in] context - JS context.
* @return void
*/
void LoadJS(void* context);
/**
* @brief Unload AAMP JS object in the specified JS context.
*
* @param[in] context - JS context.
* @return void
*/
void UnloadJS(void* context);
/**
* @brief Support multiple listeners for multiple event type
*
* @param[in] eventType - type of event.
* @param[in] eventListener - listener for the eventType.
* @return void
*/
void AddEventListener(AAMPEventType eventType, EventListener* eventListener);
/**
* @brief Remove event listener for eventType.
*
* @param[in] eventType - type of event.
* @param[in] eventListener - listener to be removed for the eventType.
* @return void
*/
void RemoveEventListener(AAMPEventType eventType, EventListener* eventListener);
/**
* @brief To check whether the asset is live or not.
*
* @return bool - True if live content, false otherwise
*/
bool IsLive();
/**
* @brief Schedule insertion of ad at given position.
*
* @param[in] url - HTTP/HTTPS url of the ad
* @param[in] positionSeconds - position at which ad shall be inserted
* @return void
*/
void InsertAd(const char *url, double positionSeconds);
/**
* @brief Get current audio language.
*
* @return const char* - current audio language
*/
const char* GetCurrentAudioLanguage();
/**
* @brief Get current drm
*
* @return char* - current drm
*/
const char* GetCurrentDRM();
/**
* @brief Add/Remove a custom HTTP header and value.
*
* @param[in] headerName - Name of custom HTTP header
* @param[in] headerValue - Value to be pased along with HTTP header.
* @param[in] isLicenseHeader - true if header is to be used for license HTTP requests
* @return void
*/
void AddCustomHTTPHeader(std::string headerName, std::vector<std::string> headerValue, bool isLicenseHeader = false);
/**
* @brief Set License Server URL.
*
* @param[in] url - URL of the server to be used for license requests
* @param[in] type - DRM Type(PR/WV) for which the server URL should be used, global by default
* @return void
*/
void SetLicenseServerURL(const char *url, DRMSystems type = eDRM_MAX_DRMSystems);
/**
* @brief Set Preferred DRM.
*
* @param[in] drmType - Preferred DRM type
* @return void
*/
void SetPreferredDRM(DRMSystems drmType);
/**
* @brief Get Preferred DRM.
*
* @return Preferred DRM type
*/
DRMSystems GetPreferredDRM();
/**
* @brief Set Stereo Only Playback.
* @param[in] bValue - disable EC3/ATMOS if the value is true
*
* @return void
*/
void SetStereoOnlyPlayback(bool bValue);
/**
* @brief Set Bulk TimedMetadata Reporting flag
* @param[in] bValue - if true Bulk event reporting enabled
*
* @return void
*/
void SetBulkTimedMetaReport(bool bValue);
/**
* @brief Set unpaired discontinuity retune flag
* @param[in] bValue - true if unpaired discontinuity retune set
*
* @return void
*/
void SetRetuneForUnpairedDiscontinuity(bool bValue);
/**
* @brief Set retune configuration for gstpipeline internal data stream error.
* @param[in] bValue - true if gst internal error retune set
*
* @return void
*/
void SetRetuneForGSTInternalError(bool bValue);
/**
* @brief Indicates if session token has to be used with license request or not.
*
* @param[in] isAnonymous - True if session token should be blank and false otherwise.
* @return void
*/
void SetAnonymousRequest(bool isAnonymous);
/**
* @brief Indicates average BW to be used for ABR Profiling.
*
* @param useAvgBW - Flag for true / false
*/
void SetAvgBWForABR(bool useAvgBW);
/**
* @brief SetPreCacheTimeWindow Function to Set PreCache Time
*
* @param Time in minutes - Max PreCache Time
*/
void SetPreCacheTimeWindow(int nTimeWindow);
/**
* @brief Set VOD Trickplay FPS.
*
* @param[in] vodTrickplayFPS - FPS to be used for VOD Trickplay
* @return void
*/
void SetVODTrickplayFPS(int vodTrickplayFPS);
/**
* @brief Set Linear Trickplay FPS.
*
* @param[in] linearTrickplayFPS - FPS to be used for Linear Trickplay
* @return void
*/
void SetLinearTrickplayFPS(int linearTrickplayFPS);
/**
* @brief Set Live Offset
*
* @param[in] liveoffset- Live Offset
* @return void
*/
void SetLiveOffset(int liveoffset);
/**
* @brief To set the error code to be used for playback stalled error.
*
* @param[in] errorCode - error code for playback stall errors.
* @return void
*/
void SetStallErrorCode(int errorCode);
/**
* @brief To set the timeout value to be used for playback stall detection.
*
* @param[in] timeoutMS - timeout in milliseconds for playback stall detection.
* @return void
*/
void SetStallTimeout(int timeoutMS);
/**
* @brief To set the Playback Position reporting interval.
*
* @param reportIntervalMS - playback reporting interval in milliseconds.
*/
void SetReportInterval(int reportIntervalMS);
/**
* @brief To set the max retry attempts for init frag curl timeout failures
*
* @param count - max attempt for timeout retry count
*/
void SetInitFragTimeoutRetryCount(int count);
/**
* @brief To get the current playback position.
*
* @ret current playback position in seconds
*/
double GetPlaybackPosition(void);
/**
* @brief To get the current asset's duration.
*
* @ret duration in seconds
*/
double GetPlaybackDuration(void);
/**
* @brief To get the current AAMP state.
*
* @ret current AAMP state
*/
PrivAAMPState GetState(void);
/**
* @brief To get the bitrate of current video profile.
*
* @ret bitrate of video profile
*/
long GetVideoBitrate(void);
/**
* @brief To set a preferred bitrate for video profile.
*
* @param[in] preferred bitrate for video profile
*/
void SetVideoBitrate(long bitrate);
/**
* @brief To get the bitrate of current audio profile.
*
* @ret bitrate of audio profile
*/
long GetAudioBitrate(void);
/**
* @brief To set a preferred bitrate for audio profile.
*
* @param[in] preferred bitrate for audio profile
*/
void SetAudioBitrate(long bitrate);
/**
* @brief To get the current audio volume.
*
* @ret audio volume
*/
int GetAudioVolume(void);
/**
* @brief To get the current playback rate.
*
* @ret current playback rate
*/
int GetPlaybackRate(void);
/**
* @brief To get the available video bitrates.
*
* @ret available video bitrates
*/
std::vector<long> GetVideoBitrates(void);
/**
* @brief To get the available audio bitrates.
*
* @ret available audio bitrates
*/
std::vector<long> GetAudioBitrates(void);
/**
* @brief To set the initial bitrate value.
*
* @param[in] initial bitrate to be selected
*/
void SetInitialBitrate(long bitrate);
/**
* @brief To set the initial bitrate value for 4K assets.
*
* @param[in] initial bitrate to be selected for 4K assets
*/
void SetInitialBitrate4K(long bitrate4K);
/**
* @brief To override default curl timeout for playlist/fragment downloads
*
* @param[in] preferred timeout value
*/
void SetNetworkTimeout(double timeout);
/**
* @brief Optionally override default HLS main manifest download timeout with app-specific value.
*
* @param[in] preferred timeout value
*/
void SetManifestTimeout(double timeout);
/**
* @brief Optionally override default HLS main manifest download timeout with app-specific value.
*
* @param[in] preferred timeout value
*/
void SetPlaylistTimeout(double timeout);
/**
* @brief To set the download buffer size value
*
* @param[in] preferred download buffer size
*/
void SetDownloadBufferSize(int bufferSize);