Fix compilation and fix event serialization.

Original commit message from CVS:
* check/gst-libs/gdp.c: (GST_START_TEST):
* gst/elements/gstfakesink.c: (gst_fake_sink_event):
Fix compilation and fix event serialization.
This commit is contained in:
Wim Taymans 2005-07-27 18:47:48 +00:00
parent 66d7070ef1
commit 7b1c29b05e
5 changed files with 66 additions and 34 deletions

View file

@ -1,3 +1,9 @@
2005-07-27 Wim Taymans <wim@fluendo.com>
* check/gst-libs/gdp.c: (GST_START_TEST):
* gst/elements/gstfakesink.c: (gst_fake_sink_event):
Fix compilation and fix event serialization.
2005-07-27 Wim Taymans <wim@fluendo.com> 2005-07-27 Wim Taymans <wim@fluendo.com>
* CHANGES-0.9: * CHANGES-0.9:

View file

@ -192,7 +192,7 @@ GST_START_TEST (test_event)
guint8 *header, *payload; guint8 *header, *payload;
g_message ("Testing EOS event at 1s\n"); g_message ("Testing EOS event at 1s\n");
send = gst_event_new (GST_EVENT_EOS); send = gst_event_new_eos ();
GST_EVENT_TIMESTAMP (send) = GST_SECOND; GST_EVENT_TIMESTAMP (send) = GST_SECOND;
fail_unless (gst_dp_packet_from_event (send, GST_DP_HEADER_FLAG_CRC, fail_unless (gst_dp_packet_from_event (send, GST_DP_HEADER_FLAG_CRC,
&header_length, &header, &payload), &header_length, &header, &payload),
@ -214,7 +214,7 @@ GST_START_TEST (test_event)
gst_event_unref (receive); gst_event_unref (receive);
g_message ("Testing FLUSH event at 2s\n"); g_message ("Testing FLUSH event at 2s\n");
send = gst_event_new (GST_EVENT_FLUSH); send = gst_event_new_flush_start ();
GST_EVENT_TIMESTAMP (send) = GST_SECOND * 2; GST_EVENT_TIMESTAMP (send) = GST_SECOND * 2;
fail_unless (gst_dp_packet_from_event (send, GST_DP_HEADER_FLAG_CRC, fail_unless (gst_dp_packet_from_event (send, GST_DP_HEADER_FLAG_CRC,
&header_length, &header, &payload), &header_length, &header, &payload),
@ -224,7 +224,7 @@ GST_START_TEST (test_event)
g_message ("Flush, timestamp %" GST_TIME_FORMAT "\n", g_message ("Flush, timestamp %" GST_TIME_FORMAT "\n",
GST_TIME_ARGS (GST_EVENT_TIMESTAMP (receive))); GST_TIME_ARGS (GST_EVENT_TIMESTAMP (receive)));
fail_unless (GST_EVENT_TYPE (receive) == GST_EVENT_FLUSH, fail_unless (GST_EVENT_TYPE (receive) == GST_EVENT_FLUSH_START,
"Received event is not flush"); "Received event is not flush");
fail_unless (GST_EVENT_TIMESTAMP (receive) == GST_SECOND * 2, fail_unless (GST_EVENT_TIMESTAMP (receive) == GST_SECOND * 2,
"Flush timestamp is not 2.0 sec"); "Flush timestamp is not 2.0 sec");
@ -236,7 +236,9 @@ GST_START_TEST (test_event)
gst_event_unref (receive); gst_event_unref (receive);
g_message ("Testing SEEK event with 1 second at 3 seconds\n"); g_message ("Testing SEEK event with 1 second at 3 seconds\n");
send = gst_event_new_seek (GST_FORMAT_TIME, GST_SECOND); send =
gst_event_new_seek (1.0, GST_FORMAT_TIME, 0, GST_SEEK_TYPE_SET,
GST_SECOND, GST_SEEK_TYPE_NONE, 0);
GST_EVENT_TIMESTAMP (send) = GST_SECOND * 3; GST_EVENT_TIMESTAMP (send) = GST_SECOND * 3;
fail_unless (gst_dp_packet_from_event (send, GST_DP_HEADER_FLAG_CRC, fail_unless (gst_dp_packet_from_event (send, GST_DP_HEADER_FLAG_CRC,
&header_length, &header, &payload), &header_length, &header, &payload),
@ -244,17 +246,26 @@ GST_START_TEST (test_event)
receive = gst_dp_event_from_packet (header_length, header, payload); receive = gst_dp_event_from_packet (header_length, header, payload);
g_message ("Seek, timestamp %" GST_TIME_FORMAT ", to %" GST_TIME_FORMAT "\n", {
GST_TIME_ARGS (GST_EVENT_TIMESTAMP (receive)), gdouble rate;
GST_TIME_ARGS (GST_EVENT_SEEK_OFFSET (receive))); GstFormat format;
GstSeekFlags flags;
GstSeekType cur_type, stop_type;
gint64 cur, stop;
gst_event_parse_seek (receive, &rate, &format, &flags,
&cur_type, &cur, &stop_type, &stop);
g_message ("Seek, timestamp %" GST_TIME_FORMAT ", to %" GST_TIME_FORMAT
"\n", GST_TIME_ARGS (GST_EVENT_TIMESTAMP (receive)),
GST_TIME_ARGS (cur));
fail_unless (GST_EVENT_TYPE (receive) == GST_EVENT_SEEK, fail_unless (GST_EVENT_TYPE (receive) == GST_EVENT_SEEK,
"Returned event is not seek"); "Returned event is not seek");
fail_unless (GST_EVENT_TIMESTAMP (receive) == GST_SECOND * 3, fail_unless (GST_EVENT_TIMESTAMP (receive) == GST_SECOND * 3,
"Seek timestamp is not 3.0 sec"); "Seek timestamp is not 3.0 sec");
fail_unless (GST_EVENT_SEEK_FORMAT (receive) == GST_FORMAT_TIME, fail_unless (format == GST_FORMAT_TIME, "Seek format is not time");
"Seek format is not time"); fail_unless (cur == GST_SECOND, "Seek cur is not 1.0 sec");
fail_unless (GST_EVENT_SEEK_OFFSET (receive) == GST_SECOND, }
"Seek offset is not 1.0 sec");
/* clean up */ /* clean up */
g_free (header); g_free (header);

View file

@ -280,8 +280,10 @@ gst_fake_sink_event (GstBaseSink * bsink, GstEvent * event)
g_free (sink->last_message); g_free (sink->last_message);
s = gst_event_get_structure (event); if ((s = gst_event_get_structure (event)))
sstr = gst_structure_to_string (s); sstr = gst_structure_to_string (s);
else
sstr = g_strdup ("");
sink->last_message = sink->last_message =
g_strdup_printf ("event ******* E (type: %d, %s) %p", g_strdup_printf ("event ******* E (type: %d, %s) %p",

View file

@ -280,8 +280,10 @@ gst_fake_sink_event (GstBaseSink * bsink, GstEvent * event)
g_free (sink->last_message); g_free (sink->last_message);
s = gst_event_get_structure (event); if ((s = gst_event_get_structure (event)))
sstr = gst_structure_to_string (s); sstr = gst_structure_to_string (s);
else
sstr = g_strdup ("");
sink->last_message = sink->last_message =
g_strdup_printf ("event ******* E (type: %d, %s) %p", g_strdup_printf ("event ******* E (type: %d, %s) %p",

View file

@ -192,7 +192,7 @@ GST_START_TEST (test_event)
guint8 *header, *payload; guint8 *header, *payload;
g_message ("Testing EOS event at 1s\n"); g_message ("Testing EOS event at 1s\n");
send = gst_event_new (GST_EVENT_EOS); send = gst_event_new_eos ();
GST_EVENT_TIMESTAMP (send) = GST_SECOND; GST_EVENT_TIMESTAMP (send) = GST_SECOND;
fail_unless (gst_dp_packet_from_event (send, GST_DP_HEADER_FLAG_CRC, fail_unless (gst_dp_packet_from_event (send, GST_DP_HEADER_FLAG_CRC,
&header_length, &header, &payload), &header_length, &header, &payload),
@ -214,7 +214,7 @@ GST_START_TEST (test_event)
gst_event_unref (receive); gst_event_unref (receive);
g_message ("Testing FLUSH event at 2s\n"); g_message ("Testing FLUSH event at 2s\n");
send = gst_event_new (GST_EVENT_FLUSH); send = gst_event_new_flush_start ();
GST_EVENT_TIMESTAMP (send) = GST_SECOND * 2; GST_EVENT_TIMESTAMP (send) = GST_SECOND * 2;
fail_unless (gst_dp_packet_from_event (send, GST_DP_HEADER_FLAG_CRC, fail_unless (gst_dp_packet_from_event (send, GST_DP_HEADER_FLAG_CRC,
&header_length, &header, &payload), &header_length, &header, &payload),
@ -224,7 +224,7 @@ GST_START_TEST (test_event)
g_message ("Flush, timestamp %" GST_TIME_FORMAT "\n", g_message ("Flush, timestamp %" GST_TIME_FORMAT "\n",
GST_TIME_ARGS (GST_EVENT_TIMESTAMP (receive))); GST_TIME_ARGS (GST_EVENT_TIMESTAMP (receive)));
fail_unless (GST_EVENT_TYPE (receive) == GST_EVENT_FLUSH, fail_unless (GST_EVENT_TYPE (receive) == GST_EVENT_FLUSH_START,
"Received event is not flush"); "Received event is not flush");
fail_unless (GST_EVENT_TIMESTAMP (receive) == GST_SECOND * 2, fail_unless (GST_EVENT_TIMESTAMP (receive) == GST_SECOND * 2,
"Flush timestamp is not 2.0 sec"); "Flush timestamp is not 2.0 sec");
@ -236,7 +236,9 @@ GST_START_TEST (test_event)
gst_event_unref (receive); gst_event_unref (receive);
g_message ("Testing SEEK event with 1 second at 3 seconds\n"); g_message ("Testing SEEK event with 1 second at 3 seconds\n");
send = gst_event_new_seek (GST_FORMAT_TIME, GST_SECOND); send =
gst_event_new_seek (1.0, GST_FORMAT_TIME, 0, GST_SEEK_TYPE_SET,
GST_SECOND, GST_SEEK_TYPE_NONE, 0);
GST_EVENT_TIMESTAMP (send) = GST_SECOND * 3; GST_EVENT_TIMESTAMP (send) = GST_SECOND * 3;
fail_unless (gst_dp_packet_from_event (send, GST_DP_HEADER_FLAG_CRC, fail_unless (gst_dp_packet_from_event (send, GST_DP_HEADER_FLAG_CRC,
&header_length, &header, &payload), &header_length, &header, &payload),
@ -244,17 +246,26 @@ GST_START_TEST (test_event)
receive = gst_dp_event_from_packet (header_length, header, payload); receive = gst_dp_event_from_packet (header_length, header, payload);
g_message ("Seek, timestamp %" GST_TIME_FORMAT ", to %" GST_TIME_FORMAT "\n", {
GST_TIME_ARGS (GST_EVENT_TIMESTAMP (receive)), gdouble rate;
GST_TIME_ARGS (GST_EVENT_SEEK_OFFSET (receive))); GstFormat format;
GstSeekFlags flags;
GstSeekType cur_type, stop_type;
gint64 cur, stop;
gst_event_parse_seek (receive, &rate, &format, &flags,
&cur_type, &cur, &stop_type, &stop);
g_message ("Seek, timestamp %" GST_TIME_FORMAT ", to %" GST_TIME_FORMAT
"\n", GST_TIME_ARGS (GST_EVENT_TIMESTAMP (receive)),
GST_TIME_ARGS (cur));
fail_unless (GST_EVENT_TYPE (receive) == GST_EVENT_SEEK, fail_unless (GST_EVENT_TYPE (receive) == GST_EVENT_SEEK,
"Returned event is not seek"); "Returned event is not seek");
fail_unless (GST_EVENT_TIMESTAMP (receive) == GST_SECOND * 3, fail_unless (GST_EVENT_TIMESTAMP (receive) == GST_SECOND * 3,
"Seek timestamp is not 3.0 sec"); "Seek timestamp is not 3.0 sec");
fail_unless (GST_EVENT_SEEK_FORMAT (receive) == GST_FORMAT_TIME, fail_unless (format == GST_FORMAT_TIME, "Seek format is not time");
"Seek format is not time"); fail_unless (cur == GST_SECOND, "Seek cur is not 1.0 sec");
fail_unless (GST_EVENT_SEEK_OFFSET (receive) == GST_SECOND, }
"Seek offset is not 1.0 sec");
/* clean up */ /* clean up */
g_free (header); g_free (header);