RDK Documentation (Open Sourced RDK Components)
AdManagerBase.h
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's license file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2018 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 /**
21  * @file AdManagerBase.h
22  * @brief Client side DAI base class, and common data structures
23  */
24 
25 
26 #ifndef ADMANAGERBASE_H_
27 #define ADMANAGERBASE_H_
28 
29 #include "priv_aamp.h"
30 
31 /**
32  * @enum AdState
33  * @brief Ad playback states
34  */
35 enum class AdState
36 {
37  OUTSIDE_ADBREAK, /**< Not in adbreak, wait for period change */
38  IN_ADBREAK_AD_NOT_PLAYING, /**< Base period in adbreak: But Ad not found/playing */
39  IN_ADBREAK_AD_PLAYING, /**< Ad playing */
40  IN_ADBREAK_AD_READY2PLAY, /**< Ready to play next Ad */
41  IN_ADBREAK_WAIT2CATCHUP /**< Waiting for base period to catchup */
42 };
43 
44 static constexpr const char *ADSTATE_STR[] =
45 {
46  (const char *)"OUTSIDE_ADBREAK",
47  (const char *)"IN_ADBREAK_AD_NOT_PLAYING",
48  (const char *)"IN_ADBREAK_AD_PLAYING",
49  (const char *)"IN_ADBREAK_AD_READY2PLAY",
50  (const char *)"IN_ADBREAK_WAIT2CATCHUP"
51 };
52 
53 /**
54  * @class CDAIObject
55  * @brief Base class for the client side DAI object
56  */
58 {
59 private:
60  PrivateInstanceAAMP* mAamp; /**< AAMP player's private instance */
61  AampLogManager *mLogObj;
62 public:
63  /**
64  * @brief CDAIObject constructor.
65  *
66  * @param[in] aamp - Pointer to PrivateInstanceAAMP
67  */
68  CDAIObject(AampLogManager *logObj, PrivateInstanceAAMP* aamp): mLogObj(logObj), mAamp(aamp)
69  {
70 
71  }
72 
73  /**
74  * @brief CDAIObject Copy Constructor
75  */
76  CDAIObject(const CDAIObject&) = delete;
77 
78  /**
79  * @brief CDAIObject assignment operator overloading
80  */
81  CDAIObject& operator=(const CDAIObject&) = delete;
82 
83  /**
84  * @brief CDAIObject destructor.
85  */
86  virtual ~CDAIObject()
87  {
88 
89  }
90 
91  /**
92  * @brief Setting the alternate contents' (Ads/blackouts) URL
93  *
94  * @param[in] adBreakId - Adbreak's unique identifier.
95  * @param[in] adId - Individual Ad's id
96  * @param[in] url - Ad URL
97  * @param[in] startMS - Ad start time in milliseconds
98  * @param[in] breakdur - Adbreak's duration in MS
99  */
100  virtual void SetAlternateContents(const std::string &adBreakId, const std::string &adId, const std::string &url, uint64_t startMS=0, uint32_t breakdur=0)
101  {
102  AAMPLOG_WARN("Stream doesn't support CDAI. Rejecting the promise.");
103  mAamp->SendAdResolvedEvent(adId, false, 0, 0);
104  }
105 };
106 
107 
108 
109 #endif /* ADMANAGERBASE_H_ */
AdState::IN_ADBREAK_AD_PLAYING
@ IN_ADBREAK_AD_PLAYING
PrivateInstanceAAMP::SendAdResolvedEvent
void SendAdResolvedEvent(const std::string &adId, bool status, uint64_t startMS=0, uint64_t durationMs=0)
Send status of Ad manifest downloading & parsing.
Definition: priv_aamp.cpp:8884
AdState::IN_ADBREAK_WAIT2CATCHUP
@ IN_ADBREAK_WAIT2CATCHUP
CDAIObject::operator=
CDAIObject & operator=(const CDAIObject &)=delete
CDAIObject assignment operator overloading.
AdState::OUTSIDE_ADBREAK
@ OUTSIDE_ADBREAK
AdState::IN_ADBREAK_AD_NOT_PLAYING
@ IN_ADBREAK_AD_NOT_PLAYING
AampLogManager
AampLogManager Class.
Definition: AampLogManager.h:150
AdState
AdState
Ad playback states.
Definition: AdManagerBase.h:35
CDAIObject::CDAIObject
CDAIObject(AampLogManager *logObj, PrivateInstanceAAMP *aamp)
CDAIObject constructor.
Definition: AdManagerBase.h:68
priv_aamp.h
Private functions and types used internally by AAMP.
PrivateInstanceAAMP
Class representing the AAMP player's private instance, which is not exposed to outside world.
Definition: priv_aamp.h:640
CDAIObject::mAamp
PrivateInstanceAAMP * mAamp
Definition: AdManagerBase.h:60
CDAIObject::SetAlternateContents
virtual void SetAlternateContents(const std::string &adBreakId, const std::string &adId, const std::string &url, uint64_t startMS=0, uint32_t breakdur=0)
Setting the alternate contents' (Ads/blackouts) URL.
Definition: AdManagerBase.h:100
AdState::IN_ADBREAK_AD_READY2PLAY
@ IN_ADBREAK_AD_READY2PLAY
CDAIObject
Base class for the client side DAI object.
Definition: AdManagerBase.h:57
CDAIObject::~CDAIObject
virtual ~CDAIObject()
CDAIObject destructor.
Definition: AdManagerBase.h:86