summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Crete <olivier.crete@collabora.co.uk>2008-07-04 20:29:41 +0000
committerOlivier CrĂȘte <olivier.crete@collabora.co.uk>2009-03-03 14:34:06 -0500
commit3f12b5905b123cb9b5e66829b72f6d4e2ddc52b9 (patch)
tree73bca6ae6a0df2debf2e4257629998dc68ab1186
parent8dca93678d054fdc5094725efa66831f239005c3 (diff)
downloadgst-plugins-bad-3f12b5905b123cb9b5e66829b72f6d4e2ddc52b9.tar.gz
gst-plugins-bad-3f12b5905b123cb9b5e66829b72f6d4e2ddc52b9.tar.bz2
gst-plugins-bad-3f12b5905b123cb9b5e66829b72f6d4e2ddc52b9.zip
[MOVED FROM GST-P-FARSIGHT] Fix conflicts
20080704202941-3e2dc-7f5a38845b797e12d672551466e635d484cb6763.gz
-rw-r--r--ext/mimic/gstmimdec.c25
-rw-r--r--ext/mimic/gstmimdec.h3
2 files changed, 24 insertions, 4 deletions
diff --git a/ext/mimic/gstmimdec.c b/ext/mimic/gstmimdec.c
index 3568f9b1..b2f15ec3 100644
--- a/ext/mimic/gstmimdec.c
+++ b/ext/mimic/gstmimdec.c
@@ -50,7 +50,7 @@ GST_STATIC_PAD_TEMPLATE (
"bpp = (int) 24, "
"depth = (int) 24, "
"endianness = (int) 4321, "
- "framerate = (double) [1.0, 30.0], "
+ "framerate = (fraction) [ 0/1, 30/1 ], "
"red_mask = (int) 16711680, "
"green_mask = (int) 65280, "
"blue_mask = (int) 255, "
@@ -233,6 +233,9 @@ gst_mimdec_chain (GstPad *pad, GstBuffer *in)
}
mimdec->payload_size = GUINT32_FROM_LE (*((guint32 *) (header + 8)));
+
+ mimdec->current_ts = GUINT32_FROM_LE (*((guint32 *) (header + 20)));
+
GST_DEBUG ("Got packet, payload size %d", mimdec->payload_size);
gst_adapter_flush (mimdec->adapter, 24);
@@ -299,7 +302,7 @@ gst_mimdec_chain (GstPad *pad, GstBuffer *in)
}
out_buf = gst_buffer_new_and_alloc (mimdec->buffer_size);
- GST_BUFFER_TIMESTAMP(out_buf) = GST_BUFFER_TIMESTAMP(buf);
+
if (!mimic_decode_frame (mimdec->dec, frame_body, GST_BUFFER_DATA (out_buf))) {
GST_WARNING_OBJECT (mimdec, "mimic_decode_frame error\n");
@@ -310,7 +313,18 @@ gst_mimdec_chain (GstPad *pad, GstBuffer *in)
res = GST_FLOW_ERROR;
goto out;
}
-
+
+ if (mimdec->last_ts != -1) {
+ int diff = mimdec->current_ts - mimdec->last_ts;
+ if (diff < 0 || diff > 5000) {
+ diff = 1000;
+ }
+ mimdec->gst_timestamp += diff * GST_MSECOND;
+ }
+ GST_BUFFER_TIMESTAMP(out_buf) = mimdec->gst_timestamp;
+ mimdec->last_ts = mimdec->current_ts;
+
+
mimic_get_property(mimdec->dec, "width", &width);
mimic_get_property(mimdec->dec, "height", &height);
GST_DEBUG_OBJECT (mimdec,
@@ -320,7 +334,7 @@ gst_mimdec_chain (GstPad *pad, GstBuffer *in)
"bpp", G_TYPE_INT, 24,
"depth", G_TYPE_INT, 24,
"endianness", G_TYPE_INT, 4321,
- "framerate", G_TYPE_DOUBLE, 30.0,
+ "framerate", GST_TYPE_FRACTION, 7, 1,
"red_mask", G_TYPE_INT, 16711680,
"green_mask", G_TYPE_INT, 65280,
"blue_mask", G_TYPE_INT, 255,
@@ -354,6 +368,9 @@ gst_mimdec_change_state (GstElement *element, GstStateChange transition)
mimdec->buffer_size = -1;
mimdec->have_header = FALSE;
mimdec->payload_size = -1;
+ mimdec->gst_timestamp = -1;
+ mimdec->current_ts = -1;
+ mimdec->last_ts = -1;
}
break;
default:
diff --git a/ext/mimic/gstmimdec.h b/ext/mimic/gstmimdec.h
index 7f930529..ddbde8d2 100644
--- a/ext/mimic/gstmimdec.h
+++ b/ext/mimic/gstmimdec.h
@@ -55,6 +55,9 @@ struct _GstMimDec
gint buffer_size;
gboolean have_header;
guint32 payload_size;
+ guint32 last_ts;
+ guint32 current_ts;
+ GstClockTime gst_timestamp;
};
struct _GstMimDecClass