Index: gst/rtsp/gstrtspsrc.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-good/gst/rtsp/gstrtspsrc.c,v
retrieving revision 1.148
diff -c -r1.148 gstrtspsrc.c
*** gst/rtsp/gstrtspsrc.c	27 Nov 2008 11:22:56 -0000	1.148
--- gst/rtsp/gstrtspsrc.c	14 Dec 2008 11:40:22 -0000
***************
*** 216,221 ****
--- 216,225 ----
  
  static void gst_rtspsrc_uri_handler_init (gpointer g_iface,
      gpointer iface_data);
+ 
+ static void gst_rtspsrc_sdp_attributes_to_caps(GArray *attributes,
+     GstCaps *caps);
+ 
  static GstCaps *gst_rtspsrc_media_to_caps (gint pt, const GstSDPMedia * media);
  
  static GstStateChangeReturn gst_rtspsrc_change_state (GstElement * element,
***************
*** 672,677 ****
--- 676,686 ----
      stream->pt = atoi (payload);
      /* convert caps */
      stream->caps = gst_rtspsrc_media_to_caps (stream->pt, media);
+     
+     GST_DEBUG ( "mapping sdp session level attributes to caps");
+     gst_rtspsrc_sdp_attributes_to_caps(sdp->attributes,stream->caps);
+     GST_DEBUG ( "mapping sdp media level attributes to caps");
+     gst_rtspsrc_sdp_attributes_to_caps(media->attributes,stream->caps);
  
      if (stream->pt >= 96) {
        /* If we have a dynamic payload type, see if we have a stream with the
***************
*** 891,896 ****
--- 900,944 ----
  }
  
  /*
+  * Mapping SDP attributes to caps
+  *
+  * prepend 'a-' to IANA registered sdp attributes names
+  * (ie: not prefixed with 'x-') in order to avoid
+  * collision with gstreamer standard caps properties names
+  *
+  */
+ static void
+ gst_rtspsrc_sdp_attributes_to_caps(GArray *attributes, GstCaps *caps) {
+ 
+   if (attributes->len > 0) {
+     GstStructure *s;
+     guint i;
+ 
+     s = gst_caps_get_structure (caps, 0);
+ 
+     for (i = 0; i < attributes->len; i++) {
+       GstSDPAttribute *attr =
+         &g_array_index (attributes, GstSDPAttribute, i);
+    
+       if ( (attr->key[0]!='x') || (attr->key[1]!='-') ) {
+         gchar *key;
+ 
+         key=g_malloc(strlen(attr->key)+2);
+         strcpy(key,"a-");
+         strcpy(key+2,attr->key);
+         GST_DEBUG ("adding caps: %s=%s", key, attr->value); 
+         gst_structure_set (s, key, G_TYPE_STRING, attr->value, NULL);
+         g_free(key);
+ 
+       } else {
+         GST_DEBUG ("adding caps: %s=%s", attr->key, attr->value); 
+         gst_structure_set (s, attr->key, G_TYPE_STRING, attr->value, NULL);
+       }
+     }
+   }
+ }
+ 
+ /*
   *  Mapping of caps to and from SDP fields:
   *
   *   m=<media> <UDP port> RTP/AVP <payload> 
***************
*** 1022,1027 ****
--- 1070,1076 ----
        g_strfreev (pairs);
      }
    }
+ 
    return caps;
  
    /* ERRORS */
