AVPKit
MediaDataWrapper.h
1 /*******************************************************************************
2  * Copyright (c) 2024, 2026, Olivier Ayache. All rights reserved.
3  *
4  * This file is part of AVPKit.
5  *
6  * AVPKit is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * AVPKit is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with AVPKit. If not, see <http://www.gnu.org/licenses/>.
18  *******************************************************************************/
19 
20 #ifndef MEDIADATAWRAPPER_H_
21 #define MEDIADATAWRAPPER_H_
22 
23 #include <com/avpkit/ferry/RefPointer.h>
24 #include <com/avpkit/core/IMediaDataWrapper.h>
25 
26 namespace com { namespace avpkit { namespace core {
27 
29 {
30  VS_JNIUTILS_REFCOUNTED_OBJECT(MediaDataWrapper);
31 public:
32  virtual int64_t getTimeStamp();
33  virtual void setTimeStamp(int64_t aTimeStamp);
34  virtual IRational* getTimeBase();
35  virtual void setTimeBase(IRational *aBase);
37  virtual int32_t getSize();
38  virtual bool isKey();
39  virtual IMediaData* get();
40  virtual void wrap(IMediaData* aObj);
41  virtual void setKey(bool aIsKey);
42  virtual IMediaData* unwrap();
43  virtual void setData(com::avpkit::ferry::IBuffer*);
44 
50  static MediaDataWrapper* make(IMediaData* obj);
51 
52 protected:
54  virtual ~MediaDataWrapper();
55 
56 private:
57  int64_t mTimeStamp;
60  bool mIsKey;
61 };
62 
63 }}}
64 
65 #endif /* MEDIADATAWRAPPER_H_ */
This class wraps an IMediaData object, but then allows you to set new TimeStamps and TimeBases.
The parent class of all media objects than can be gotten from an IStream.
Definition: IMediaData.h:34
This class wraps represents a Rational number for the AVPKit.
Definition: IRational.h:43
virtual int32_t getSize()
Get the size in bytes of the raw data available for this object.
virtual bool isKey()
Is this object a key object? i.e.
virtual void setTimeStamp(int64_t aTimeStamp)
Set the time stamp for this object in getTimeBase() units.
virtual IMediaData * unwrap()
Gets the non IMediaDataWrapper object ultimately wrapped in this wrapper, or null if there isn't one.
static MediaDataWrapper * make(IMediaData *obj)
Create a new IMediaDataWrapper that wraps a given object.
virtual void wrap(IMediaData *aObj)
Set an object to wrap, or null to release the old object.
virtual void setData(com::avpkit::ferry::IBuffer *)
Sets the underlying buffer used by this object.
virtual IRational * getTimeBase()
Get the time base that time stamps of this object are represented in.
virtual com::avpkit::ferry::IBuffer * getData()
Get any underlying raw data available for this object.
virtual void setKey(bool aIsKey)
Allows you to reset whether the wrapper things this is key or not.
virtual int64_t getTimeStamp()
Get the time stamp of this object in getTimeBase() units.
virtual IMediaData * get()
Return the object being wrapped.
virtual void setTimeBase(IRational *aBase)
Set the time base that time stamps of this object are represented in.
Allows Java code to get data from a native buffers, and optionally modify native memory directly.
Definition: IBuffer.h:54
This class is only useful from C++.
Definition: RefPointer.h:47
WARNING: Do not use logging in this class, and do not set any static file variables to values other t...