From: Tim-Philipp Müller Date: Sun, 9 Sep 2012 20:11:20 +0000 (+0100) Subject: discoverer: extract audio depth correctly X-Git-Tag: 1.19.3~511^2~5933 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9b8cbec5907775f620c4c7babbbab1f1c21b876f;p=platform%2Fupstream%2Fgstreamer.git discoverer: extract audio depth correctly But we should only do that if it comes straight from a container or wavparse, not if it comes from a decoder, otherwise it's probably not really meaningful. --- diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c index 6434600..96110b5 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/gst-libs/gst/pbutils/gstdiscoverer.c @@ -43,6 +43,7 @@ #endif #include +#include #include "pbutils.h" #include "pbutils-private.h" @@ -762,6 +763,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, if (g_str_has_prefix (name, "audio/")) { GstDiscovererAudioInfo *info; + const gchar *format_str; if (parent) info = (GstDiscovererAudioInfo *) gst_discoverer_stream_info_ref (parent); @@ -777,8 +779,17 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, if (gst_structure_get_int (caps_st, "channels", &tmp)) info->channels = (guint) tmp; - if (gst_structure_get_int (caps_st, "depth", &tmp)) - info->depth = (guint) tmp; + /* 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"); + if (format_str != NULL) { + const GstAudioFormatInfo *finfo; + GstAudioFormat format; + + format = gst_audio_format_from_string (format_str); + finfo = gst_audio_format_get_info (format); + info->depth = GST_AUDIO_FORMAT_INFO_DEPTH (finfo); + } if (gst_structure_id_has_field (st, _TAGS_QUARK)) { gst_structure_id_get (st, _TAGS_QUARK, GST_TYPE_TAG_LIST, &tags_st, NULL);