libs/gst/dataprotocol/dataprotocol.c: Fix serialization of seek events.

Original commit message from CVS:
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_event),
(gst_dp_event_from_packet):
Fix serialization of seek events.
This commit is contained in:
Wim Taymans 2005-07-27 19:00:36 +00:00
parent 7b1c29b05e
commit 540d6342e9
2 changed files with 42 additions and 22 deletions

View file

@ -1,3 +1,9 @@
2005-07-27 Wim Taymans <wim@fluendo.com>
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_event),
(gst_dp_event_from_packet):
Fix serialization of seek events.
2005-07-27 Wim Taymans <wim@fluendo.com> 2005-07-27 Wim Taymans <wim@fluendo.com>
* check/gst-libs/gdp.c: (GST_START_TEST): * check/gst-libs/gdp.c: (GST_START_TEST):

View file

@ -329,18 +329,27 @@ gst_dp_packet_from_event (const GstEvent * event, GstDPHeaderFlag flags,
*payload = NULL; *payload = NULL;
break; break;
case GST_EVENT_SEEK: case GST_EVENT_SEEK:
pl_length = 4 + 8 + 8 + 4; {
gdouble rate;
GstFormat format;
GstSeekFlags flags;
GstSeekType cur_type, stop_type;
gint64 cur, stop;
gst_event_parse_seek ((GstEvent *) event, &rate, &format, &flags,
&cur_type, &cur, &stop_type, &stop);
pl_length = 4 + 4 + 4 + 8 + 4 + 8;
*payload = g_malloc0 (pl_length); *payload = g_malloc0 (pl_length);
/* /* FIXME write rate */
GST_WRITE_UINT32_BE (*payload, (guint32) GST_EVENT_SEEK_TYPE (event)); GST_WRITE_UINT32_BE (*payload, (guint32) format);
GST_WRITE_UINT64_BE (*payload + 4, GST_WRITE_UINT32_BE (*payload + 4, (guint32) flags);
(guint64) GST_EVENT_SEEK_OFFSET (event)); GST_WRITE_UINT32_BE (*payload + 8, (guint32) cur_type);
GST_WRITE_UINT64_BE (*payload + 12, GST_WRITE_UINT64_BE (*payload + 12, (guint64) cur);
(guint64) GST_EVENT_SEEK_ENDOFFSET (event)); GST_WRITE_UINT32_BE (*payload + 20, (guint32) stop_type);
GST_WRITE_UINT32_BE (*payload + 20, GST_WRITE_UINT64_BE (*payload + 24, (guint64) stop);
(guint32) GST_EVENT_SEEK_ACCURACY (event));
*/
break; break;
}
case GST_EVENT_QOS: case GST_EVENT_QOS:
case GST_EVENT_NAVIGATION: case GST_EVENT_NAVIGATION:
case GST_EVENT_TAG: case GST_EVENT_TAG:
@ -481,19 +490,24 @@ gst_dp_event_from_packet (guint header_length, const guint8 * header,
break; break;
case GST_EVENT_SEEK: case GST_EVENT_SEEK:
{ {
/* gdouble rate;
GstSeekType type; GstFormat format;
gint64 offset, endoffset; GstSeekFlags flags;
GstSeekAccuracy accuracy; GstSeekType cur_type, stop_type;
gint64 cur, stop;
type = (GstSeekType) GST_READ_UINT32_BE (payload); /* FIXME, read rate */
offset = (gint64) GST_READ_UINT64_BE (payload + 4); rate = 1.0;
endoffset = (gint64) GST_READ_UINT64_BE (payload + 12); format = (GstFormat) GST_READ_UINT32_BE (payload);
accuracy = (GstSeekAccuracy) GST_READ_UINT32_BE (payload + 20); flags = (GstSeekFlags) GST_READ_UINT32_BE (payload + 4);
event = gst_event_new_segment_seek (type, offset, endoffset); cur_type = (GstSeekType) GST_READ_UINT32_BE (payload + 8);
GST_EVENT_TIMESTAMP (event) = GST_DP_HEADER_TIMESTAMP (header); cur = (gint64) GST_READ_UINT64_BE (payload + 12);
GST_EVENT_SEEK_ACCURACY (event) = accuracy; stop_type = (GstSeekType) GST_READ_UINT32_BE (payload + 20);
*/ stop = (gint64) GST_READ_UINT64_BE (payload + 24);
event = gst_event_new_seek (rate, format, flags, cur_type, cur,
stop_type, stop);
GST_EVENT_TIMESTAMP (event) = GST_DP_HEADER_TIMESTAMP (header);
break; break;
} }
case GST_EVENT_QOS: case GST_EVENT_QOS: