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
71/* H.265 */
72
73GST_PBUTILS_API
74const gchar * gst_codec_utils_h265_get_profile (const guint8 * profile_tier_level,
75 guint len);
76
77GST_PBUTILS_API
78const gchar * gst_codec_utils_h265_get_tier (const guint8 * profile_tier_level,
79 guint len);
80
81GST_PBUTILS_API
82const gchar * gst_codec_utils_h265_get_level (const guint8 * profile_tier_level,
83 guint len);
84
85GST_PBUTILS_API
86guint8 gst_codec_utils_h265_get_level_idc (const gchar * level);
87
88GST_PBUTILS_API
89gboolean gst_codec_utils_h265_caps_set_level_tier_and_profile (GstCaps * caps,
90 const guint8 * profile_tier_level,
91 guint len);
92/* MPEG-4 part 2 */
93
94GST_PBUTILS_API
95const gchar * gst_codec_utils_mpeg4video_get_profile (const guint8 * vis_obj_seq, guint len);
96
97GST_PBUTILS_API
98const gchar * gst_codec_utils_mpeg4video_get_level (const guint8 * vis_obj_seq, guint len);
99
100GST_PBUTILS_API
101gboolean gst_codec_utils_mpeg4video_caps_set_level_and_profile (GstCaps * caps,
102 const guint8 * vis_obj_seq,
103 guint len);
104
105/* Opus */
106
107GST_PBUTILS_API
108gboolean gst_codec_utils_opus_parse_caps (GstCaps * caps,
109 guint32 * rate,
110 guint8 * channels,
111 guint8 * channel_mapping_family,
112 guint8 * stream_count,
113 guint8 * coupled_count,
114 guint8 channel_mapping[256]);
115
116GST_PBUTILS_API
117GstCaps * gst_codec_utils_opus_create_caps (guint32 rate,
118 guint8 channels,
119 guint8 channel_mapping_family,
120 guint8 stream_count,
121 guint8 coupled_count,
122 const guint8 * channel_mapping);
123
124GST_PBUTILS_API
125GstCaps * gst_codec_utils_opus_create_caps_from_header (GstBuffer * header, GstBuffer * comments);
126
127GST_PBUTILS_API
128GstBuffer * gst_codec_utils_opus_create_header (guint32 rate,
129 guint8 channels,
130 guint8 channel_mapping_family,
131 guint8 stream_count,
132 guint8 coupled_count,
133 const guint8 * channel_mapping,
134 guint16 pre_skip,
135 gint16 output_gain);
136
137GST_PBUTILS_API
138gboolean gst_codec_utils_opus_parse_header (GstBuffer * header,
139 guint32 * rate,
140 guint8 * channels,
141 guint8 * channel_mapping_family,
142 guint8 * stream_count,
143 guint8 * coupled_count,
144 guint8 channel_mapping[256],
145 guint16 * pre_skip,
146 gint16 * output_gain);
147
148G_END_DECLS
149
150#endif /* __GST_PB_UTILS_CODEC_UTILS_H__ */
151