1 /* GStreamer unit tests for the -base typefind functions
2 *
3 * Copyright (C) 2007 Tim-Philipp Müller <tim centricular net>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21 #ifdef HAVE_CONFIG_H
22 # include <config.h>
23 #endif
24
25 #include <gst/check/gstcheck.h>
26 #include <gst/base/gsttypefindhelper.h>
27
28 static GstCaps *
typefind_data(const guint8 * data,gsize data_size,GstTypeFindProbability * prob)29 typefind_data (const guint8 * data, gsize data_size,
30 GstTypeFindProbability * prob)
31 {
32 GstBuffer *buf;
33 GstCaps *caps;
34
35 GST_MEMDUMP ("typefind data", data, data_size);
36 buf = gst_buffer_new ();
37 gst_buffer_append_memory (buf,
38 gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
39 (guint8 *) data, data_size, 0, data_size, NULL, NULL));
40 GST_BUFFER_OFFSET (buf) = 0;
41
42 caps = gst_type_find_helper_for_buffer (NULL, buf, prob);
43 GST_INFO ("caps: %" GST_PTR_FORMAT ", probability=%u", caps, *prob);
44
45 gst_buffer_unref (buf);
46
47 return caps;
48 }
49
GST_START_TEST(test_quicktime_mpeg4video)50 GST_START_TEST (test_quicktime_mpeg4video)
51 {
52 /* quicktime redirect file which starts with what could also be interpreted
53 * as an MPEG-4 video object layer start code */
54 const guint8 qt_redirect_396042[] =
55 { 0x00, 0x00, 0x01, 0x22, 0x6d, 0x6f, 0x6f, 0x76, 0x00, 0x00, 0x01, 0x1a,
56 0x72, 0x6d, 0x72, 0x61, 0x00, 0x00, 0x00, 0x86, 0x72, 0x6d, 0x64, 0x61,
57 0x00, 0x00, 0x00, 0x54, 0x72, 0x64, 0x72, 0x66, 0x00, 0x00, 0x00, 0x00,
58 0x75, 0x72, 0x6c, 0x20, 0x00, 0x00, 0x00, 0x40, 0x68, 0x74, 0x74, 0x70,
59 0x3a, 0x2f, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x71, 0x74,
60 0x76, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
61 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x6a, 0x61, 0x6e, 0x2f, 0x6a,
62 0x34, 0x37, 0x64, 0x35, 0x32, 0x6f, 0x6f, 0x2f, 0x71, 0x74, 0x37, 0x72,
63 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x2e, 0x6d, 0x6f, 0x76, 0x00,
64 0x00, 0x00, 0x00, 0x10, 0x72, 0x6d, 0x64, 0x72, 0x00, 0x00, 0x00, 0x00,
65 0x00, 0x00, 0x0a, 0xf0, 0x00, 0x00, 0x00, 0x1a, 0x72, 0x6d, 0x76, 0x63,
66 0x00, 0x00, 0x00, 0x00, 0x71, 0x74, 0x69, 0x6d, 0x06, 0x50, 0x00, 0x00,
67 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x72, 0x6d,
68 0x64, 0x61, 0x00, 0x00, 0x00, 0x5a, 0x72, 0x64, 0x72, 0x66, 0x00, 0x00,
69 0x00, 0x00, 0x75, 0x72, 0x6c, 0x20, 0x00, 0x00, 0x00, 0x46, 0x68, 0x74,
70 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e,
71 0x71, 0x74, 0x76, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f,
72 0x6d, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x6a, 0x61, 0x6e,
73 0x2f, 0x6a, 0x34, 0x37, 0x64, 0x35, 0x32, 0x6f, 0x6f, 0x2f, 0x38, 0x38,
74 0x34, 0x38, 0x31, 0x32, 0x35, 0x5f, 0x32, 0x5f, 0x33, 0x35, 0x30, 0x5f,
75 0x72, 0x65, 0x66, 0x2e, 0x6d, 0x6f, 0x76, 0x00, 0x00, 0x00, 0x00, 0x10,
76 0x72, 0x6d, 0x64, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xf0,
77 0x00, 0x00, 0x00, 0x1a, 0x72, 0x6d, 0x76, 0x63, 0x00, 0x00, 0x00, 0x00,
78 0x71, 0x74, 0x69, 0x6d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
79 0x00, 0x00
80 };
81 GstTypeFindProbability prob;
82 const gchar *type;
83 GstBuffer *buf;
84 GstCaps *caps = NULL;
85
86 buf = gst_buffer_new ();
87 gst_buffer_append_memory (buf,
88 gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
89 (gpointer) qt_redirect_396042,
90 sizeof (qt_redirect_396042), 0, sizeof (qt_redirect_396042), NULL,
91 NULL));
92
93 GST_BUFFER_OFFSET (buf) = 0;
94
95 caps = gst_type_find_helper_for_buffer (NULL, buf, &prob);
96 fail_unless (caps != NULL);
97 GST_LOG ("Found type: %" GST_PTR_FORMAT, caps);
98
99 type = gst_structure_get_name (gst_caps_get_structure (caps, 0));
100 fail_unless_equals_string (type, "video/quicktime");
101 fail_unless (prob > GST_TYPE_FIND_MINIMUM && prob <= GST_TYPE_FIND_MAXIMUM);
102
103 gst_buffer_unref (buf);
104 gst_caps_unref (caps);
105 }
106
107 GST_END_TEST;
108
GST_START_TEST(test_broken_flac_in_ogg)109 GST_START_TEST (test_broken_flac_in_ogg)
110 {
111 const guint8 flac_id_packet[4] = { 'f', 'L', 'a', 'C' };
112 GstTypeFindProbability prob;
113 const gchar *type;
114 GstBuffer *buf;
115 GstCaps *caps = NULL;
116
117 buf = gst_buffer_new ();
118 gst_buffer_append_memory (buf,
119 gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
120 (gpointer) flac_id_packet,
121 sizeof (flac_id_packet), 0, sizeof (flac_id_packet), NULL, NULL));
122
123 GST_BUFFER_OFFSET (buf) = 0;
124
125 caps = gst_type_find_helper_for_buffer (NULL, buf, &prob);
126 fail_unless (caps != NULL);
127 GST_LOG ("Found type: %" GST_PTR_FORMAT, caps);
128
129 type = gst_structure_get_name (gst_caps_get_structure (caps, 0));
130 fail_unless_equals_string (type, "audio/x-flac");
131 fail_unless (prob > GST_TYPE_FIND_MINIMUM && prob <= GST_TYPE_FIND_MAXIMUM);
132
133 gst_buffer_unref (buf);
134 gst_caps_unref (caps);
135 }
136
137 GST_END_TEST;
138
139 static GstCaps *
typefind_test_file(const gchar * filename)140 typefind_test_file (const gchar * filename)
141 {
142 GstBuffer *buf;
143 GError *err = NULL;
144 GstCaps *caps = NULL;
145 gchar *path, *data = NULL;
146 gsize data_len;
147
148 path = g_build_filename (GST_TEST_FILES_PATH, filename, NULL);
149 GST_LOG ("reading file '%s'", path);
150 if (!g_file_get_contents (path, &data, &data_len, &err)) {
151 g_error ("error loading test file: %s", err->message);
152 g_clear_error (&err);
153 }
154
155 buf = gst_buffer_new ();
156 gst_buffer_append_memory (buf,
157 gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
158 (gpointer) data, data_len, 0, data_len, NULL, NULL));
159
160 GST_BUFFER_OFFSET (buf) = 0;
161
162 caps = gst_type_find_helper_for_buffer (NULL, buf, NULL);
163 fail_unless (caps != NULL);
164 GST_LOG ("Found type: %" GST_PTR_FORMAT, caps);
165
166 gst_buffer_unref (buf);
167 g_free (data);
168 g_free (path);
169
170 return caps;
171 }
172
GST_START_TEST(test_jpeg_not_ac3)173 GST_START_TEST (test_jpeg_not_ac3)
174 {
175 const gchar *type;
176 GstCaps *caps = NULL;
177
178 caps = typefind_test_file ("partialframe.mjpeg");
179 type = gst_structure_get_name (gst_caps_get_structure (caps, 0));
180 fail_unless_equals_string (type, "image/jpeg");
181
182 gst_caps_unref (caps);
183 }
184
185 GST_END_TEST;
186
GST_START_TEST(test_mpegts)187 GST_START_TEST (test_mpegts)
188 {
189 GstStructure *s;
190 gboolean systemstream = FALSE;
191 GstCaps *caps = NULL;
192 gint packetsize = -1;
193
194 caps = typefind_test_file ("623663.mts");
195 s = gst_caps_get_structure (caps, 0);
196 fail_unless (gst_structure_has_name (s, "video/mpegts"));
197 fail_unless (gst_structure_has_field (s, "systemstream"));
198 fail_unless (gst_structure_get_boolean (s, "systemstream", &systemstream));
199 fail_unless_equals_int (systemstream, TRUE);
200 fail_unless (gst_structure_has_field (s, "packetsize"));
201 fail_unless (gst_structure_get_int (s, "packetsize", &packetsize));
202 fail_unless_equals_int (packetsize, 192);
203
204 gst_caps_unref (caps);
205 }
206
207 GST_END_TEST;
208
209 struct ac3_frmsize
210 {
211 unsigned frmsizecod;
212 unsigned frmsize;
213 };
214
215 static void
make_ac3_packet(guint8 * data,guint bytesize,guint bsid)216 make_ac3_packet (guint8 * data, guint bytesize, guint bsid)
217 {
218 /* Actually not a fully valid packet; if the typefinder starts to
219 * check e.g. the CRCs, this test needs to be improved as well. */
220 const guint8 ac3_header[] = {
221 0x0b, 0x77, /* syncword */
222 0x00, 0x00, /* crc1 */
223 0x00, /* fscod 0xc0, frmsizecod 0x3f */
224 0x00 /* bsid 0xf8, bsmod 0x07 */
225 };
226 const struct ac3_frmsize frmsize[] = {
227 {17, 256}, {26, 640} /* small subset of supported sizes */
228 };
229 guint wordsize = bytesize >> 1, frmsizecod = 0;
230 int i;
231
232 fail_unless ((bytesize & 0x01) == 0);
233 fail_unless (bytesize >= sizeof (ac3_header));
234
235 for (i = 0; i < G_N_ELEMENTS (frmsize); i++) {
236 if (frmsize[i].frmsize == wordsize) {
237 frmsizecod = frmsize[i].frmsizecod;
238 break;
239 }
240 }
241
242 fail_unless (frmsizecod);
243
244 memcpy (data, ac3_header, sizeof (ac3_header));
245 data[4] = (data[4] & ~0x3f) | (frmsizecod & 0x3f);
246 data[5] = (bsid & 0x1f) << 3;
247 memset (data + 6, 0, bytesize - 6);
248 }
249
GST_START_TEST(test_ac3)250 GST_START_TEST (test_ac3)
251 {
252 GstTypeFindProbability prob;
253 const gchar *type;
254 GstBuffer *buf;
255 GstCaps *caps = NULL;
256 guint bsid;
257
258 for (bsid = 0; bsid < 32; bsid++) {
259 GstMapInfo map;
260
261 buf = gst_buffer_new_and_alloc ((256 + 640) * 2);
262 gst_buffer_map (buf, &map, GST_MAP_WRITE);
263 make_ac3_packet (map.data, 256 * 2, bsid);
264 make_ac3_packet (map.data + 256 * 2, 640 * 2, bsid);
265 gst_buffer_unmap (buf, &map);
266
267 caps = gst_type_find_helper_for_buffer (NULL, buf, &prob);
268 if (bsid <= 8) {
269 fail_unless (caps != NULL);
270 GST_LOG ("Found type for BSID %u: %" GST_PTR_FORMAT, bsid, caps);
271
272 type = gst_structure_get_name (gst_caps_get_structure (caps, 0));
273 fail_unless_equals_string (type, "audio/x-ac3");
274 fail_unless (prob > GST_TYPE_FIND_MINIMUM
275 && prob <= GST_TYPE_FIND_MAXIMUM);
276 gst_caps_unref (caps);
277 } else {
278 fail_unless (caps == NULL);
279 }
280
281 gst_buffer_unref (buf);
282 }
283 }
284
285 GST_END_TEST;
286
287 static void
make_eac3_packet(guint8 * data,guint bytesize,guint bsid)288 make_eac3_packet (guint8 * data, guint bytesize, guint bsid)
289 {
290 /* Actually not a fully valid packet; if the typefinder starts to
291 * check e.g. the CRCs, this test needs to be improved as well. */
292 const guint8 eac3_header[] = {
293 0x0b, 0x77, /* syncword */
294 0x00, /* strmtyp 0xc0, substreamid 0x38,
295 * frmsize 0x07 (3 high bits) */
296 0x00, /* frmsize (low bits -> 11 total) */
297 0x00, /* fscod 0xc0, fscod2/numblocks 0x30,
298 * acmod 0x0e, lfeon 0x01 */
299 0x00 /* bsid 0xf8, dialnorm 0x07 (3 high bits) */
300 };
301 guint wordsize = bytesize >> 1;
302
303 fail_unless ((bytesize & 0x01) == 0);
304 fail_unless (bytesize >= sizeof (eac3_header));
305
306 memcpy (data, eac3_header, sizeof (eac3_header));
307 data[2] = (data[2] & ~0x07) | ((((wordsize - 1) & 0x700) >> 8) & 0xff);
308 data[3] = (wordsize - 1) & 0xff;
309 data[5] = (bsid & 0x1f) << 3;
310 memset (data + 6, 0, bytesize - 6);
311 }
312
GST_START_TEST(test_eac3)313 GST_START_TEST (test_eac3)
314 {
315 GstTypeFindProbability prob;
316 const gchar *type;
317 GstBuffer *buf;
318 GstCaps *caps = NULL;
319 guint bsid;
320
321 for (bsid = 0; bsid <= 32; bsid++) {
322 GstMapInfo map;
323
324 buf = gst_buffer_new_and_alloc (558 + 384);
325 gst_buffer_map (buf, &map, GST_MAP_WRITE);
326 make_eac3_packet (map.data, 558, bsid);
327 make_eac3_packet (map.data + 558, 384, bsid);
328 gst_buffer_unmap (buf, &map);
329
330 caps = gst_type_find_helper_for_buffer (NULL, buf, &prob);
331 if (bsid > 10 && bsid <= 16) {
332 /* Only BSIs 11..16 are valid for Annex E */
333 fail_unless (caps != NULL);
334 GST_LOG ("Found type for BSID %u: %" GST_PTR_FORMAT, bsid, caps);
335
336 type = gst_structure_get_name (gst_caps_get_structure (caps, 0));
337 fail_unless_equals_string (type, "audio/x-eac3");
338 fail_unless (prob > GST_TYPE_FIND_MINIMUM
339 && prob <= GST_TYPE_FIND_MAXIMUM);
340 gst_caps_unref (caps);
341 } else {
342 /* Invalid E-AC-3 BSID, must not be detected as anything: */
343 fail_unless (caps == NULL);
344 }
345
346 gst_buffer_unref (buf);
347 }
348 }
349
350 GST_END_TEST;
351
352 #define TEST_RANDOM_DATA_SIZE (4*1024)
353
354 /* typefind random data, to make sure all typefinders are called */
GST_START_TEST(test_random_data)355 GST_START_TEST (test_random_data)
356 {
357 GstTypeFindProbability prob;
358 const gchar *seed_env;
359 GstBuffer *buf;
360 GstCaps *caps;
361 guint32 seed;
362 guint8 *data;
363 gint i;
364
365 seed_env = g_getenv ("GST_TYPEFIND_TEST_SEED");
366 if (seed_env != NULL)
367 seed = atoi (seed_env);
368 else
369 seed = (guint32) time (NULL);
370
371 g_random_set_seed (seed);
372
373 data = g_malloc (TEST_RANDOM_DATA_SIZE);
374 for (i = 0; i < TEST_RANDOM_DATA_SIZE; ++i)
375 data[i] = g_random_int () & 0xff;
376
377 buf = gst_buffer_new ();
378 gst_buffer_append_memory (buf,
379 gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
380 data, TEST_RANDOM_DATA_SIZE, 0, TEST_RANDOM_DATA_SIZE, NULL, NULL));
381
382 GST_BUFFER_OFFSET (buf) = 0;
383
384 caps = gst_type_find_helper_for_buffer (NULL, buf, &prob);
385 GST_INFO ("caps: %" GST_PTR_FORMAT ", probability=%u", caps, prob);
386 /* for now we just print an error log message */
387 if (caps != NULL /* && prob >= GST_TYPE_FIND_LIKELY */ ) {
388 GST_ERROR ("typefinder thinks random data is %" GST_PTR_FORMAT ", with a "
389 "probability of %u (seed was %u)", caps, prob, seed);
390 gst_caps_unref (caps);
391 }
392
393 gst_buffer_unref (buf);
394 g_free (data);
395 }
396
397 GST_END_TEST;
398
GST_START_TEST(test_hls_m3u8)399 GST_START_TEST (test_hls_m3u8)
400 {
401 const gchar *type;
402 GstCaps *caps = NULL;
403
404 caps = typefind_test_file ("hls.m3u8");
405 type = gst_structure_get_name (gst_caps_get_structure (caps, 0));
406 fail_unless_equals_string (type, "application/x-hls");
407
408 gst_caps_unref (caps);
409 }
410
411 GST_END_TEST;
412
413 static const gchar MANIFEST[] =
414 "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n"
415 "<!--Created with Expression Encoder version 2.1.1216.0-->\n"
416 "<SmoothStreamingMedia\n"
417 " MajorVersion=\"1\"\n"
418 " MinorVersion=\"0\"\n"
419 " Duration=\"5965419999\">\n"
420 " <StreamIndex\n"
421 " Type=\"video\"\n"
422 " Subtype=\"WVC1\"\n"
423 " Chunks=\"299\"\n"
424 " Url=\"QualityLevels({bitrate})/Fragments(video={start time})\">\n"
425 " <QualityLevel\n"
426 " Bitrate=\"2750000\"\n"
427 " FourCC=\"WVC1\"\n" " Width=\"1280\"\n" " Height=\"720\"\n";
428
429 static guint8 *
generate_utf16(guint off_lo,guint off_hi)430 generate_utf16 (guint off_lo, guint off_hi)
431 {
432 guint8 *utf16;
433 gsize len, i;
434
435 len = strlen (MANIFEST);
436 /* BOM + UTF-16 string */
437 utf16 = g_malloc (2 + len * 2);
438 utf16[off_lo] = 0xff;
439 utf16[off_hi] = 0xfe;
440 for (i = 0; i < len; ++i) {
441 utf16[2 + (2 * i) + off_lo] = MANIFEST[i];
442 utf16[2 + (2 * i) + off_hi] = 0x00;
443 }
444
445 return utf16;
446 }
447
448 /* Test that we can typefind UTF16-LE and UTF16-BE variants
449 * of smooth streaming manifests (even without iconv) */
GST_START_TEST(test_manifest_typefinding)450 GST_START_TEST (test_manifest_typefinding)
451 {
452 GstTypeFindProbability prob;
453 const gchar *media_type;
454 GstCaps *caps;
455 guint8 *utf16;
456
457 utf16 = generate_utf16 (0, 1);
458 prob = 0;
459 caps = typefind_data (utf16, 2 + strlen (MANIFEST) * 2, &prob);
460 fail_unless (caps != NULL);
461 media_type = gst_structure_get_name (gst_caps_get_structure (caps, 0));
462 fail_unless_equals_string (media_type, "application/vnd.ms-sstr+xml");
463 fail_unless_equals_int (prob, GST_TYPE_FIND_MAXIMUM);
464 gst_caps_unref (caps);
465 g_free (utf16);
466
467 utf16 = generate_utf16 (1, 0);
468 prob = 0;
469 caps = typefind_data (utf16, 2 + strlen (MANIFEST) * 2, &prob);
470 fail_unless (caps != NULL);
471 media_type = gst_structure_get_name (gst_caps_get_structure (caps, 0));
472 fail_unless_equals_string (media_type, "application/vnd.ms-sstr+xml");
473 fail_unless_equals_int (prob, GST_TYPE_FIND_MAXIMUM);
474 gst_caps_unref (caps);
475 g_free (utf16);
476 }
477
478 GST_END_TEST;
479
GST_START_TEST(test_webvtt)480 GST_START_TEST (test_webvtt)
481 {
482 GstTypeFindProbability prob;
483 const gchar *media_type;
484 GstCaps *caps;
485 guint8 webvtt[] = {
486 'W', 'E', 'B', 'V', 'T', 'T', '\n', '\n'
487 };
488 guint8 webvtt_with_bom[] = {
489 0xef, 0xbb, 0xbf, 'W', 'E', 'B', 'V', 'T', 'T', '\n', '\n'
490 };
491
492 prob = 0;
493 caps = typefind_data (webvtt, sizeof (webvtt), &prob);
494 fail_unless (caps != NULL);
495 media_type = gst_structure_get_name (gst_caps_get_structure (caps, 0));
496 fail_unless_equals_string (media_type, "application/x-subtitle-vtt");
497 fail_unless_equals_int (prob, GST_TYPE_FIND_MAXIMUM);
498 gst_caps_unref (caps);
499
500 prob = 0;
501 caps = typefind_data (webvtt_with_bom, sizeof (webvtt_with_bom), &prob);
502 fail_unless (caps != NULL);
503 media_type = gst_structure_get_name (gst_caps_get_structure (caps, 0));
504 fail_unless_equals_string (media_type, "application/x-subtitle-vtt");
505 fail_unless_equals_int (prob, GST_TYPE_FIND_MAXIMUM);
506 gst_caps_unref (caps);
507 }
508
509 GST_END_TEST;
510
511 static Suite *
typefindfunctions_suite(void)512 typefindfunctions_suite (void)
513 {
514 Suite *s = suite_create ("typefindfunctions");
515 TCase *tc_chain = tcase_create ("general");
516
517 suite_add_tcase (s, tc_chain);
518
519 tcase_add_test (tc_chain, test_quicktime_mpeg4video);
520 tcase_add_test (tc_chain, test_broken_flac_in_ogg);
521 tcase_add_test (tc_chain, test_jpeg_not_ac3);
522 tcase_add_test (tc_chain, test_mpegts);
523 tcase_add_test (tc_chain, test_ac3);
524 tcase_add_test (tc_chain, test_eac3);
525 tcase_add_test (tc_chain, test_random_data);
526 tcase_add_test (tc_chain, test_hls_m3u8);
527 tcase_add_test (tc_chain, test_manifest_typefinding);
528 tcase_add_test (tc_chain, test_webvtt);
529
530 return s;
531 }
532
533 GST_CHECK_MAIN (typefindfunctions);
534