• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  *
3  * unit test for the id3tag element
4  *
5  * Copyright (C) 2006 Tim-Philipp Müller  <tim centricular net>
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 
23 #include <gst/check/gstcheck.h>
24 
25 #include <gst/gst.h>
26 #include <string.h>
27 
28 #define TEST_ARTIST           "Ar T\303\255st"
29 #define TEST_TITLE            "M\303\274llermilch!"
30 #define TEST_ALBUM            "Boom"
31 #define TEST_DATE             g_date_new_dmy(1,1,2006)
32 #define TEST_TRACK_NUMBER     7
33 #define TEST_TRACK_COUNT      19
34 #define TEST_VOLUME_NUMBER    2
35 #define TEST_VOLUME_COUNT     3
36 #define TEST_TRACK_GAIN      1.45
37 #define TEST_ALBUM_GAIN      0.78
38 #define TEST_TRACK_PEAK      0.83
39 #define TEST_ALBUM_PEAK      0.18
40 #define TEST_BPM             113.0
41 
42 /* for dummy mp3 frame sized MP3_FRAME_SIZE bytes,
43  * start: ff fb b0 44 00 00 08 00  00 4b 00 00 00 00 00 00 */
44 static const guint8 mp3_dummyhdr[] = { 0xff, 0xfb, 0xb0, 0x44, 0x00, 0x00,
45   0x08, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00
46 };
47 
48 static const guint8 privatedata[] = { 0x99, 0x66, 0x33, 0x11, 0x22, 0x44 };
49 
50 #define MP3_FRAME_SIZE 626
51 
52 /* the peak and gain values are stored pretty roughly, so check that they're
53  * within 2% of the expected value.
54  */
55 #define fail_unless_sorta_equals_float(a, b)				\
56 G_STMT_START {								\
57   double first = a;							\
58   double second = b;							\
59   fail_unless(fabs (first - second) < (0.02 * fabs (first)),		\
60       "'" #a "' (%g) is not equal to '" #b "' (%g)", first, second);	\
61 } G_STMT_END;
62 
63 
64 static GstTagList *
test_taglib_id3mux_create_tags(guint32 mask)65 test_taglib_id3mux_create_tags (guint32 mask)
66 {
67   GstTagList *tags;
68 
69   tags = gst_tag_list_new_empty ();
70 
71   if (mask & (1 << 0)) {
72     gst_tag_list_add (tags, GST_TAG_MERGE_KEEP,
73         GST_TAG_ARTIST, TEST_ARTIST, NULL);
74   }
75   if (mask & (1 << 1)) {
76     gst_tag_list_add (tags, GST_TAG_MERGE_KEEP,
77         GST_TAG_TITLE, TEST_TITLE, NULL);
78   }
79   if (mask & (1 << 2)) {
80     gst_tag_list_add (tags, GST_TAG_MERGE_KEEP,
81         GST_TAG_ALBUM, TEST_ALBUM, NULL);
82   }
83   if (mask & (1 << 3)) {
84     GDate *date;
85 
86     date = TEST_DATE;
87     gst_tag_list_add (tags, GST_TAG_MERGE_KEEP, GST_TAG_DATE, date, NULL);
88     g_date_free (date);
89   }
90   if (mask & (1 << 4)) {
91     gst_tag_list_add (tags, GST_TAG_MERGE_KEEP,
92         GST_TAG_TRACK_NUMBER, TEST_TRACK_NUMBER, NULL);
93   }
94   if (mask & (1 << 5)) {
95     gst_tag_list_add (tags, GST_TAG_MERGE_KEEP,
96         GST_TAG_TRACK_COUNT, TEST_TRACK_COUNT, NULL);
97   }
98   if (mask & (1 << 6)) {
99     gst_tag_list_add (tags, GST_TAG_MERGE_KEEP,
100         GST_TAG_ALBUM_VOLUME_NUMBER, TEST_VOLUME_NUMBER, NULL);
101   }
102   if (mask & (1 << 7)) {
103     gst_tag_list_add (tags, GST_TAG_MERGE_KEEP,
104         GST_TAG_ALBUM_VOLUME_COUNT, TEST_VOLUME_COUNT, NULL);
105   }
106   if (mask & (1 << 8)) {
107     gst_tag_list_add (tags, GST_TAG_MERGE_KEEP,
108         GST_TAG_TRACK_GAIN, TEST_TRACK_GAIN, NULL);
109   }
110   if (mask & (1 << 9)) {
111     gst_tag_list_add (tags, GST_TAG_MERGE_KEEP,
112         GST_TAG_ALBUM_GAIN, TEST_ALBUM_GAIN, NULL);
113   }
114   if (mask & (1 << 10)) {
115     gst_tag_list_add (tags, GST_TAG_MERGE_KEEP,
116         GST_TAG_TRACK_PEAK, TEST_TRACK_PEAK, NULL);
117   }
118   if (mask & (1 << 11)) {
119     gst_tag_list_add (tags, GST_TAG_MERGE_KEEP,
120         GST_TAG_ALBUM_PEAK, TEST_ALBUM_PEAK, NULL);
121   }
122   if (mask & (1 << 12)) {
123     gst_tag_list_add (tags, GST_TAG_MERGE_KEEP,
124         GST_TAG_BEATS_PER_MINUTE, TEST_BPM, NULL);
125   }
126   if (mask & (1 << 13)) {
127     GstSample *sample;
128     GstBuffer *buf;
129 
130     buf = gst_buffer_new_and_alloc (sizeof (privatedata));
131     gst_buffer_fill (buf, 0, privatedata, sizeof (privatedata));
132     sample = gst_sample_new (buf, NULL, NULL,
133         gst_structure_new ("ID3PrivateFrame",
134             "owner", G_TYPE_STRING, "me", NULL));
135     gst_buffer_unref (buf);
136     gst_tag_list_add (tags, GST_TAG_MERGE_KEEP,
137         GST_TAG_PRIVATE_DATA, sample, NULL);
138     gst_sample_unref (sample);
139   }
140   if (mask & (1 << 14)) {
141   }
142   return tags;
143 }
144 
145 static gboolean
utf_string_in_buf(GstBuffer * buf,const gchar * s,int v2version)146 utf_string_in_buf (GstBuffer * buf, const gchar * s, int v2version)
147 {
148   gint i, len;
149   gchar *free_str = NULL;
150   GstMapInfo map;
151 
152   if (v2version == 3) {
153     free_str = g_convert (s, -1, "UTF-16LE", "UTF-8", NULL, NULL, NULL);
154     s = free_str;
155   }
156 
157   len = strlen (s);
158   gst_buffer_map (buf, &map, GST_MAP_READ);
159   for (i = 0; i < (map.size - len); ++i) {
160     if (memcmp (map.data + i, s, len) == 0) {
161       gst_buffer_unmap (buf, &map);
162       g_free (free_str);
163       return TRUE;
164     }
165   }
166   gst_buffer_unmap (buf, &map);
167 
168   g_free (free_str);
169   return FALSE;
170 }
171 
172 static void
test_taglib_id3mux_check_tag_buffer(GstBuffer * buf,guint32 mask,int v2version)173 test_taglib_id3mux_check_tag_buffer (GstBuffer * buf, guint32 mask,
174     int v2version)
175 {
176   /* make sure our UTF-8 string hasn't been put into the tag as ISO-8859-1 */
177   if (mask & (1 << 0)) {
178     fail_unless (utf_string_in_buf (buf, TEST_ARTIST, v2version));
179   }
180   /* make sure our UTF-8 string hasn't been put into the tag as ISO-8859-1 */
181   if (mask & (1 << 1)) {
182     fail_unless (utf_string_in_buf (buf, TEST_TITLE, v2version));
183   }
184   /* make sure our UTF-8 string hasn't been put into the tag as ISO-8859-1 */
185   if (mask & (1 << 2)) {
186     fail_unless (utf_string_in_buf (buf, TEST_ALBUM, v2version));
187   }
188 }
189 
190 static void
test_taglib_id3mux_check_tags(GstTagList * tags,guint32 mask,int v2version)191 test_taglib_id3mux_check_tags (GstTagList * tags, guint32 mask, int v2version)
192 {
193   if (mask & (1 << 0)) {
194     gchar *s = NULL;
195 
196     fail_unless (gst_tag_list_get_string (tags, GST_TAG_ARTIST, &s));
197     fail_unless (g_str_equal (s, TEST_ARTIST));
198     g_free (s);
199   }
200   if (mask & (1 << 1)) {
201     gchar *s = NULL;
202 
203     fail_unless (gst_tag_list_get_string (tags, GST_TAG_TITLE, &s));
204     fail_unless (g_str_equal (s, TEST_TITLE));
205     g_free (s);
206   }
207   if (mask & (1 << 2)) {
208     gchar *s = NULL;
209 
210     fail_unless (gst_tag_list_get_string (tags, GST_TAG_ALBUM, &s));
211     fail_unless (g_str_equal (s, TEST_ALBUM));
212     g_free (s);
213   }
214   if (mask & (1 << 3)) {
215     GDate *shouldbe, *date = NULL;
216 
217     shouldbe = TEST_DATE;
218     fail_unless (gst_tag_list_get_date (tags, GST_TAG_DATE, &date));
219     fail_unless (g_date_compare (shouldbe, date) == 0);
220     g_date_free (shouldbe);
221     g_date_free (date);
222   }
223   if (mask & (1 << 4)) {
224     guint num;
225 
226     fail_unless (gst_tag_list_get_uint (tags, GST_TAG_TRACK_NUMBER, &num));
227     fail_unless (num == TEST_TRACK_NUMBER);
228   }
229   if (mask & (1 << 5)) {
230     guint count;
231 
232     fail_unless (gst_tag_list_get_uint (tags, GST_TAG_TRACK_COUNT, &count));
233     fail_unless (count == TEST_TRACK_COUNT);
234   }
235   if (mask & (1 << 6)) {
236     guint num;
237 
238     fail_unless (gst_tag_list_get_uint (tags, GST_TAG_ALBUM_VOLUME_NUMBER,
239             &num));
240     fail_unless (num == TEST_VOLUME_NUMBER);
241   }
242   if (mask & (1 << 7)) {
243     guint count;
244 
245     fail_unless (gst_tag_list_get_uint (tags, GST_TAG_ALBUM_VOLUME_COUNT,
246             &count));
247     fail_unless (count == TEST_VOLUME_COUNT);
248   }
249   if (mask & (1 << 8)) {
250     gdouble gain;
251 
252     if (v2version == 4) {
253       fail_unless (gst_tag_list_get_double (tags, GST_TAG_TRACK_GAIN, &gain));
254       fail_unless_sorta_equals_float (gain, TEST_TRACK_GAIN);
255     }
256   }
257   if (mask & (1 << 9)) {
258     gdouble gain;
259 
260     if (v2version == 4) {
261       fail_unless (gst_tag_list_get_double (tags, GST_TAG_ALBUM_GAIN, &gain));
262       fail_unless_sorta_equals_float (gain, TEST_ALBUM_GAIN);
263     }
264   }
265   if (mask & (1 << 10)) {
266     gdouble peak;
267 
268     if (v2version == 4) {
269       fail_unless (gst_tag_list_get_double (tags, GST_TAG_TRACK_PEAK, &peak));
270       fail_unless_sorta_equals_float (peak, TEST_TRACK_PEAK);
271     }
272   }
273   if (mask & (1 << 11)) {
274     gdouble peak;
275 
276     if (v2version == 4) {
277       fail_unless (gst_tag_list_get_double (tags, GST_TAG_ALBUM_PEAK, &peak));
278       fail_unless_sorta_equals_float (peak, TEST_ALBUM_PEAK);
279     }
280   }
281   if (mask & (1 << 12)) {
282     gdouble bpm;
283 
284     fail_unless (gst_tag_list_get_double (tags, GST_TAG_BEATS_PER_MINUTE,
285             &bpm));
286     fail_unless_sorta_equals_float (bpm, TEST_BPM);
287   }
288   if (mask & (1 << 13)) {
289     GstSample *sample = NULL;
290     const GstStructure *info;
291     GstBuffer *buf;
292 
293     fail_unless (gst_tag_list_get_sample (tags, GST_TAG_PRIVATE_DATA, &sample));
294     fail_unless (sample != NULL);
295     buf = gst_sample_get_buffer (sample);
296     fail_if (gst_buffer_memcmp (buf, 0, privatedata, sizeof (privatedata)));
297     info = gst_sample_get_info (sample);
298     fail_unless (gst_structure_has_name (info, "ID3PrivateFrame"));
299     fail_unless_equals_string (gst_structure_get_string (info, "owner"), "me");
300     gst_sample_unref (sample);
301   }
302   if (mask & (1 << 14)) {
303   }
304 }
305 
306 static void
fill_mp3_buffer(GstElement * fakesrc,GstBuffer * buf,GstPad * pad,guint64 * p_offset)307 fill_mp3_buffer (GstElement * fakesrc, GstBuffer * buf, GstPad * pad,
308     guint64 * p_offset)
309 {
310   fail_unless (gst_buffer_get_size (buf) == MP3_FRAME_SIZE);
311 
312   GST_LOG ("filling buffer with fake mp3 data, offset = %" G_GUINT64_FORMAT,
313       *p_offset);
314 
315   gst_buffer_fill (buf, 0, mp3_dummyhdr, sizeof (mp3_dummyhdr));
316 
317 #if 0
318   /* can't use gst_buffer_set_caps() here because the metadata isn't writable
319    * because of the extra refcounts taken by the signal emission mechanism;
320    * we know it's fine to use GST_BUFFER_CAPS() here though */
321   GST_BUFFER_CAPS (buf) = gst_caps_new_simple ("audio/mpeg", "mpegversion",
322       G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, NULL);
323 #endif
324 
325   GST_BUFFER_OFFSET (buf) = *p_offset;
326   *p_offset += gst_buffer_get_size (buf);
327 }
328 
329 static void
got_buffer(GstElement * fakesink,GstBuffer * buf,GstPad * pad,GstBuffer ** p_buf)330 got_buffer (GstElement * fakesink, GstBuffer * buf, GstPad * pad,
331     GstBuffer ** p_buf)
332 {
333   GstMapInfo map;
334   gint64 off;
335   guint size;
336 
337   off = GST_BUFFER_OFFSET (buf);
338   gst_buffer_map (buf, &map, GST_MAP_READ);
339   size = map.size;
340 
341   GST_LOG ("got buffer, size=%u, offset=%" G_GINT64_FORMAT, size, off);
342 
343   fail_unless (GST_BUFFER_OFFSET_IS_VALID (buf));
344 
345   if (*p_buf == NULL || (off + size) > gst_buffer_get_size (*p_buf)) {
346     GstBuffer *newbuf;
347 
348     /* not very elegant, but who cares */
349     newbuf = gst_buffer_new_and_alloc (off + size);
350     if (*p_buf) {
351       GstMapInfo pmap;
352 
353       gst_buffer_map (*p_buf, &pmap, GST_MAP_READ);
354       gst_buffer_fill (newbuf, 0, pmap.data, pmap.size);
355       gst_buffer_unmap (*p_buf, &pmap);
356     }
357     gst_buffer_fill (newbuf, off, map.data, size);
358 
359     if (*p_buf)
360       gst_buffer_unref (*p_buf);
361     *p_buf = newbuf;
362   } else {
363     gst_buffer_fill (*p_buf, off, map.data, size);
364   }
365   gst_buffer_unmap (buf, &map);
366 }
367 
368 static void
test_taglib_id3mux_check_output_buffer(GstBuffer * buf)369 test_taglib_id3mux_check_output_buffer (GstBuffer * buf)
370 {
371   GstMapInfo map;
372   guint off;
373 
374   gst_buffer_map (buf, &map, GST_MAP_READ);
375 
376   g_assert (map.size % MP3_FRAME_SIZE == 0);
377 
378   for (off = 0; off < map.size; off += MP3_FRAME_SIZE) {
379     fail_unless (memcmp (map.data + off, mp3_dummyhdr,
380             sizeof (mp3_dummyhdr)) == 0);
381   }
382   gst_buffer_unmap (buf, &map);
383 }
384 
385 static void
identity_cb(GstElement * identity,GstBuffer * buf,GstBuffer ** p_tagbuf)386 identity_cb (GstElement * identity, GstBuffer * buf, GstBuffer ** p_tagbuf)
387 {
388   if (*p_tagbuf == NULL) {
389     *p_tagbuf = gst_buffer_ref (buf);
390   }
391 }
392 
393 static void
test_taglib_id3mux_with_tags(GstTagList * tags,guint32 mask,int v2version)394 test_taglib_id3mux_with_tags (GstTagList * tags, guint32 mask, int v2version)
395 {
396   GstMessage *msg;
397   GstTagList *tags_read = NULL;
398   GstElement *pipeline, *id3mux, *id3demux, *fakesrc, *identity, *fakesink;
399   GstBus *bus;
400   guint64 offset;
401   GstBuffer *outbuf = NULL;
402   GstBuffer *tagbuf = NULL;
403   GstStateChangeReturn state_result;
404 
405   pipeline = gst_pipeline_new ("pipeline");
406   g_assert (pipeline != NULL);
407 
408   fakesrc = gst_element_factory_make ("fakesrc", "fakesrc");
409   g_assert (fakesrc != NULL);
410 
411   id3mux = gst_element_factory_make ("id3mux", "id3mux");
412   g_assert (id3mux != NULL);
413   g_object_set (id3mux, "v2-version", v2version, NULL);
414 
415   identity = gst_element_factory_make ("identity", "identity");
416   g_assert (identity != NULL);
417 
418   id3demux = gst_element_factory_make ("id3demux", "id3demux");
419   g_assert (id3demux != NULL);
420 
421   fakesink = gst_element_factory_make ("fakesink", "fakesink");
422   g_assert (fakesink != NULL);
423 
424   /* set up sink */
425   outbuf = NULL;
426   g_object_set (fakesink, "signal-handoffs", TRUE, NULL);
427   g_signal_connect (fakesink, "handoff", G_CALLBACK (got_buffer), &outbuf);
428 
429   gst_bin_add (GST_BIN (pipeline), fakesrc);
430   gst_bin_add (GST_BIN (pipeline), id3mux);
431   gst_bin_add (GST_BIN (pipeline), identity);
432   gst_bin_add (GST_BIN (pipeline), id3demux);
433   gst_bin_add (GST_BIN (pipeline), fakesink);
434 
435   gst_tag_setter_merge_tags (GST_TAG_SETTER (id3mux), tags,
436       GST_TAG_MERGE_APPEND);
437 
438   gst_element_link_many (fakesrc, id3mux, identity, id3demux, fakesink, NULL);
439 
440   /* set up source */
441   g_object_set (fakesrc, "signal-handoffs", TRUE, "can-activate-pull", FALSE,
442       "filltype", 2, "sizetype", 2, "sizemax", MP3_FRAME_SIZE,
443       "num-buffers", 16, NULL);
444 
445   offset = 0;
446   g_signal_connect (fakesrc, "handoff", G_CALLBACK (fill_mp3_buffer), &offset);
447 
448   /* set up identity to catch tag buffer */
449   g_signal_connect (identity, "handoff", G_CALLBACK (identity_cb), &tagbuf);
450 
451   GST_LOG ("setting and getting state ...");
452   gst_element_set_state (pipeline, GST_STATE_PLAYING);
453   state_result = gst_element_get_state (pipeline, NULL, NULL, -1);
454   fail_unless (state_result == GST_STATE_CHANGE_SUCCESS,
455       "Unexpected result from get_state(). Expected success, got %d",
456       state_result);
457 
458   bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
459 
460   GST_LOG ("Waiting for tag ...");
461   msg =
462       gst_bus_poll (bus, GST_MESSAGE_TAG | GST_MESSAGE_EOS | GST_MESSAGE_ERROR,
463       -1);
464   if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR) {
465     GError *err;
466     gchar *dbg;
467 
468     gst_message_parse_error (msg, &err, &dbg);
469     g_printerr ("ERROR from element %s: %s\n%s\n",
470         GST_OBJECT_NAME (msg->src), err->message, GST_STR_NULL (dbg));
471     g_error_free (err);
472     g_free (dbg);
473   } else if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_EOS) {
474     g_printerr ("EOS message, but were waiting for TAGS!\n");
475   }
476   fail_unless (msg->type == GST_MESSAGE_TAG);
477 
478   gst_message_parse_tag (msg, &tags_read);
479   gst_message_unref (msg);
480 
481   GST_LOG ("Got tags: %" GST_PTR_FORMAT, tags_read);
482   test_taglib_id3mux_check_tags (tags_read, mask, v2version);
483   gst_tag_list_unref (tags_read);
484 
485   fail_unless (tagbuf != NULL);
486   test_taglib_id3mux_check_tag_buffer (tagbuf, mask, v2version);
487   gst_buffer_unref (tagbuf);
488 
489   GST_LOG ("Waiting for EOS ...");
490   msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1);
491   if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR) {
492     GError *err;
493     gchar *dbg;
494 
495     gst_message_parse_error (msg, &err, &dbg);
496     g_printerr ("ERROR from element %s: %s\n%s\n",
497         GST_OBJECT_NAME (msg->src), err->message, GST_STR_NULL (dbg));
498     g_error_free (err);
499     g_free (dbg);
500   }
501   fail_unless (msg->type == GST_MESSAGE_EOS);
502   gst_message_unref (msg);
503 
504   gst_object_unref (bus);
505 
506   GST_LOG ("Got EOS, shutting down ...");
507   gst_element_set_state (pipeline, GST_STATE_NULL);
508   gst_object_unref (pipeline);
509 
510   test_taglib_id3mux_check_output_buffer (outbuf);
511   gst_buffer_unref (outbuf);
512 
513   GST_LOG ("Done");
514 }
515 
516 static void
run_id3mux_test(int v2version)517 run_id3mux_test (int v2version)
518 {
519   GstTagList *tags;
520   gint i;
521 
522   g_random_set_seed (247166295);
523 
524   /* internal consistency check */
525   tags = test_taglib_id3mux_create_tags (0xFFFFFFFF);
526   test_taglib_id3mux_check_tags (tags, 0xFFFFFFFF, v2version);
527   gst_tag_list_unref (tags);
528 
529   /* now the real tests */
530   for (i = 0; i < 50; ++i) {
531     guint32 mask;
532 
533     mask = g_random_int ();
534     GST_LOG ("tag mask = %08x (i=%d)", mask, i);
535 
536     if (mask == 0)
537       continue;
538 
539     /* create tags */
540     tags = test_taglib_id3mux_create_tags (mask);
541     GST_LOG ("tags for mask %08x = %" GST_PTR_FORMAT, mask, tags);
542 
543     /* double-check for internal consistency */
544     test_taglib_id3mux_check_tags (tags, mask, v2version);
545 
546     /* test with pipeline */
547     test_taglib_id3mux_with_tags (tags, mask, v2version);
548 
549     /* free tags */
550     gst_tag_list_unref (tags);
551   }
552 }
553 
GST_START_TEST(test_id3mux_v2_3)554 GST_START_TEST (test_id3mux_v2_3)
555 {
556   run_id3mux_test (3);
557 }
558 
559 GST_END_TEST;
560 
GST_START_TEST(test_id3mux_v2_4)561 GST_START_TEST (test_id3mux_v2_4)
562 {
563   run_id3mux_test (4);
564 }
565 
566 GST_END_TEST;
567 
568 static Suite *
id3mux_suite(void)569 id3mux_suite (void)
570 {
571   Suite *s = suite_create ("id3mux");
572   TCase *tc_chain = tcase_create ("general");
573 
574   suite_add_tcase (s, tc_chain);
575 
576   if (gst_registry_check_feature_version (gst_registry_get (), "id3demux",
577           GST_VERSION_MAJOR, GST_VERSION_MINOR, 0)) {
578     tcase_add_test (tc_chain, test_id3mux_v2_3);
579     tcase_add_test (tc_chain, test_id3mux_v2_4);
580   } else {
581     GST_WARNING ("id3demux element not available, skipping tests");
582   }
583 
584   return s;
585 }
586 
587 GST_CHECK_MAIN (id3mux);
588