blob: 07cffc159171e086cfc13b77a7f91fdfb3d4ebb8 [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*/
63typedef struct {
64 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
76typedef enum _RenderMsgType {
77 //notify a msg
78 MSG_NOTIFY = 0,
79 //frame buffer is released
80 MSG_RELEASE_BUFFER = 100, //the msg value type is RenderBuffer
81 //frame buffer is displayed
82 MSG_DISPLAYED_BUFFER = 101, //the msg value type is RenderBuffer
83 //the frame buffer is droped
84 MSG_DROPED_BUFFER = 102,//the msg value type is RenderBuffer
85 //first frame displayed msg
86 MSG_FIRST_FRAME = 103, //the msg value type is frame pts
87 //under flow msg
88 MSG_UNDER_FLOW = 104, //the msg value type is null
89 //pause with special pts
90 MSG_PAUSED_PTS = 105, //the msg value type is RenderBuffer
91} RenderMsgType;
92
93/**video format*/
94typedef enum {
95 VIDEO_FORMAT_UNKNOWN,
96 VIDEO_FORMAT_ENCODED,
97 VIDEO_FORMAT_I420,
98 VIDEO_FORMAT_YV12,
99 VIDEO_FORMAT_YUY2,
100 VIDEO_FORMAT_UYVY,
101 VIDEO_FORMAT_AYUV,
102 VIDEO_FORMAT_RGBx,
103 VIDEO_FORMAT_BGRx,
104 VIDEO_FORMAT_xRGB,
105 VIDEO_FORMAT_xBGR,
106 VIDEO_FORMAT_RGBA,
107 VIDEO_FORMAT_BGRA,
108 VIDEO_FORMAT_ARGB,
109 VIDEO_FORMAT_ABGR,
110 VIDEO_FORMAT_RGB,
111 VIDEO_FORMAT_BGR,
112 VIDEO_FORMAT_Y41B,
113 VIDEO_FORMAT_Y42B,
114 VIDEO_FORMAT_YVYU,
115 VIDEO_FORMAT_Y444,
116 VIDEO_FORMAT_v210,
117 VIDEO_FORMAT_v216,
118 VIDEO_FORMAT_NV12,
119 VIDEO_FORMAT_NV21,
120 VIDEO_FORMAT_GRAY8,
121 VIDEO_FORMAT_GRAY16_BE,
122 VIDEO_FORMAT_GRAY16_LE,
123 VIDEO_FORMAT_v308,
124 VIDEO_FORMAT_RGB16,
125 VIDEO_FORMAT_BGR16,
126 VIDEO_FORMAT_RGB15,
127 VIDEO_FORMAT_BGR15,
128 VIDEO_FORMAT_UYVP,
129 VIDEO_FORMAT_A420,
130 VIDEO_FORMAT_RGB8P,
131 VIDEO_FORMAT_YUV9,
132 VIDEO_FORMAT_YVU9,
133 VIDEO_FORMAT_IYU1,
134 VIDEO_FORMAT_ARGB64,
135 VIDEO_FORMAT_AYUV64,
136 VIDEO_FORMAT_r210,
137 VIDEO_FORMAT_I420_10BE,
138 VIDEO_FORMAT_I420_10LE,
139 VIDEO_FORMAT_I422_10BE,
140 VIDEO_FORMAT_I422_10LE,
141 VIDEO_FORMAT_Y444_10BE,
142 VIDEO_FORMAT_Y444_10LE,
143 VIDEO_FORMAT_GBR,
144 VIDEO_FORMAT_GBR_10BE,
145 VIDEO_FORMAT_GBR_10LE,
146 VIDEO_FORMAT_NV16,
147 VIDEO_FORMAT_NV24,
148 VIDEO_FORMAT_NV12_64Z32,
149 VIDEO_FORMAT_A420_10BE,
150 VIDEO_FORMAT_A420_10LE,
151 VIDEO_FORMAT_A422_10BE,
152 VIDEO_FORMAT_A422_10LE,
153 VIDEO_FORMAT_A444_10BE,
154 VIDEO_FORMAT_A444_10LE,
155 VIDEO_FORMAT_NV61,
156 VIDEO_FORMAT_P010_10BE,
157 VIDEO_FORMAT_P010_10LE,
158 VIDEO_FORMAT_IYU2,
159 VIDEO_FORMAT_VYUY,
160 VIDEO_FORMAT_GBRA,
161 VIDEO_FORMAT_GBRA_10BE,
162 VIDEO_FORMAT_GBRA_10LE,
163 VIDEO_FORMAT_GBR_12BE,
164 VIDEO_FORMAT_GBR_12LE,
165 VIDEO_FORMAT_GBRA_12BE,
166 VIDEO_FORMAT_GBRA_12LE,
167 VIDEO_FORMAT_I420_12BE,
168 VIDEO_FORMAT_I420_12LE,
169 VIDEO_FORMAT_I422_12BE,
170 VIDEO_FORMAT_I422_12LE,
171 VIDEO_FORMAT_Y444_12BE,
172 VIDEO_FORMAT_Y444_12LE,
173 VIDEO_FORMAT_GRAY10_LE32,
174 VIDEO_FORMAT_NV12_10LE32,
175 VIDEO_FORMAT_NV16_10LE32,
176 VIDEO_FORMAT_NV12_10LE40,
177 VIDEO_FORMAT_Y210,
178 VIDEO_FORMAT_Y410,
179 VIDEO_FORMAT_VUYA,
180 VIDEO_FORMAT_BGR10A2_LE,
181} RenderVideoFormat;
182
183#ifdef __cplusplus
184}
185#endif
186#endif /*__RENDER_COMMON_H__*/