• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  *
3  * unit test for GstMessage
4  *
5  * Copyright (C) <2005> Wim Taymans <wim at fluendo dot com>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22 #ifdef HAVE_CONFIG_H
23 #include "config.h"
24 #endif
25 
26 #include <gst/check/gstcheck.h>
27 
28 static GQuark domain;
29 
GST_START_TEST(test_parsing)30 GST_START_TEST (test_parsing)
31 {
32   GstMessage *message;
33 
34   domain = g_quark_from_static_string ("test");
35 
36   /* GST_MESSAGE_EOS */
37   {
38     GstStructure *s;
39 
40     message = gst_message_new_eos (NULL);
41     fail_if (message == NULL);
42     fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_EOS);
43     fail_unless (GST_MESSAGE_SRC (message) == NULL);
44 
45     /* Add an extra field */
46     s = gst_message_writable_structure (message);
47     fail_if (s == NULL);
48     gst_structure_set (s, "eos-extra-field", G_TYPE_BOOLEAN, TRUE, NULL);
49 
50     gst_message_unref (message);
51   }
52   /* GST_MESSAGE_ERROR */
53   {
54     GError *error = NULL;
55     gchar *debug;
56 
57     error = g_error_new (domain, 10, "test error");
58     fail_if (error == NULL);
59     message = gst_message_new_error (NULL, error, "error string");
60     fail_if (message == NULL);
61     fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR);
62     fail_unless (GST_MESSAGE_SRC (message) == NULL);
63 
64     g_error_free (error);
65     error = NULL;
66     debug = NULL;
67 
68     gst_message_parse_error (message, NULL, NULL);
69 
70     gst_message_parse_error (message, &error, &debug);
71     fail_if (error == NULL);
72     fail_if (debug == NULL);
73     fail_unless (strcmp (error->message, "test error") == 0);
74     fail_unless (error->domain == domain);
75     fail_unless (error->code == 10);
76     fail_unless (strcmp (debug, "error string") == 0);
77 
78     gst_message_unref (message);
79     g_error_free (error);
80     g_free (debug);
81   }
82   /* GST_MESSAGE_ERROR with details */
83   {
84     GError *error = NULL;
85     gchar *debug;
86     GstStructure *d;
87     const GstStructure *dc;
88 
89     error = g_error_new (domain, 10, "test error");
90     fail_if (error == NULL);
91     d = gst_structure_new ("title", "test-field", G_TYPE_STRING,
92         "test-contents", NULL);
93     message =
94         gst_message_new_error_with_details (NULL, error, "error string", d);
95     fail_if (message == NULL);
96     fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR);
97     fail_unless (GST_MESSAGE_SRC (message) == NULL);
98 
99     g_error_free (error);
100     error = NULL;
101     debug = NULL;
102 
103     gst_message_parse_error (message, NULL, NULL);
104 
105     gst_message_parse_error (message, &error, &debug);
106     fail_if (error == NULL);
107     fail_if (debug == NULL);
108     fail_unless (strcmp (error->message, "test error") == 0);
109     fail_unless (error->domain == domain);
110     fail_unless (error->code == 10);
111     fail_unless (strcmp (debug, "error string") == 0);
112     gst_message_parse_error_details (message, &dc);
113     fail_unless (dc != NULL);
114     fail_unless (gst_structure_has_field_typed (dc, "test-field",
115             G_TYPE_STRING));
116     fail_unless (gst_structure_get_string (dc, "test-field"), "test-contents");
117 
118     gst_message_unref (message);
119     g_error_free (error);
120     g_free (debug);
121   }
122   /* GST_MESSAGE_WARNING   */
123   {
124     GError *warning = NULL;
125     gchar *debug;
126 
127     warning = g_error_new (domain, 10, "test warning");
128     fail_if (warning == NULL);
129     message = gst_message_new_warning (NULL, warning, "warning string");
130     fail_if (message == NULL);
131     fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_WARNING);
132     fail_unless (GST_MESSAGE_SRC (message) == NULL);
133 
134     g_error_free (warning);
135     warning = NULL;
136     debug = NULL;
137 
138     gst_message_parse_warning (message, NULL, NULL);
139 
140     gst_message_parse_warning (message, &warning, &debug);
141     fail_if (warning == NULL);
142     fail_if (debug == NULL);
143     fail_unless (strcmp (warning->message, "test warning") == 0);
144     fail_unless (warning->domain == domain);
145     fail_unless (warning->code == 10);
146     fail_unless (strcmp (debug, "warning string") == 0);
147 
148     gst_message_unref (message);
149     g_error_free (warning);
150     g_free (debug);
151   }
152   /* GST_MESSAGE_INFO   */
153   {
154     GError *info = NULL;
155     gchar *debug;
156 
157     info = g_error_new (domain, 10, "test info");
158     fail_if (info == NULL);
159     message = gst_message_new_info (NULL, info, "info string");
160     fail_if (message == NULL);
161     fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_INFO);
162     fail_unless (GST_MESSAGE_SRC (message) == NULL);
163 
164     g_error_free (info);
165     info = NULL;
166     debug = NULL;
167 
168     gst_message_parse_info (message, NULL, NULL);
169 
170     gst_message_parse_info (message, &info, &debug);
171     fail_if (info == NULL);
172     fail_if (debug == NULL);
173     fail_unless (strcmp (info->message, "test info") == 0);
174     fail_unless (info->domain == domain);
175     fail_unless (info->code == 10);
176     fail_unless (strcmp (debug, "info string") == 0);
177 
178     gst_message_unref (message);
179     g_error_free (info);
180     g_free (debug);
181   }
182   /* GST_MESSAGE_TAG  */
183   {
184     GstTagList *tag;
185 
186     /* FIXME, do some more tag adding */
187     tag = gst_tag_list_new_empty ();
188     fail_if (tag == NULL);
189     message = gst_message_new_tag (NULL, tag);
190     fail_if (message == NULL);
191     fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TAG);
192     fail_unless (GST_MESSAGE_SRC (message) == NULL);
193     tag = NULL;
194     gst_message_parse_tag (message, &tag);
195     fail_if (tag == NULL);
196     /* FIXME, check the actual tags */
197     gst_message_unref (message);
198     gst_tag_list_unref (tag);
199   }
200   /* GST_MESSAGE_BUFFERING   */
201   {
202   }
203   /* GST_MESSAGE_STATE_CHANGED   */
204   {
205     GstState oldstate, newstate, pending;
206 
207     oldstate = GST_STATE_PAUSED;
208     newstate = GST_STATE_PLAYING;
209     pending = GST_STATE_VOID_PENDING;
210 
211     message = gst_message_new_state_changed (NULL, oldstate, newstate, pending);
212     fail_if (message == NULL);
213     fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STATE_CHANGED);
214     fail_unless (GST_MESSAGE_SRC (message) == NULL);
215 
216     /* set some wrong values to check if the parse method overwrites them
217      * with the good values */
218     oldstate = GST_STATE_READY;
219     newstate = GST_STATE_READY;
220     pending = GST_STATE_READY;
221     gst_message_parse_state_changed (message, &oldstate, &newstate, &pending);
222     fail_unless (oldstate == GST_STATE_PAUSED);
223     fail_unless (newstate == GST_STATE_PLAYING);
224     fail_unless (pending == GST_STATE_VOID_PENDING);
225 
226     gst_message_unref (message);
227   }
228   /* GST_MESSAGE_STEP_DONE   */
229   {
230   }
231   /* GST_MESSAGE_NEW_CLOCK  */
232   {
233   }
234   /* GST_MESSAGE_STRUCTURE_CHANGE  */
235   {
236   }
237   /* GST_MESSAGE_STREAM_STATUS  */
238   {
239   }
240   /* GST_MESSAGE_APPLICATION */
241   {
242     GstStructure *structure;
243     const GstStructure *struc;
244     gint some_int;
245     gdouble a_double;
246 
247     structure = gst_structure_new ("test_struct",
248         "some_int", G_TYPE_INT, 10,
249         "a_double", G_TYPE_DOUBLE, (gdouble) 1.8, NULL);
250     fail_if (structure == NULL);
251     message = gst_message_new_application (NULL, structure);
252     fail_if (message == NULL);
253     struc = gst_message_get_structure (message);
254     fail_if (struc == NULL);
255     fail_unless (gst_structure_get_int (struc, "some_int", &some_int));
256     fail_unless (gst_structure_get_double (struc, "a_double", &a_double));
257     fail_unless (some_int == 10);
258     fail_unless (a_double == 1.8);
259 
260     gst_message_unref (message);
261   }
262 
263   /*
264      void            gst_message_parse_tag           (GstMessage *message, GstTagList **tag_list);
265      void            gst_message_parse_state_changed (GstMessage *message, GstState *old_state,
266      GstState *new_state);
267      void            gst_message_parse_error         (GstMessage *message, GError **gerror, gchar **debug);
268      void            gst_message_parse_warning       (GstMessage *message, GError **gerror, gchar **debug);
269    */
270 
271   /* GST_MESSAGE_STREAM_STATUS   */
272   {
273     GstStreamStatusType type;
274     GstTask *task, *task2;
275     GValue value = { 0 };
276     const GValue *val;
277 
278     message =
279         gst_message_new_stream_status (NULL, GST_STREAM_STATUS_TYPE_ENTER,
280         NULL);
281     fail_if (message == NULL);
282     fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STREAM_STATUS);
283     fail_unless (GST_MESSAGE_SRC (message) == NULL);
284 
285     /* set some wrong values to check if the parse method overwrites them
286      * with the good values */
287     type = GST_STREAM_STATUS_TYPE_START;
288     gst_message_parse_stream_status (message, &type, NULL);
289     fail_unless (type == GST_STREAM_STATUS_TYPE_ENTER);
290 
291     /* create a task with some dummy function, we're not actually going to run
292      * the task here */
293     task = gst_task_new ((GstTaskFunction) gst_object_unref, NULL, NULL);
294 
295     ASSERT_OBJECT_REFCOUNT (task, "task", 1);
296 
297     /* set the task */
298     g_value_init (&value, GST_TYPE_TASK);
299     g_value_set_object (&value, task);
300 
301     ASSERT_OBJECT_REFCOUNT (task, "task", 2);
302 
303     gst_message_set_stream_status_object (message, &value);
304     ASSERT_OBJECT_REFCOUNT (task, "task", 3);
305     g_value_unset (&value);
306     ASSERT_OBJECT_REFCOUNT (task, "task", 2);
307     gst_object_unref (task);
308     ASSERT_OBJECT_REFCOUNT (task, "task", 1);
309 
310     /* get the object back, no refcount is changed */
311     val = gst_message_get_stream_status_object (message);
312     ASSERT_OBJECT_REFCOUNT (task, "task", 1);
313 
314     task2 = g_value_get_object (val);
315 
316     fail_unless (GST_IS_TASK (task2));
317     fail_unless (task2 == task);
318 
319     ASSERT_OBJECT_REFCOUNT (task, "task", 1);
320     ASSERT_OBJECT_REFCOUNT (task2, "task", 1);
321 
322     gst_message_unref (message);
323   }
324 
325   /* GST_MESSAGE_REQUEST_STATE   */
326   {
327     GstState state;
328 
329     state = GST_STATE_PAUSED;
330 
331     message = gst_message_new_request_state (NULL, state);
332     fail_if (message == NULL);
333     fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_REQUEST_STATE);
334     fail_unless (GST_MESSAGE_SRC (message) == NULL);
335 
336     /* set some wrong values to check if the parse method overwrites them
337      * with the good values */
338     state = GST_STATE_READY;
339     gst_message_parse_request_state (message, &state);
340     fail_unless (state == GST_STATE_PAUSED);
341 
342     gst_message_unref (message);
343   }
344   /* GST_MESSAGE_QOS   */
345   {
346     gboolean live;
347     GstClockTime running_time;
348     GstClockTime stream_time;
349     GstClockTime timestamp, duration;
350     gint64 jitter;
351     gdouble proportion;
352     gint quality;
353     GstFormat format;
354     guint64 processed;
355     guint64 dropped;
356 
357     running_time = 1 * GST_SECOND;
358     stream_time = 2 * GST_SECOND;
359     timestamp = 3 * GST_SECOND;
360     duration = 4 * GST_SECOND;
361 
362     message =
363         gst_message_new_qos (NULL, TRUE, running_time, stream_time, timestamp,
364         duration);
365     fail_if (message == NULL);
366     fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_QOS);
367     fail_unless (GST_MESSAGE_SRC (message) == NULL);
368 
369     /* check defaults */
370     gst_message_parse_qos_values (message, &jitter, &proportion, &quality);
371     fail_unless (jitter == 0);
372     fail_unless (proportion == 1.0);
373     fail_unless (quality == 1000000);
374 
375     gst_message_parse_qos_stats (message, &format, &processed, &dropped);
376     fail_unless (format == GST_FORMAT_UNDEFINED);
377     fail_unless (processed == -1);
378     fail_unless (dropped == -1);
379 
380     /* set some wrong values to check if the parse method overwrites them
381      * with the good values */
382     running_time = stream_time = timestamp = duration = 5 * GST_SECOND;
383     live = FALSE;
384     gst_message_parse_qos (message, &live, &running_time, &stream_time,
385         &timestamp, &duration);
386     fail_unless (live == TRUE);
387     fail_unless (running_time == 1 * GST_SECOND);
388     fail_unless (stream_time == 2 * GST_SECOND);
389     fail_unless (timestamp == 3 * GST_SECOND);
390     fail_unless (duration == 4 * GST_SECOND);
391 
392     /* change some values */
393     gst_message_set_qos_values (message, -10, 2.0, 5000);
394     gst_message_parse_qos_values (message, &jitter, &proportion, &quality);
395     fail_unless (jitter == -10);
396     fail_unless (proportion == 2.0);
397     fail_unless (quality == 5000);
398 
399     gst_message_set_qos_stats (message, GST_FORMAT_DEFAULT, 1030, 65);
400     gst_message_parse_qos_stats (message, &format, &processed, &dropped);
401     fail_unless (format == GST_FORMAT_DEFAULT);
402     fail_unless (processed == 1030);
403     fail_unless (dropped == 65);
404 
405     gst_message_unref (message);
406   }
407   /* GST_MESSAGE_PROGRESS   */
408   {
409     GstProgressType type;
410     gchar *category, *text;
411 
412     message =
413         gst_message_new_progress (NULL, GST_PROGRESS_TYPE_START, "connecting",
414         "Connecting to youtbue.com");
415     fail_if (message == NULL);
416     fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_PROGRESS);
417     fail_unless (GST_MESSAGE_SRC (message) == NULL);
418 
419     /* set some wrong values to check if the parse method overwrites them
420      * with the good values */
421     type = GST_PROGRESS_TYPE_ERROR;
422     gst_message_parse_progress (message, &type, &category, &text);
423     fail_unless (type == GST_PROGRESS_TYPE_START);
424     fail_unless (!strcmp (category, "connecting"));
425     fail_unless (!strcmp (text, "Connecting to youtbue.com"));
426     g_free (category);
427     g_free (text);
428 
429     gst_message_unref (message);
430   }
431   /* GST_MESSAGE_STREAM_COLLECTION */
432   {
433     GstMessage *message;
434     GstStreamCollection *collection, *res = NULL;
435     GstStream *stream1, *stream2;
436     GstCaps *caps1, *caps2;
437 
438     /* Create a collection of two streams */
439     caps1 = gst_caps_from_string ("some/caps");
440     caps2 = gst_caps_from_string ("some/other-string");
441 
442     stream1 = gst_stream_new ("stream-1", caps1, GST_STREAM_TYPE_AUDIO, 0);
443     stream2 = gst_stream_new ("stream-2", caps2, GST_STREAM_TYPE_VIDEO, 0);
444 
445     collection = gst_stream_collection_new ("something");
446     fail_unless (gst_stream_collection_add_stream (collection, stream1));
447     fail_unless (gst_stream_collection_add_stream (collection, stream2));
448 
449     message = gst_message_new_stream_collection (NULL, collection);
450     fail_unless (message != NULL);
451 
452     gst_message_parse_stream_collection (message, &res);
453     fail_unless (res != NULL);
454 
455     gst_message_unref (message);
456     gst_object_unref (res);
457     gst_object_unref (collection);
458     gst_caps_unref (caps1);
459     gst_caps_unref (caps2);
460   }
461   /* GST_MESSAGE_STREAMS_SELECTED */
462   {
463     GstMessage *message;
464     GstStreamCollection *collection, *res = NULL;
465     GstStream *stream1, *stream2, *stream3;
466     GstCaps *caps1, *caps2;
467 
468     /* Create a collection of two streams */
469     caps1 = gst_caps_from_string ("some/caps");
470     caps2 = gst_caps_from_string ("some/other-string");
471 
472     stream1 = gst_stream_new ("stream-1", caps1, GST_STREAM_TYPE_AUDIO, 0);
473     stream2 = gst_stream_new ("stream-2", caps2, GST_STREAM_TYPE_VIDEO, 0);
474 
475     collection = gst_stream_collection_new ("something");
476     fail_unless (gst_stream_collection_add_stream (collection, stream1));
477     fail_unless (gst_stream_collection_add_stream (collection, stream2));
478 
479     message = gst_message_new_streams_selected (NULL, collection);
480     fail_unless (message != NULL);
481 
482     gst_message_parse_streams_selected (message, &res);
483     fail_unless (res != NULL);
484 
485     fail_unless (gst_message_streams_selected_get_size (message) == 0);
486     gst_object_unref (res);
487     gst_message_unref (message);
488 
489     /* Once again, this time with a stream in it */
490     message = gst_message_new_streams_selected (NULL, collection);
491     fail_unless (message != NULL);
492 
493     gst_message_streams_selected_add (message, stream1);
494 
495     gst_message_parse_streams_selected (message, &res);
496     fail_unless (res != NULL);
497 
498     /* There is only one stream ! */
499     fail_unless (gst_message_streams_selected_get_size (message) == 1);
500 
501     stream3 = gst_message_streams_selected_get_stream (message, 0);
502     fail_unless (stream3 != NULL);
503     gst_object_unref (stream3);
504 
505     /* Should fail */
506     ASSERT_CRITICAL (gst_message_streams_selected_get_stream (message, 1));
507 
508     gst_object_unref (res);
509     gst_message_unref (message);
510 
511     gst_object_unref (collection);
512     gst_caps_unref (caps1);
513     gst_caps_unref (caps2);
514   }
515   /* GST_MESSAGE_REDIRECT */
516   {
517     const gchar *parsed_location;
518     GstTagList *parsed_tag_list;
519     const GstStructure *parsed_structure;
520     const gchar *test_location = "some-location";
521     const gchar *test_struct_name = "test-struct";
522     const gchar *test_value_name = "foo";
523     const gint test_value = 12345;
524     const guint test_bitrate = 120000;
525     gint value;
526     guint bitrate;
527     GstTagList *test_tag_list;
528     GstStructure *test_structure;
529 
530     test_structure =
531         gst_structure_new (test_struct_name, test_value_name, G_TYPE_INT,
532         test_value, NULL);
533 
534     /* Create a test tag list. It is ref'd  before adding an entry to be able
535      * to test that new_redirect takes ownership */
536     test_tag_list = gst_tag_list_new (GST_TAG_BITRATE, test_bitrate, NULL);
537 
538     /* Create the message and add the first entry, which only has a location
539      * and a tag list */
540     gst_tag_list_ref (test_tag_list);
541     message =
542         gst_message_new_redirect (NULL, test_location, test_tag_list, NULL);
543     fail_if (message == NULL);
544     fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_REDIRECT);
545     fail_unless (GST_MESSAGE_SRC (message) == NULL);
546 
547     /* Add the second entry, which only has a location and a structure */
548     gst_message_add_redirect_entry (message, test_location, NULL,
549         gst_structure_copy (test_structure));
550 
551     /* Add the third entry, which has a location, a taglist, and a structure */
552     gst_tag_list_ref (test_tag_list);
553     gst_message_add_redirect_entry (message, test_location, test_tag_list,
554         gst_structure_copy (test_structure));
555 
556     fail_unless (gst_message_get_num_redirect_entries (message) == 3);
557 
558     /* Check that the location of the first entry is correct and that the
559      * structure pointer is set to NULL */
560     parsed_location = NULL;
561     parsed_tag_list = NULL;
562     parsed_structure = (const GstStructure *) 0x1;
563     gst_message_parse_redirect_entry (message, 0, &parsed_location,
564         &parsed_tag_list, &parsed_structure);
565     fail_unless (parsed_location != NULL);
566     fail_unless (parsed_tag_list != NULL);
567     fail_unless (parsed_structure == NULL);
568     fail_unless (!strcmp (parsed_location, test_location));
569     fail_unless (gst_tag_list_get_uint (parsed_tag_list, GST_TAG_BITRATE,
570             &bitrate) && (bitrate == test_bitrate));
571 
572     /* Check that the structure of the second entry is correct and that the
573      * tag list pointer is set to NULL */
574     parsed_location = NULL;
575     parsed_tag_list = (GstTagList *) 0x1;
576     parsed_structure = NULL;
577     gst_message_parse_redirect_entry (message, 1, &parsed_location,
578         &parsed_tag_list, &parsed_structure);
579     fail_unless (parsed_location != NULL);
580     fail_unless (parsed_tag_list == NULL);
581     fail_unless (parsed_structure != NULL);
582     fail_unless (!strcmp (parsed_location, test_location));
583     fail_unless (!strcmp (gst_structure_get_name (parsed_structure),
584             test_struct_name));
585     fail_unless (gst_structure_get_int (parsed_structure, test_value_name,
586             &value) && (value == test_value));
587 
588     /* Check that the location, tag list, and structure pointers of the
589      * third entry are correct */
590     parsed_location = NULL;
591     parsed_tag_list = NULL;
592     parsed_structure = NULL;
593     gst_message_parse_redirect_entry (message, 2, &parsed_location,
594         &parsed_tag_list, &parsed_structure);
595     fail_unless (parsed_location != NULL);
596     fail_unless (parsed_tag_list != NULL);
597     fail_unless (parsed_structure != NULL);
598     fail_unless (!strcmp (parsed_location, test_location));
599     fail_unless (!strcmp (gst_structure_get_name (parsed_structure),
600             test_struct_name));
601     fail_unless (gst_tag_list_get_uint (parsed_tag_list, GST_TAG_BITRATE,
602             &bitrate) && (bitrate == test_bitrate));
603     fail_unless (gst_structure_get_int (parsed_structure, test_value_name,
604             &value) && (value == test_value));
605 
606     gst_message_unref (message);
607 
608     /* Since the message takes ownership over the tag list, its refcount
609      * must have been decreased after each added entry */
610     fail_unless_equals_int (GST_MINI_OBJECT_REFCOUNT_VALUE (test_tag_list), 1);
611 
612     gst_structure_free (test_structure);
613     gst_tag_list_unref (test_tag_list);
614   }
615   /* GST_MESSAGE_RATE_CHANGE */
616   {
617     gdouble rate_multiplier;
618 
619     message = gst_message_new_instant_rate_request (NULL, 1.5);
620     fail_if (message == NULL);
621     fail_unless (GST_MESSAGE_TYPE (message) ==
622         GST_MESSAGE_INSTANT_RATE_REQUEST);
623     fail_unless (GST_MESSAGE_SRC (message) == NULL);
624 
625     gst_message_parse_instant_rate_request (message, &rate_multiplier);
626     fail_unless (rate_multiplier == 1.5);
627 
628     gst_message_unref (message);
629   }
630 }
631 
632 GST_END_TEST;
633 
634 static Suite *
gst_message_suite(void)635 gst_message_suite (void)
636 {
637   Suite *s = suite_create ("GstMessage");
638   TCase *tc_chain = tcase_create ("general");
639 
640   suite_add_tcase (s, tc_chain);
641   tcase_add_test (tc_chain, test_parsing);
642 
643   return s;
644 }
645 
646 GST_CHECK_MAIN (gst_message);
647