mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 02:15:31 +00:00
API: gst_discoverer_audio_info_get_channel_mask
https://bugzilla.gnome.org/show_bug.cgi?id=783722
This commit is contained in:
parent
8598f08278
commit
2a26baf4be
6 changed files with 35 additions and 2 deletions
|
@ -3279,6 +3279,7 @@ gst_discoverer_info_get_subtitle_streams
|
|||
gst_discoverer_info_get_video_streams
|
||||
gst_discoverer_audio_info_get_bitrate
|
||||
gst_discoverer_audio_info_get_channels
|
||||
gst_discoverer_audio_info_get_channel_mask
|
||||
gst_discoverer_audio_info_get_depth
|
||||
gst_discoverer_audio_info_get_language
|
||||
gst_discoverer_audio_info_get_max_bitrate
|
||||
|
|
|
@ -248,6 +248,7 @@ gst_discoverer_audio_info_copy_int (GstDiscovererAudioInfo * ptr)
|
|||
ret = gst_discoverer_audio_info_new ();
|
||||
|
||||
ret->channels = ptr->channels;
|
||||
ret->channel_mask = ptr->channel_mask;
|
||||
ret->sample_rate = ptr->sample_rate;
|
||||
ret->depth = ptr->depth;
|
||||
ret->bitrate = ptr->bitrate;
|
||||
|
@ -748,6 +749,19 @@ gst_discoverer_container_info_get_streams (GstDiscovererContainerInfo * info)
|
|||
|
||||
AUDIO_INFO_ACCESSOR_CODE (channels, guint, 0);
|
||||
|
||||
/**
|
||||
* gst_discoverer_audio_info_get_channel_mask:
|
||||
* @info: a #GstDiscovererAudioInfo
|
||||
*
|
||||
* Returns: the channel-mask of the stream, refer to
|
||||
* gst_audio_channel_positions_from_mask() for more
|
||||
* information.
|
||||
*
|
||||
* Since: 1.14
|
||||
*/
|
||||
|
||||
AUDIO_INFO_ACCESSOR_CODE (channel_mask, guint64, G_MAXUINT64);
|
||||
|
||||
/**
|
||||
* gst_discoverer_audio_info_get_sample_rate:
|
||||
* @info: a #GstDiscovererAudioInfo
|
||||
|
|
|
@ -868,6 +868,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
|
|||
if (g_str_has_prefix (name, "audio/")) {
|
||||
GstDiscovererAudioInfo *info;
|
||||
const gchar *format_str;
|
||||
guint64 channel_mask;
|
||||
|
||||
info = (GstDiscovererAudioInfo *) make_info (parent,
|
||||
GST_TYPE_DISCOVERER_AUDIO_INFO, caps);
|
||||
|
@ -878,6 +879,13 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
|
|||
if (gst_structure_get_int (caps_st, "channels", &tmp))
|
||||
info->channels = (guint) tmp;
|
||||
|
||||
if (gst_structure_get (caps_st, "channel-mask", GST_TYPE_BITMASK,
|
||||
&channel_mask, NULL)) {
|
||||
info->channel_mask = channel_mask;
|
||||
} else if (info->channels) {
|
||||
info->channel_mask = gst_audio_channel_get_fallback_mask (info->channels);
|
||||
}
|
||||
|
||||
/* FIXME: we only want to extract depth if raw audio is what's in the
|
||||
* container (i.e. not if there is a decoder involved) */
|
||||
format_str = gst_structure_get_string (caps_st, "format");
|
||||
|
@ -1836,10 +1844,11 @@ _serialize_info (GstDiscovererInfo * info, GstDiscovererSerializeFlags flags)
|
|||
static GVariant *
|
||||
_serialize_audio_stream_info (GstDiscovererAudioInfo * ainfo)
|
||||
{
|
||||
return g_variant_new ("(uuuuums)",
|
||||
return g_variant_new ("(uuuuumst)",
|
||||
ainfo->channels,
|
||||
ainfo->sample_rate,
|
||||
ainfo->bitrate, ainfo->max_bitrate, ainfo->depth, ainfo->language);
|
||||
ainfo->bitrate, ainfo->max_bitrate, ainfo->depth, ainfo->language,
|
||||
ainfo->channel_mask);
|
||||
}
|
||||
|
||||
static GVariant *
|
||||
|
@ -1994,6 +2003,8 @@ _parse_audio_stream_info (GstDiscovererAudioInfo * ainfo, GVariant * specific)
|
|||
if (str)
|
||||
ainfo->language = g_strdup (str);
|
||||
|
||||
GET_FROM_TUPLE (specific, uint64, 6, &ainfo->channel_mask);
|
||||
|
||||
g_variant_unref (specific);
|
||||
}
|
||||
|
||||
|
|
|
@ -124,6 +124,9 @@ GType gst_discoverer_audio_info_get_type (void);
|
|||
GST_EXPORT
|
||||
guint gst_discoverer_audio_info_get_channels(const GstDiscovererAudioInfo* info);
|
||||
|
||||
GST_EXPORT
|
||||
guint64 gst_discoverer_audio_info_get_channel_mask(const GstDiscovererAudioInfo* info);
|
||||
|
||||
GST_EXPORT
|
||||
guint gst_discoverer_audio_info_get_sample_rate(const GstDiscovererAudioInfo* info);
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "gstdiscoverer.h"
|
||||
|
||||
struct _GstDiscovererStreamInfo {
|
||||
GObject parent;
|
||||
|
||||
|
@ -44,6 +46,7 @@ struct _GstDiscovererContainerInfo {
|
|||
struct _GstDiscovererAudioInfo {
|
||||
GstDiscovererStreamInfo parent;
|
||||
|
||||
guint64 channel_mask;
|
||||
guint channels;
|
||||
guint sample_rate;
|
||||
guint depth;
|
||||
|
|
|
@ -27,6 +27,7 @@ EXPORTS
|
|||
gst_codec_utils_opus_parse_header
|
||||
gst_discoverer_audio_info_get_bitrate
|
||||
gst_discoverer_audio_info_get_channels
|
||||
gst_discoverer_audio_info_get_channel_mask
|
||||
gst_discoverer_audio_info_get_depth
|
||||
gst_discoverer_audio_info_get_language
|
||||
gst_discoverer_audio_info_get_max_bitrate
|
||||
|
|
Loading…
Reference in a new issue