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 28 G_BEGIN_DECLS 29 30 /* AAC */ 31 32 GST_PBUTILS_API 33 guint gst_codec_utils_aac_get_sample_rate_from_index (guint sr_idx); 34 35 GST_PBUTILS_API 36 gint gst_codec_utils_aac_get_index_from_sample_rate (guint rate); 37 38 GST_PBUTILS_API 39 const gchar * gst_codec_utils_aac_get_profile (const guint8 * audio_config, guint len); 40 41 GST_PBUTILS_API 42 const gchar * gst_codec_utils_aac_get_level (const guint8 * audio_config, guint len); 43 44 GST_PBUTILS_API 45 guint gst_codec_utils_aac_get_sample_rate (const guint8 * audio_config, guint len); 46 47 GST_PBUTILS_API 48 guint gst_codec_utils_aac_get_channels (const guint8 * audio_config, guint len); 49 50 GST_PBUTILS_API 51 gboolean gst_codec_utils_aac_caps_set_level_and_profile (GstCaps * caps, 52 const guint8 * audio_config, 53 guint len); 54 55 /* H.264 */ 56 57 GST_PBUTILS_API 58 const gchar * gst_codec_utils_h264_get_profile (const guint8 * sps, guint len); 59 60 GST_PBUTILS_API 61 const gchar * gst_codec_utils_h264_get_level (const guint8 * sps, guint len); 62 63 GST_PBUTILS_API 64 guint8 gst_codec_utils_h264_get_level_idc (const gchar * level); 65 66 GST_PBUTILS_API 67 gboolean gst_codec_utils_h264_caps_set_level_and_profile (GstCaps * caps, 68 const guint8 * sps, 69 guint len); 70 71 GST_PBUTILS_API 72 gboolean 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 80 GST_PBUTILS_API 81 const gchar * gst_codec_utils_h265_get_profile (const guint8 * profile_tier_level, 82 guint len); 83 84 GST_PBUTILS_API 85 const gchar * gst_codec_utils_h265_get_tier (const guint8 * profile_tier_level, 86 guint len); 87 88 GST_PBUTILS_API 89 const gchar * gst_codec_utils_h265_get_level (const guint8 * profile_tier_level, 90 guint len); 91 92 GST_PBUTILS_API 93 guint8 gst_codec_utils_h265_get_level_idc (const gchar * level); 94 95 GST_PBUTILS_API 96 gboolean 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 101 GST_PBUTILS_API 102 const gchar * gst_codec_utils_mpeg4video_get_profile (const guint8 * vis_obj_seq, guint len); 103 104 GST_PBUTILS_API 105 const gchar * gst_codec_utils_mpeg4video_get_level (const guint8 * vis_obj_seq, guint len); 106 107 GST_PBUTILS_API 108 gboolean gst_codec_utils_mpeg4video_caps_set_level_and_profile (GstCaps * caps, 109 const guint8 * vis_obj_seq, 110 guint len); 111 112 /* Opus */ 113 114 GST_PBUTILS_API 115 gboolean 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 123 GST_PBUTILS_API 124 GstCaps * 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 131 GST_PBUTILS_API 132 GstCaps * gst_codec_utils_opus_create_caps_from_header (GstBuffer * header, GstBuffer * comments); 133 134 GST_PBUTILS_API 135 GstBuffer * 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 144 GST_PBUTILS_API 145 gboolean 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 */ 156 GST_PBUTILS_API 157 gchar * gst_codec_utils_caps_get_mime_codec (GstCaps * caps); 158 159 160 G_END_DECLS 161 162 #endif /* __GST_PB_UTILS_CODEC_UTILS_H__ */ 163