@@ -36,6 +36,24 @@ struct AampPsshData
3636{
3737 std::string systemID; // 16 bytes UUID
3838 std::vector<uint8_t > pssh; // variable length
39+
40+ // Default constructor
41+ AampPsshData (): systemID(), pssh()
42+ {
43+ }
44+
45+ // Constructor with parameters
46+ AampPsshData (std::string id, std::vector<uint8_t > data): systemID(std::move(id)), pssh(std::move(data))
47+ {
48+ }
49+
50+ // Move constructor and move assignment (allow efficient transfers)
51+ AampPsshData (AampPsshData&&) = default ;
52+ AampPsshData& operator =(AampPsshData&&) = default ;
53+
54+ // delete copy constructor and copy assignment to prevent accidental copies
55+ AampPsshData (const AampPsshData&) = delete ;
56+ AampPsshData& operator =(const AampPsshData&) = delete ;
3957};
4058
4159/*
@@ -73,28 +91,64 @@ struct AampCodecInfo
7391 } video;
7492 } mInfo ;
7593
94+ /* *
95+ * @brief Constructor for AampCodecInfo
96+ */
7697 AampCodecInfo () : mCodecFormat (FORMAT_INVALID), mIsEncrypted (false ), mCodecData ()
7798 {
7899 std::memset (&mInfo , 0 , sizeof (mInfo ));
79100 }
80101
102+ /* *
103+ * @brief Constructor for AampCodecInfo with format
104+ * @param format Stream output format
105+ */
81106 AampCodecInfo (StreamOutputFormat format) : mCodecFormat (format), mIsEncrypted (false ), mCodecData ()
82107 {
83108 std::memset (&mInfo , 0 , sizeof (mInfo ));
84109 }
85110
111+ // Delete copy constructor and copy assignment to prevent accidental copies
112+ AampCodecInfo (const AampCodecInfo&) = delete ;
113+ AampCodecInfo& operator =(const AampCodecInfo&) = delete ;
114+
115+ /* *
116+ * @brief Move constructor for AampCodecInfo
117+ * @param other Source AampCodecInfo to move from
118+ */
86119 AampCodecInfo (AampCodecInfo&& other) noexcept
87- : mCodecFormat (other.mCodecFormat )
120+ : mCodecFormat (std::move( other.mCodecFormat ) )
88121 , mCodecData (std::move(other.mCodecData ))
89- , mIsEncrypted (other.mIsEncrypted )
90- , mInfo (other.mInfo )
122+ , mIsEncrypted (std::move( other.mIsEncrypted ) )
123+ , mInfo (std::move( other.mInfo ) )
91124 {
92- // Reset the source object to default state
125+ // Explicitly reset the source object to default state after move
93126 other.mCodecFormat = FORMAT_INVALID;
94127 other.mIsEncrypted = false ;
95128 std::memset (&other.mInfo , 0 , sizeof (other.mInfo ));
96129 // mCodecData is already empty after std::move
97130 }
131+
132+ /* * Move assignment operator for AampCodecInfo
133+ * @param other Source AampCodecInfo to move from
134+ */
135+ AampCodecInfo& operator =(AampCodecInfo&& other) noexcept
136+ {
137+ if (this != &other)
138+ {
139+ mCodecFormat = std::move (other.mCodecFormat );
140+ mCodecData = std::move (other.mCodecData );
141+ mIsEncrypted = std::move (other.mIsEncrypted );
142+ mInfo = std::move (other.mInfo );
143+
144+ // Explicitly reset the source object to default state after move
145+ other.mCodecFormat = FORMAT_INVALID;
146+ other.mIsEncrypted = false ;
147+ std::memset (&other.mInfo , 0 , sizeof (other.mInfo ));
148+ // mCodecData is already empty after std::move
149+ }
150+ return *this ;
151+ }
98152};
99153
100154/*
@@ -111,10 +165,61 @@ struct AampDrmMetadata
111165 uint8_t mCryptByteBlock ;
112166 uint8_t mSkipByteBlock ;
113167
168+ /* *
169+ * @brief Constructor for AampDrmMetadata
170+ */
114171 AampDrmMetadata () : mIsEncrypted (false ), mKeyId (), mIV (), mCipher (),
115172 mSubSamples (), mCryptByteBlock(0 ), mSkipByteBlock(0 )
116173 {
117174 }
175+
176+ /* *
177+ * @brief Move constructor for AampDrmMetadata
178+ * @param other Source AampDrmMetadata to move from
179+ */
180+ AampDrmMetadata (AampDrmMetadata&& other) noexcept
181+ : mIsEncrypted(other.mIsEncrypted ),
182+ mKeyId(std::move(other.mKeyId )),
183+ mIV(std::move(other.mIV )),
184+ mCipher(std::move(other.mCipher )),
185+ mSubSamples(std::move(other.mSubSamples )),
186+ mCryptByteBlock(other.mCryptByteBlock ),
187+ mSkipByteBlock(other.mSkipByteBlock )
188+ {
189+ // Reset source object to default state after move
190+ other.mIsEncrypted = false ;
191+ other.mCryptByteBlock = 0 ;
192+ other.mSkipByteBlock = 0 ;
193+ }
194+
195+ /* *
196+ * @brief Move assignment operator for AampDrmMetadata
197+ * @param other Source AampDrmMetadata to move from
198+ * @return Reference to this object
199+ */
200+ AampDrmMetadata& operator =(AampDrmMetadata&& other) noexcept
201+ {
202+ if (this != &other)
203+ {
204+ mIsEncrypted = other.mIsEncrypted ;
205+ mKeyId = std::move (other.mKeyId );
206+ mIV = std::move (other.mIV );
207+ mCipher = std::move (other.mCipher );
208+ mSubSamples = std::move (other.mSubSamples );
209+ mCryptByteBlock = other.mCryptByteBlock ;
210+ mSkipByteBlock = other.mSkipByteBlock ;
211+
212+ // Reset source object to default state after move
213+ other.mIsEncrypted = false ;
214+ other.mCryptByteBlock = 0 ;
215+ other.mSkipByteBlock = 0 ;
216+ }
217+ return *this ;
218+ }
219+
220+ // Delete copy constructor and copy assignment to prevent accidental copies
221+ AampDrmMetadata (const AampDrmMetadata&) = delete ;
222+ AampDrmMetadata& operator =(const AampDrmMetadata&) = delete ;
118223};
119224
120225/*
@@ -130,9 +235,20 @@ struct AampMediaSample
130235
131236 AampDrmMetadata mDrmMetadata ; // empty if not encrypted
132237
238+ /* *
239+ * @brief Constructor for AampMediaSample
240+ */
133241 AampMediaSample () : mData (" AampMediaSample" ), mPts (0 ), mDts (0 ), mDuration (0 ), mDrmMetadata ()
134242 {
135243 }
244+
245+ // Move constructor and move assignment (allow efficient transfers)
246+ AampMediaSample (AampMediaSample&&) = default ;
247+ AampMediaSample& operator =(AampMediaSample&&) = default ;
248+
249+ // Delete copy constructor and copy assignment to prevent accidental copies
250+ AampMediaSample (const AampMediaSample&) = delete ;
251+ AampMediaSample& operator =(const AampMediaSample&) = delete ;
136252};
137253
138254#endif /* __AAMP_DEMUX_DATA_TYPES_H__ */
0 commit comments