This repository has been archived by the owner on Jan 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
AampEvent.h
2153 lines (1861 loc) · 57 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 42 // <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 12 /* [-64, -32, -16, -4, -1, 0, 0.5, 1, 4, 16, 32, 64] */
/**
* @enum AAMPEventType
* @brief Type of the events sending to the JSPP player.
*/
typedef enum
{
AAMP_EVENT_ALL_EVENTS = 0, /**< 0, All Events */
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_EVENT_CONTENT_GAP, /**< 39, Content gap event for progress gap reporting*/
AAMP_EVENT_HTTP_RESPONSE_HEADER, /**< 40, Http response header data */
AAMP_EVENT_WATERMARK_SESSION_UPDATE, /**< 41, Update on Watermark Session*/
AAMP_EVENT_CONTENT_PROTECTION_DATA_UPDATE, /**< 42, Update on Content Protection Data on Dynamic Key Rotation*/
AAMP_MAX_NUM_EVENTS
} AAMPEventType;
/**
* @enum AAMPEventMode
* @brief AAMP event modes
*/
typedef enum
{
AAMP_EVENT_DEFAULT_MODE = 0, /**< Aamp Default event mode */
AAMP_EVENT_SYNC_MODE, /**< Events handled in sync mode */
AAMP_EVENT_ASYNC_MODE /**< Events handled in Async mode */
}AAMPEventMode;
/**
* @enum AAMPTuneFailure
* @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_DRM_SELF_ABORT, /**< Download activity is aborted by player */
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;
/**
* @enum PrivAAMPState
* @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;
/**
* @enum MetricsDataType
* @brief AAMP metric data types
*/
typedef enum E_MetricsDataType
{
AAMP_DATA_NONE,
AAMP_DATA_VIDEO_END
} MetricsDataType;
/**
* @enum VideoScanType Video Scan Type
*
* @brief VideoScanType - Progressive/Interlaced
* */
typedef enum
{
eVIDEOSCAN_PROGRESSIVE, /**< Progressive Video */
eVIDEOSCAN_INTERLACED, /**< Interlaced Video */
eVIDEOSCAN_UNKNOWN /**< Unknown Video */
}VideoScanType;
/**
* @struct AAMPEvent
* @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 */
const char* timecode; /**< SEI Timecode information */
} 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
{
float 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*/
bool cappedProfile; /**< profile capped status*/
int displayWidth; /**< output display width*/
int displayHeight; /**< output display height*/
VideoScanType videoScanType;/**< video scan type*/
int aspectRatioWidth; /**< aspect ratio width*/
int aspectRatioHeight; /**< aspect ratio height*/
} 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 */
float supportedSpeeds[MAX_SUPPORTED_SPEED_COUNT]; /**< Supported playback speeds */
double programStartTime; /**< Program/Availability start time */
} 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 */
int32_t classCode; /**< class Code */
int32_t reasonCode; /**<reason Code */
int32_t businessStatus; /**< business Status */
} 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 */
float 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;
struct
{
long long timeMilliseconds; /**< Playback position - relative to tune time - starts at zero */
double durationMilliSeconds; /**< Duration of the gap */
} contentGap;
/**
* @brief Structure of the http response header event
*/
struct
{
const char* header; /**< HTTP header name */
const char* response; /**< HTTP response value */
} httpResponseHeader;
/**
* @brief Structure of the content protection data update event
*/
struct
{
uint8_t *keyID; /**< Session KeyID */
const char* streamType; /**< Session StreamType */
} contentProtectionData;
} data;
/**
* @brief AAMPEvent Constructor
*/
AAMPEvent() : type(AAMP_MAX_NUM_EVENTS), data()
{
}
/**
* @brief AAMPEvent Constructor
*
* @param[in] t Event type
*/
AAMPEvent(AAMPEventType t) : type(t), data()
{
}
/**
* @brief Copy constructor disabled
*
*/
AAMPEvent(const AAMPEvent&) = delete;
/**
* @brief assignment operator disabled
*
*/
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;
/**
* @brief Copy constructor disabled
*
*/
AAMPEventObject(const AAMPEventObject&) = delete;
/**
* @brief assignment operator disabled
*
*/
AAMPEventObject& operator=(const AAMPEventObject&) = delete;
/**
* @fn AAMPEventObject
*/
AAMPEventObject(AAMPEventType type);
/**
* @brief AAMPEvent Destructor
*/
virtual ~AAMPEventObject() { }
/**
* @fn getType
*/
AAMPEventType getType() const;
};
/**
* @class MediaErrorEvent
* @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 */
int32_t mSecManagerClass; /**< Secmanager error class */
int32_t mSecManagerReasonCode; /**< Secmanager reason code */
int32_t mBusinessStatus; /**< secclient business reason code */
public:
MediaErrorEvent() = delete;
MediaErrorEvent(const MediaErrorEvent&) = delete;
MediaErrorEvent& operator=(const MediaErrorEvent&) = delete;
/**
* @fn MediaErrorEvent
*
* @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, int32_t classCode, int32_t reason, int32_t businessStatus);
/**
* @brief MediaErrorEvent Destructor
*/
virtual ~MediaErrorEvent() { }
/**
* @fn getFailure
*/
AAMPTuneFailure getFailure() const;
/**
* @fn getCode
*/
int getCode() const;
/**
* @fn getDescription
*/
const std::string &getDescription() const;
/**
* @fn shouldRetry
*/
bool shouldRetry() const;
/**
* @fn getClass
*/
int32_t getClass() const;
/**
* @fn getReason
*/
int32_t getReason() const;
/**
* @fn getBusinessStatus
*/
int32_t getBusinessStatus() const;
};
/**
* @class SpeedChangedEvent
* @brief Class for the Speed changed event
*/
class SpeedChangedEvent: public AAMPEventObject
{
float mRate; /**< Playback rate */
public:
SpeedChangedEvent() = delete;
SpeedChangedEvent(const SpeedChangedEvent&) = delete;
SpeedChangedEvent& operator=(const SpeedChangedEvent&) = delete;
/**
* @fn SpeedChangedEvent
*
* @param[in] rate - New speed
*/
SpeedChangedEvent(float rate);
/**
* @brief SpeedChangedEvent Destructor
*/
virtual ~SpeedChangedEvent() { }
/**
* @fn getRate
*/
float getRate() const;
};
/**
* @class ProgressEvent
* @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 */
std::string mSEITimecode; /**< SEI Timecode information */
public:
ProgressEvent() = delete;
ProgressEvent(const ProgressEvent&) = delete;
ProgressEvent& operator=(const ProgressEvent&) = delete;
/**
* @fn ProgressEvent
*
* @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, std::string seiTimecode);
/**
* @brief ProgressEvent Destructor
*/
virtual ~ProgressEvent() { }
/**
* @fn getDuration
*/
double getDuration() const;
/**
* @fn getPosition
*
*/
double getPosition() const;
/**
* @fn getStart
*
*/
double getStart() const;
/**
* @fn getEnd
*/
double getEnd() const;
/**
* @fn getSpeed
*/
float getSpeed() const;
/**
* @fn getPTS
*
*/
long long getPTS() const;
/**
* @fn getBufferedDuration
*/
double getBufferedDuration() const;
/**
* @fn getSEITimeCode
*/
const char* getSEITimeCode() const;
};
/**
* @class CCHandleEvent
* @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;
/**
* @fn CCHandleEvent
*/
CCHandleEvent(unsigned long handle);
/**
* @brief CCHandleEvent Destructor
*/
virtual ~CCHandleEvent() { }
/**
* @fn getCCHandle
*/
unsigned long getCCHandle() const;
};
/**
* @class MediaMetadataEvent
* @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<float> mSupportedSpeeds; /**< Supported playback speeds */
bool mIsLive; /**< Is Live */
std::string mDrmType; /**< DRM type */
double mProgramStartTime; /**< Program/Availability start time */
/* Additional data from ATSC playback */
std::string mPCRating; /**< Parental control rating json string object */
int mSsi; /**< Signal strength indicator 0-100 where 100 is a perfect signal. -1 indicates data not available */
/* Video info */
float mFrameRate; /**< FrameRate */
VideoScanType mVideoScanType; /**< Video Scan Type progressive/interlaced */
int mAspectRatioWidth; /**< Aspect Ratio Width*/
int mAspectRatioHeight; /**< Aspect Ratio Height*/
std::string mVideoCodec; /**< VideoCodec - E.g MPEG2.*/
std::string mHdrType; /**< type of HDR being played, in example "DOLBY_VISION" */
std::string mMediaFormatName; /*< Media format type */
/* Audio Info */
std::vector<long> mAudioBitrates; /**< Available Audio bitrates */
std::string mAudioCodec; /**< AudioCodec E.g AC3.*/
std::string mAudioMixType; /**< AudioMixType(- E.g STEREO. */
bool isAtmos; /**< Is Atmos : 1 - True if audio playing is Dolby Atmos, 0 false , -1 indicates data not available */
public:
MediaMetadataEvent() = delete;
MediaMetadataEvent(const MediaMetadataEvent&) = delete;
MediaMetadataEvent& operator=(const MediaMetadataEvent&) = delete;
/**
* @fn MediaMetadataEvent
*
* @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
* @param[in] programStartTime - Program/Availability start time
*/
MediaMetadataEvent(long duration, int width, int height, bool hasDrm, bool isLive, const std::string &DrmType, double programStartTime);
/**
* @brief MediaMetadataEvent Destructor
*/
virtual ~MediaMetadataEvent() { }
/**
* @fn getDuration
*/
long getDuration() const;
/**
* @fn getProgramStartTime
*/
double getProgramStartTime() const;
/**
* @fn addLanguage
*
* @param[in] lang - Supported language
* @return void
*/
void addLanguage(const std::string &lang);
/**
* @fn getLanguages
*/
const std::vector<std::string> &getLanguages() const;
/**
* @fn getLanguagesCount
*/
int getLanguagesCount() const;
/**
* @fn addBitrate
*
* @param[in] bitrate - Supported bitrate
* @return void
*/
void addBitrate(long bitrate);
/**
* @fn getBitrates
*/
const std::vector<long> &getBitrates() const;
/**
* @fn getBitratesCount
*/
int getBitratesCount() const;
/**
* @fn getWidth
*/
int getWidth() const;
/**
* @fn getHeight
*/
int getHeight() const;
/**
* @fn hasDrmt
*/
bool hasDrm() const;
/**
* @fn isLive
*/
bool isLive() const;
/**
* @fn getDrmType
*/
const std::string &getDrmType() const;
/**
* @fn addSupportedSpeed
*
* @param[in] speed - Supported speed
* @return void
*/
void addSupportedSpeed(float speed);
/**
* @fn getSupportedSpeeds
*/
const std::vector<float> &getSupportedSpeeds() const;
/**
* @fn getSupportedSpeedCount
*/
int getSupportedSpeedCount() const;
/**
* @fn SetVideoMetaData
*
* @param[in] mFrameRate - video framerate
* @param[in] videoScanType - Scan Type progressive/interlaced
* @param[in] aspectRatioWidth - Aspect Ratio Width
* @param[in] aspectRatioHeight - Aspect Ratio Height
* @param[in] strVideoCodec - VideoCodec(v1) - E.g MPEG2.
* @param[in] strHdrType - type of HDR being played, in example "DOLBY_VISION"
* @param[in] strPCRating - Parental control rating json string object
* @param[int] ssi - Signal strength indicator 0-100 where 100 is a perfect signal. -1 indicates data not available
*/
void SetVideoMetaData(float frameRate,VideoScanType videoScanType,int aspectRatioWidth,int aspectRatioHeight, const std::string &videoCodec, const std::string & hdrType, const std::string & pcRating, int ssi);
/**
* @fn getAudioBitrates
*/
const std::vector<long> &getAudioBitrates() const { return mAudioBitrates; }
/**
* @brief Sets additional metadata for Audio
*
* @param[in] strAudioCodec - AudioCodec - E.g AC3.
* @param[in] strMixType - AudioMixType - E.g STEREO.
* @param[in] iAtmos - 1 - True if audio playing is Dolby Atmos, 0 false , -1 indicates data not available
*/
void SetAudioMetaData(const std::string &audioCodec,const std::string & mixType,bool isAtmos );
/**
* @brief Add a supported bitrate
*
* @param[in] bitrate - Supported bitrate
* @return void
*/
void addAudioBitrate(long bitrate) { return mAudioBitrates.push_back(bitrate); }
/**
* @brief get Parental control ratings
*
* @return ratings string
*/
const std::string & getRatings() const { return mPCRating;}
/**
* @brief get Signal strength indicator
*
* @return ratings string
*/
int getSsi() const { return mSsi;}
/**
* @brief get framerate
*
* @return ratings string
*/
float getFrameRate() const {return mFrameRate;}
/**
* @brief Get VideoScanType
*
* @return VideoScanType
*/
VideoScanType getVideoScanType() const { return mVideoScanType;}
/**
* @brief Get AspectRatioWidth
*
* @return AspectRatioWidth
*/
int getAspectRatioWidth() const { return mAspectRatioWidth;}
/**
* @brief Get AspectRatioHeight
*
* @return AspectRatioHeight
*/
int getAspectRatioHeight() const { return mAspectRatioHeight;}
/**
* @brief Get VideoCodec
*
* @return VideoCodec
*/
const std::string & getVideoCodec() const { return mVideoCodec;}
/**
* @brief Get HdrType
*
* @return HdrType
*/
const std::string & getHdrType() const { return mHdrType;}
/**
* @brief Get AudioCodec
*
* @return AudioCodec
*/
const std::string & getAudioCodec() const {return mAudioCodec;}
/**
* @brief returns AudioMixType
*
* @return AudioMixType
*/
const std::string & getAudioMixType() const {return mAudioMixType;}
/**
* @brief Get Atmos info
*
* @return true/false
*/