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 extern int device_version;
53 enum codec_log_level {
60 #define CODEC_DEV "/dev/brillcodec"
63 #define CHECK_VERSION(version) (device_version > version)
65 #define CODEC_LOG(level, fmt, ...) \
68 printf("[gst-maru][%s:%d] " fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
71 #define FF_INPUT_BUFFER_PADDING_SIZE 8
72 #define FF_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
73 #define FF_MIN_BUFFER_SIZE 16384
75 #define GEN_MASK(x) ((1<<(x))-1)
76 #define ROUND_UP_X(v, x) (((v) + GEN_MASK(x)) & ~GEN_MASK(x))
77 #define ROUND_UP_2(x) ROUND_UP_X(x, 1)
78 #define ROUND_UP_4(x) ROUND_UP_X(x, 2)
79 #define ROUND_UP_8(x) ROUND_UP_X(x, 3)
80 #define DIV_ROUND_UP_X(v, x) (((v) + GEN_MASK(x)) >> (x))
82 typedef struct _CodecDevice {
88 typedef struct _CodecElement {
95 int32_t sample_fmts[4];
99 typedef struct _VideoData {
100 int32_t width, height;
101 int32_t fps_n, fps_d;
102 int32_t par_n, par_d;
103 int32_t pix_fmt, bpp;
104 int32_t ticks_per_frame;
107 typedef struct _AudioData {
108 int32_t channels, sample_rate;
109 int32_t block_align, depth;
110 int32_t sample_fmt, frame_size;
111 int32_t bits_per_sample_fmt, reserved;
112 int64_t channel_layout;
115 typedef struct _CodecContext {
122 int32_t codecdata_size;
129 enum CODEC_FUNC_TYPE {
141 CODEC_CMD_GET_VERSION = 20,
142 CODEC_CMD_GET_ELEMENT,
143 CODEC_CMD_GET_CONTEXT_INDEX,
144 CODEC_CMD_GET_ELEMENT_DATA,
145 CODEC_CMD_PUT_DATA_INTO_BUFFER = 40,
146 CODEC_CMD_SECURE_BUFFER,
147 CODEC_CMD_TRY_SECURE_BUFFER,
148 CODEC_CMD_RELEASE_BUFFER,
149 CODEC_CMD_INVOKE_API_AND_RELEASE_BUFFER,
152 enum CODEC_MEDIA_TYPE {
153 AVMEDIA_TYPE_UNKNOWN = -1,
159 CODEC_TYPE_UNKNOWN = -1,
164 enum AUDIO_SAMPLE_FORMAT {
165 SAMPLE_FMT_NONE = -1,