xref: /OK3568_Linux_fs/external/rockit/tgi/sdk/include/RTVideoFrame.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright 2021 Rockchip Electronics Co. LTD
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef SRC_RT_MEDIA_INCLUDE_RTVFRAMEBUFFER_H_
18 #define SRC_RT_MEDIA_INCLUDE_RTVFRAMEBUFFER_H_
19 
20 #include <map>
21 
22 #include "RTAVShellBuffer.h"
23 
24 class RTVideoFrame : public RTAVShellBuffer {
25  public:
26     RTVideoFrame();
27     explicit RTVideoFrame(UINT32 size);
28     virtual ~RTVideoFrame() = default;
29     RTVideoFrame& operator=(const RTVideoFrame& in);
30 
31     virtual RTMediaBufferType getType();
32     virtual void reset();
33 
34     UINT32 getWidth() const;
35     UINT32 getHeight() const;
36     UINT32 getVirWidth() const;
37     UINT32 getVirHeight() const;
38     RTPixelFormat getPixelFormat() const;
39     RTCompressMode getCompressMode() const;
40     RTRect getOpRect() const;
41     RTRect getBaseRect() const;
42     RTRect getRect() const;
43     INT64 getPts() const;
44     INT64 getDts() const;
45     INT32 getSeq() const;
46     INT32 getDuration() const;
47     INT32 getRotation() const;
48 
49     void  setWidth(const UINT32 width);
50     void  setHeight(const UINT32 height);
51     void  setVirWidth(const UINT32 virWidth);
52     void  setVirHeight(const UINT32 virHeight);
53     void  setPixelFormat(const RTPixelFormat pixelFormat);
54     void  setCompressMode(const RTCompressMode mode);
55     void  setOpRect(const RTRect rect);
56     void  setBaseRect(const RTRect rect);
57     void  setPts(const INT64 pts);
58     void  setDts(const INT64 dts);
59     void  setSeq(const INT32 seq);
60     void  setDuration(const INT32 duration);
61     void  setRotation(const INT32 rotation);
62     void  clone(const RTVideoFrame& in);
63 
64  private:
65     void baseInit();
66 
67  private:
68      UINT32 mWidth;
69      UINT32 mHeight;
70      UINT32 mVirWidth;
71      UINT32 mVirHeight;
72      RTRect mOpRect;
73      RTRect mBaseRect;
74      INT64  mPts;
75      INT64  mDts;
76      INT32  mSeq;
77      INT32  mDuration;
78      INT32  mRotation;
79      RTPixelFormat mPixelFormat;
80      RTCompressMode mCompressMode;
81 };
82 
83 RTVideoFrame* clone_vframe(RTVideoFrame *buffer);
84 RTVideoFrame* reinterpret_vframe(RTMediaBuffer *buffer);
85 RTVideoFrame* construct_vframe(RTMediaBuffer *buffer);
86 
87 #endif  // SRC_RT_MEDIA_INCLUDE_RTVFRAMEBUFFER_H_
88