summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <bilboed@bilboed.com>2009-07-29 13:38:03 +0200
committerEdward Hervey <bilboed@bilboed.com>2009-07-29 13:39:08 +0200
commit050e91995e0c8a451859fad365af5d85e9b3af77 (patch)
tree96058a355a7308a5c9aa6a153e6347d9b801d4ee
parent9c341347ba8d9d8d77e45cbf32e8ef3b4fedad97 (diff)
rtpsv3depay: Fix width/height calculation, bring up to marginal rank.
Based on documentation found on http://wiki.multimedia.cx/
-rw-r--r--gst/rtp/gstrtpsv3vdepay.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/gst/rtp/gstrtpsv3vdepay.c b/gst/rtp/gstrtpsv3vdepay.c
index b518b0aa4..550da4bed 100644
--- a/gst/rtp/gstrtpsv3vdepay.c
+++ b/gst/rtp/gstrtpsv3vdepay.c
@@ -152,6 +152,19 @@ gst_rtp_sv3v_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
rtpsv3vdepay->nextseq = seq + 1;
{
+ static struct
+ {
+ guint width, height;
+ } resolutions[7] = {
+ {
+ 160, 128}, {
+ 128, 96}, {
+ 176, 144}, {
+ 352, 288}, {
+ 704, 576}, {
+ 240, 180}, {
+ 320, 240}
+ };
gint payload_len;
guint8 *payload;
gboolean M;
@@ -188,19 +201,24 @@ gst_rtp_sv3v_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
GstCaps *caps;
GstBuffer *codec_data;
GValue value = { 0 };
+ guint8 res;
/* if we already have caps, we don't need to do anything. FIXME, check if
* something changed. */
if (GST_PAD_CAPS (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload)))
return NULL;
- /* No idea... These are the two examples I found.. */
- if (payload[2] == 0x1d) {
- rtpsv3vdepay->width = 160;
- rtpsv3vdepay->height = 128;
- } else if (payload[2] == 0xdd) {
- rtpsv3vdepay->width = 320;
- rtpsv3vdepay->height = 240;
+ res = payload[2] >> 5;
+
+ /* width and height, according to http://wiki.multimedia.cx/index.php?title=Sorenson_Video_1#Stream_Format_And_Header */
+ if (res < 7) {
+ rtpsv3vdepay->width = resolutions[res].width;
+ rtpsv3vdepay->height = resolutions[res].height;
+ } else {
+ /* extended width/height, they're contained in the following 24bit */
+ rtpsv3vdepay->width = ((payload[2] & 0x1f) << 7) | (payload[3] >> 1);
+ rtpsv3vdepay->height =
+ (payload[3] & 0x1) << 11 | payload[4] << 3 | (payload[5] >> 5);
}
/* we need a dummy empty codec data */
@@ -279,5 +297,5 @@ gboolean
gst_rtp_sv3v_depay_plugin_init (GstPlugin * plugin)
{
return gst_element_register (plugin, "rtpsv3vdepay",
- GST_RANK_NONE, GST_TYPE_RTP_SV3V_DEPAY);
+ GST_RANK_MARGINAL, GST_TYPE_RTP_SV3V_DEPAY);
}