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.cpp
1466 lines (1300 loc) · 34.4 KB
/
AampEvent.cpp
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.cpp
* @brief Implementation of AAMPEventObject and derived class.
*/
#include "AampEvent.h"
#include "AampDefine.h"
#include <map>
#ifdef USE_SECCLIENT
#include "sec_client.h"
#endif
#ifdef USE_SECCLIENT
//Lookup table to convert secclient error to secmanager error
std::map<const int32_t, std::pair<const int32_t, const int32_t>> secClientSeManagerErrorLookUp =
{
{SEC_CLIENT_RESULT_SUCCESS, {SECMANAGER_CLASS_RESULT_SUCCESS, SECMANAGER_SUCCESS}},
{SEC_CLIENT_RESULT_FAILURE, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_INVALID_PARAMETERS, {SECMANAGER_CLASS_RESULT_SECCLIENT_FAIL, 0}},
{SEC_CLIENT_RESULT_HTTP_RESULT_FAILURE_GENERIC, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_LICENSE_NETWORK_FAIL}},
{SEC_CLIENT_RESULT_HTTP_RESULT_FAILURE_TOO_MANY_REDIRECTS, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_LICENSE_NETWORK_FAIL}},
{SEC_CLIENT_RESULT_HTTP_RESULT_FAILURE_CONNECTIVITY, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_LICENSE_NETWORK_FAIL}},
{SEC_CLIENT_RESULT_HTTP_RESULT_FAILURE_HOST_RESOLUTION, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_LICENSE_NETWORK_FAIL}},
{SEC_CLIENT_RESULT_HTTP_RESULT_FAILURE_TIMEOUT, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_LICENSE_NETWORK_FAIL}},
{SEC_CLIENT_RESULT_HTTP_RESULT_FAILURE_TLS, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_LICENSE_NETWORK_FAIL}},
{SEC_CLIENT_RESULT_MAC_AUTH_NOT_PROVISIONED, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_MAC_TOKEN_NO_PROV}},
{SEC_CLIENT_RESULT_MONEYTRACE_MISSING_OR_MALFORMED, {SECMANAGER_CLASS_RESULT_SECCLIENT_FAIL, 0}},
{SEC_CLIENT_RESULT_REQUEST_CREATION_ERROR, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_MALFORMED_RESPONSE_ERROR, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_MALFORMED_CONFIGURATION_PARAMETER_ERROR,{SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_MEMORY_ERROR, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_MEMORY_ALLOCATION_ERROR}},
{SEC_CLIENT_RESULT_FAILED_TO_LOAD_SEC_LIBRARY_ERROR, {SECMANAGER_CLASS_RESULT_SECCLIENT_FAIL, 0}},
{SEC_CLIENT_RESULT_INVALID_LOAD_CONFIGURATION_ERROR, {SECMANAGER_CLASS_RESULT_SECCLIENT_FAIL, 0}},
{SEC_CLIENT_RESULT_INVALID_LOAD_CRYPTO_TYPE_ERROR, {SECMANAGER_CLASS_RESULT_SECCLIENT_FAIL, 0}},
{SEC_CLIENT_RESULT_INVALID_LOAD_TIMEOUT_ERROR, {SECMANAGER_CLASS_RESULT_SECCLIENT_FAIL, 0}},
{SEC_CLIENT_RESULT_JSON_ENCODING_ERROR, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_UNSUPPORTED_FEATURE, {SECMANAGER_CLASS_RESULT_SECCLIENT_FAIL, 0}},
{SEC_CLIENT_RESULT_WATERMARKING_NOT_REQUIRED, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_WATERMARKING_SESSION_DENIED, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_GENERAL_CRYPTOGRAPHIC_ERROR, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_UNKNOWN_CRYPTO_ENGINE, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_UNKNOWN_KEY_AGREEMENT_ALGO, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_INTERNAL_ERROR_EXPONENT, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_INTERNAL_ERROR_RANDOM, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_UNSUPPORTED_HASH_ALGORITHM, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_ERROR_CREATING_MAC_AUTH_HEADER, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_ERROR_GENERATING_KEY_PAIR, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_ERROR_GENERATING_DERIVED_KEYS, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_ERROR_GENERATING_MAC_VALUE, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_CLIENT_VERFICATION_ERROR, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_MISSING_SESSION_CREDENTIALS, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_ENCRYPTION_KEY_MISMATCH, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_PKCS7_SIGNATURE_ERROR, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_UNDEFINED_ERROR}}, // Undefined
{SEC_CLIENT_RESULT_CLIENT_AUTH_TOKEN_FAILURE, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_UNDEFINED_ERROR}}, // Undefined
{SEC_CLIENT_RESULT_MISSING_KEY_PROVISIONING_DATA, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_UNDEFINED_ERROR}}, // Undefined
{SEC_CLIENT_RESULT_MISSING_DEVICE_AUTH_DATA, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_UNDEFINED_ERROR}}, // Undefined
{SEC_CLIENT_RESULT_INVALID_CONFIGURATION_PARAMETER, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_INVALID_DEVICE_TOKEN_PARAMETER, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_UNDEFINED_ERROR}}, // Undefined
{SEC_CLIENT_RESULT_INVALID_KEY_PROVISION_RESULT_PARAMETER, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_UNDEFINED_ERROR}}, // Undefined
{SEC_CLIENT_RESULT_INVALID_DEVICE_AUTHENTICATION_RESULT_PARAMETER, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_UNDEFINED_ERROR}}, // Undefined
{SEC_CLIENT_RESULT_INVALID_DEVICE_ATTRIBUTES_PARAMETER, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_UNDEFINED_ERROR}}, // Undefined
{SEC_CLIENT_RESULT_INVALID_ACCESS_TOKEN_PARAMETER, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_INVALID_ACCESS_TOKEN}},
{SEC_CLIENT_RESULT_INVALID_ACCESS_ATTRIBUTES_PARAMETER, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_INVALID_ACCESS_ATTRIBUTE}},
{SEC_CLIENT_RESULT_INVALID_KEY_SYSTEM_PARAMETER, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_INVALID_KEY_SYSTEM_PARAM}},
{SEC_CLIENT_RESULT_INVALID_LICENSE_REQUEST_PARAMETER, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_INVALID_DRM_LICENSE_PARAM}},
{SEC_CLIENT_RESULT_INVALID_CONTENT_METADATA_PARAMETER, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_INVALID_CONTENT_METADATA}},
{SEC_CLIENT_RESULT_INVALID_MEDIA_USAGE_PARAMETER, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_INVALID_MEDIA_USAGE}},
{SEC_CLIENT_RESULT_INVALID_LICENSE_IDENTIFIER, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_UNDEFINED_ERROR}}, // Undefined
{SEC_CLIENT_RESULT_INVALID_REQUEST_BODY, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_ENTITLEMENT_ERROR}}, // Undefined
{SEC_CLIENT_RESULT_INVALID_ACCOUNT_TOKEN_PARAMETER, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_UNDEFINED_ERROR}}, // Undefined
{SEC_CLIENT_RESULT_INVALID_REQUEST_METADATA_PARAMETER, {SECMANAGER_CLASS_RESULT_SECCLIENT_FAIL, 0}},
{SEC_CLIENT_RESULT_INVALID_CONTENT_IDENTIFIER_PARAMETER, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_UNDEFINED_ERROR}}, // Undefined
{SEC_CLIENT_RESULT_INVALID_DOWNLOADS_LIST_PARAMETER, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_UNDEFINED_ERROR}}, // Undefined
{SEC_CLIENT_RESULT_INVALID_ACQUIRE_SAT_FUNCTION_PARAMETER, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_UNDEFINED_ERROR}}, // Undefined
{SEC_CLIENT_RESULT_INVALID_WATERMARKING_SYSTEM_PARAMETER, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_INVALID_WATERMARK_PARAMETER}},
{SEC_CLIENT_RESULT_INVALID_CONTENT_ATTRIBUTES_PARAMETER, {SECMANAGER_CLASS_RESULT_API_FAIL, SECMANAGER_REASON_API_INVALID_CONTENT_PARAMETER}},
{SEC_CLIENT_RESULT_UNSUPPORTED_OR_INVALID_WATERMARK_FEATURE, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}},
{SEC_CLIENT_RESULT_INVALID_WATERMARK_SESSION_RESPONSE, {SECMANAGER_CLASS_RESULT_DRM_FAIL, SECMANAGER_REASON_DRM_GENERAL_FAILURE}}
};
#endif
/**
* @brief AAMPEventObject Constructor
*/
AAMPEventObject::AAMPEventObject(AAMPEventType type): mType(type)
{
}
/**
* @brief Get Event Type
*
* @return Event Type
*/
AAMPEventType AAMPEventObject::getType() const
{
return mType;
}
/**
* @brief MediaErrorEvent Constructor
*/
MediaErrorEvent::MediaErrorEvent(AAMPTuneFailure failure, int code, const std::string &desc, bool shouldRetry, int classCode, int reason, int businessStatus):
AAMPEventObject(AAMP_EVENT_TUNE_FAILED), mFailure(failure), mCode(code),
mDescription(desc), mShouldRetry(shouldRetry), mSecManagerClass(classCode), mSecManagerReasonCode(reason), mBusinessStatus(businessStatus)
{
}
/**
* @brief Get Failure Type
*
* @return Tune failure type
*/
AAMPTuneFailure MediaErrorEvent::getFailure() const
{
return mFailure;
}
/**
* @brief Get Error Code
*
* @return Tune error code
*/
int MediaErrorEvent::getCode() const
{
return mCode;
}
/**
* @brief Get Description
*
* @return Error description
*/
const std::string &MediaErrorEvent::getDescription() const
{
return mDescription;
}
/**
* @brief Retry or not
*
* @return Retry or don't retry
*/
bool MediaErrorEvent::shouldRetry() const
{
return mShouldRetry;
}
/**
* @fn getClass
*/
int32_t MediaErrorEvent::getClass() const
{
return mSecManagerClass;
}
/**
* @fn getReason
*/
int32_t MediaErrorEvent::getReason() const
{
return mSecManagerReasonCode;
}
/**
* @fn getBusinessStatus
*/
int32_t MediaErrorEvent::getBusinessStatus() const
{
return mBusinessStatus;
}
/**
* @brief SpeedChangedEvent Constructor
*/
SpeedChangedEvent::SpeedChangedEvent(float rate):
AAMPEventObject(AAMP_EVENT_SPEED_CHANGED), mRate(rate)
{
}
/**
* @brief Get Rate
*
* @return New speed
*/
float SpeedChangedEvent::getRate() const
{
return mRate;
}
/**
* @brief ProgressEvent Constructor
*
*/
ProgressEvent::ProgressEvent(double duration, double position, double start, double end, float speed, long long pts, double bufferedDuration, std::string seiTimecode):
AAMPEventObject(AAMP_EVENT_PROGRESS), mDuration(duration),
mPosition(position), mStart(start),
mEnd(end), mSpeed(speed), mPTS(pts),
mBufferedDuration(bufferedDuration),
mSEITimecode(seiTimecode)
{
}
/**
* @brief Get Duration of Asset
*
* @return Asset duration in MS
*/
double ProgressEvent::getDuration() const
{
return mDuration;
}
/**
* @brief Get Current Position
*
* @return Current position in MS
*/
double ProgressEvent::getPosition() const
{
return mPosition;
}
/**
* @brief Get Start Position
*
* @return Start position in MS
*/
double ProgressEvent::getStart() const
{
return mStart;
}
/**
* @brief Get End Position
*
* @return End position in MS
*/
double ProgressEvent::getEnd() const
{
return mEnd;
}
/**
* @brief Get Speed
*
* @return Current speed
*/
float ProgressEvent::getSpeed() const
{
return mSpeed;
}
/**
* @brief Get Video PTS
*
* @return Video PTS
*/
long long ProgressEvent::getPTS() const
{
return mPTS;
}
/**
* @brief Get Buffered Duration
*
* @return Buffered duration
*/
double ProgressEvent::getBufferedDuration() const
{
return mBufferedDuration;
}
/**
* @brief Get SEI Time Code information
*
* @return SEI Time Code
*/
const char* ProgressEvent::getSEITimeCode() const
{
return mSEITimecode.c_str();
}
/**
* @brief CCHandleEvent Constructor
*
* @param[in] handle - Handle to close caption
*/
CCHandleEvent::CCHandleEvent(unsigned long handle):
AAMPEventObject(AAMP_EVENT_CC_HANDLE_RECEIVED), mHandle(handle)
{
}
/**
* @brief Get Closed Caption Handle
*
* @return Handle to the closed caption
*/
unsigned long CCHandleEvent::getCCHandle() const
{
return mHandle;
}
/**
* @brief MediaMetadataEvent Constructor
*/
MediaMetadataEvent::MediaMetadataEvent(long duration, int width, int height, bool hasDrm, bool isLive, const std::string &DrmType, double programStartTime):
AAMPEventObject(AAMP_EVENT_MEDIA_METADATA), mDuration(duration),
mLanguages(), mBitrates(), mWidth(width), mHeight(height),
mHasDrm(hasDrm), mSupportedSpeeds(), mIsLive(isLive), mDrmType(DrmType), mProgramStartTime(programStartTime),
mPCRating(),mSsi(-1),mFrameRate(0),mVideoScanType(eVIDEOSCAN_UNKNOWN),mAspectRatioWidth(0),mAspectRatioHeight(0),
mVideoCodec(),mHdrType(),mAudioBitrates(),mAudioCodec(),mAudioMixType(),isAtmos(false),mMediaFormatName()
{
}
/**
* @brief Get Duration
*
* @return Asset duration
*/
long MediaMetadataEvent::getDuration() const
{
return mDuration;
}
/**
* @brief Get Program/Availability Start Time.
*
* @return Program/Availability Start Time.
*/
double MediaMetadataEvent::getProgramStartTime() const
{
return mProgramStartTime;
}
/**
* @brief Add a supported language
*/
void MediaMetadataEvent::addLanguage(const std::string &lang)
{
return mLanguages.push_back(lang);
}
/**
* @brief Get Languages
*
* @return Vector of supported languages
*/
const std::vector<std::string> &MediaMetadataEvent::getLanguages() const
{
return mLanguages;
}
/**
* @brief Get Language Count
*
* @return Supported language count
*/
int MediaMetadataEvent::getLanguagesCount() const
{
return mLanguages.size();
}
/**
* @brief Add a supported bitrate
*/
void MediaMetadataEvent::addBitrate(long bitrate)
{
return mBitrates.push_back(bitrate);
}
/**
* @brief Get Bitrates
*
* @return Vector of supported bitrates
*/
const std::vector<long> &MediaMetadataEvent::getBitrates() const
{
return mBitrates;
}
/**
* @brief Get Bitrate Count
*
* @return Supported bitrate count
*/
int MediaMetadataEvent::getBitratesCount() const
{
return mBitrates.size();
}
/**
* @brief Get Width
*
* @return Video width
*/
int MediaMetadataEvent::getWidth() const
{
return mWidth;
}
/**
* @brief Get Height
*
* @return Video height
*/
int MediaMetadataEvent::getHeight() const
{
return mHeight;
}
/**
* @brief Supports DRM or not
*
* @return DRM enablement status
*/
bool MediaMetadataEvent::hasDrm() const
{
return mHasDrm;
}
/**
* @brief Add a supported speed
*/
void MediaMetadataEvent::addSupportedSpeed(float speed)
{
return mSupportedSpeeds.push_back(speed);
}
/**
* @brief Get Supported Speeds
*
* @return Vector of supported speeds
*/
const std::vector<float> &MediaMetadataEvent::getSupportedSpeeds() const
{
return mSupportedSpeeds;
}
/**
* @brief Get Supported Speed count
*
* @return Supported speeds count
*/
int MediaMetadataEvent::getSupportedSpeedCount() const
{
return mSupportedSpeeds.size();
}
/**
* @brief Check for Live content or VOD
*
* @return isLive
*/
bool MediaMetadataEvent::isLive() const
{
return mIsLive;
}
/**
* @brief Get Current DRM Type
*
* @return Current DRM
*/
const std::string &MediaMetadataEvent::getDrmType() const
{
return mDrmType;
}
/**
* @brief Sets additional metadata for video
*/
void MediaMetadataEvent::SetVideoMetaData(float frameRate,VideoScanType videoScanType,int aspectRatioWidth,int aspectRatioHeight, const std::string & videoCodec, const std::string & strHdrType, const std::string & strPCRating, int ssi)
{
this->mFrameRate = frameRate;
this->mVideoScanType = videoScanType;
this->mAspectRatioWidth = aspectRatioWidth;
this->mAspectRatioHeight = aspectRatioHeight;
this->mVideoCodec = videoCodec;
this->mHdrType = strHdrType;
this->mSsi = ssi;
this->mPCRating = strPCRating;
return;
}
/**
* @brief Get Bitrates
*
* @return Vector of supported bitrates
*/
void MediaMetadataEvent::SetAudioMetaData(const std::string &audioCodec,const std::string &mixType,bool isAtmos )
{
mAudioCodec = audioCodec;
mAudioMixType = mixType;
isAtmos = isAtmos;
return;
}
/**
* @brief BitrateChangeEvent Constructor
*/
BitrateChangeEvent::BitrateChangeEvent(int time, long bitrate, const std::string &desc, int width, int height, double frameRate, double position, bool cappedProfile, int displayWidth, int displayHeight, VideoScanType videoScanType, int aspectRatioWidth, int aspectRatioHeight):
AAMPEventObject(AAMP_EVENT_BITRATE_CHANGED), mTime(time),
mBitrate(bitrate), mDescription(desc), mWidth(width),
mHeight(height), mFrameRate(frameRate), mPosition(position), mCappedProfile(cappedProfile), mDisplayWidth(displayWidth), mDisplayHeight(displayHeight), mVideoScanType(videoScanType), mAspectRatioWidth(aspectRatioWidth), mAspectRatioHeight(aspectRatioHeight)
{
}
/**
* @brief Get Time
*
* @return Playback time
*/
int BitrateChangeEvent::getTime() const
{
return mTime;
}
/**
* @brief Get Bitrate
*
* @return Current bitrate
*/
long BitrateChangeEvent::getBitrate() const
{
return mBitrate;
}
/**
* @brief Get Description
*
* @return Reason of bitrate change
*/
const std::string &BitrateChangeEvent::getDescription() const
{
return mDescription;
}
/**
* @brief Get Width
*
* @return Video width
*/
int BitrateChangeEvent::getWidth() const
{
return mWidth;
}
/**
* @brief Get Height
*
* @return Video height
*/
int BitrateChangeEvent::getHeight() const
{
return mHeight;
}
/**
* @brief Get Frame Rate
*
* @return Frame Rate
*/
double BitrateChangeEvent::getFrameRate() const
{
return mFrameRate;
}
/**
* @brief Get Position
*
* @return Position
*/
double BitrateChangeEvent::getPosition() const
{
return mPosition;
}
/**
* @brief Get Capped Profile status
*
* @return profile filterting restricted status
*/
bool BitrateChangeEvent::getCappedProfileStatus() const
{
return mCappedProfile;
}
/**
* @brief Get display width
*
* @return output display tv width
*/
int BitrateChangeEvent::getDisplayWidth() const
{
return mDisplayWidth;
}
/**
* @brief Get output tv display Height
*
* @return output display tv height
*/
int BitrateChangeEvent::getDisplayHeight() const
{
return mDisplayHeight;
}
/**
* @brief Get Video Scan Type
*
* @return output video scan type
*/
VideoScanType BitrateChangeEvent::getScanType() const
{
return mVideoScanType;
}
/**
* @brief Get Aspect Ratio Width
*
* @return output aspect ratio width
*/
int BitrateChangeEvent::getAspectRatioWidth() const
{
return mAspectRatioWidth;
}
/**
* @brief Get Aspect Ratio Height
*
* @return output Aspect Ratio Height
*/
int BitrateChangeEvent::getAspectRatioHeight() const
{
return mAspectRatioHeight;
}
/**
* @brief TimedMetadataEvent Constructor
*/
TimedMetadataEvent::TimedMetadataEvent(const std::string &name, const std::string &id, double time, double duration, const std::string &content):
AAMPEventObject(AAMP_EVENT_TIMED_METADATA), mName(name), mId(id),
mTime(time), mDuration(duration), mContent(content)
{
}
/**
* @brief Get Timed Metadata Name
*
* @return TimedMetadata name string
*/
const std::string &TimedMetadataEvent::getName() const
{
return mName;
}
/**
* @brief Get Timed Metadata Id
*
* @return TimedMetadata id string
*/
const std::string &TimedMetadataEvent::getId() const
{
return mId;
}
/**
* @brief Get Time
*
* @return Time of the Timed Metadata
*/
double TimedMetadataEvent::getTime() const
{
return mTime;
}
/**
* @brief Get Duration
*
* @return Duration (in MS) of the TimedMetadata
*/
double TimedMetadataEvent::getDuration() const
{
return mDuration;
}
/**
* @brief Get Content
*
* @return Content field of the TimedMetadata
*/
const std::string &TimedMetadataEvent::getContent() const
{
return mContent;
}
/**
* @brief BulkTimedMetadataEvent Constructor
*/
BulkTimedMetadataEvent::BulkTimedMetadataEvent(const std::string &content):
AAMPEventObject(AAMP_EVENT_BULK_TIMED_METADATA), mContent(content)
{
}
/**
* @brief Get metadata content
*
* @return metadata content
*/
const std::string &BulkTimedMetadataEvent::getContent() const
{
return mContent;
}
/**
* @brief StateChangedEvent Constructor
*/
StateChangedEvent::StateChangedEvent(PrivAAMPState state):
AAMPEventObject(AAMP_EVENT_STATE_CHANGED), mState(state)
{
}
/**
* @brief Get Current Player State
*
* @return Player state
*/
PrivAAMPState StateChangedEvent::getState() const
{
return mState;
}
/**
* @brief SupportedSpeedsChangedEvent Constructor
*/
SupportedSpeedsChangedEvent::SupportedSpeedsChangedEvent():
AAMPEventObject(AAMP_EVENT_SPEEDS_CHANGED), mSupportedSpeeds()
{
}
/**
* @brief Add a Supported Speed
*/
void SupportedSpeedsChangedEvent::addSupportedSpeed(float speed)
{
return mSupportedSpeeds.push_back(speed);
}
/**
* @brief Get Supported Speeds
*
* @return Vector of supported speeds
*/
const std::vector<float> &SupportedSpeedsChangedEvent::getSupportedSpeeds() const
{
return mSupportedSpeeds;
}
/**
* @brief Get Supported Speeds Count
*
* @return Supported speeds count
*/
int SupportedSpeedsChangedEvent::getSupportedSpeedCount() const
{
return mSupportedSpeeds.size();
}
/**
* @brief SeekedEvent Constructor
*/
SeekedEvent::SeekedEvent(double positionMS):
AAMPEventObject(AAMP_EVENT_SEEKED), mPosition(positionMS)
{
}
/**
* @brief Get position
*
* @return Seeked position
*/
double SeekedEvent::getPosition() const
{
return mPosition;
}
/**
* @brief TuneProfilingEvent Constructor
*/
TuneProfilingEvent::TuneProfilingEvent(std::string &profilingData):
AAMPEventObject(AAMP_EVENT_TUNE_PROFILING), mProfilingData(profilingData)
{
}
/**
* @brief Get Tune profiling data
*
* @return Tune profiling data
*/
const std::string &TuneProfilingEvent::getProfilingData() const
{
return mProfilingData;
}
/**
* @brief BufferingChangedEvent Constructor
*/
BufferingChangedEvent::BufferingChangedEvent(bool buffering):
AAMPEventObject(AAMP_EVENT_BUFFERING_CHANGED), mBuffering(buffering)
{
}
/**
* @brief Get Buffering Status
*
* @return Buffering status (true/false)
*/
bool BufferingChangedEvent::buffering() const
{
return mBuffering;
}
/**
* @brief DrmMetaDataEvent Constructor
*/
DrmMetaDataEvent::DrmMetaDataEvent(AAMPTuneFailure failure, const std::string &accessStatus, int statusValue, long responseCode, bool secclientErr):
AAMPEventObject(AAMP_EVENT_DRM_METADATA), mFailure(failure), mAccessStatus(accessStatus),
mAccessStatusValue(statusValue), mResponseCode(responseCode), mSecclientError(secclientErr), mSecManagerReasonCode(-1), mSecManagerClass(-1),
mBusinessStatus(-1)
{
}
/**
* @brief Get Failure type
*
* @return Tune failure type
*/
AAMPTuneFailure DrmMetaDataEvent::getFailure() const
{
return mFailure;
}
/**
* @brief Set Failure type
*/
void DrmMetaDataEvent::setFailure(AAMPTuneFailure failure)
{
mFailure = failure;
}
/**
* @brief Get Access Status
*
* @return Access status string
*/
const std::string &DrmMetaDataEvent::getAccessStatus() const
{
return mAccessStatus;
}
/**
* @brief Set Access Status
*/
void DrmMetaDataEvent::setAccessStatus(const std::string &status)
{
mAccessStatus = status;
}
/**
* @brief Get Access Status
*
* @return Access status value
*/
int DrmMetaDataEvent::getAccessStatusValue() const
{
return mAccessStatusValue;
}
/**
* @brief Set Access Status Value
*/
void DrmMetaDataEvent::setAccessStatusValue(int value)
{
mAccessStatusValue = value;
}
/**
* @brief Get Response Code
*
* @return Response code
*/
long DrmMetaDataEvent::getResponseCode() const
{
return mResponseCode;
}
/**
* @brief Get Response Code
*
* @return Response code
*/
int32_t DrmMetaDataEvent::getSecManagerReasonCode() const
{
return mSecManagerReasonCode;
}
/**
* @brief Get Response Code
*
* @return Response code
*/
int32_t DrmMetaDataEvent::getSecManagerClassCode() const
{
return mSecManagerClass;
}
/**
* @brief Get Response Code
*
* @return Response code
*/
int32_t DrmMetaDataEvent::getBusinessStatus() const
{
return mBusinessStatus;
}
/**
* @brief Set Response Code
*/
void DrmMetaDataEvent::setResponseCode(long code)
{
mResponseCode = code;
}
/**
* @brief Set Secmanager response code
*/
void DrmMetaDataEvent::setSecManagerReasonCode(int32_t code)
{
mSecManagerReasonCode = code;
}
/**
* @brief Convert the secclient DRM error code into secmanager error code to have a unified verbose error reported
*/
void DrmMetaDataEvent::ConvertToVerboseErrorCode(int32_t httpCode, int32_t httpExtStatusCode )
{
mSecManagerClass = SECMANAGER_CLASS_RESULT_DRM_FAIL;
mSecManagerReasonCode = SECMANAGER_REASON_DRM_GENERAL_FAILURE;
#ifdef USE_SECCLIENT
//look for the correct code from the lookup
auto it = secClientSeManagerErrorLookUp.find(-httpCode); //Secclient error codes are -ve
if (it != secClientSeManagerErrorLookUp.end()) {
mSecManagerClass = it->second.first;
mSecManagerReasonCode = it->second.second;
if(412 == httpCode && 401 == httpExtStatusCode)
{
mSecManagerReasonCode = SECMANAGER_REASON_DRM_ACCESS_TOKEN_EXPIRED;
}
if (mSecManagerClass == SECMANAGER_CLASS_RESULT_SECCLIENT_FAIL) {
mSecManagerReasonCode = httpCode;
}
}
mBusinessStatus = httpExtStatusCode;
#endif
}