mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
codec-utils: Add utilities for AAC and the AACHead header
Add utilities about the channels and sample rate for AAC. https://bugzilla.gnome.org/show_bug.cgi?id=749110
This commit is contained in:
parent
090d0d1961
commit
65f721b326
4 changed files with 61 additions and 0 deletions
|
@ -2217,6 +2217,8 @@ gst_codec_utils_aac_get_sample_rate_from_index
|
|||
gst_codec_utils_aac_get_index_from_sample_rate
|
||||
gst_codec_utils_aac_get_profile
|
||||
gst_codec_utils_aac_get_level
|
||||
gst_codec_utils_aac_get_channels
|
||||
gst_codec_utils_aac_get_sample_rate
|
||||
gst_codec_utils_aac_caps_set_level_and_profile
|
||||
<SUBSECTION>
|
||||
gst_codec_utils_h264_get_profile
|
||||
|
|
|
@ -109,6 +109,59 @@ gst_codec_utils_aac_get_index_from_sample_rate (guint rate)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_codec_utils_aac_get_sample_rate:
|
||||
* @audio_config: a pointer to the AudioSpecificConfig as specified in the
|
||||
* Elementary Stream Descriptor (esds) in ISO/IEC 14496-1.
|
||||
* @len: Length of @audio_config in bytes
|
||||
*
|
||||
* Translates the sample rate index found in AAC headers to the actual sample
|
||||
* rate.
|
||||
*
|
||||
* Returns: The sample rate if sr_idx is valid, 0 otherwise.
|
||||
*
|
||||
* Since 1.10
|
||||
*/
|
||||
guint
|
||||
gst_codec_utils_aac_get_sample_rate (const guint8 * audio_config, guint len)
|
||||
{
|
||||
guint rate_index;
|
||||
|
||||
if (len < 2)
|
||||
return 0;
|
||||
|
||||
rate_index = ((audio_config[0] & 0x7) << 1) | ((audio_config[1] & 0x80) >> 7);
|
||||
return gst_codec_utils_aac_get_sample_rate_from_index (rate_index);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_codec_utils_aac_get_channels:
|
||||
* @audio_config: a pointer to the AudioSpecificConfig as specified in the
|
||||
* Elementary Stream Descriptor (esds) in ISO/IEC 14496-1.
|
||||
*
|
||||
* Returns the channels of the given AAC stream.
|
||||
*
|
||||
* Returns: The channels or 0 if the channel could not be determined.
|
||||
*
|
||||
* Since 1.10
|
||||
*/
|
||||
guint
|
||||
gst_codec_utils_aac_get_channels (const guint8 * audio_config, guint len)
|
||||
{
|
||||
guint channels;
|
||||
|
||||
if (len < 2)
|
||||
return 0;
|
||||
|
||||
channels = (audio_config[1] & 0x7f) >> 3;
|
||||
if (channels > 0 && channels < 7)
|
||||
return channels;
|
||||
else if (channels == 7)
|
||||
return 8;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_codec_utils_aac_get_profile:
|
||||
* @audio_config: a pointer to the AudioSpecificConfig as specified in the
|
||||
|
|
|
@ -35,6 +35,10 @@ const gchar * gst_codec_utils_aac_get_profile (const guint8 * audio_config, guin
|
|||
|
||||
const gchar * gst_codec_utils_aac_get_level (const guint8 * audio_config, guint len);
|
||||
|
||||
guint gst_codec_utils_aac_get_sample_rate (const guint8 * audio_config, guint len);
|
||||
|
||||
guint gst_codec_utils_aac_get_channels (const guint8 * audio_config, guint len);
|
||||
|
||||
gboolean gst_codec_utils_aac_caps_set_level_and_profile (GstCaps * caps,
|
||||
const guint8 * audio_config,
|
||||
guint len);
|
||||
|
|
|
@ -5,6 +5,8 @@ EXPORTS
|
|||
gst_codec_utils_aac_get_index_from_sample_rate
|
||||
gst_codec_utils_aac_get_level
|
||||
gst_codec_utils_aac_get_profile
|
||||
gst_codec_utils_aac_get_sample_rate
|
||||
gst_codec_utils_aac_get_channels
|
||||
gst_codec_utils_aac_get_sample_rate_from_index
|
||||
gst_codec_utils_h264_caps_set_level_and_profile
|
||||
gst_codec_utils_h264_get_level
|
||||
|
|
Loading…
Reference in a new issue