Removed compile warnings.
[platform/adaptation/emulator/gst-plugins-emulator.git] / src / gstmaruutils.h
1 /*
2  * GStreamer codec plugin for Tizen Emulator.
3  *
4  * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact:
7  * KiTae Kim <kt920.kim@samsung.com>
8  * SeokYeon Hwang <syeon.hwang@samsung.com>
9  * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
10  *
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.
15  *
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.
20  *
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.
25  *
26  * Contributors:
27  * - S-Core Co., Ltd
28  *
29  */
30
31 #ifndef __GST_MARU_UTIL_H__
32 #define __GST_MARU_UTIL_H__
33
34 #include "gstmaru.h"
35
36 // libav
37 #include "audioconvert.h"
38
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
60
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
65
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
82
83 GstCaps *gst_maru_codectype_to_video_caps (CodecContext *ctx, const char *name,
84     gboolean encode, CodecElement *codec);
85
86 GstCaps *gst_maru_codectype_to_audio_caps (CodecContext *ctx, const char *name,
87     gboolean encode, CodecElement *codec);
88
89
90 GstCaps *gst_maru_codectype_to_caps (int media_type, CodecContext *ctx,
91     const char *name, gboolean encode);
92
93 void gst_maru_caps_with_codecname (const char *name, int media_type,
94     const GstCaps *caps, CodecContext *ctx);
95
96 void gst_maru_caps_with_codectype (int media_type, const GstCaps *caps, CodecContext *ctx);
97
98 GstCaps *gst_maru_video_caps_new (CodecContext *ctx, const char *name,
99         const char *mimetype, const char *fieldname, ...);
100
101 GstCaps *gst_maru_audio_caps_new (CodecContext *ctx, const char *name,
102         const char *mimetype, const char *fieldname, ...);
103
104 GstCaps *gst_maru_pixfmt_to_caps (enum PixelFormat pix_fmt, CodecContext *ctx, const char *name);
105
106 GstCaps *gst_maru_smpfmt_to_caps (int8_t sample_fmt, CodecContext *ctx, const char *name);
107
108 GstCaps *gst_maru_codecname_to_caps (const char *name, CodecContext *ctx, gboolean encode);
109
110 void gst_maru_caps_to_codecname (const GstCaps *caps, gchar *codec_name, CodecContext *context);
111
112 void gst_maru_init_pix_fmt_info (void);
113
114 int gst_maru_avpicture_size (int pix_fmt, int width, int height);
115
116 int gst_maru_align_size (int buf_size);
117
118 gint gst_maru_smpfmt_depth (int smp_fmt);
119
120 #endif