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__
41 #include <sys/ioctl.h>
47 GST_DEBUG_CATEGORY_EXTERN (maru_debug);
48 #define GST_CAT_DEFAULT maru_debug
52 extern int device_version;
54 enum codec_log_level {
61 #define CODEC_DEV "/dev/brillcodec"
64 #define CHECK_VERSION(version) (device_version >= version)
66 #define CODEC_LOG(level, fmt, ...) \
69 printf("[gst-maru][%s:%d] " fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
72 #define FF_INPUT_BUFFER_PADDING_SIZE 8
73 #define FF_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
74 #define FF_MIN_BUFFER_SIZE 16384
76 #define GEN_MASK(x) ((1<<(x))-1)
77 #define ROUND_UP_X(v, x) (((v) + GEN_MASK(x)) & ~GEN_MASK(x))
78 #define ROUND_UP_2(x) ROUND_UP_X(x, 1)
79 #define ROUND_UP_4(x) ROUND_UP_X(x, 2)
80 #define ROUND_UP_8(x) ROUND_UP_X(x, 3)
81 #define DIV_ROUND_UP_X(v, x) (((v) + GEN_MASK(x)) >> (x))
83 static inline bool can_use_new_decode_api(void) {
84 if (CHECK_VERSION(3)) {
90 typedef struct _CodecDevice {
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, reserved;
120 int64_t channel_layout;
123 typedef struct _CodecContext {
130 int32_t codecdata_size;
137 enum CODEC_FUNC_TYPE {
150 CODEC_CMD_GET_VERSION = 20,
151 CODEC_CMD_GET_ELEMENT,
152 CODEC_CMD_GET_CONTEXT_INDEX,
153 CODEC_CMD_GET_ELEMENT_DATA,
154 CODEC_CMD_PUT_DATA_INTO_BUFFER = 40,
155 CODEC_CMD_SECURE_BUFFER,
156 CODEC_CMD_TRY_SECURE_BUFFER,
157 CODEC_CMD_RELEASE_BUFFER,
158 CODEC_CMD_INVOKE_API_AND_RELEASE_BUFFER,
161 enum CODEC_MEDIA_TYPE {
162 AVMEDIA_TYPE_UNKNOWN = -1,
168 CODEC_TYPE_UNKNOWN = -1,
173 enum AUDIO_SAMPLE_FORMAT {
174 SAMPLE_FMT_NONE = -1,