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 /* H.265 */ 72 73 GST_PBUTILS_API 74 const gchar * gst_codec_utils_h265_get_profile (const guint8 * profile_tier_level, 75 guint len); 76 77 GST_PBUTILS_API 78 const gchar * gst_codec_utils_h265_get_tier (const guint8 * profile_tier_level, 79 guint len); 80 81 GST_PBUTILS_API 82 const gchar * gst_codec_utils_h265_get_level (const guint8 * profile_tier_level, 83 guint len); 84 85 GST_PBUTILS_API 86 guint8 gst_codec_utils_h265_get_level_idc (const gchar * level); 87 88 GST_PBUTILS_API 89 gboolean 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 94 GST_PBUTILS_API 95 const gchar * gst_codec_utils_mpeg4video_get_profile (const guint8 * vis_obj_seq, guint len); 96 97 GST_PBUTILS_API 98 const gchar * gst_codec_utils_mpeg4video_get_level (const guint8 * vis_obj_seq, guint len); 99 100 GST_PBUTILS_API 101 gboolean gst_codec_utils_mpeg4video_caps_set_level_and_profile (GstCaps * caps, 102 const guint8 * vis_obj_seq, 103 guint len); 104 105 /* Opus */ 106 107 GST_PBUTILS_API 108 gboolean 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 116 GST_PBUTILS_API 117 GstCaps * 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 124 GST_PBUTILS_API 125 GstCaps * gst_codec_utils_opus_create_caps_from_header (GstBuffer * header, GstBuffer * comments); 126 127 GST_PBUTILS_API 128 GstBuffer * 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 137 GST_PBUTILS_API 138 gboolean 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 148 G_END_DECLS 149 150 #endif /* __GST_PB_UTILS_CODEC_UTILS_H__ */ 151