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_EMUL_UTIL_H__
32 #define __GST_EMUL_UTIL_H__
34 #include "gstemulcommon.h"
37 #include "audioconvert.h"
39 /* Audio channel masks */
40 #define CH_FRONT_LEFT AV_CH_FRONT_LEFT
41 #define CH_FRONT_RIGHT AV_CH_FRONT_RIGHT
42 #define CH_FRONT_CENTER AV_CH_FRONT_CENTER
43 #define CH_LOW_FREQUENCY AV_CH_LOW_FREQUENCY
44 #define CH_BACK_LEFT AV_CH_BACK_LEFT
45 #define CH_BACK_RIGHT AV_CH_BACK_RIGHT
46 #define CH_FRONT_LEFT_OF_CENTER AV_CH_FRONT_LEFT_OF_CENTER
47 #define CH_FRONT_RIGHT_OF_CENTER AV_CH_FRONT_RIGHT_OF_CENTER
48 #define CH_BACK_CENTER AV_CH_BACK_CENTER
49 #define CH_SIDE_LEFT AV_CH_SIDE_LEFT
50 #define CH_SIDE_RIGHT AV_CH_SIDE_RIGHT
51 #define CH_TOP_CENTER AV_CH_TOP_CENTER
52 #define CH_TOP_FRONT_LEFT AV_CH_TOP_FRONT_LEFT
53 #define CH_TOP_FRONT_CENTER AV_CH_TOP_FRONT_CENTER
54 #define CH_TOP_FRONT_RIGHT AV_CH_TOP_FRONT_RIGHT
55 #define CH_TOP_BACK_LEFT AV_CH_TOP_BACK_LEFT
56 #define CH_TOP_BACK_CENTER AV_CH_TOP_BACK_CENTER
57 #define CH_TOP_BACK_RIGHT AV_CH_TOP_BACK_RIGHT
58 #define CH_STEREO_LEFT AV_CH_STEREO_LEFT
59 #define CH_STEREO_RIGHT AV_CH_STEREO_RIGHT
61 /** Channel mask value used for AVCodecContext.request_channel_layout
62 to indicate that the user requests the channel order of the decoder output
63 to be the native codec channel order. */
64 #define CH_LAYOUT_NATIVE AV_CH_LAYOUT_NATIVE
66 /* Audio channel convenience macros */
67 #define CH_LAYOUT_MONO AV_CH_LAYOUT_MONO
68 #define CH_LAYOUT_STEREO AV_CH_LAYOUT_STEREO
69 #define CH_LAYOUT_2_1 AV_CH_LAYOUT_2_1
70 #define CH_LAYOUT_SURROUND AV_CH_LAYOUT_SURROUND
71 #define CH_LAYOUT_4POINT0 AV_CH_LAYOUT_4POINT0
72 #define CH_LAYOUT_2_2 AV_CH_LAYOUT_2_2
73 #define CH_LAYOUT_QUAD AV_CH_LAYOUT_QUAD
74 #define CH_LAYOUT_5POINT0 AV_CH_LAYOUT_5POINT0
75 #define CH_LAYOUT_5POINT1 AV_CH_LAYOUT_5POINT1
76 #define CH_LAYOUT_5POINT0_BACK AV_CH_LAYOUT_5POINT0_BACK
77 #define CH_LAYOUT_5POINT1_BACK AV_CH_LAYOUT_5POINT1_BACK
78 #define CH_LAYOUT_7POINT0 AV_CH_LAYOUT_7POINT0
79 #define CH_LAYOUT_7POINT1 AV_CH_LAYOUT_7POINT1
80 #define CH_LAYOUT_7POINT1_WIDE AV_CH_LAYOUT_7POINT1_WIDE
81 #define CH_LAYOUT_STEREO_DOWNMIX AV_CH_LAYOUT_STEREO_DOWNMIX
83 GstCaps *gst_emul_codectype_to_video_caps (CodecContext *ctx, const char *name,
84 gboolean encode, CodecElement *codec);
86 GstCaps *gst_emul_codectype_to_audio_caps (CodecContext *ctx, const char *name,
87 gboolean encode, CodecElement *codec);
90 GstCaps *gst_emul_codectype_to_caps (int media_type, CodecContext *ctx,
91 const char *name, gboolean encode);
93 void gst_emul_caps_with_codecname (const char *name, int media_type,
94 const GstCaps *caps, CodecContext *ctx);
96 void gst_emul_caps_with_codectype (int media_type, const GstCaps *caps, CodecContext *ctx);
98 GstCaps *gst_emul_video_caps_new (CodecContext *ctx, const char *name,
99 const char *mimetype, const char *fieldname, ...);
101 GstCaps *gst_emul_audio_caps_new (CodecContext *ctx, const char *name,
102 const char *mimetype, const char *fieldname, ...);
104 GstCaps *gst_emul_pixfmt_to_caps (enum PixelFormat pix_fmt, CodecContext *ctx, const char *name);
106 GstCaps *gst_emul_smpfmt_to_caps (int8_t sample_fmt, CodecContext *ctx, const char *name);
108 GstCaps *gst_emul_codecname_to_caps (const char *name, CodecContext *ctx, gboolean encode);
110 int gst_emul_avpicture_size (int pix_fmt, int width, int height);
112 int gst_emul_align_size (int buf_size);
114 gint gst_emul_smpfmt_depth (int smp_fmt);