summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2007-10-01 14:01:40 +0000
committerWim Taymans <wim.taymans@gmail.com>2007-10-01 14:01:40 +0000
commitfaa4937cdc7f6fd316a6c72834d5cc5c3111c7ad (patch)
treec7700569b9a4888dbd6fe2953d405ba4443c210e
parenta2a6ea8645b6270564ab3a1f4b448f0cc378d9fd (diff)
downloadgst-plugins-bad-faa4937cdc7f6fd316a6c72834d5cc5c3111c7ad.tar.gz
gst-plugins-bad-faa4937cdc7f6fd316a6c72834d5cc5c3111c7ad.tar.bz2
gst-plugins-bad-faa4937cdc7f6fd316a6c72834d5cc5c3111c7ad.zip
gst/sdp/gstsdpdemux.c: Use new function in -base to get the default clock-rate.
Original commit message from CVS: * gst/sdp/gstsdpdemux.c: (gst_sdp_demux_media_to_caps): Use new function in -base to get the default clock-rate.
-rw-r--r--ChangeLog5
-rw-r--r--gst/sdp/gstsdpdemux.c63
2 files changed, 22 insertions, 46 deletions
diff --git a/ChangeLog b/ChangeLog
index faf57788..cbdfb975 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2007-10-01 Wim Taymans <wim.taymans@gmail.com>
+ * gst/sdp/gstsdpdemux.c: (gst_sdp_demux_media_to_caps):
+ Use new function in -base to get the default clock-rate.
+
+2007-10-01 Wim Taymans <wim.taymans@gmail.com>
+
* configure.ac:
* gst/sdp/gstsdpdemux.c: (_do_init), (gst_sdp_demux_base_init),
(gst_sdp_demux_class_init), (gst_sdp_demux_init),
diff --git a/gst/sdp/gstsdpdemux.c b/gst/sdp/gstsdpdemux.c
index b574eadf..f73ed4c0 100644
--- a/gst/sdp/gstsdpdemux.c
+++ b/gst/sdp/gstsdpdemux.c
@@ -60,6 +60,7 @@
#include <stdio.h>
#include <stdarg.h>
+#include <gst/rtp/gstrtppayloads.h>
#include <gst/sdp/gstsdpmessage.h>
#include "gstsdpdemux.h"
@@ -450,51 +451,6 @@ gst_sdp_demux_cleanup (GstSDPDemux * demux)
demux->numstreams = 0;
}
-/* FIXME, this should go somewhere else, ideally
- */
-static guint
-get_default_rate_for_pt (gint pt, gchar * name, gchar * params)
-{
- switch (pt) {
- case 0:
- case 3:
- case 4:
- case 5:
- case 7:
- case 8:
- case 9:
- case 12:
- case 13:
- case 15:
- case 18:
- return 8000;
- case 16:
- return 11025;
- case 17:
- return 22050;
- case 6:
- return 16000;
- case 10:
- case 11:
- return 44100;
- case 14:
- case 25:
- case 26:
- case 28:
- case 31:
- case 32:
- case 33:
- case 34:
- return 90000;
- default:
- {
- if (g_str_has_prefix (name, "x-pn-real"))
- return 1000;
- return -1;
- }
- }
-}
-
#define PARSE_INT(p, del, res) \
G_STMT_START { \
gchar *t = p; \
@@ -622,7 +578,22 @@ gst_sdp_demux_media_to_caps (gint pt, const GstSDPMedia * media)
/* check if we have a rate, if not, we need to look up the rate from the
* default rates based on the payload types. */
if (rate == -1) {
- rate = get_default_rate_for_pt (pt, name, params);
+ const GstRTPPayloadInfo *info;
+
+ if (GST_RTP_PAYLOAD_IS_DYNAMIC (pt)) {
+ /* dynamic types, use media and encoding_name */
+ tmp = g_ascii_strdown (media->media, -1);
+ info = gst_rtp_payload_info_for_name (tmp, name);
+ g_free (tmp);
+ } else {
+ /* static types, use payload type */
+ info = gst_rtp_payload_info_for_pt (pt);
+ }
+
+ if (info) {
+ if ((rate = info->clock_rate) == 0)
+ rate = -1;
+ }
/* we fail if we cannot find one */
if (rate == -1)
goto no_rate;