forked from rdkcmf/rdk-aamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AampEvent.h
1681 lines (1463 loc) · 43.4 KB
/
AampEvent.h
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 AampEvent.h
* @brief Events supported by the AAMP player.
*/
#ifndef __AAMP_EVENTS_H__
#define __AAMP_EVENTS_H__
#include "vttCue.h" //Required for VTTCue
#include <memory>
#include <vector>
// Macros required for backward compatible AAMPEventListener implementation
#define MAX_LANGUAGE_COUNT 16
#define MAX_LANGUAGE_TAG_LENGTH 32 // <lang>-<role>
//(3+1+1) /* iso639-2 + optional 2..9 digit to disambiguate multiple same-language tracms, + nul terminator */
#define MAX_BITRATE_COUNT 10
#define MAX_SUPPORTED_SPEED_COUNT 11 /* [-64, -32, -16, -4, -1, 0, 1, 4, 16, 32, 64] */
/**
* @brief Type of the events sending to the JSPP player.
*/
typedef enum
{
AAMP_EVENT_TUNED = 1, /**< 1, Tune success*/
AAMP_EVENT_TUNE_FAILED, /**< 2, Tune failure*/
AAMP_EVENT_SPEED_CHANGED, /**< 3, Speed changed internally*/
AAMP_EVENT_EOS, /**< 4, End of stream*/
AAMP_EVENT_PLAYLIST_INDEXED, /**< 5, Playlist downloaded and indexed*/
AAMP_EVENT_PROGRESS, /**< 6, Progress event with playback stats. Report interval configurable */
AAMP_EVENT_CC_HANDLE_RECEIVED, /**< 7, Sent when video decoder handle retrieved */
AAMP_EVENT_JS_EVENT, /**< 8, Generic event generated by JavaScript binding */
AAMP_EVENT_MEDIA_METADATA, /**< 9, Meta-data of asset currently playing*/
AAMP_EVENT_ENTERING_LIVE, /**< 10, Event when live point reached*/
AAMP_EVENT_BITRATE_CHANGED, /**< 11, Event when bitrate changes */
AAMP_EVENT_TIMED_METADATA, /**< 12, Meta-data of a subscribed tag parsed from manifest*/
AAMP_EVENT_BULK_TIMED_METADATA, /**< 13, Bulk Meta-data of a subscribed tag parsed from manifest*/
AAMP_EVENT_STATE_CHANGED, /**< 14, Event when player state changes */
AAMP_EVENT_SPEEDS_CHANGED, /**< 15, Event when supported playback speeds changes */
AAMP_EVENT_SEEKED, /**< 16, Event when seek completes, including new position*/
AAMP_EVENT_TUNE_PROFILING, /**< 17, Event when micro event data sends*/
AAMP_EVENT_BUFFERING_CHANGED, /**< 18, Event when buffering starts/ends btw a playback*/
AAMP_EVENT_DURATION_CHANGED, /**< 19, Event when duration changed */
AAMP_EVENT_AUDIO_TRACKS_CHANGED, /**< 20, Event when available audio tracks changes */
AAMP_EVENT_TEXT_TRACKS_CHANGED, /**< 21, Event when available test tracks changes */
AAMP_EVENT_AD_BREAKS_CHANGED, /**< 22, Event when content/ad breaks changes */
AAMP_EVENT_AD_STARTED, /**< 23, Ad playback started */
AAMP_EVENT_AD_COMPLETED, /**< 24, Ad playback completed */
AAMP_EVENT_DRM_METADATA, /**< 25, Event with DRM metadata info*/
AAMP_EVENT_REPORT_ANOMALY, /**< 26, Playback Anomaly reporting */
AAMP_EVENT_WEBVTT_CUE_DATA, /**< 27, WebVTT Cue data */
AAMP_EVENT_AD_RESOLVED, /**< 28, Ad fulfill status */
AAMP_EVENT_AD_RESERVATION_START, /**< 29, Adbreak playback starts */
AAMP_EVENT_AD_RESERVATION_END, /**< 30, Adbreak playback ends */
AAMP_EVENT_AD_PLACEMENT_START, /**< 31, Ad playback starts */
AAMP_EVENT_AD_PLACEMENT_END, /**< 32, Ad playback ends */
AAMP_EVENT_AD_PLACEMENT_ERROR, /**< 33, Ad playback error */
AAMP_EVENT_AD_PLACEMENT_PROGRESS, /**< 34, Ad playback progress */
AAMP_EVENT_REPORT_METRICS_DATA, /**< 35, AAMP VideoEnd info reporting */
AAMP_EVENT_ID3_METADATA, /**< 36, ID3 metadata from audio stream */
AAMP_EVENT_DRM_MESSAGE, /**< 37, Message from the DRM system */
AAMP_EVENT_BLOCKED, /**< 38, ATSC AV BLOCKED Event*/
AAMP_MAX_NUM_EVENTS
} AAMPEventType;
/**
* @brief AAMP playback error codes
*/
typedef enum
{
AAMP_TUNE_INIT_FAILED, /**< Tune failure due to initialization error*/
AAMP_TUNE_INIT_FAILED_MANIFEST_DNLD_ERROR, /**< Tune failure due to manifest download error*/
AAMP_TUNE_INIT_FAILED_MANIFEST_CONTENT_ERROR, /**< Tune failure due to manifest content error*/
AAMP_TUNE_INIT_FAILED_MANIFEST_PARSE_ERROR, /**< Tune failure due to manifest parse error*/
AAMP_TUNE_INIT_FAILED_PLAYLIST_VIDEO_DNLD_ERROR,/**< Tune failure due to video playlist download error*/
AAMP_TUNE_INIT_FAILED_PLAYLIST_AUDIO_DNLD_ERROR,/**< Tune failure due to audio playlist download error*/
AAMP_TUNE_INIT_FAILED_TRACK_SYNC_ERROR, /**< Tune failure due to A/V track sync error*/
AAMP_TUNE_MANIFEST_REQ_FAILED, /**< Tune failure caused by manifest fetch failure*/
AAMP_TUNE_AUTHORISATION_FAILURE, /**< Not authorised to view the content*/
AAMP_TUNE_FRAGMENT_DOWNLOAD_FAILURE, /**< When fragment download fails for 5 consecutive fragments*/
AAMP_TUNE_INIT_FRAGMENT_DOWNLOAD_FAILURE, /**< Unable to download init fragment*/
AAMP_TUNE_UNTRACKED_DRM_ERROR, /**< DRM error*/
AAMP_TUNE_DRM_INIT_FAILED, /**< DRM initialization failure */
AAMP_TUNE_DRM_DATA_BIND_FAILED, /**< InitData binding with DRM failed */
AAMP_TUNE_DRM_SESSIONID_EMPTY, /**< DRM session ID empty */
AAMP_TUNE_DRM_CHALLENGE_FAILED, /**< DRM key request challenge generation failed */
AAMP_TUNE_LICENCE_TIMEOUT, /**< DRM license request timeout */
AAMP_TUNE_LICENCE_REQUEST_FAILED, /**< DRM license got invalid response */
AAMP_TUNE_INVALID_DRM_KEY, /**< DRM reporting invalid license key */
AAMP_TUNE_UNSUPPORTED_STREAM_TYPE, /**< Unsupported stream type */
AAMP_TUNE_UNSUPPORTED_AUDIO_TYPE, /**< Unsupported audio type in manifest */
AAMP_TUNE_FAILED_TO_GET_KEYID, /**< Failed to parse key id from init data*/
AAMP_TUNE_FAILED_TO_GET_ACCESS_TOKEN, /**< Failed to get session token from AuthService*/
AAMP_TUNE_CORRUPT_DRM_DATA, /**< DRM failure due to corrupt drm data, self heal might clear further errors*/
AAMP_TUNE_CORRUPT_DRM_METADATA, /**< DRM failure due to corrupt drm metadata in the stream*/
AAMP_TUNE_DRM_DECRYPT_FAILED, /**< DRM Decryption Failed for Fragments */
AAMP_TUNE_DRM_UNSUPPORTED, /**< DRM Format Unsupported */
AAMP_TUNE_GST_PIPELINE_ERROR, /**< Playback failure due to error from GStreamer pipeline or associated plugins */
AAMP_TUNE_PLAYBACK_STALLED, /**< Playback was stalled due to valid fragments not available in playlist */
AAMP_TUNE_CONTENT_NOT_FOUND, /**< The resource was not found at the URL provided (HTTP 404) */
AAMP_TUNE_DRM_KEY_UPDATE_FAILED, /**< Failed to process DRM key, see the error code returned from Update() for more info */
AAMP_TUNE_DEVICE_NOT_PROVISIONED, /**< STB not provisioned/corrupted; need to re-provision. */
AAMP_TUNE_HDCP_COMPLIANCE_ERROR, /**< HDCP Compliance Check failure.Not compatible hdcp version for playback */
AAMP_TUNE_INVALID_MANIFEST_FAILURE, /**< Manifest is invalid */
AAMP_TUNE_FAILED_PTS_ERROR, /**< Playback failed due to PTS error */
AAMP_TUNE_MP4_INIT_FRAGMENT_MISSING, /**< Init fragments missing in playlist */
AAMP_TUNE_FAILURE_UNKNOWN /**< Unknown failure */
} AAMPTuneFailure;
/**
* @brief Mapping all required status codes based on JS player requirement. These requirements may be
* forced by psdk player.AAMP may not use all the statuses mentioned below:
* Mainly required states - idle, initializing, initialized, preparing, prepared, playing, paused, seek, complete and error
*/
typedef enum
{
eSTATE_IDLE, /**< 0 - Player is idle */
eSTATE_INITIALIZING, /**< 1 - Player is initializing a particular content */
eSTATE_INITIALIZED, /**< 2 - Player has initialized for a content successfully */
eSTATE_PREPARING, /**< 3 - Player is loading all associated resources */
eSTATE_PREPARED, /**< 4 - Player has loaded all associated resources successfully */
eSTATE_BUFFERING, /**< 5 - Player is in buffering state */
eSTATE_PAUSED, /**< 6 - Playback is paused */
eSTATE_SEEKING, /**< 7 - Seek is in progress */
eSTATE_PLAYING, /**< 8 - Playback is in progress */
eSTATE_STOPPING, /**< 9 - Player is stopping the playback */
eSTATE_STOPPED, /**< 10 - Player has stopped playback successfully */
eSTATE_COMPLETE, /**< 11 - Playback completed */
eSTATE_ERROR, /**< 12 - Error encountered and playback stopped */
eSTATE_RELEASED, /**< 13 - Player has released all resources for playback */
eSTATE_BLOCKED /**< 14 - Player has blocked and cant play content*/
} PrivAAMPState;
/**
* @brief AAMP metric data types
*/
typedef enum E_MetricsDataType
{
AAMP_DATA_NONE,
AAMP_DATA_VIDEO_END
} MetricsDataType;
/**
* @brief Structure of the AAMP events.
* Recommend new AAMP integration layers to use AAMPEventObject based listener
* For new event definition, should use AAMPEventObject class
* TODO: Deperecate in future, kept for backward compatibility only
*/
struct AAMPEvent
{
AAMPEventType type; /**< Event type */
union
{
struct
{
int severity; /**< informative number indicates severity of msg, e.g Warning, Error, Trace etc */
const char *msg;
} anomalyReport;
struct
{
const char *microData; /**< micro event data for profiling */
} tuneProfile;
struct
{
MetricsDataType type; /**< type of data , e.g AAMP_DATA_VIDEO_END for VideoEndEvent data */
const char *metricUUID; /**< unique session id passed during tune */
const char *data; /**< data for event */
} metricsData;
/**
* @brief Structure of the progress event data
*/
struct
{
double durationMiliseconds; /**< current size of time shift buffer */
double positionMiliseconds; /**< current play/pause position relative to tune time - starts at zero) */
float playbackSpeed; /**< current trick speed (1.0 for normal play rate) */
double startMiliseconds; /**< time shift buffer start position (relative to tune time - starts at zero) */
double endMiliseconds; /**< time shift buffer end position (relative to tune time - starts at zero) */
long long videoPTS; /**< Video Presentation 90 Khz time-stamp */
double videoBufferedMiliseconds; /**< current duration of buffered video ready to playback */
} progress;
/**
* @brief Structure of the seeked event data
*/
struct
{
double positionMiliseconds; /**< new seeked position in milliseconds */
} seeked;
/**
* @brief Structure of the speed change event
*/
struct
{
int rate; /**< Playback rate */
} speedChanged;
/**
* @brief Structure of the bitrate change event
*/
struct
{
int time; /**< Playback time */
long bitrate; /**< Playback bitrate */
const char *description; /**< Description */
int width; /**< Video width */
int height; /**< Video height */
double framerate; /**< FrameRate */
double position; /**< bitrate changed position*/
} bitrateChanged;
/**
* @brief Structure of the metadata event
*/
struct
{
long durationMiliseconds; /**< Asset duration */
int languageCount; /**< Available language count */
char languages[MAX_LANGUAGE_COUNT][MAX_LANGUAGE_TAG_LENGTH]; /**< Available languages */
int bitrateCount; /**< Available bitrate count */
long bitrates[MAX_BITRATE_COUNT]; /**< Available bitrates */
int width; /**< Maximum video width */
int height; /**< Maximum video height */
bool hasDrm; /**< Drm enabled */
int supportedSpeedCount; /**< Supported playback speed count */
int supportedSpeeds[MAX_SUPPORTED_SPEED_COUNT]; /**< Supported playback speeds */
} metadata;
/**
* @brief Structure of the closed caption handle event
*/
struct
{
unsigned long handle; /**< Closed caption handle */
} ccHandle;
/**
* @brief Structure of the timed metadata event
*/
struct
{
const char* szName; /**< Metadata name */
const char* id; /**< Id of the timedMetadata */
long long timeMilliseconds; /**< Playback position - relative to tune time - starts at zero */
double durationMilliSeconds;/**< Duration of the timed event. */
const char* szContent; /**< Metadata content */
} timedMetadata;
/**
* @brief Structure of the bulk timed metadata event
*/
struct
{
const char* szMetaContent; /**< Metadata content */
} bulktimedMetadata;
/**
* @brief Structure of the Java Script event
*/
struct
{
const char* szEventType; /**< Event Type */
void* jsObject; /**< Pointer to the Java Scipt Object */
} jsEvent;
/**
* @brief Structure of the media error event
*/
struct
{
AAMPTuneFailure failure; /**< Error Type */
int code; /**< Error code */
const char *description; /**< Error description */
bool shouldRetry; /**< If recovery on retry is possible */
} mediaError;
struct
{
AAMPTuneFailure failure; /**< Error Type */
const char *accessStatus;
int accessStatus_value;
long responseCode;
bool isSecClientError;
} dash_drmmetadata;
/**
* @brief Structure of the player state changed event
*/
struct
{
PrivAAMPState state; /**< Player state */
} stateChanged;
/**
* @brief Structure of the buffering changed event
*/
struct
{
bool buffering; /**< true if buffering started, false otherwise */
} bufferingChanged;
/**
* @brief Structure of the supported speeds changed event
*/
struct
{
int supportedSpeedCount; /**< Supported playback speed count */
int supportedSpeeds[MAX_SUPPORTED_SPEED_COUNT]; /**< Supported playback speeds */
} speedsChanged;
/**
* @brief Structure of the WebVTT cue data
*/
struct
{
VTTCue* cueData;
} cue;
/**
* @brief Structure for ad fulfill status event
*/
struct
{
bool resolveStatus;
const char *adId;
uint64_t startMS;
uint64_t durationMs;
} adResolved;
/**
* @brief Structure for ad reservation events
*/
struct
{
const char *adBreakId; /**< Reservation Id */
uint64_t position;
} adReservation;
/**
* @brief Structure for ad placement events
*/
struct
{
const char *adId; /**< Placement Id */
uint32_t position; /**<Ad Position relative to Reservation Start */
uint32_t offset; /**<Ad start offset */
uint32_t duration;
int errorCode;
} adPlacement;
/** @brief Structure of the id3 metadata event
*/
struct
{
uint8_t *data; /**< Data pointer to ID3 metadata blob */
int32_t length; /**< Length of the ID3 metadata blob */
} id3Metadata;
struct
{
const char *data;
} drmMessage;
} data;
/**
* @brief AAMPEvent Constructor
*/
AAMPEvent() : type(AAMP_MAX_NUM_EVENTS), data()
{
}
/**
* @brief AAMPEvent Constructor
*
* @param[in] Event type
*/
AAMPEvent(AAMPEventType t) : type(t), data()
{
}
AAMPEvent(const AAMPEvent&) = delete;
AAMPEvent& operator=(const AAMPEvent&) = delete;
};
/**
* @brief Base class of all AAMP events.
* New AAMP event object for ease of use
* While defining new event objects inherit from this base class
*/
class AAMPEventObject
{
AAMPEventType mType; /**< Event type */
public:
AAMPEventObject() = delete;
AAMPEventObject(const AAMPEventObject&) = delete;
AAMPEventObject& operator=(const AAMPEventObject&) = delete;
/**
* @brief AAMPEvent Constructor
*/
AAMPEventObject(AAMPEventType type);
/**
* @brief AAMPEvent Destructor
*/
virtual ~AAMPEventObject() { }
/**
* @brief Get Event Type
*
* @return Event Type
*/
AAMPEventType getType() const;
};
/**
* @brief Class for the Media Error event
*/
class MediaErrorEvent: public AAMPEventObject
{
AAMPTuneFailure mFailure; /**< Error Type */
int mCode; /**< Error code */
std::string mDescription; /**< Error description */
bool mShouldRetry; /**< If recovery on retry is possible */
public:
MediaErrorEvent() = delete;
MediaErrorEvent(const MediaErrorEvent&) = delete;
MediaErrorEvent& operator=(const MediaErrorEvent&) = delete;
/*
* @brief MediaErrorEvent Constructor
*
* @param[in] failure - Failure type
* @param[in] code - Error code
* @param[in] desc - Error description
* @param[in] shouldRetry - Retry or not
*/
MediaErrorEvent(AAMPTuneFailure failure, int code, const std::string &desc, bool shouldRetry);
/**
* @brief MediaErrorEvent Destructor
*/
virtual ~MediaErrorEvent() { }
/**
* @brief Get Failure Type
*
* @return Tune failure type
*/
AAMPTuneFailure getFailure() const;
/**
* @brief Get Error Code
*
* @return Tune error code
*/
int getCode() const;
/**
* @brief Get Description
*
* @return Error description
*/
const std::string &getDescription() const;
/**
* @brief Retry or not
*
* @return Retry or don't retry
*/
bool shouldRetry() const;
};
/**
* @brief Class for the Speed changed event
*/
class SpeedChangedEvent: public AAMPEventObject
{
int mRate; /**< Playback rate */
public:
SpeedChangedEvent() = delete;
SpeedChangedEvent(const SpeedChangedEvent&) = delete;
SpeedChangedEvent& operator=(const SpeedChangedEvent&) = delete;
/*
* @brief SpeedChangedEvent Constructor
*
* @param[in] rate - New speed
*/
SpeedChangedEvent(int rate);
/**
* @brief SpeedChangedEvent Destructor
*/
virtual ~SpeedChangedEvent() { }
/**
* @brief Get Rate
*
* @return New speed
*/
int getRate() const;
};
/**
* @brief Class for the Progress event
*/
class ProgressEvent: public AAMPEventObject
{
double mDuration; /**< current size of time shift buffer in MS*/
double mPosition; /**< current play/pause position relative to tune time - starts at zero) in MS */
double mStart; /**< time shift buffer start position (relative to tune time - starts at zero) in MS */
double mEnd; /**< time shift buffer end position (relative to tune time - starts at zero) in MS */
float mSpeed; /**< current trick speed (1.0 for normal play rate) */
long long mPTS; /**< Video Presentation 90 Khz time-stamp */
double mBufferedDuration; /**< current duration of buffered video ready to playback */
public:
ProgressEvent() = delete;
ProgressEvent(const ProgressEvent&) = delete;
ProgressEvent& operator=(const ProgressEvent&) = delete;
/*
* @brief ProgressEvent Constructor
*
* @param[in] duration - Duration of Asset
* @param[in] position - Current Position
* @param[in] start - Start Position
* @param[in] end - End Position
* @param[in] speed - Current Speed
* @param[in] pts - Video PTS
* @param[in] bufferedDuration - buffered duration
*/
ProgressEvent(double duration, double position, double start, double end, float speed, long long pts, double bufferedDuration);
/**
* @brief ProgressEvent Destructor
*/
virtual ~ProgressEvent() { }
/**
* @brief Get Duration of Asset
*
* @return Asset duration in MS
*/
double getDuration() const;
/**
* @brief Get Current Position
*
* @return Current position in MS
*/
double getPosition() const;
/**
* @brief Get Start Position
*
* @return Start position in MS
*/
double getStart() const;
/**
* @brief Get End Position
*
* @return End position in MS
*/
double getEnd() const;
/**
* @brief Get Speed
*
* @return Current speed
*/
float getSpeed() const;
/**
* @brief Get Video PTS
*
* @return Video PTS
*/
long long getPTS() const;
/**
* @brief Get Buffered Duration
*
* @return Buffered duration
*/
double getBufferedDuration() const;
};
/**
* @brief Class for the Closed Caption Handle event
*/
class CCHandleEvent: public AAMPEventObject
{
unsigned long mHandle; /**< Closed caption handle */
public:
CCHandleEvent() = delete;
CCHandleEvent(const CCHandleEvent&) = delete;
CCHandleEvent& operator=(const CCHandleEvent&) = delete;
/*
* @brief CCHandleEvent Constructor
*
* @param[in] handle - Handle to close caption
*/
CCHandleEvent(unsigned long handle);
/**
* @brief CCHandleEvent Destructor
*/
virtual ~CCHandleEvent() { }
/**
* @brief Get Closed Caption Handle
*
* @return Handle to the closed caption
*/
unsigned long getCCHandle() const;
};
/**
* @brief Class for the Media Metadata event
*/
class MediaMetadataEvent: public AAMPEventObject
{
long mDuration; /**< Asset duration in MS */
std::vector<std::string> mLanguages; /**< Available languages */
std::vector<long> mBitrates; /**< Available bitrates */
int mWidth; /**< Maximum video width */
int mHeight; /**< Maximum video height */
bool mHasDrm; /**< Drm enabled */
std::vector<int> mSupportedSpeeds; /**< Supported playback speeds */
bool mIsLive; /**< Is Live */
std::string mDrmType; /**< DRM type */
public:
MediaMetadataEvent() = delete;
MediaMetadataEvent(const MediaMetadataEvent&) = delete;
MediaMetadataEvent& operator=(const MediaMetadataEvent&) = delete;
/*
* @brief MediaMetadataEvent Constructor
*
* @param[in] duration - Duration of Media Metadata
* @param[in] width - Video width
* @param[in] height - Video height
* @param[in] hasDrm - Drm enablement status
* @param[in] isLive - Is Live
* @param[in] DrmType - DRM Type
*/
MediaMetadataEvent(long duration, int width, int height, bool hasDrm, bool isLive, const std::string &DrmType);
/**
* @brief MediaMetadataEvent Destructor
*/
virtual ~MediaMetadataEvent() { }
/**
* @brief Get Duration
*
* @return Asset duration
*/
long getDuration() const;
/**
* @brief Add a supported language
*
* @param[in] lang - Supported language
* @return void
*/
void addLanguage(const std::string &lang);
/**
* @brief Get Languages
*
* @return Vector of supported languages
*/
const std::vector<std::string> &getLanguages() const;
/**
* @brief Get Language Count
*
* @return Supported language count
*/
int getLanguagesCount() const;
/**
* @brief Add a supported bitrate
*
* @param[in] bitrate - Supported bitrate
* @return void
*/
void addBitrate(long bitrate);
/**
* @brief Get Bitrates
*
* @return Vector of supported bitrates
*/
const std::vector<long> &getBitrates() const;
/**
* @brief Get Bitrate Count
*
* @return Supported bitrate count
*/
int getBitratesCount() const;
/**
* @brief Get Width
*
* @return Video width
*/
int getWidth() const;
/**
* @brief Get Height
*
* @return Video height
*/
int getHeight() const;
/**
* @brief Supports DRM or not
*
* @return DRM enablement status
*/
bool hasDrm() const;
/**
* @brief Check for Live content or VOD
*
* @return isLive
*/
bool isLive() const;
/**
* @brief Get Current DRM Type
*
* @return Current DRM
*/
const std::string &getDrmType() const;
/**
* @brief Add a supported speed
*
* @param[in] speed - Supported speed
* @return void
*/
void addSupportedSpeed(int speed);
/**
* @brief Get Supported Speeds
*
* @return Vector of supported speeds
*/
const std::vector<int> &getSupportedSpeeds() const;
/**
* @brief Get Supported Speed count
*
* @return Supported speeds count
*/
int getSupportedSpeedCount() const;
};
/**
* @brief Class for the Bitrate change event
*/
class BitrateChangeEvent: public AAMPEventObject
{
int mTime; /**< Playback time */
long mBitrate; /**< Playback bitrate */
std::string mDescription; /**< Bitrate change reason */
int mWidth; /**< Video width */
int mHeight; /**< Video height */
double mFrameRate; /**< FrameRate */
double mPosition; /**< Position at which bitrate changed */
public:
BitrateChangeEvent() = delete;
BitrateChangeEvent(const BitrateChangeEvent&) = delete;
BitrateChangeEvent& operator=(const BitrateChangeEvent&) = delete;
/*
* @brief BitrateChangeEvent Constructor
*
* @param[in] time - Time of bitrate change
* @param[in] bitrate - New bitrate
* @param[in] desc - Reason of change
* @param[in] width - Video width
* @param[in] height - Video height
* @param[in] frameRate - Framerate
* @param[in] position - Position
*/
BitrateChangeEvent(int time, long bitrate, const std::string &desc, int width, int height, double frameRate, double position);
/**
* @brief BitrateChangeEvent Destructor
*/
virtual ~BitrateChangeEvent() { }
/**
* @brief Get Time
*
* @return Playback time
*/
int getTime() const;
/**
* @brief Get Bitrate
*
* @return Current bitrate
*/
long getBitrate() const;
/**
* @brief Get Description
*
* @return Reason of bitrate change
*/
const std::string &getDescription() const;
/**
* @brief Get Width
*
* @return Video width
*/
int getWidth() const;
/**
* @brief Get Height
*
* @return Video height
*/
int getHeight() const;
/**
* @brief Get Frame Rate
*
* @return Frame Rate
*/
double getFrameRate() const;
/**
* @brief Get Position
*
* @return Position
*/
double getPosition() const;
};
/**
* @brief Class for the Timed Metadata event
*/
class TimedMetadataEvent: public AAMPEventObject
{
std::string mName; /**< Metadata name */
std::string mId; /**< Id of the timedMetadata */
double mTime; /**< Playback position in MS- relative to tune time - starts at zero */
double mDuration; /**< Duration of the timed event in MS */
std::string mContent; /**< Metadata content */
public:
TimedMetadataEvent() = delete;
TimedMetadataEvent(const TimedMetadataEvent&) = delete;
TimedMetadataEvent& operator=(const TimedMetadataEvent&) = delete;
/*
* @brief TimedMetadataEvent Constructor
*
* @param[in] name - TimedMetadata name
* @param[in] id - TimedMetadata id
* @param[in] time - Time of event
* @param[in] duration - Duration of event
* @param[in] content - Content field of the TimedMetadata
*/
TimedMetadataEvent(const std::string &name, const std::string &id, double time, double duration, const std::string &content);
/**
* @brief TimedMetadataEvent Destructor
*/
virtual ~TimedMetadataEvent() { }
/**
* @brief Get Timed Metadata Name
*
* @return TimedMetadata name string
*/
const std::string &getName() const;
/**
* @brief Get Timed Metadata Id
*
* @return TimedMetadata id string
*/
const std::string &getId() const;
/**
* @brief Get Time
*
* @return Time of the Timed Metadata
*/
double getTime() const;
/**
* @brief Get Duration
*
* @return Duration (in MS) of the TimedMetadata
*/
double getDuration() const;
/**
* @brief Get Content
*
* @return Content field of the TimedMetadata
*/
const std::string &getContent() const;
};
/**
* @brief Class for the Bulk TimedMetadata Event
*/
class BulkTimedMetadataEvent: public AAMPEventObject
{
std::string mContent; /**< Metadata content */
public:
BulkTimedMetadataEvent() = delete;
BulkTimedMetadataEvent(const BulkTimedMetadataEvent&) = delete;
BulkTimedMetadataEvent& operator=(const BulkTimedMetadataEvent&) = delete;
/*
* @brief BulkTimedMetadataEvent Constructor
*
* @param[in] content - metadata serialized in JSON format
*/
BulkTimedMetadataEvent(const std::string &content);
/**
* @brief BulkTimedMetadataEvent Destructor
*/
virtual ~BulkTimedMetadataEvent() { }
/**
* @brief Get metadata content
*
* @return metadata content
*/
const std::string &getContent() const;
};
/**
* @brief Class for the Player State Changed event
*/
class StateChangedEvent: public AAMPEventObject
{
PrivAAMPState mState; /**< Player state */
public:
StateChangedEvent() = delete;
StateChangedEvent(const StateChangedEvent&) = delete;
StateChangedEvent& operator=(const StateChangedEvent&) = delete;
/*
* @brief StateChangedEvent Constructor
*