Index: gst/rtp/gstrtpjpegdepay.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-good/gst/rtp/gstrtpjpegdepay.c,v
retrieving revision 1.2
diff -u -p -r1.2 gstrtpjpegdepay.c
--- gst/rtp/gstrtpjpegdepay.c	9 Dec 2008 14:19:16 -0000	1.2
+++ gst/rtp/gstrtpjpegdepay.c	15 Dec 2008 18:54:20 -0000
@@ -26,6 +26,8 @@
 #include <string.h>
 #include "gstrtpjpegdepay.h"
 
+extern double round(double x);
+
 GST_DEBUG_CATEGORY_STATIC (rtpjpegdepay_debug);
 #define GST_CAT_DEFAULT (rtpjpegdepay_debug)
 
@@ -50,11 +52,35 @@ static GstStaticPadTemplate gst_rtp_jpeg
     GST_STATIC_CAPS ("application/x-rtp, "
         "media = (string) \"video\", "
         "payload = (int) " GST_RTP_PAYLOAD_DYNAMIC_STRING ", "
-        "clock-rate = (int) 90000, " "encoding-name = (string) \"JPEG\";"
+        "clock-rate = (int) 90000, "
+        "encoding-name = (string) \"JPEG\"; "
+	/* optional caps */
+	/*
+	"width = (int) [16, 4096], " // FIXME: MAX_WIDTH too low in gstjpegdec
+	"height = (int) [8, 4096], " // FIXME: MAX_HEIGHT too low
+	"framerate = (fraction) [ 0/1, MAX ], "
+	*/
+        /* optional SDP attributes */
+        /*
+        "a-framerate = (double) 0.00; "
+        "x-dimensions = (string) \"1234,1234\", "
+        */
         "application/x-rtp, "
         "media = (string) \"video\", "
         "payload = (int) " GST_RTP_PAYLOAD_JPEG_STRING ", "
-        "clock-rate = (int) 90000")
+        "clock-rate = (int) 90000"
+	/* optional caps */
+	/*
+	"width = (int) [16, 4096], " // FIXME: MAX_WIDTH too low in gstjpegdec
+	"height = (int) [8, 4096], " // FIXME: MAX_HEIGHT too low
+	"framerate = (fraction) [ 0/1, MAX ], "
+	*/
+        /* optional SDP attributes */
+        /*
+        "a-framerate = (double) 0.0, "
+        "x-dimensions = (string) \"1234,1234\""
+        */
+        )
     );
 
 GST_BOILERPLATE (GstRtpJPEGDepay, gst_rtp_jpeg_depay, GstBaseRTPDepayload,
@@ -392,18 +418,66 @@ gst_rtp_jpeg_depay_setcaps (GstBaseRTPDe
   GstCaps *outcaps;
   gint clock_rate;
   gboolean res;
+  const gchar *media_attr;
+  gint framerate;
+  gint denom;
 
   rtpjpegdepay = GST_RTP_JPEG_DEPAY (depayload);
 
   structure = gst_caps_get_structure (caps, 0);
 
+  GST_DEBUG_OBJECT(rtpjpegdepay,"Caps set: %" GST_PTR_FORMAT, caps);
   if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
     clock_rate = 90000;
   depayload->clock_rate = clock_rate;
 
+  media_attr=gst_structure_get_string (structure, "x-dimensions");
+  if (media_attr) {
+    gchar *c;
+    c=strchr(media_attr,',');
+    if (c) {
+      *c=0;
+      rtpjpegdepay->media_width = atoi(media_attr);
+      rtpjpegdepay->media_height = atoi(c+1);
+      /* the string should not be modified but nobody noticed */ 
+      *c=',';
+    } else {
+      media_attr=0;
+    }
+  }
+
+  if (!rtpjpegdepay->media_width)
+    gst_structure_get_int (structure, "width", &rtpjpegdepay->media_width);
+
+  if (!rtpjpegdepay->media_height)
+    gst_structure_get_int (structure, "height", &rtpjpegdepay->media_height);
+
+  media_attr=gst_structure_get_string (structure, "a-framerate");
+  if (media_attr) {
+
+    double d_framerate;
+    d_framerate=atof(media_attr);
+
+    if (d_framerate-(round(d_framerate))) {
+      framerate=(gint)round(d_framerate*100.0);
+      denom=100;
+
+    } else {
+      framerate=(gint)d_framerate;
+      denom=1;
+    }
+
+  } else {
+    if (!gst_structure_get_fraction(structure,"framerate",&framerate,&denom)) {
+      framerate=0;
+      denom=1;
+    }
+  }
+
   outcaps =
-      gst_caps_new_simple ("image/jpeg", "framerate", GST_TYPE_FRACTION, 0, 1,
-      NULL);
+    gst_caps_new_simple ("image/jpeg", "framerate", GST_TYPE_FRACTION, framerate, denom,
+    NULL);
+
   res = gst_pad_set_caps (depayload->srcpad, outcaps);
   gst_caps_unref (outcaps);
 
@@ -451,6 +525,16 @@ gst_rtp_jpeg_depay_process (GstBaseRTPDe
   width = payload[6] * 8;
   height = payload[7] * 8;
 
+/* allow frame dimensions > 2040, passed in SDP session or media attributes
+ * from gstrtspsrc.c (gst_rtspsrc_sdp_attributes_to_caps), or in caps
+ */
+
+  if (!width)
+    width=rtpjpegdepay->media_width;
+
+  if (!height)
+    height=rtpjpegdepay->media_height;
+
   GST_DEBUG_OBJECT (rtpjpegdepay, "frag %u, type %u, Q %d, width %u, height %u",
       frag_offset, type, Q, width, height);
 
Index: gst/rtp/gstrtpjpegdepay.h
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-good/gst/rtp/gstrtpjpegdepay.h,v
retrieving revision 1.2
diff -u -p -r1.2 gstrtpjpegdepay.h
--- gst/rtp/gstrtpjpegdepay.h	25 Nov 2008 18:02:58 -0000	1.2
+++ gst/rtp/gstrtpjpegdepay.h	15 Dec 2008 18:54:20 -0000
@@ -48,6 +48,11 @@ struct _GstRtpJPEGDepay
 
   /* cached quant tables */
   guint8 * qtables[255];
+
+  /* sdp media optional attributes needed for dimension > 2040 */
+  gint media_width;
+  gint media_height;
+
 };
 
 struct _GstRtpJPEGDepayClass
Index: gst/rtsp/gstrtspsrc.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-good/gst/rtsp/gstrtspsrc.c,v
retrieving revision 1.148
diff -u -p -r1.148 gstrtspsrc.c
--- gst/rtsp/gstrtspsrc.c	27 Nov 2008 11:22:56 -0000	1.148
+++ gst/rtsp/gstrtspsrc.c	15 Dec 2008 18:54:22 -0000
@@ -216,6 +216,10 @@ static void gst_rtspsrc_get_property (GO
 
 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,6 +676,11 @@ gst_rtspsrc_create_stream (GstRTSPSrc * 
     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,6 +900,45 @@ gst_rtspsrc_parse_rtpmap (const gchar * 
 }
 
 /*
+ * 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> 
