1/* GStreamer base utils library codec-specific utility functions
2 * Copyright (C) 2010 Arun Raghavan <arun.raghavan@collabora.co.uk>
3 * 2010 Collabora Multimedia
4 * 2010 Nokia Corporation
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 */
21
22#ifndef __GST_PB_UTILS_CODEC_UTILS_H__
23#define __GST_PB_UTILS_CODEC_UTILS_H__
24
25#include <gst/gst.h>
26#include <gst/pbutils/pbutils-prelude.h>
27
28G_BEGIN_DECLS
29
30/* AAC */
31
32GST_PBUTILS_API
33guint gst_codec_utils_aac_get_sample_rate_from_index (guint sr_idx);
34
35GST_PBUTILS_API
36gint gst_codec_utils_aac_get_index_from_sample_rate (guint rate);
37
38GST_PBUTILS_API
39const gchar * gst_codec_utils_aac_get_profile (const guint8 * audio_config, guint len);
40
41GST_PBUTILS_API
42const gchar * gst_codec_utils_aac_get_level (const guint8 * audio_config, guint len);
43
44GST_PBUTILS_API
45guint gst_codec_utils_aac_get_sample_rate (const guint8 * audio_config, guint len);
46
47GST_PBUTILS_API
48guint gst_codec_utils_aac_get_channels (const guint8 * audio_config, guint len);
49
50GST_PBUTILS_API
51gboolean gst_codec_utils_aac_caps_set_level_and_profile (GstCaps * caps,
52 const guint8 * audio_config,
53 guint len);
54
55/* H.264 */
56
57GST_PBUTILS_API
58const gchar * gst_codec_utils_h264_get_profile (const guint8 * sps, guint len);
59
60GST_PBUTILS_API
61const gchar * gst_codec_utils_h264_get_level (const guint8 * sps, guint len);
62
63GST_PBUTILS_API
64guint8 gst_codec_utils_h264_get_level_idc (const gchar * level);
65
66GST_PBUTILS_API
67gboolean gst_codec_utils_h264_caps_set_level_and_profile (GstCaps * caps,
68 const guint8 * sps,
69 guint len);
70
71GST_PBUTILS_API
72gboolean gst_codec_utils_h264_get_profile_flags_level (const guint8 * codec_data,
73 guint len,
74 guint8 * profile,
75 guint8 * flags,
76 guint8 * level);
77
78/* H.265 */
79
80GST_PBUTILS_API
81const gchar * gst_codec_utils_h265_get_profile (const guint8 * profile_tier_level,
82 guint len);
83
84GST_PBUTILS_API
85const gchar * gst_codec_utils_h265_get_tier (const guint8 * profile_tier_level,
86 guint len);
87
88GST_PBUTILS_API
89const gchar * gst_codec_utils_h265_get_level (const guint8 * profile_tier_level,
90 guint len);
91
92GST_PBUTILS_API
93guint8 gst_codec_utils_h265_get_level_idc (const gchar * level);
94
95GST_PBUTILS_API
96gboolean gst_codec_utils_h265_caps_set_level_tier_and_profile (GstCaps * caps,
97 const guint8 * profile_tier_level,
98 guint len);
99/* MPEG-4 part 2 */
100
101GST_PBUTILS_API
102const gchar * gst_codec_utils_mpeg4video_get_profile (const guint8 * vis_obj_seq, guint len);
103
104GST_PBUTILS_API
105const gchar * gst_codec_utils_mpeg4video_get_level (const guint8 * vis_obj_seq, guint len);
106
107GST_PBUTILS_API
108gboolean gst_codec_utils_mpeg4video_caps_set_level_and_profile (GstCaps * caps,
109 const guint8 * vis_obj_seq,
110 guint len);
111
112/* Opus */
113
114GST_PBUTILS_API
115gboolean gst_codec_utils_opus_parse_caps (GstCaps * caps,
116 guint32 * rate,
117 guint8 * channels,
118 guint8 * channel_mapping_family,
119 guint8 * stream_count,
120 guint8 * coupled_count,
121 guint8 channel_mapping[256]);
122
123GST_PBUTILS_API
124GstCaps * gst_codec_utils_opus_create_caps (guint32 rate,
125 guint8 channels,
126 guint8 channel_mapping_family,
127 guint8 stream_count,
128 guint8 coupled_count,
129 const guint8 * channel_mapping);
130
131GST_PBUTILS_API
132GstCaps * gst_codec_utils_opus_create_caps_from_header (GstBuffer * header, GstBuffer * comments);
133
134GST_PBUTILS_API
135GstBuffer * gst_codec_utils_opus_create_header (guint32 rate,
136 guint8 channels,
137 guint8 channel_mapping_family,
138 guint8 stream_count,
139 guint8 coupled_count,
140 const guint8 * channel_mapping,
141 guint16 pre_skip,
142 gint16 output_gain);
143
144GST_PBUTILS_API
145gboolean gst_codec_utils_opus_parse_header (GstBuffer * header,
146 guint32 * rate,
147 guint8 * channels,
148 guint8 * channel_mapping_family,
149 guint8 * stream_count,
150 guint8 * coupled_count,
151 guint8 channel_mapping[256],
152 guint16 * pre_skip,
153 gint16 * output_gain);
154
155/* General */
156GST_PBUTILS_API
157gchar * gst_codec_utils_caps_get_mime_codec (GstCaps * caps);
158
159
160G_END_DECLS
161
162#endif /* __GST_PB_UTILS_CODEC_UTILS_H__ */
163

source code of include/gstreamer-1.0/gst/pbutils/codec-utils.h