forked from rellla/libcedarx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibcedarx.h
More file actions
executable file
·209 lines (195 loc) · 6.07 KB
/
libcedarx.h
File metadata and controls
executable file
·209 lines (195 loc) · 6.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/*
* Copyright (c) 2012-2013
*
* Authors: Wills Wang <wills.wang@hotmail.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef LIBCEDARX_H
#define LIBCEDARX_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef u8
typedef unsigned char u8;
#endif
#ifndef u16
typedef unsigned short u16;
#endif
#ifndef u32
typedef unsigned int u32;
#endif
#ifndef u64
#ifdef COMPILER_ARMCC
typedef unsigned __int64 u64;
#else
typedef unsigned long long u64;
#endif
#endif
#ifndef s8
typedef signed char s8;
#endif
#ifndef s16
typedef signed short s16;
#endif
#ifndef s32
typedef signed int s32;
#endif
#ifndef s64
#ifdef COMPILER_ARMCC
typedef signed __int64 s64;
#else
typedef signed long long s64;
#endif
#endif
#ifndef Handle
typedef void* Handle;
#endif
#ifndef NULL
#define NULL ((void*)0)
#endif
typedef enum CEDARX_RESULT
{
CEDARX_RESULT_OK = 0,
CEDARX_RESULT_NO_INIT = -1,
CEDARX_RESULT_NO_ENOUGH_MEMORY = -2,
CEDARX_RESULT_INVALID_ARGS = -3,
CEDARX_RESULT_VBV_BUFFER_FULL = -4,
CEDARX_RESULT_VBV_BUFFER_NO_ENOUGH = -5,
CEDARX_RESULT_VBV_BUFFER_EMPTY = -6,
CEDARX_RESULT_NO_FRAME_BUFFER = -7,
CEDARX_RESULT_NO_DISPLAY_BUFFER = -8,
CEDARX_RESULT_VE_FAILED = -9,
CEDARX_RESULT_DE_FAILED = -10,
CEDARX_RESULT_NO_RESOURCE = -11,
}cedarx_result_e;
typedef enum CEDARV_STREAM_FORMAT
{
CEDARX_STREAM_FORMAT_UNKNOWN,
CEDARX_STREAM_FORMAT_MPEG1,
CEDARX_STREAM_FORMAT_MPEG2,
CEDARX_STREAM_FORMAT_XVID,
CEDARX_STREAM_FORMAT_REALVIDEO,
CEDARX_STREAM_FORMAT_H263,
CEDARX_STREAM_FORMAT_SORENSSON_H263,
CEDARX_STREAM_FORMAT_H264,
CEDARX_STREAM_FORMAT_DIVX3,
CEDARX_STREAM_FORMAT_DIVX4,
CEDARX_STREAM_FORMAT_DIVX5,
CEDARX_STREAM_FORMAT_VC1,
CEDARX_STREAM_FORMAT_AVS,
CEDARX_STREAM_FORMAT_MJPEG,
CEDARX_STREAM_FORMAT_WMV1,
CEDARX_STREAM_FORMAT_WMV2,
CEDARX_STREAM_FORMAT_VP6,
CEDARX_STREAM_FORMAT_VP8,
CEDARX_STREAM_FORMAT_DIVX2, //MSMPEGV2
CEDARX_STREAM_FORMAT_DIVX1 //MSMPEGV1
}cedarx_stream_format_e;
typedef enum CEDARV_CONTAINER_FORMAT
{
CEDARX_CONTAINER_FORMAT_UNKNOW,
CEDARX_CONTAINER_FORMAT_AVI,
CEDARX_CONTAINER_FORMAT_ASF,
CEDARX_CONTAINER_FORMAT_DAT,
CEDARX_CONTAINER_FORMAT_FLV,
CEDARX_CONTAINER_FORMAT_MKV,
CEDARX_CONTAINER_FORMAT_MOV,
CEDARX_CONTAINER_FORMAT_MPG,
CEDARX_CONTAINER_FORMAT_PMP,
CEDARX_CONTAINER_FORMAT_RM,
CEDARX_CONTAINER_FORMAT_TS,
CEDARX_CONTAINER_FORMAT_VOB,
CEDARX_CONTAINER_FORMAT_WEBM,
CEDARX_CONTAINER_FORMAT_OGM
}cedarx_container_format_e;
typedef enum CEDARV_PIXEL_FORMAT
{
CEDARX_PIXEL_FORMAT_1BPP = 0x0,
CEDARX_PIXEL_FORMAT_2BPP = 0x1,
CEDARX_PIXEL_FORMAT_4BPP = 0x2,
CEDARX_PIXEL_FORMAT_8BPP = 0x3,
CEDARX_PIXEL_FORMAT_RGB655 = 0x4,
CEDARX_PIXEL_FORMAT_RGB565 = 0x5,
CEDARX_PIXEL_FORMAT_RGB556 = 0x6,
CEDARX_PIXEL_FORMAT_ARGB1555 = 0x7,
CEDARX_PIXEL_FORMAT_RGBA5551 = 0x8,
CEDARX_PIXEL_FORMAT_RGB888 = 0x9,
CEDARX_PIXEL_FORMAT_ARGB8888 = 0xa,
CEDARX_PIXEL_FORMAT_YUV444 = 0xb,
CEDARX_PIXEL_FORMAT_YUV422 = 0xc,
CEDARX_PIXEL_FORMAT_YUV420 = 0xd,
CEDARX_PIXEL_FORMAT_YUV411 = 0xe,
CEDARX_PIXEL_FORMAT_CSIRGB = 0xf,
CEDARX_PIXEL_FORMAT_AW_YUV420 = 0x10,
CEDARX_PIXEL_FORMAT_AW_YUV422 = 0x11,
CEDARX_PIXEL_FORMAT_AW_YUV411 = 0x12
}cedarx_pixel_format_e;
typedef struct {
u32 width;
u32 height;
u32 top_offset;
u32 left_offset;
u32 display_width;
u32 display_height;
u32 size_y[2];
u32 size_u[2];
u32 size_v[2];
u32 size_alpha[2];
u8* y[2];
u8* u[2];
u8* v[2];
u8* alpha[2];
u64 pts;
u32 frame_rate;
u8 is_progressive;
u8 top_field_first;
u8 repeat_top_field;
u8 repeat_bottom_field;
Handle sys;
}cedarx_picture_t;
typedef struct {
cedarx_stream_format_e stream;
cedarx_container_format_e container;
u32 frame_rate;
u32 frame_duration;
u32 width;
u32 height;
u8* data;
u32 data_size;
Handle sys;
void (*request_buffer)(cedarx_picture_t * pic, void *sys);
void (*update_buffer)(cedarx_picture_t * pic, void *sys);
void (*release_buffer)(cedarx_picture_t * pic, void *sys);
void (*lock_buffer)(cedarx_picture_t * pic, void *sys);
void (*unlock_buffer)(cedarx_picture_t * pic, void *sys);
}cedarx_info_t;
cedarx_result_e libcedarx_decoder_open(cedarx_info_t* info);
void libcedarx_decoder_close(void);
cedarx_result_e libcedarx_decoder_add_stream(u8* buf, u32 size, u64 pts, u64 pcr);
cedarx_result_e libcedarx_decoder_decode_stream(int force);
Handle libcedarx_decoder_request_frame(void);
cedarx_result_e libcedarx_display_open(void);
void libcedarx_display_close(void);
cedarx_result_e libcedarx_display_alloc_frame(cedarx_picture_t *picture);
void libcedarx_display_free_frame(cedarx_picture_t *picture);
cedarx_result_e libcedarx_display_request_layer(int top);
void libcedarx_display_release_layer(void);
cedarx_result_e libcedarx_display_video_frame(cedarx_picture_t *picture);
char* libcedarx_version(void);
#ifdef __cplusplus
}
#endif
#endif