2 * GStreamer codec plugin for Tizen Emulator.
4 * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved.
7 * KiTae Kim <kt920.kim@samsung.com>
8 * SeokYeon Hwang <syeon.hwang@samsung.com>
9 * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the
23 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 * Boston, MA 02111-1307, USA.
31 #ifndef __GST_MARU_H__
32 #define __GST_MARU_H__
40 #include <sys/ioctl.h>
46 GST_DEBUG_CATEGORY_EXTERN (maru_debug);
47 #define GST_CAT_DEFAULT maru_debug
51 enum codec_log_level {
58 #define CODEC_DEV "/dev/brillcodec"
61 #define CODEC_LOG(level, fmt, ...) \
64 printf("[gst-maru][%d] " fmt, __LINE__, ##__VA_ARGS__); \
67 #define FF_INPUT_BUFFER_PADDING_SIZE 8
68 #define FF_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
69 #define FF_MIN_BUFFER_SIZE 16384
71 #define GEN_MASK(x) ((1<<(x))-1)
72 #define ROUND_UP_X(v, x) (((v) + GEN_MASK(x)) & ~GEN_MASK(x))
73 #define ROUND_UP_2(x) ROUND_UP_X(x, 1)
74 #define ROUND_UP_4(x) ROUND_UP_X(x, 2)
75 #define ROUND_UP_8(x) ROUND_UP_X(x, 3)
76 #define DIV_ROUND_UP_X(v, x) (((v) + GEN_MASK(x)) >> (x))
78 typedef struct _CodecIOParams {
84 typedef struct _CodecDeviceMem {
89 typedef struct _CodecDevice {
93 CodecDeviceMem mem_info;
96 typedef struct _CodecElement {
103 int32_t sample_fmts[4];
107 typedef struct _VideoData {
108 int32_t width, height;
109 int32_t fps_n, fps_d;
110 int32_t par_n, par_d;
111 int32_t pix_fmt, bpp;
112 int32_t ticks_per_frame;
115 typedef struct _AudioData {
116 int32_t channels, sample_rate;
117 int32_t block_align, depth;
118 int32_t sample_fmt, frame_size;
119 int32_t bits_per_sample_fmt;
120 int64_t channel_layout;
123 typedef struct _CodecContext {
132 int32_t codecdata_size;
139 enum CODEC_FUNC_TYPE {
151 CODEC_CMD_COPY_TO_DEVICE_MEM = 5,
152 CODEC_CMD_COPY_FROM_DEVICE_MEM,
153 CODEC_CMD_GET_VERSION = 20,
154 CODEC_CMD_GET_ELEMENT,
155 CODEC_CMD_GET_CONTEXT_INDEX,
156 CODEC_CMD_SECURE_MEMORY = 30,
157 CODEC_CMD_RELEASE_MEMORY,
158 CODEC_CMD_USE_DEVICE_MEM,
159 CODEC_CMD_REQ_FROM_SMALL_MEMORY,
160 CODEC_CMD_REQ_FROM_MEDIUM_MEMORY,
161 CODEC_CMD_REQ_FROM_LARGE_MEMORY,
162 CODEC_CMD_S_SECURE_BUFFER,
163 CODEC_CMD_M_SECURE_BUFFER,
164 CODEC_CMD_L_SECURE_BUFFER,
169 CODEC_CMD_GET_VERSION = 20,
170 CODEC_CMD_GET_ELEMENT,
171 CODEC_CMD_GET_CONTEXT_INDEX,
172 CODEC_CMD_USE_DEVICE_MEM = 40,
173 CODEC_CMD_GET_DATA_FROM_SMALL_BUFFER,
174 CODEC_CMD_GET_DATA_FROM_MEDIUM_BUFFER,
175 CODEC_CMD_GET_DATA_FROM_LARGE_BUFFER,
176 CODEC_CMD_SECURE_SMALL_BUFFER,
177 CODEC_CMD_SECURE_MEDIUM_BUFFER,
178 CODEC_CMD_SECURE_LARGE_BUFFER,
179 CODEC_CMD_RELEASE_BUFFER,
183 enum CODEC_MEDIA_TYPE {
184 AVMEDIA_TYPE_UNKNOWN = -1,
190 CODEC_TYPE_UNKNOWN = -1,
196 SAMPLE_FMT_NONE = -1,