blob: fbe9ae40bc9047598d088904228237a5ab25f7bd [file] [log] [blame]
fei.dengf7a0cd32023-08-29 09:36:37 +00001/*
2 * Copyright (C) 2021 Amlogic Corporation.
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#ifndef __RENDER_COMMON_H__
17#define __RENDER_COMMON_H__
18#include <stdint.h>
19#include <stdlib.h>
20#include <stdarg.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#define RENDER_MAX_PLANES 3
27
28/*allocate render buffer flag */
29typedef enum _BufferFlag {
30 BUFFER_FLAG_NONE = 0,
31 BUFFER_FLAG_DMA_BUFFER = 1 << 1,
32 BUFFER_FLAG_RAW_BUFFER = 1 << 2,
33} RenderBufferFlag;
34
35typedef struct _RenderRawBuffer {
36 void *dataPtr; //video render buffer pointer
37 int size; //video render buffer size
38} RenderRawBuffer;
39
40typedef struct _RenderDmaBuffer {
41 int width;
42 int height;
43 int planeCnt;
44 uint32_t handle[RENDER_MAX_PLANES];
45 uint32_t stride[RENDER_MAX_PLANES];
46 uint32_t offset[RENDER_MAX_PLANES];
47 uint32_t size[RENDER_MAX_PLANES];
48 int fd[RENDER_MAX_PLANES];
49} RenderDmaBuffer;
50
51typedef struct _RenderBuffer {
52 int id; //buffer id,set by video render
53 int flag; /*render buffer flag, refer to RenderBufferFlag*/
54 RenderDmaBuffer dma;
55 RenderRawBuffer raw;
56 int64_t pts; //time is nano second
57 int64_t time; //frame display time
58 void *priv; //user data passed to render lib
59 int reserved[4]; //reserved for extend
60} RenderBuffer;
61
62/*video render rectangle*/
fei.deng7ac1aeb2023-12-05 01:38:57 +000063typedef struct _RenderRect{
fei.dengf7a0cd32023-08-29 09:36:37 +000064 int x;
65 int y;
66 int w;
67 int h;
68} RenderRect;
69
70/*video frame size*/
71typedef struct _RenderFrameSize {
72 int width;
73 int height;
74} RenderFrameSize;
75
fei.deng7ac1aeb2023-12-05 01:38:57 +000076typedef struct {
77 int num; //numerator
78 int denom; //denominator
79} RenderFraction;
80
fei.dengf7a0cd32023-08-29 09:36:37 +000081typedef enum _RenderMsgType {
82 //notify a msg
83 MSG_NOTIFY = 0,
84 //frame buffer is released
85 MSG_RELEASE_BUFFER = 100, //the msg value type is RenderBuffer
86 //frame buffer is displayed
87 MSG_DISPLAYED_BUFFER = 101, //the msg value type is RenderBuffer
88 //the frame buffer is droped
89 MSG_DROPED_BUFFER = 102,//the msg value type is RenderBuffer
90 //first frame displayed msg
91 MSG_FIRST_FRAME = 103, //the msg value type is frame pts
92 //under flow msg
93 MSG_UNDER_FLOW = 104, //the msg value type is null
94 //pause with special pts
95 MSG_PAUSED_PTS = 105, //the msg value type is RenderBuffer
96} RenderMsgType;
97
98/**video format*/
99typedef enum {
100 VIDEO_FORMAT_UNKNOWN,
101 VIDEO_FORMAT_ENCODED,
102 VIDEO_FORMAT_I420,
103 VIDEO_FORMAT_YV12,
104 VIDEO_FORMAT_YUY2,
105 VIDEO_FORMAT_UYVY,
106 VIDEO_FORMAT_AYUV,
107 VIDEO_FORMAT_RGBx,
108 VIDEO_FORMAT_BGRx,
109 VIDEO_FORMAT_xRGB,
110 VIDEO_FORMAT_xBGR,
111 VIDEO_FORMAT_RGBA,
112 VIDEO_FORMAT_BGRA,
113 VIDEO_FORMAT_ARGB,
114 VIDEO_FORMAT_ABGR,
115 VIDEO_FORMAT_RGB,
116 VIDEO_FORMAT_BGR,
117 VIDEO_FORMAT_Y41B,
118 VIDEO_FORMAT_Y42B,
119 VIDEO_FORMAT_YVYU,
120 VIDEO_FORMAT_Y444,
121 VIDEO_FORMAT_v210,
122 VIDEO_FORMAT_v216,
123 VIDEO_FORMAT_NV12,
124 VIDEO_FORMAT_NV21,
125 VIDEO_FORMAT_GRAY8,
126 VIDEO_FORMAT_GRAY16_BE,
127 VIDEO_FORMAT_GRAY16_LE,
128 VIDEO_FORMAT_v308,
129 VIDEO_FORMAT_RGB16,
130 VIDEO_FORMAT_BGR16,
131 VIDEO_FORMAT_RGB15,
132 VIDEO_FORMAT_BGR15,
133 VIDEO_FORMAT_UYVP,
134 VIDEO_FORMAT_A420,
135 VIDEO_FORMAT_RGB8P,
136 VIDEO_FORMAT_YUV9,
137 VIDEO_FORMAT_YVU9,
138 VIDEO_FORMAT_IYU1,
139 VIDEO_FORMAT_ARGB64,
140 VIDEO_FORMAT_AYUV64,
141 VIDEO_FORMAT_r210,
142 VIDEO_FORMAT_I420_10BE,
143 VIDEO_FORMAT_I420_10LE,
144 VIDEO_FORMAT_I422_10BE,
145 VIDEO_FORMAT_I422_10LE,
146 VIDEO_FORMAT_Y444_10BE,
147 VIDEO_FORMAT_Y444_10LE,
148 VIDEO_FORMAT_GBR,
149 VIDEO_FORMAT_GBR_10BE,
150 VIDEO_FORMAT_GBR_10LE,
151 VIDEO_FORMAT_NV16,
152 VIDEO_FORMAT_NV24,
153 VIDEO_FORMAT_NV12_64Z32,
154 VIDEO_FORMAT_A420_10BE,
155 VIDEO_FORMAT_A420_10LE,
156 VIDEO_FORMAT_A422_10BE,
157 VIDEO_FORMAT_A422_10LE,
158 VIDEO_FORMAT_A444_10BE,
159 VIDEO_FORMAT_A444_10LE,
160 VIDEO_FORMAT_NV61,
161 VIDEO_FORMAT_P010_10BE,
162 VIDEO_FORMAT_P010_10LE,
163 VIDEO_FORMAT_IYU2,
164 VIDEO_FORMAT_VYUY,
165 VIDEO_FORMAT_GBRA,
166 VIDEO_FORMAT_GBRA_10BE,
167 VIDEO_FORMAT_GBRA_10LE,
168 VIDEO_FORMAT_GBR_12BE,
169 VIDEO_FORMAT_GBR_12LE,
170 VIDEO_FORMAT_GBRA_12BE,
171 VIDEO_FORMAT_GBRA_12LE,
172 VIDEO_FORMAT_I420_12BE,
173 VIDEO_FORMAT_I420_12LE,
174 VIDEO_FORMAT_I422_12BE,
175 VIDEO_FORMAT_I422_12LE,
176 VIDEO_FORMAT_Y444_12BE,
177 VIDEO_FORMAT_Y444_12LE,
178 VIDEO_FORMAT_GRAY10_LE32,
179 VIDEO_FORMAT_NV12_10LE32,
180 VIDEO_FORMAT_NV16_10LE32,
181 VIDEO_FORMAT_NV12_10LE40,
182 VIDEO_FORMAT_Y210,
183 VIDEO_FORMAT_Y410,
184 VIDEO_FORMAT_VUYA,
185 VIDEO_FORMAT_BGR10A2_LE,
186} RenderVideoFormat;
187
188#ifdef __cplusplus
189}
190#endif
191#endif /*__RENDER_COMMON_H__*/