typefindfunctions: allow per features registration
authorStéphane Cerveau <scerveau@collabora.com>
Fri, 4 Dec 2020 15:55:53 +0000 (16:55 +0100)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 10 Dec 2020 13:01:57 +0000 (13:01 +0000)
Split plugin into features including
typefind functions which can be indiviually
registered during a static build.

More details here:

https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/900>

gst/typefind/gsttypefindfunctions.c
gst/typefind/gsttypefindfunctionsdata.c [new file with mode: 0644]
gst/typefind/gsttypefindfunctionsdata.h [new file with mode: 0644]
gst/typefind/gsttypefindfunctionsplugin.c [new file with mode: 0644]
gst/typefind/gsttypefindfunctionsplugin.h [new file with mode: 0644]
gst/typefind/gsttypefindfunctionsriff.c [new file with mode: 0644]
gst/typefind/gsttypefindfunctionsstartwith.c [new file with mode: 0644]
gst/typefind/meson.build

index 3ef051c..da56455 100644 (file)
@@ -43,6 +43,8 @@
 #include <gst/pbutils/pbutils.h>
 #include <gst/base/gstbytereader.h>
 
+#include "gsttypefindfunctionsplugin.h"
+
 GST_DEBUG_CATEGORY_STATIC (type_find_debug);
 #define GST_CAT_DEFAULT type_find_debug
 
@@ -5838,438 +5840,225 @@ aa_type_find (GstTypeFind * tf, gpointer private)
   }
 }
 
-/*** generic typefind for streams that have some data at a specific position***/
-typedef struct
-{
-  const guint8 *data;
-  guint size;
-  guint probability;
-  GstCaps *caps;
-}
-GstTypeFindData;
-
-static void
-start_with_type_find (GstTypeFind * tf, gpointer private)
-{
-  GstTypeFindData *start_with = (GstTypeFindData *) private;
-  const guint8 *data;
-
-  GST_LOG ("trying to find mime type %s with the first %u bytes of data",
-      gst_structure_get_name (gst_caps_get_structure (start_with->caps, 0)),
-      start_with->size);
-  data = gst_type_find_peek (tf, 0, start_with->size);
-  if (data && memcmp (data, start_with->data, start_with->size) == 0) {
-    gst_type_find_suggest (tf, start_with->probability, start_with->caps);
-  }
-}
-
-static void
-sw_data_destroy (GstTypeFindData * sw_data)
-{
-  if (G_LIKELY (sw_data->caps != NULL))
-    gst_caps_unref (sw_data->caps);
-  g_slice_free (GstTypeFindData, sw_data);
-}
-
-#define TYPE_FIND_REGISTER_START_WITH(plugin,name,rank,ext,_data,_size,_probability)\
-G_BEGIN_DECLS{                                                          \
-  GstTypeFindData *sw_data = g_slice_new (GstTypeFindData);             \
-  sw_data->data = (const guint8 *)_data;                                \
-  sw_data->size = _size;                                                \
-  sw_data->probability = _probability;                                  \
-  sw_data->caps = gst_caps_new_empty_simple (name);                     \
-  if (!gst_type_find_register (plugin, name, rank, start_with_type_find,\
-                     ext, sw_data->caps, sw_data,                       \
-                     (GDestroyNotify) (sw_data_destroy))) {             \
-    sw_data_destroy (sw_data);                                          \
-  }                                                                     \
-}G_END_DECLS
-
-/*** same for riff types ***/
-
-static void
-riff_type_find (GstTypeFind * tf, gpointer private)
-{
-  GstTypeFindData *riff_data = (GstTypeFindData *) private;
-  const guint8 *data = gst_type_find_peek (tf, 0, 12);
-
-  if (data && (memcmp (data, "RIFF", 4) == 0 || memcmp (data, "AVF0", 4) == 0)) {
-    data += 8;
-    if (memcmp (data, riff_data->data, 4) == 0)
-      gst_type_find_suggest (tf, riff_data->probability, riff_data->caps);
-  }
-}
-
-#define TYPE_FIND_REGISTER_RIFF(plugin,name,rank,ext,_data)             \
-G_BEGIN_DECLS{                                                          \
-  GstTypeFindData *sw_data = g_slice_new (GstTypeFindData);             \
-  sw_data->data = (gpointer)_data;                                      \
-  sw_data->size = 4;                                                    \
-  sw_data->probability = GST_TYPE_FIND_MAXIMUM;                         \
-  sw_data->caps = gst_caps_new_empty_simple (name);                     \
-  if (!gst_type_find_register (plugin, name, rank, riff_type_find,      \
-                      ext, sw_data->caps, sw_data,                      \
-                      (GDestroyNotify) (sw_data_destroy))) {            \
-    sw_data_destroy (sw_data);                                          \
-  }                                                                     \
-}G_END_DECLS
-
-
-/*** plugin initialization ***/
-
-#define TYPE_FIND_REGISTER(plugin,name,rank,func,ext,caps,priv,notify) \
-G_BEGIN_DECLS{\
-  if (!gst_type_find_register (plugin, name, rank, func, ext, caps, priv, notify))\
-    return FALSE; \
-}G_END_DECLS
-
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-  /* can't initialize this via a struct as caps can't be statically initialized */
-
-  GST_DEBUG_CATEGORY_INIT (type_find_debug, "typefindfunctions",
-      GST_DEBUG_FG_GREEN | GST_DEBUG_BG_RED, "generic type find functions");
-
-  /* note: asx/wax/wmx are XML files, asf doesn't handle them */
-  /* must use strings, macros don't accept initializers */
-  TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-ms-asf", GST_RANK_SECONDARY,
-      "asf,wm,wma,wmv",
-      "\060\046\262\165\216\146\317\021\246\331\000\252\000\142\316\154", 16,
-      GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER (plugin, "audio/x-musepack", GST_RANK_PRIMARY,
-      musepack_type_find, "mpc,mpp,mp+", MUSEPACK_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "audio/x-au", GST_RANK_MARGINAL,
-      au_type_find, "au,snd", AU_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER_RIFF (plugin, "video/x-msvideo", GST_RANK_PRIMARY,
-      "avi", "AVI ");
-  TYPE_FIND_REGISTER_RIFF (plugin, "audio/qcelp", GST_RANK_PRIMARY,
-      "qcp", "QLCM");
-  TYPE_FIND_REGISTER_RIFF (plugin, "video/x-cdxa", GST_RANK_PRIMARY,
-      "dat", "CDXA");
-  TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-vcd", GST_RANK_PRIMARY,
-      "dat", "\000\377\377\377\377\377\377\377\377\377\377\000", 12,
-      GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-imelody", GST_RANK_PRIMARY,
-      "imy,ime,imelody", "BEGIN:IMELODY", 13, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-scc", GST_RANK_PRIMARY,
-      "scc", "Scenarist_SCC V1.0", 18, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER (plugin, "application/x-mcc", GST_RANK_PRIMARY,
-      mcc_type_find, "mcc", MCC_CAPS, NULL, NULL);
+/*Type find definition by functions */
+GST_TYPE_FIND_REGISTER_DEFINE (musepack, "audio/x-musepack", GST_RANK_PRIMARY,
+    musepack_type_find, "mpc,mpp,mp+", MUSEPACK_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (au, "audio/x-au", GST_RANK_MARGINAL,
+    au_type_find, "au,snd", AU_CAPS, NULL, NULL);
 
+GST_TYPE_FIND_REGISTER_DEFINE (mcc, "application/x-mcc", GST_RANK_PRIMARY,
+    mcc_type_find, "mcc", MCC_CAPS, NULL, NULL);
 #if 0
-  TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-smoke", GST_RANK_PRIMARY,
-      NULL, "\x80smoke\x00\x01\x00", 6, GST_TYPE_FIND_MAXIMUM);
+GST_TYPE_FIND_REGISTER_START_WITH_DEFINE (smoke, "video/x-smoke",
+    GST_RANK_PRIMARY, NULL, "\x80smoke\x00\x01\x00", 6, GST_TYPE_FIND_MAXIMUM);
 #endif
-  TYPE_FIND_REGISTER (plugin, "audio/midi", GST_RANK_PRIMARY, mid_type_find,
-      "mid,midi", MID_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER_RIFF (plugin, "audio/riff-midi", GST_RANK_PRIMARY,
-      "mid,midi", "RMID");
-  TYPE_FIND_REGISTER (plugin, "audio/mobile-xmf", GST_RANK_PRIMARY,
-      mxmf_type_find, "mxmf", MXMF_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "video/x-fli", GST_RANK_MARGINAL, flx_type_find,
-      "flc,fli", FLX_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/x-id3v2", GST_RANK_PRIMARY + 103,
-      id3v2_type_find, "mp3,mp2,mp1,mpga,ogg,flac,tta", ID3_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/x-id3v1", GST_RANK_PRIMARY + 101,
-      id3v1_type_find, "mp3,mp2,mp1,mpga,ogg,flac,tta", ID3_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/x-apetag", GST_RANK_PRIMARY + 102,
-      apetag_type_find, "mp3,ape,mpc,wv", APETAG_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "audio/x-ttafile", GST_RANK_PRIMARY,
-      tta_type_find, "tta", TTA_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "audio/x-mod", GST_RANK_SECONDARY, mod_type_find,
-      "669,amf,ams,dbm,digi,dmf,dsm,gdm,far,imf,it,j2b,mdl,med,mod,mt2,mtm,"
-      "okt,psm,ptm,sam,s3m,stm,stx,ult,umx,xm", MOD_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "audio/mpeg", GST_RANK_PRIMARY, mp3_type_find,
-      "mp3,mp2,mp1,mpga", MP3_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "audio/x-ac3", GST_RANK_PRIMARY, ac3_type_find,
-      "ac3,eac3", AC3_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "audio/x-dts", GST_RANK_SECONDARY, dts_type_find,
-      "dts", DTS_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "audio/x-gsm", GST_RANK_PRIMARY, NULL, "gsm",
-      GSM_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "video/mpeg-sys", GST_RANK_PRIMARY,
-      mpeg_sys_type_find, "mpe,mpeg,mpg", MPEG_SYS_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "video/mpegts", GST_RANK_PRIMARY,
-      mpeg_ts_type_find, "ts,mts", MPEGTS_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/ogg", GST_RANK_PRIMARY,
-      ogganx_type_find, "ogg,oga,ogv,ogm,ogx,spx,anx,axa,axv", OGG_CAPS,
-      NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "video/mpeg-elementary", GST_RANK_MARGINAL,
-      mpeg_video_stream_type_find, "mpv,mpeg,mpg", MPEG_VIDEO_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "video/mpeg4", GST_RANK_PRIMARY,
-      mpeg4_video_type_find, "m4v", MPEG_VIDEO_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "video/x-h263", GST_RANK_SECONDARY,
-      h263_video_type_find, "h263,263", H263_VIDEO_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "video/x-h264", GST_RANK_PRIMARY,
-      h264_video_type_find, "h264,x264,264", H264_VIDEO_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "video/x-h265", GST_RANK_PRIMARY,
-      h265_video_type_find, "h265,x265,265", H265_VIDEO_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "video/x-nuv", GST_RANK_SECONDARY, nuv_type_find,
-      "nuv", NUV_CAPS, NULL, NULL);
-
-  /* ISO formats */
-  TYPE_FIND_REGISTER (plugin, "audio/x-m4a", GST_RANK_PRIMARY, m4a_type_find,
-      "m4a", M4A_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/x-3gp", GST_RANK_PRIMARY,
-      q3gp_type_find, "3gp", Q3GP_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "video/quicktime", GST_RANK_PRIMARY,
-      qt_type_find, "mov,mp4", QT_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "image/x-quicktime", GST_RANK_SECONDARY,
-      qtif_type_find, "qif,qtif,qti", QTIF_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "image/jp2", GST_RANK_PRIMARY,
-      jp2_type_find, "jp2", JP2_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "image/x-jpc", GST_RANK_PRIMARY,
-      jpc_type_find, "jpc,j2k", JPC_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "video/mj2", GST_RANK_PRIMARY,
-      jp2_type_find, "mj2", MJ2_CAPS, NULL, NULL);
-
-  TYPE_FIND_REGISTER (plugin, "text/html", GST_RANK_SECONDARY, html_type_find,
-      "htm,html", HTML_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "application/vnd.rn-realmedia",
-      GST_RANK_SECONDARY, "ra,ram,rm,rmvb", ".RMF", 4, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-pn-realaudio",
-      GST_RANK_SECONDARY, "ra,ram,rm,rmvb", ".ra\375", 4,
-      GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER (plugin, "application/x-shockwave-flash",
-      GST_RANK_SECONDARY, swf_type_find, "swf,swfl", SWF_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/xges",
-      GST_RANK_PRIMARY, xges_type_find, "xges", XGES_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/vnd.apple-xmeml+xml",
-      GST_RANK_SECONDARY, xmeml_type_find, "xmeml", XMEML_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/vnd.apple-fcp+xml",
-      GST_RANK_SECONDARY, fcpxml_type_find, "fcpxml", FCPXML_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/vnd.pixar.opentimelineio+json",
-      GST_RANK_SECONDARY, otio_type_find, "otio", OTIO_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/dash+xml",
-      GST_RANK_PRIMARY, dash_mpd_type_find, "mpd,MPD", DASH_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/vnd.ms-sstr+xml",
-      GST_RANK_PRIMARY, mss_manifest_type_find, NULL, MSS_MANIFEST_CAPS, NULL,
-      NULL);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-flv", GST_RANK_SECONDARY,
-      "flv", "FLV", 3, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER (plugin, "text/plain", GST_RANK_MARGINAL, utf8_type_find,
-      "txt", UTF8_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "text/utf-16", GST_RANK_MARGINAL, utf16_type_find,
-      "txt", UTF16_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "text/utf-32", GST_RANK_MARGINAL, utf32_type_find,
-      "txt", UTF32_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "text/uri-list", GST_RANK_MARGINAL, uri_type_find,
-      "ram", URI_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/itc", GST_RANK_SECONDARY,
-      itc_type_find, "itc", ITC_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/x-hls", GST_RANK_MARGINAL,
-      hls_type_find, "m3u8", HLS_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/sdp", GST_RANK_SECONDARY,
-      sdp_type_find, "sdp", SDP_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/smil", GST_RANK_SECONDARY,
-      smil_type_find, "smil", SMIL_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/ttml+xml", GST_RANK_SECONDARY,
-      ttml_xml_type_find, "ttml+xml", TTML_XML_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/xml", GST_RANK_MARGINAL,
-      xml_type_find, "xml", GENERIC_XML_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER_RIFF (plugin, "audio/x-wav", GST_RANK_PRIMARY, "wav",
-      "WAVE");
-  TYPE_FIND_REGISTER (plugin, "audio/x-aiff", GST_RANK_SECONDARY,
-      aiff_type_find, "aiff,aif,aifc", AIFF_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "audio/x-svx", GST_RANK_SECONDARY, svx_type_find,
-      "iff,svx", SVX_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "audio/x-paris", GST_RANK_SECONDARY,
-      paris_type_find, "paf", PARIS_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-nist", GST_RANK_SECONDARY,
-      "nist", "NIST", 4, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-voc", GST_RANK_SECONDARY,
-      "voc", "Creative", 8, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER (plugin, "audio/x-sds", GST_RANK_SECONDARY, sds_type_find,
-      "sds", SDS_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "audio/x-ircam", GST_RANK_SECONDARY,
-      ircam_type_find, "sf", IRCAM_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-w64", GST_RANK_SECONDARY,
-      "w64", "riff", 4, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-rf64", GST_RANK_PRIMARY,
-      "rf64", "RF64", 4, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER (plugin, "audio/x-shorten", GST_RANK_SECONDARY,
-      shn_type_find, "shn", SHN_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/x-ape", GST_RANK_SECONDARY,
-      ape_type_find, "ape", APE_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "image/jpeg", GST_RANK_PRIMARY + 15,
-      jpeg_type_find, "jpg,jpe,jpeg", JPEG_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "image/gif", GST_RANK_PRIMARY, "gif",
-      "GIF8", 4, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "image/png", GST_RANK_PRIMARY + 14,
-      "png", "\211PNG\015\012\032\012", 8, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER (plugin, "image/bmp", GST_RANK_PRIMARY, bmp_type_find,
-      "bmp", BMP_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "image/tiff", GST_RANK_PRIMARY, tiff_type_find,
-      "tif,tiff", TIFF_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER_RIFF (plugin, "image/webp", GST_RANK_PRIMARY,
-      "webp", "WEBP");
-  TYPE_FIND_REGISTER (plugin, "image/x-exr", GST_RANK_PRIMARY, exr_type_find,
-      "exr", EXR_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "image/x-portable-pixmap", GST_RANK_SECONDARY,
-      pnm_type_find, "pnm,ppm,pgm,pbm", PNM_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "video/x-matroska", GST_RANK_PRIMARY,
-      matroska_type_find, "mkv,mka,mk3d,webm", MATROSKA_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/mxf", GST_RANK_PRIMARY,
-      mxf_type_find, "mxf", MXF_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-mve", GST_RANK_SECONDARY,
-      "mve", "Interplay MVE File\032\000\032\000\000\001\063\021", 26,
-      GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER (plugin, "video/x-dv", GST_RANK_SECONDARY, dv_type_find,
-      "dv,dif", DV_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-amr-nb-sh", GST_RANK_PRIMARY,
-      "amr", "#!AMR", 5, GST_TYPE_FIND_LIKELY);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-amr-wb-sh", GST_RANK_PRIMARY,
-      "amr", "#!AMR-WB", 7, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER (plugin, "audio/iLBC-sh", GST_RANK_PRIMARY, ilbc_type_find,
-      "ilbc", ILBC_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "audio/x-sbc", GST_RANK_MARGINAL, sbc_type_find,
-      "sbc", SBC_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-sid", GST_RANK_MARGINAL,
-      "sid", "PSID", 4, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "image/x-xcf", GST_RANK_SECONDARY,
-      "xcf", "gimp xcf", 8, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-mng", GST_RANK_SECONDARY,
-      "mng", "\212MNG\015\012\032\012", 8, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "image/x-jng", GST_RANK_SECONDARY,
-      "jng", "\213JNG\015\012\032\012", 8, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "image/x-xpixmap", GST_RANK_SECONDARY,
-      "xpm", "/* XPM */", 9, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "image/x-sun-raster",
-      GST_RANK_SECONDARY, "ras", "\131\246\152\225", 4, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-bzip",
-      GST_RANK_SECONDARY, "bz2", "BZh", 3, GST_TYPE_FIND_LIKELY);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-gzip",
-      GST_RANK_SECONDARY, "gz", "\037\213", 2, GST_TYPE_FIND_LIKELY);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "application/zip", GST_RANK_SECONDARY,
-      "zip", "PK\003\004", 4, GST_TYPE_FIND_LIKELY);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-compress",
-      GST_RANK_SECONDARY, "Z", "\037\235", 2, GST_TYPE_FIND_LIKELY);
-  TYPE_FIND_REGISTER (plugin, "subtitle/x-kate", GST_RANK_MARGINAL,
-      kate_type_find, NULL, NULL, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/x-subtitle-vtt", GST_RANK_MARGINAL,
-      webvtt_type_find, "vtt", WEBVTT_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "audio/x-flac", GST_RANK_PRIMARY, flac_type_find,
-      "flac", FLAC_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "audio/x-vorbis", GST_RANK_PRIMARY,
-      vorbis_type_find, NULL, VORBIS_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "video/x-theora", GST_RANK_PRIMARY,
-      theora_type_find, NULL, THEORA_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/x-ogm-video", GST_RANK_PRIMARY,
-      ogmvideo_type_find, NULL, OGMVIDEO_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/x-ogm-audio", GST_RANK_PRIMARY,
-      ogmaudio_type_find, NULL, OGMAUDIO_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/x-ogm-text", GST_RANK_PRIMARY,
-      ogmtext_type_find, NULL, OGMTEXT_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "audio/x-speex", GST_RANK_PRIMARY,
-      speex_type_find, NULL, SPEEX_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "audio/x-celt", GST_RANK_PRIMARY, celt_type_find,
-      NULL, CELT_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/x-ogg-skeleton", GST_RANK_PRIMARY,
-      oggskel_type_find, NULL, OGG_SKELETON_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "text/x-cmml", GST_RANK_PRIMARY, cmml_type_find,
-      NULL, CMML_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-executable",
-      GST_RANK_MARGINAL, NULL, "\177ELF", 4, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER (plugin, "audio/aac", GST_RANK_SECONDARY, aac_type_find,
-      "aac,adts,adif,loas", AAC_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-spc", GST_RANK_SECONDARY,
-      "spc", "SNES-SPC700 Sound File Data", 27, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER (plugin, "audio/x-wavpack", GST_RANK_SECONDARY,
-      wavpack_type_find, "wv,wvp", WAVPACK_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "audio/x-wavpack-correction", GST_RANK_SECONDARY,
-      wavpack_type_find, "wvc", WAVPACK_CORRECTION_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-caf", GST_RANK_SECONDARY,
-      "caf", "caff\000\001", 6, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER (plugin, "application/postscript", GST_RANK_SECONDARY,
-      postscript_type_find, "ps", POSTSCRIPT_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "image/svg+xml", GST_RANK_SECONDARY,
-      svg_type_find, "svg", SVG_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-rar",
-      GST_RANK_SECONDARY, "rar", "Rar!", 4, GST_TYPE_FIND_LIKELY);
-  TYPE_FIND_REGISTER (plugin, "application/x-tar", GST_RANK_SECONDARY,
-      tar_type_find, "tar", TAR_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/x-ar", GST_RANK_SECONDARY,
-      ar_type_find, "a", AR_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/x-ms-dos-executable",
-      GST_RANK_SECONDARY, msdos_type_find, "dll,exe,ocx,sys,scr,msstyles,cpl",
-      MSDOS_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "video/x-dirac", GST_RANK_PRIMARY,
-      dirac_type_find, NULL, DIRAC_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "multipart/x-mixed-replace", GST_RANK_SECONDARY,
-      multipart_type_find, NULL, MULTIPART_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/x-mmsh", GST_RANK_SECONDARY,
-      mmsh_type_find, NULL, MMSH_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "video/vivo", GST_RANK_SECONDARY, vivo_type_find,
-      "viv", VIVO_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-nsf", GST_RANK_SECONDARY,
-      "nsf", "NESM\x1a", 5, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-gym", GST_RANK_SECONDARY,
-      "gym", "GYMX", 4, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-ay", GST_RANK_SECONDARY, "ay",
-      "ZXAYEMUL", 8, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-gbs", GST_RANK_SECONDARY,
-      "gbs", "GBS\x01", 4, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-vgm", GST_RANK_SECONDARY,
-      "vgm", "Vgm\x20", 4, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-sap", GST_RANK_SECONDARY,
-      "sap", "SAP\x0d\x0a" "AUTHOR\x20", 12, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-ivf", GST_RANK_SECONDARY,
-      "ivf", "DKIF", 4, GST_TYPE_FIND_NEARLY_CERTAIN);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-kss", GST_RANK_SECONDARY,
-      "kss", "KSSX\0", 5, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "application/pdf", GST_RANK_SECONDARY,
-      "pdf", "%PDF-", 5, GST_TYPE_FIND_LIKELY);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "application/msword",
-      GST_RANK_SECONDARY, "doc", "\320\317\021\340\241\261\032\341", 8,
-      GST_TYPE_FIND_LIKELY);
-  /* Mac OS X .DS_Store files tend to be taken for video/mpeg */
-  TYPE_FIND_REGISTER_START_WITH (plugin, "application/octet-stream",
-      GST_RANK_SECONDARY, "DS_Store", "\000\000\000\001Bud1", 8,
-      GST_TYPE_FIND_LIKELY);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "image/vnd.adobe.photoshop",
-      GST_RANK_SECONDARY, "psd", "8BPS\000\001\000\000\000\000", 10,
-      GST_TYPE_FIND_LIKELY);
-  TYPE_FIND_REGISTER (plugin, "image/vnd.wap.wbmp", GST_RANK_MARGINAL,
-      wbmp_typefind, NULL, NULL, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/x-yuv4mpeg", GST_RANK_SECONDARY,
-      y4m_typefind, NULL, NULL, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "image/x-icon", GST_RANK_MARGINAL,
-      windows_icon_typefind, NULL, NULL, NULL, NULL);
-
+GST_TYPE_FIND_REGISTER_DEFINE (mid, "audio/midi", GST_RANK_PRIMARY,
+    mid_type_find, "mid,midi", MID_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (mxmf, "audio/mobile-xmf", GST_RANK_PRIMARY,
+    mxmf_type_find, "mxmf", MXMF_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (flx, "video/x-fli", GST_RANK_MARGINAL,
+    flx_type_find, "flc,fli", FLX_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (id3v2, "application/x-id3v2",
+    GST_RANK_PRIMARY + 103, id3v2_type_find, "mp3,mp2,mp1,mpga,ogg,flac,tta",
+    ID3_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (id3v1, "application/x-id3v1",
+    GST_RANK_PRIMARY + 101, id3v1_type_find, "mp3,mp2,mp1,mpga,ogg,flac,tta",
+    ID3_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (apetag, "application/x-apetag",
+    GST_RANK_PRIMARY + 102, apetag_type_find, "mp3,ape,mpc,wv", APETAG_CAPS,
+    NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (tta, "audio/x-ttafile", GST_RANK_PRIMARY,
+    tta_type_find, "tta", TTA_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (mod, "audio/x-mod", GST_RANK_SECONDARY,
+    mod_type_find,
+    "669,amf,ams,dbm,digi,dmf,dsm,gdm,far,imf,it,j2b,mdl,med,mod,mt2,mtm,"
+    "okt,psm,ptm,sam,s3m,stm,stx,ult,umx,xm", MOD_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (mp3, "audio/mpeg", GST_RANK_PRIMARY,
+    mp3_type_find, "mp3,mp2,mp1,mpga", MP3_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (ac3, "audio/x-ac3", GST_RANK_PRIMARY,
+    ac3_type_find, "ac3,eac3", AC3_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (dts, "audio/x-dts", GST_RANK_SECONDARY,
+    dts_type_find, "dts", DTS_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (gsm, "audio/x-gsm", GST_RANK_PRIMARY, NULL,
+    "gsm", GSM_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (mpeg_sys, "video/mpeg-sys", GST_RANK_PRIMARY,
+    mpeg_sys_type_find, "mpe,mpeg,mpg", MPEG_SYS_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (mpeg_ts, "video/mpegts", GST_RANK_PRIMARY,
+    mpeg_ts_type_find, "ts,mts", MPEGTS_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (ogganx, "application/ogg", GST_RANK_PRIMARY,
+    ogganx_type_find, "ogg,oga,ogv,ogm,ogx,spx,anx,axa,axv", OGG_CAPS, NULL,
+    NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (mpeg_video_stream, "video/mpeg-elementary",
+    GST_RANK_MARGINAL, mpeg_video_stream_type_find, "mpv,mpeg,mpg",
+    MPEG_VIDEO_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (mpeg4_video, "video/mpeg4", GST_RANK_PRIMARY,
+    mpeg4_video_type_find, "m4v", MPEG_VIDEO_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (h263_video, "video/x-h263", GST_RANK_SECONDARY,
+    h263_video_type_find, "h263,263", H263_VIDEO_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (h264_video, "video/x-h264", GST_RANK_PRIMARY,
+    h264_video_type_find, "h264,x264,264", H264_VIDEO_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (h265_video, "video/x-h265", GST_RANK_PRIMARY,
+    h265_video_type_find, "h265,x265,265", H265_VIDEO_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (nuv, "video/x-nuv", GST_RANK_SECONDARY,
+    nuv_type_find, "nuv", NUV_CAPS, NULL, NULL);
+/* ISO formats */
+GST_TYPE_FIND_REGISTER_DEFINE (m4a, "audio/x-m4a", GST_RANK_PRIMARY,
+    m4a_type_find, "m4a", M4A_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (q3gp, "application/x-3gp", GST_RANK_PRIMARY,
+    q3gp_type_find, "3gp", Q3GP_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (qt, "video/quicktime", GST_RANK_PRIMARY,
+    qt_type_find, "mov,mp4", QT_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (qtif, "image/x-quicktime", GST_RANK_SECONDARY,
+    qtif_type_find, "qif,qtif,qti", QTIF_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (jp2, "image/jp2", GST_RANK_PRIMARY,
+    jp2_type_find, "jp2", JP2_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (jpc, "image/x-jpc", GST_RANK_PRIMARY,
+    jpc_type_find, "jpc,j2k", JPC_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (mj2, "video/mj2", GST_RANK_PRIMARY,
+    jp2_type_find, "mj2", MJ2_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (html, "text/html", GST_RANK_SECONDARY,
+    html_type_find, "htm,html", HTML_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (swf, "application/x-shockwave-flash",
+    GST_RANK_SECONDARY, swf_type_find, "swf,swfl", SWF_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (xges, "application/xges",
+    GST_RANK_PRIMARY, xges_type_find, "xges", XGES_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (xmeml, "application/vnd.apple-xmeml+xml",
+    GST_RANK_SECONDARY, xmeml_type_find, "xmeml", XMEML_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (fcpxml, "application/vnd.apple-fcp+xml",
+    GST_RANK_SECONDARY, fcpxml_type_find, "fcpxml", FCPXML_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (otio,
+    "application/vnd.pixar.opentimelineio+json", GST_RANK_SECONDARY,
+    otio_type_find, "otio", OTIO_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (dash_mpd, "application/dash+xml",
+    GST_RANK_PRIMARY, dash_mpd_type_find, "mpd,MPD", DASH_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (mss_manifest, "application/vnd.ms-sstr+xml",
+    GST_RANK_PRIMARY, mss_manifest_type_find, NULL, MSS_MANIFEST_CAPS, NULL,
+    NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (utf8, "text/plain", GST_RANK_MARGINAL,
+    utf8_type_find, "txt", UTF8_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (utf16, "text/utf-16", GST_RANK_MARGINAL,
+    utf16_type_find, "txt", UTF16_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (utf32, "text/utf-32", GST_RANK_MARGINAL,
+    utf32_type_find, "txt", UTF32_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (uri, "text/uri-list", GST_RANK_MARGINAL,
+    uri_type_find, "ram", URI_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (itc, "application/itc", GST_RANK_SECONDARY,
+    itc_type_find, "itc", ITC_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (hls, "application/x-hls", GST_RANK_MARGINAL,
+    hls_type_find, "m3u8", HLS_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (sdp, "application/sdp", GST_RANK_SECONDARY,
+    sdp_type_find, "sdp", SDP_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (smil, "application/smil", GST_RANK_SECONDARY,
+    smil_type_find, "smil", SMIL_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (ttml_xml, "application/ttml+xml",
+    GST_RANK_SECONDARY, ttml_xml_type_find, "ttml+xml", TTML_XML_CAPS, NULL,
+    NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (xml, "application/xml", GST_RANK_MARGINAL,
+    xml_type_find, "xml", GENERIC_XML_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (aiff, "audio/x-aiff", GST_RANK_SECONDARY,
+    aiff_type_find, "aiff,aif,aifc", AIFF_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (svx, "audio/x-svx", GST_RANK_SECONDARY,
+    svx_type_find, "iff,svx", SVX_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (paris, "audio/x-paris", GST_RANK_SECONDARY,
+    paris_type_find, "paf", PARIS_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (sds, "audio/x-sds", GST_RANK_SECONDARY,
+    sds_type_find, "sds", SDS_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (ircam, "audio/x-ircam", GST_RANK_SECONDARY,
+    ircam_type_find, "sf", IRCAM_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (shn, "audio/x-shorten", GST_RANK_SECONDARY,
+    shn_type_find, "shn", SHN_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (ape, "application/x-ape", GST_RANK_SECONDARY,
+    ape_type_find, "ape", APE_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (jpeg, "image/jpeg", GST_RANK_PRIMARY + 15,
+    jpeg_type_find, "jpg,jpe,jpeg", JPEG_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (bmp, "image/bmp", GST_RANK_PRIMARY,
+    bmp_type_find, "bmp", BMP_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (tiff, "image/tiff", GST_RANK_PRIMARY,
+    tiff_type_find, "tif,tiff", TIFF_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (exr, "image/x-exr", GST_RANK_PRIMARY,
+    exr_type_find, "exr", EXR_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (pnm, "image/x-portable-pixmap",
+    GST_RANK_SECONDARY, pnm_type_find, "pnm,ppm,pgm,pbm", PNM_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (matroska, "video/x-matroska", GST_RANK_PRIMARY,
+    matroska_type_find, "mkv,mka,mk3d,webm", MATROSKA_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (mxf, "application/mxf", GST_RANK_PRIMARY,
+    mxf_type_find, "mxf", MXF_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (dv, "video/x-dv", GST_RANK_SECONDARY,
+    dv_type_find, "dv,dif", DV_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (ilbc, "audio/iLBC-sh", GST_RANK_PRIMARY,
+    ilbc_type_find, "ilbc", ILBC_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (sbc, "audio/x-sbc", GST_RANK_MARGINAL,
+    sbc_type_find, "sbc", SBC_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (kate, "subtitle/x-kate", GST_RANK_MARGINAL,
+    kate_type_find, NULL, NULL, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (webvtt, "application/x-subtitle-vtt",
+    GST_RANK_MARGINAL, webvtt_type_find, "vtt", WEBVTT_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (flac, "audio/x-flac", GST_RANK_PRIMARY,
+    flac_type_find, "flac", FLAC_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (vorbis, "audio/x-vorbis", GST_RANK_PRIMARY,
+    vorbis_type_find, NULL, VORBIS_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (theora, "video/x-theora", GST_RANK_PRIMARY,
+    theora_type_find, NULL, THEORA_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (ogmvideo, "application/x-ogm-video",
+    GST_RANK_PRIMARY, ogmvideo_type_find, NULL, OGMVIDEO_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (ogmaudio, "application/x-ogm-audio",
+    GST_RANK_PRIMARY, ogmaudio_type_find, NULL, OGMAUDIO_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (ogmtext, "application/x-ogm-text",
+    GST_RANK_PRIMARY, ogmtext_type_find, NULL, OGMTEXT_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (speex, "audio/x-speex", GST_RANK_PRIMARY,
+    speex_type_find, NULL, SPEEX_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (celt, "audio/x-celt", GST_RANK_PRIMARY,
+    celt_type_find, NULL, CELT_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (oggskel, "application/x-ogg-skeleton",
+    GST_RANK_PRIMARY, oggskel_type_find, NULL, OGG_SKELETON_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (cmml, "text/x-cmml", GST_RANK_PRIMARY,
+    cmml_type_find, NULL, CMML_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (aac, "audio/aac", GST_RANK_SECONDARY,
+    aac_type_find, "aac,adts,adif,loas", AAC_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (wavpack_wvp, "audio/x-wavpack",
+    GST_RANK_SECONDARY, wavpack_type_find, "wv,wvp", WAVPACK_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (wavpack_wvc, "audio/x-wavpack-correction",
+    GST_RANK_SECONDARY, wavpack_type_find, "wvc", WAVPACK_CORRECTION_CAPS, NULL,
+    NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (postscript, "application/postscript",
+    GST_RANK_SECONDARY, postscript_type_find, "ps", POSTSCRIPT_CAPS, NULL,
+    NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (svg, "image/svg+xml", GST_RANK_SECONDARY,
+    svg_type_find, "svg", SVG_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (tar, "application/x-tar", GST_RANK_SECONDARY,
+    tar_type_find, "tar", TAR_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (ar, "application/x-ar", GST_RANK_SECONDARY,
+    ar_type_find, "a", AR_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (msdos, "application/x-ms-dos-executable",
+    GST_RANK_SECONDARY, msdos_type_find, "dll,exe,ocx,sys,scr,msstyles,cpl",
+    MSDOS_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (dirac, "video/x-dirac", GST_RANK_PRIMARY,
+    dirac_type_find, NULL, DIRAC_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (multipart, "multipart/x-mixed-replace",
+    GST_RANK_SECONDARY, multipart_type_find, NULL, MULTIPART_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (mmsh, "application/x-mmsh", GST_RANK_SECONDARY,
+    mmsh_type_find, NULL, MMSH_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (vivo, "video/vivo", GST_RANK_SECONDARY,
+    vivo_type_find, "viv", VIVO_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (wbmp, "image/vnd.wap.wbmp", GST_RANK_MARGINAL,
+    wbmp_typefind, NULL, NULL, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (y4m, "application/x-yuv4mpeg",
+    GST_RANK_SECONDARY, y4m_typefind, NULL, NULL, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (windows_icon, "image/x-icon", GST_RANK_MARGINAL,
+    windows_icon_typefind, NULL, NULL, NULL, NULL);
 #ifdef USE_GIO
-  TYPE_FIND_REGISTER (plugin, "xdgmime-base", GST_RANK_MARGINAL,
-      xdgmime_typefind, NULL, NULL, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (xdgmime, "xdgmime-base", GST_RANK_MARGINAL,
+    xdgmime_typefind, NULL, NULL, NULL, NULL);
 #endif
-
-  TYPE_FIND_REGISTER (plugin, "image/x-degas", GST_RANK_MARGINAL,
-      degas_type_find, NULL, NULL, NULL, NULL);
-  TYPE_FIND_REGISTER (plugin, "application/octet-stream", GST_RANK_MARGINAL,
-      dvdiso_type_find, NULL, NULL, NULL, NULL);
-
-  TYPE_FIND_REGISTER (plugin, "application/x-ssa", GST_RANK_SECONDARY,
-      ssa_type_find, "ssa,ass", NULL, NULL, NULL);
-
-  TYPE_FIND_REGISTER (plugin, "video/x-pva", GST_RANK_SECONDARY,
-      pva_type_find, "pva", PVA_CAPS, NULL, NULL);
-
-  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-xi", GST_RANK_SECONDARY,
-      "xi", "Extended Instrument: ", 21, GST_TYPE_FIND_MAXIMUM);
-
-  TYPE_FIND_REGISTER (plugin, "audio/audible", GST_RANK_MARGINAL,
-      aa_type_find, "aa,aax", AA_CAPS, NULL, NULL);
-
-  TYPE_FIND_REGISTER (plugin, "audio/x-tap-tap", GST_RANK_PRIMARY,
-      tap_type_find, "tap", TAP_CAPS, NULL, NULL);
-  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-tap-dmp",
-      GST_RANK_SECONDARY, "dmp", "DC2N-TAP-RAW", 12, GST_TYPE_FIND_LIKELY);
-
-  return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
-    GST_VERSION_MINOR,
-    typefindfunctions,
-    "default typefind functions",
-    plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
+GST_TYPE_FIND_REGISTER_DEFINE (degas, "image/x-degas", GST_RANK_MARGINAL,
+    degas_type_find, NULL, NULL, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (dvdiso, "application/octet-stream",
+    GST_RANK_MARGINAL, dvdiso_type_find, NULL, NULL, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (ssa, "application/x-ssa", GST_RANK_SECONDARY,
+    ssa_type_find, "ssa,ass", NULL, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (pva, "video/x-pva", GST_RANK_SECONDARY,
+    pva_type_find, "pva", PVA_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (aa, "audio/audible", GST_RANK_MARGINAL,
+    aa_type_find, "aa,aax", AA_CAPS, NULL, NULL);
+GST_TYPE_FIND_REGISTER_DEFINE (tap, "audio/x-tap-tap", GST_RANK_PRIMARY,
+    tap_type_find, "tap", TAP_CAPS, NULL, NULL);
diff --git a/gst/typefind/gsttypefindfunctionsdata.c b/gst/typefind/gsttypefindfunctionsdata.c
new file mode 100644 (file)
index 0000000..b2c3d87
--- /dev/null
@@ -0,0 +1,39 @@
+/* GStreamer
+ * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
+ * Copyright (C) 2005-2009 Tim-Philipp Müller <tim centricular net>
+ * Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd.
+ *   @Author: Stéphane Cerveau <scerveau@collabora.com>
+ *
+ * gsttypefindfunctionsdata.c: helper method for typefind functions
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+#include "gsttypefindfunctionsdata.h"
+
+void
+sw_data_destroy (GstTypeFindData * sw_data)
+{
+  if (G_LIKELY (sw_data->caps != NULL))
+    gst_caps_unref (sw_data->caps);
+  g_slice_free (GstTypeFindData, sw_data);
+}
diff --git a/gst/typefind/gsttypefindfunctionsdata.h b/gst/typefind/gsttypefindfunctionsdata.h
new file mode 100644 (file)
index 0000000..7998bcd
--- /dev/null
@@ -0,0 +1,44 @@
+/* GStreamer
+ * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
+ * Copyright (C) 2005-2009 Tim-Philipp Müller <tim centricular net>
+ * Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd.
+ *   @Author: Stéphane Cerveau <scerveau@collabora.com>
+ *
+ * gsttypefindfunctionsdata.h: collection of various typefind functions
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_TYPE_FIND_FUNCTIONS_DATA_H__
+#define __GST_TYPE_FIND_FUNCTIONS_DATA_H__
+
+#include <gst/gst.h>
+
+
+/*** generic typefind for streams that have some data at a specific position***/
+typedef struct
+{
+  const guint8 *data;
+  guint size;
+  guint probability;
+  GstCaps *caps;
+}
+GstTypeFindData;
+
+void sw_data_destroy (GstTypeFindData * sw_data);
+
+#endif //__GST_TYPE_FIND_FUNCTIONS_DATA_H__
diff --git a/gst/typefind/gsttypefindfunctionsplugin.c b/gst/typefind/gsttypefindfunctionsplugin.c
new file mode 100644 (file)
index 0000000..94030d1
--- /dev/null
@@ -0,0 +1,215 @@
+/* GStreamer
+ * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
+ * Copyright (C) 2005-2009 Tim-Philipp Müller <tim centricular net>
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd.
+ *   @Author: Stéphane Cerveau <scerveau@collabora.com>
+ *
+ * gsttypefindfunctions.c: collection of various typefind functions
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gsttypefindfunctionsplugin.h"
+
+#include <gst/gst.h>
+
+GST_DEBUG_CATEGORY_STATIC (type_find_debug);
+#define GST_CAT_DEFAULT type_find_debug
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+  /* can't initialize this via a struct as caps can't be statically initialized */
+  GST_DEBUG_CATEGORY_INIT (type_find_debug, "typefindfunctions",
+      GST_DEBUG_FG_GREEN | GST_DEBUG_BG_RED, "generic type find functions");
+  /* note: asx/wax/wmx are XML files, asf doesn't handle them */
+  /* must use strings, macros don't accept initializers */
+
+  /*Riff Type find register */
+  GST_TYPE_FIND_REGISTER (avi, plugin);
+  GST_TYPE_FIND_REGISTER (qcp, plugin);
+  GST_TYPE_FIND_REGISTER (cdxa, plugin);
+  GST_TYPE_FIND_REGISTER (riff_mid, plugin);
+  GST_TYPE_FIND_REGISTER (wav, plugin);
+  GST_TYPE_FIND_REGISTER (webp, plugin);
+
+  /*'Start with' Type find register */
+  GST_TYPE_FIND_REGISTER (asf, plugin);
+  GST_TYPE_FIND_REGISTER (vcd, plugin);
+  GST_TYPE_FIND_REGISTER (imelody, plugin);
+  GST_TYPE_FIND_REGISTER (scc, plugin);
+#if 0
+  GST_TYPE_FIND_REGISTER (smoke, plugin);
+#endif
+  GST_TYPE_FIND_REGISTER (rmf, plugin);
+  GST_TYPE_FIND_REGISTER (ram, plugin);
+  GST_TYPE_FIND_REGISTER (flv, plugin);
+  GST_TYPE_FIND_REGISTER (nist, plugin);
+  GST_TYPE_FIND_REGISTER (voc, plugin);
+  GST_TYPE_FIND_REGISTER (w64, plugin);
+  GST_TYPE_FIND_REGISTER (rf64, plugin);
+  GST_TYPE_FIND_REGISTER (gif, plugin);
+  GST_TYPE_FIND_REGISTER (png, plugin);
+  GST_TYPE_FIND_REGISTER (mve, plugin);
+  GST_TYPE_FIND_REGISTER (amr, plugin);
+  GST_TYPE_FIND_REGISTER (amr_wb, plugin);
+  GST_TYPE_FIND_REGISTER (sid, plugin);
+  GST_TYPE_FIND_REGISTER (xcf, plugin);
+  GST_TYPE_FIND_REGISTER (mng, plugin);
+  GST_TYPE_FIND_REGISTER (jng, plugin);
+  GST_TYPE_FIND_REGISTER (xpm, plugin);
+  GST_TYPE_FIND_REGISTER (ras, plugin);
+  GST_TYPE_FIND_REGISTER (bz2, plugin);
+  GST_TYPE_FIND_REGISTER (gz, plugin);
+  GST_TYPE_FIND_REGISTER (zip, plugin);
+  GST_TYPE_FIND_REGISTER (z, plugin);
+  GST_TYPE_FIND_REGISTER (elf, plugin);
+  GST_TYPE_FIND_REGISTER (spc, plugin);
+  GST_TYPE_FIND_REGISTER (caf, plugin);
+  GST_TYPE_FIND_REGISTER (rar, plugin);
+  GST_TYPE_FIND_REGISTER (nsf, plugin);
+  GST_TYPE_FIND_REGISTER (gym, plugin);
+  GST_TYPE_FIND_REGISTER (ay, plugin);
+  GST_TYPE_FIND_REGISTER (gbs, plugin);
+  GST_TYPE_FIND_REGISTER (vgm, plugin);
+  GST_TYPE_FIND_REGISTER (sap, plugin);
+  GST_TYPE_FIND_REGISTER (ivf, plugin);
+  GST_TYPE_FIND_REGISTER (kss, plugin);
+  GST_TYPE_FIND_REGISTER (pdf, plugin);
+  GST_TYPE_FIND_REGISTER (doc, plugin);
+  /* Mac OS X .DS_Store files tend to be taken for video/mpeg */
+  GST_TYPE_FIND_REGISTER (ds_store, plugin);
+  GST_TYPE_FIND_REGISTER (psd, plugin);
+  GST_TYPE_FIND_REGISTER (xi, plugin);
+  GST_TYPE_FIND_REGISTER (dmp, plugin);
+
+  /* functions Type find register */
+  GST_TYPE_FIND_REGISTER (musepack, plugin);
+  GST_TYPE_FIND_REGISTER (au, plugin);
+  GST_TYPE_FIND_REGISTER (mcc, plugin);
+  GST_TYPE_FIND_REGISTER (mid, plugin);
+  GST_TYPE_FIND_REGISTER (mxmf, plugin);
+  GST_TYPE_FIND_REGISTER (flx, plugin);
+  GST_TYPE_FIND_REGISTER (id3v2, plugin);
+  GST_TYPE_FIND_REGISTER (id3v1, plugin);
+  GST_TYPE_FIND_REGISTER (apetag, plugin);
+  GST_TYPE_FIND_REGISTER (tta, plugin);
+  GST_TYPE_FIND_REGISTER (mod, plugin);
+  GST_TYPE_FIND_REGISTER (mp3, plugin);
+  GST_TYPE_FIND_REGISTER (ac3, plugin);
+  GST_TYPE_FIND_REGISTER (dts, plugin);
+  GST_TYPE_FIND_REGISTER (gsm, plugin);
+  GST_TYPE_FIND_REGISTER (mpeg_sys, plugin);
+  GST_TYPE_FIND_REGISTER (mpeg_ts, plugin);
+  GST_TYPE_FIND_REGISTER (ogganx, plugin);
+  GST_TYPE_FIND_REGISTER (mpeg_video_stream, plugin);
+  GST_TYPE_FIND_REGISTER (mpeg4_video, plugin);
+  GST_TYPE_FIND_REGISTER (h263_video, plugin);
+  GST_TYPE_FIND_REGISTER (h264_video, plugin);
+  GST_TYPE_FIND_REGISTER (h265_video, plugin);
+  GST_TYPE_FIND_REGISTER (nuv, plugin);
+  /* ISO formats */
+  GST_TYPE_FIND_REGISTER (m4a, plugin);
+  GST_TYPE_FIND_REGISTER (q3gp, plugin);
+  GST_TYPE_FIND_REGISTER (qt, plugin);
+  GST_TYPE_FIND_REGISTER (qtif, plugin);
+  GST_TYPE_FIND_REGISTER (jp2, plugin);
+  GST_TYPE_FIND_REGISTER (jpc, plugin);
+  GST_TYPE_FIND_REGISTER (mj2, plugin);
+  GST_TYPE_FIND_REGISTER (html, plugin);
+  GST_TYPE_FIND_REGISTER (swf, plugin);
+  GST_TYPE_FIND_REGISTER (xges, plugin);
+  GST_TYPE_FIND_REGISTER (xmeml, plugin);
+  GST_TYPE_FIND_REGISTER (fcpxml, plugin);
+  GST_TYPE_FIND_REGISTER (otio, plugin);
+  GST_TYPE_FIND_REGISTER (dash_mpd, plugin);
+  GST_TYPE_FIND_REGISTER (mss_manifest, plugin);
+  GST_TYPE_FIND_REGISTER (utf8, plugin);
+  GST_TYPE_FIND_REGISTER (utf16, plugin);
+  GST_TYPE_FIND_REGISTER (utf32, plugin);
+  GST_TYPE_FIND_REGISTER (uri, plugin);
+  GST_TYPE_FIND_REGISTER (itc, plugin);
+  GST_TYPE_FIND_REGISTER (hls, plugin);
+  GST_TYPE_FIND_REGISTER (sdp, plugin);
+  GST_TYPE_FIND_REGISTER (smil, plugin);
+  GST_TYPE_FIND_REGISTER (ttml_xml, plugin);
+  GST_TYPE_FIND_REGISTER (xml, plugin);
+  GST_TYPE_FIND_REGISTER (aiff, plugin);
+  GST_TYPE_FIND_REGISTER (svx, plugin);
+  GST_TYPE_FIND_REGISTER (paris, plugin);
+  GST_TYPE_FIND_REGISTER (sds, plugin);
+  GST_TYPE_FIND_REGISTER (ircam, plugin);
+  GST_TYPE_FIND_REGISTER (shn, plugin);
+  GST_TYPE_FIND_REGISTER (ape, plugin);
+  GST_TYPE_FIND_REGISTER (jpeg, plugin);
+  GST_TYPE_FIND_REGISTER (bmp, plugin);
+  GST_TYPE_FIND_REGISTER (tiff, plugin);
+  GST_TYPE_FIND_REGISTER (exr, plugin);
+  GST_TYPE_FIND_REGISTER (pnm, plugin);
+  GST_TYPE_FIND_REGISTER (matroska, plugin);
+  GST_TYPE_FIND_REGISTER (mxf, plugin);
+  GST_TYPE_FIND_REGISTER (dv, plugin);
+  GST_TYPE_FIND_REGISTER (ilbc, plugin);
+  GST_TYPE_FIND_REGISTER (sbc, plugin);
+  GST_TYPE_FIND_REGISTER (kate, plugin);
+  GST_TYPE_FIND_REGISTER (webvtt, plugin);
+  GST_TYPE_FIND_REGISTER (flac, plugin);
+  GST_TYPE_FIND_REGISTER (vorbis, plugin);
+  GST_TYPE_FIND_REGISTER (theora, plugin);
+  GST_TYPE_FIND_REGISTER (ogmvideo, plugin);
+  GST_TYPE_FIND_REGISTER (ogmaudio, plugin);
+  GST_TYPE_FIND_REGISTER (ogmtext, plugin);
+  GST_TYPE_FIND_REGISTER (speex, plugin);
+  GST_TYPE_FIND_REGISTER (celt, plugin);
+  GST_TYPE_FIND_REGISTER (oggskel, plugin);
+  GST_TYPE_FIND_REGISTER (cmml, plugin);
+  GST_TYPE_FIND_REGISTER (aac, plugin);
+  GST_TYPE_FIND_REGISTER (wavpack_wvp, plugin);
+  GST_TYPE_FIND_REGISTER (wavpack_wvc, plugin);
+  GST_TYPE_FIND_REGISTER (postscript, plugin);
+  GST_TYPE_FIND_REGISTER (svg, plugin);
+  GST_TYPE_FIND_REGISTER (tar, plugin);
+  GST_TYPE_FIND_REGISTER (ar, plugin);
+  GST_TYPE_FIND_REGISTER (msdos, plugin);
+  GST_TYPE_FIND_REGISTER (dirac, plugin);
+  GST_TYPE_FIND_REGISTER (multipart, plugin);
+  GST_TYPE_FIND_REGISTER (mmsh, plugin);
+  GST_TYPE_FIND_REGISTER (vivo, plugin);
+  GST_TYPE_FIND_REGISTER (wbmp, plugin);
+  GST_TYPE_FIND_REGISTER (y4m, plugin);
+  GST_TYPE_FIND_REGISTER (windows_icon, plugin);
+#ifdef USE_GIO
+  GST_TYPE_FIND_REGISTER (xdgmime, plugin);
+#endif
+  GST_TYPE_FIND_REGISTER (degas, plugin);
+  GST_TYPE_FIND_REGISTER (dvdiso, plugin);
+  GST_TYPE_FIND_REGISTER (ssa, plugin);
+  GST_TYPE_FIND_REGISTER (pva, plugin);
+  GST_TYPE_FIND_REGISTER (aa, plugin);
+  GST_TYPE_FIND_REGISTER (tap, plugin);
+
+  return TRUE;
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+    GST_VERSION_MINOR,
+    typefindfunctions,
+    "default typefind functions",
+    plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/typefind/gsttypefindfunctionsplugin.h b/gst/typefind/gsttypefindfunctionsplugin.h
new file mode 100644 (file)
index 0000000..960c910
--- /dev/null
@@ -0,0 +1,196 @@
+/* GStreamer
+ * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
+ * Copyright (C) 2005-2009 Tim-Philipp Müller <tim centricular net>
+ * Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd.
+ *   @Author: Stéphane Cerveau <scerveau@collabora.com>
+ *
+ * gsttypefindfunctionsplugin.h: collection of various typefind functions
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_TYPE_FIND_FUNCTIONS_PLUGIN_H__
+#define __GST_TYPE_FIND_FUNCTIONS_PLUGIN_H__
+
+#include <gst/gst.h>
+
+/*** plugin initialization ***/
+
+/*RIFF type find declaration */
+GST_TYPE_FIND_REGISTER_DECLARE (avi);
+GST_TYPE_FIND_REGISTER_DECLARE (qcp);
+GST_TYPE_FIND_REGISTER_DECLARE (cdxa);
+GST_TYPE_FIND_REGISTER_DECLARE (riff_mid);
+GST_TYPE_FIND_REGISTER_DECLARE (wav);
+GST_TYPE_FIND_REGISTER_DECLARE (webp);
+
+/*'Start with' type find declaration */
+GST_TYPE_FIND_REGISTER_DECLARE (asf);
+GST_TYPE_FIND_REGISTER_DECLARE (vcd);
+GST_TYPE_FIND_REGISTER_DECLARE (imelody);
+GST_TYPE_FIND_REGISTER_DECLARE (scc);
+#if 0
+GST_TYPE_FIND_REGISTER_DECLARE (smoke);
+#endif
+GST_TYPE_FIND_REGISTER_DECLARE (rmf);
+GST_TYPE_FIND_REGISTER_DECLARE (ram);
+GST_TYPE_FIND_REGISTER_DECLARE (flv);
+GST_TYPE_FIND_REGISTER_DECLARE (nist);
+GST_TYPE_FIND_REGISTER_DECLARE (voc);
+GST_TYPE_FIND_REGISTER_DECLARE (w64);
+GST_TYPE_FIND_REGISTER_DECLARE (rf64);
+GST_TYPE_FIND_REGISTER_DECLARE (gif);
+GST_TYPE_FIND_REGISTER_DECLARE (png);
+GST_TYPE_FIND_REGISTER_DECLARE (mve);
+GST_TYPE_FIND_REGISTER_DECLARE (amr);
+GST_TYPE_FIND_REGISTER_DECLARE (amr_wb);
+GST_TYPE_FIND_REGISTER_DECLARE (sid);
+GST_TYPE_FIND_REGISTER_DECLARE (xcf);
+GST_TYPE_FIND_REGISTER_DECLARE (mng);
+GST_TYPE_FIND_REGISTER_DECLARE (jng);
+GST_TYPE_FIND_REGISTER_DECLARE (xpm);
+GST_TYPE_FIND_REGISTER_DECLARE (ras);
+GST_TYPE_FIND_REGISTER_DECLARE (bz2);
+GST_TYPE_FIND_REGISTER_DECLARE (gz);
+GST_TYPE_FIND_REGISTER_DECLARE (zip);
+GST_TYPE_FIND_REGISTER_DECLARE (z);
+GST_TYPE_FIND_REGISTER_DECLARE (elf);
+GST_TYPE_FIND_REGISTER_DECLARE (spc);
+GST_TYPE_FIND_REGISTER_DECLARE (caf);
+GST_TYPE_FIND_REGISTER_DECLARE (rar);
+GST_TYPE_FIND_REGISTER_DECLARE (nsf);
+GST_TYPE_FIND_REGISTER_DECLARE (gym);
+GST_TYPE_FIND_REGISTER_DECLARE (ay);
+GST_TYPE_FIND_REGISTER_DECLARE (gbs);
+GST_TYPE_FIND_REGISTER_DECLARE (vgm);
+GST_TYPE_FIND_REGISTER_DECLARE (sap);
+GST_TYPE_FIND_REGISTER_DECLARE (ivf);
+GST_TYPE_FIND_REGISTER_DECLARE (kss);
+GST_TYPE_FIND_REGISTER_DECLARE (pdf);
+GST_TYPE_FIND_REGISTER_DECLARE (doc);
+/* Mac OS X .DS_Store files tend to be taken for video/mpeg */
+GST_TYPE_FIND_REGISTER_DECLARE (ds_store);
+GST_TYPE_FIND_REGISTER_DECLARE (psd);
+GST_TYPE_FIND_REGISTER_DECLARE (xi);
+GST_TYPE_FIND_REGISTER_DECLARE (dmp);
+
+/*Type find declaration by functions */
+GST_TYPE_FIND_REGISTER_DECLARE (musepack);
+GST_TYPE_FIND_REGISTER_DECLARE (au);
+GST_TYPE_FIND_REGISTER_DECLARE (mcc);
+GST_TYPE_FIND_REGISTER_DECLARE (mid);
+GST_TYPE_FIND_REGISTER_DECLARE (mxmf);
+GST_TYPE_FIND_REGISTER_DECLARE (flx);
+GST_TYPE_FIND_REGISTER_DECLARE (id3v2);
+GST_TYPE_FIND_REGISTER_DECLARE (id3v1);
+GST_TYPE_FIND_REGISTER_DECLARE (apetag);
+GST_TYPE_FIND_REGISTER_DECLARE (tta);
+GST_TYPE_FIND_REGISTER_DECLARE (mod);
+GST_TYPE_FIND_REGISTER_DECLARE (mp3);
+GST_TYPE_FIND_REGISTER_DECLARE (ac3);
+GST_TYPE_FIND_REGISTER_DECLARE (dts);
+GST_TYPE_FIND_REGISTER_DECLARE (gsm);
+GST_TYPE_FIND_REGISTER_DECLARE (mpeg_sys);
+GST_TYPE_FIND_REGISTER_DECLARE (mpeg_ts);
+GST_TYPE_FIND_REGISTER_DECLARE (ogganx);
+GST_TYPE_FIND_REGISTER_DECLARE (mpeg_video_stream);
+GST_TYPE_FIND_REGISTER_DECLARE (mpeg4_video);
+GST_TYPE_FIND_REGISTER_DECLARE (h263_video);
+GST_TYPE_FIND_REGISTER_DECLARE (h264_video);
+GST_TYPE_FIND_REGISTER_DECLARE (h265_video);
+GST_TYPE_FIND_REGISTER_DECLARE (nuv);
+GST_TYPE_FIND_REGISTER_DECLARE (m4a);
+GST_TYPE_FIND_REGISTER_DECLARE (q3gp);
+GST_TYPE_FIND_REGISTER_DECLARE (qt);
+GST_TYPE_FIND_REGISTER_DECLARE (qtif);
+GST_TYPE_FIND_REGISTER_DECLARE (jp2);
+GST_TYPE_FIND_REGISTER_DECLARE (jpc);
+GST_TYPE_FIND_REGISTER_DECLARE (mj2);
+GST_TYPE_FIND_REGISTER_DECLARE (html);
+GST_TYPE_FIND_REGISTER_DECLARE (swf);
+GST_TYPE_FIND_REGISTER_DECLARE (xges);
+GST_TYPE_FIND_REGISTER_DECLARE (xmeml);
+GST_TYPE_FIND_REGISTER_DECLARE (fcpxml);
+GST_TYPE_FIND_REGISTER_DECLARE (otio);
+GST_TYPE_FIND_REGISTER_DECLARE (dash_mpd);
+GST_TYPE_FIND_REGISTER_DECLARE (mss_manifest);
+GST_TYPE_FIND_REGISTER_DECLARE (utf8);
+GST_TYPE_FIND_REGISTER_DECLARE (utf16);
+GST_TYPE_FIND_REGISTER_DECLARE (utf32);
+GST_TYPE_FIND_REGISTER_DECLARE (uri);
+GST_TYPE_FIND_REGISTER_DECLARE (itc);
+GST_TYPE_FIND_REGISTER_DECLARE (hls);
+GST_TYPE_FIND_REGISTER_DECLARE (sdp);
+GST_TYPE_FIND_REGISTER_DECLARE (smil);
+GST_TYPE_FIND_REGISTER_DECLARE (ttml_xml);
+GST_TYPE_FIND_REGISTER_DECLARE (xml);
+GST_TYPE_FIND_REGISTER_DECLARE (aiff);
+GST_TYPE_FIND_REGISTER_DECLARE (svx);
+GST_TYPE_FIND_REGISTER_DECLARE (paris);
+GST_TYPE_FIND_REGISTER_DECLARE (sds);
+GST_TYPE_FIND_REGISTER_DECLARE (ircam);
+GST_TYPE_FIND_REGISTER_DECLARE (shn);
+GST_TYPE_FIND_REGISTER_DECLARE (ape);
+GST_TYPE_FIND_REGISTER_DECLARE (jpeg);
+GST_TYPE_FIND_REGISTER_DECLARE (bmp);
+GST_TYPE_FIND_REGISTER_DECLARE (tiff);
+GST_TYPE_FIND_REGISTER_DECLARE (exr);
+GST_TYPE_FIND_REGISTER_DECLARE (pnm);
+GST_TYPE_FIND_REGISTER_DECLARE (matroska);
+GST_TYPE_FIND_REGISTER_DECLARE (mxf);
+GST_TYPE_FIND_REGISTER_DECLARE (dv);
+GST_TYPE_FIND_REGISTER_DECLARE (ilbc);
+GST_TYPE_FIND_REGISTER_DECLARE (sbc);
+GST_TYPE_FIND_REGISTER_DECLARE (kate);
+GST_TYPE_FIND_REGISTER_DECLARE (webvtt);
+GST_TYPE_FIND_REGISTER_DECLARE (flac);
+GST_TYPE_FIND_REGISTER_DECLARE (vorbis);
+GST_TYPE_FIND_REGISTER_DECLARE (theora);
+GST_TYPE_FIND_REGISTER_DECLARE (ogmvideo);
+GST_TYPE_FIND_REGISTER_DECLARE (ogmaudio);
+GST_TYPE_FIND_REGISTER_DECLARE (ogmtext);
+GST_TYPE_FIND_REGISTER_DECLARE (speex);
+GST_TYPE_FIND_REGISTER_DECLARE (celt);
+GST_TYPE_FIND_REGISTER_DECLARE (oggskel);
+GST_TYPE_FIND_REGISTER_DECLARE (cmml);
+GST_TYPE_FIND_REGISTER_DECLARE (aac);
+GST_TYPE_FIND_REGISTER_DECLARE (wavpack_wvp);
+GST_TYPE_FIND_REGISTER_DECLARE (wavpack_wvc);
+GST_TYPE_FIND_REGISTER_DECLARE (postscript);
+GST_TYPE_FIND_REGISTER_DECLARE (svg);
+GST_TYPE_FIND_REGISTER_DECLARE (tar);
+GST_TYPE_FIND_REGISTER_DECLARE (ar);
+GST_TYPE_FIND_REGISTER_DECLARE (msdos);
+GST_TYPE_FIND_REGISTER_DECLARE (dirac);
+GST_TYPE_FIND_REGISTER_DECLARE (multipart);
+GST_TYPE_FIND_REGISTER_DECLARE (mmsh);
+GST_TYPE_FIND_REGISTER_DECLARE (vivo);
+GST_TYPE_FIND_REGISTER_DECLARE (wbmp);
+GST_TYPE_FIND_REGISTER_DECLARE (y4m);
+GST_TYPE_FIND_REGISTER_DECLARE (windows_icon);
+#ifdef USE_GIO
+GST_TYPE_FIND_REGISTER_DECLARE (xdgmime);
+#endif
+GST_TYPE_FIND_REGISTER_DECLARE (degas);
+GST_TYPE_FIND_REGISTER_DECLARE (dvdiso);
+GST_TYPE_FIND_REGISTER_DECLARE (ssa);
+GST_TYPE_FIND_REGISTER_DECLARE (pva);
+GST_TYPE_FIND_REGISTER_DECLARE (aa);
+GST_TYPE_FIND_REGISTER_DECLARE (tap);
+
+#endif //__GST_TYPE_FIND_FUNCTIONS_PLUGIN_H__
diff --git a/gst/typefind/gsttypefindfunctionsriff.c b/gst/typefind/gsttypefindfunctionsriff.c
new file mode 100644 (file)
index 0000000..fb9308d
--- /dev/null
@@ -0,0 +1,83 @@
+/* GStreamer
+ * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
+ * Copyright (C) 2005-2009 Tim-Philipp Müller <tim centricular net>
+ * Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd.
+ *   @Author: Stéphane Cerveau <scerveau@collabora.com>
+ *
+ * gsttypefindfunctionsriff.c: collection of various typefind functions
+ * based on riff format.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+
+#include "gsttypefindfunctionsplugin.h"
+#include "gsttypefindfunctionsdata.h"
+
+/*** same for riff types ***/
+static void
+riff_type_find (GstTypeFind * tf, gpointer private)
+{
+  GstTypeFindData *riff_data = (GstTypeFindData *) private;
+  const guint8 *data = gst_type_find_peek (tf, 0, 12);
+
+  if (data && (memcmp (data, "RIFF", 4) == 0 || memcmp (data, "AVF0", 4) == 0)) {
+    data += 8;
+    if (memcmp (data, riff_data->data, 4) == 0)
+      gst_type_find_suggest (tf, riff_data->probability, riff_data->caps);
+  }
+}
+
+#define TYPE_FIND_REGISTER_RIFF_DEFINE(typefind_name, name, rank, ext, _data) \
+G_BEGIN_DECLS \
+static gboolean \
+G_PASTE(_private_type_find_riff_, typefind_name) (GstPlugin * plugin) \
+{ \
+  GstTypeFindData *sw_data = g_slice_new (GstTypeFindData);             \
+  sw_data->data = (gpointer)_data;                                      \
+  sw_data->size = 4;                                                    \
+  sw_data->probability = GST_TYPE_FIND_MAXIMUM;                         \
+  sw_data->caps = gst_caps_new_empty_simple (name);                     \
+  if (!gst_type_find_register (plugin, name, rank, riff_type_find,      \
+                      ext, sw_data->caps, sw_data,                      \
+                      (GDestroyNotify) (sw_data_destroy))) {            \
+    sw_data_destroy (sw_data);                                          \
+    return FALSE;                                                       \
+  }                                                                     \
+  return TRUE;                                                          \
+} \
+GST_TYPE_FIND_REGISTER_DEFINE_CUSTOM (typefind_name, G_PASTE(_private_type_find_riff_, typefind_name)); \
+G_END_DECLS
+
+/*RIFF type find definition */
+TYPE_FIND_REGISTER_RIFF_DEFINE (avi, "video/x-msvideo", GST_RANK_PRIMARY,
+    "avi", "AVI ");
+TYPE_FIND_REGISTER_RIFF_DEFINE (qcp, "audio/qcelp", GST_RANK_PRIMARY,
+    "qcp", "QLCM");
+TYPE_FIND_REGISTER_RIFF_DEFINE (cdxa, "video/x-cdxa", GST_RANK_PRIMARY,
+    "dat", "CDXA");
+TYPE_FIND_REGISTER_RIFF_DEFINE (riff_mid, "audio/riff-midi",
+    GST_RANK_PRIMARY, "mid,midi", "RMID");
+TYPE_FIND_REGISTER_RIFF_DEFINE (wav, "audio/x-wav", GST_RANK_PRIMARY, "wav",
+    "WAVE");
+TYPE_FIND_REGISTER_RIFF_DEFINE (webp, "image/webp", GST_RANK_PRIMARY,
+    "webp", "WEBP");
diff --git a/gst/typefind/gsttypefindfunctionsstartwith.c b/gst/typefind/gsttypefindfunctionsstartwith.c
new file mode 100644 (file)
index 0000000..decf9a8
--- /dev/null
@@ -0,0 +1,182 @@
+/* GStreamer
+ * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
+ * Copyright (C) 2005-2009 Tim-Philipp Müller <tim centricular net>
+ * Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd.
+ *   @Author: Stéphane Cerveau <scerveau@collabora.com>
+ *
+ * gsttypefindfunctionsstartwith.c: collection of various typefind functions
+ * using the start with pattern
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+
+#include "gsttypefindfunctionsplugin.h"
+#include "gsttypefindfunctionsdata.h"
+
+GST_DEBUG_CATEGORY_STATIC (type_find_debug);
+#define GST_CAT_DEFAULT type_find_debug
+
+static void
+start_with_type_find (GstTypeFind * tf, gpointer private)
+{
+  GstTypeFindData *start_with = (GstTypeFindData *) private;
+  const guint8 *data;
+
+  GST_LOG ("trying to find mime type %s with the first %u bytes of data",
+      gst_structure_get_name (gst_caps_get_structure (start_with->caps, 0)),
+      start_with->size);
+  data = gst_type_find_peek (tf, 0, start_with->size);
+  if (data && memcmp (data, start_with->data, start_with->size) == 0) {
+    gst_type_find_suggest (tf, start_with->probability, start_with->caps);
+  }
+}
+
+#define TYPE_FIND_REGISTER_START_WITH_DEFINE(typefind_name, name, rank, ext, _data, _size, _probability)\
+G_BEGIN_DECLS \
+static gboolean \
+G_PASTE(_private_type_find_start_with_, typefind_name) (GstPlugin * plugin) \
+{ \
+  GstTypeFindData *sw_data = g_slice_new (GstTypeFindData);             \
+  sw_data->data = (const guint8 *)_data;                                \
+  sw_data->size = _size;                                                \
+  sw_data->probability = _probability;                                  \
+  sw_data->caps = gst_caps_new_empty_simple (name);                     \
+  if (!gst_type_find_register (plugin, name, rank, start_with_type_find,\
+                     ext, sw_data->caps, sw_data,                       \
+                     (GDestroyNotify) (sw_data_destroy))) {             \
+    sw_data_destroy (sw_data);                                          \
+    return FALSE; \
+  } \
+  return TRUE; \
+}\
+GST_TYPE_FIND_REGISTER_DEFINE_CUSTOM (typefind_name, G_PASTE(_private_type_find_start_with_, typefind_name)); \
+G_END_DECLS
+
+/*'Start with' type find definition */
+TYPE_FIND_REGISTER_START_WITH_DEFINE (asf, "video/x-ms-asf",
+    GST_RANK_SECONDARY, "asf,wm,wma,wmv",
+    "\060\046\262\165\216\146\317\021\246\331\000\252\000\142\316\154", 16,
+    GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (vcd, "video/x-vcd", GST_RANK_PRIMARY,
+    "dat", "\000\377\377\377\377\377\377\377\377\377\377\000", 12,
+    GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (imelody, "audio/x-imelody",
+    GST_RANK_PRIMARY, "imy,ime,imelody", "BEGIN:IMELODY", 13,
+    GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (scc, "application/x-scc",
+    GST_RANK_PRIMARY, "scc", "Scenarist_SCC V1.0", 18, GST_TYPE_FIND_MAXIMUM);
+#if 0
+TYPE_FIND_REGISTER_START_WITH_DEFINE (smoke, "video/x-smoke",
+    GST_RANK_PRIMARY, NULL, "\x80smoke\x00\x01\x00", 6, GST_TYPE_FIND_MAXIMUM);
+#endif
+TYPE_FIND_REGISTER_START_WITH_DEFINE (rmf, "application/vnd.rn-realmedia",
+    GST_RANK_SECONDARY, "ra,ram,rm,rmvb", ".RMF", 4, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (ram, "application/x-pn-realaudio",
+    GST_RANK_SECONDARY, "ra,ram,rm,rmvb", ".ra\375", 4, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (flv, "video/x-flv",
+    GST_RANK_SECONDARY, "flv", "FLV", 3, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (nist, "audio/x-nist",
+    GST_RANK_SECONDARY, "nist", "NIST", 4, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (voc, "audio/x-voc",
+    GST_RANK_SECONDARY, "voc", "Creative", 8, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (w64, "audio/x-w64",
+    GST_RANK_SECONDARY, "w64", "riff", 4, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (rf64, "audio/x-rf64",
+    GST_RANK_PRIMARY, "rf64", "RF64", 4, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (gif, "image/gif", GST_RANK_PRIMARY,
+    "gif", "GIF8", 4, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (png, "image/png",
+    GST_RANK_PRIMARY + 14, "png", "\211PNG\015\012\032\012", 8,
+    GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (mve, "video/x-mve",
+    GST_RANK_SECONDARY, "mve",
+    "Interplay MVE File\032\000\032\000\000\001\063\021", 26,
+    GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (amr, "audio/x-amr-nb-sh",
+    GST_RANK_PRIMARY, "amr", "#!AMR", 5, GST_TYPE_FIND_LIKELY);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (amr_wb, "audio/x-amr-wb-sh",
+    GST_RANK_PRIMARY, "amr", "#!AMR-WB", 7, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (sid, "audio/x-sid", GST_RANK_MARGINAL,
+    "sid", "PSID", 4, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (xcf, "image/x-xcf",
+    GST_RANK_SECONDARY, "xcf", "gimp xcf", 8, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (mng, "video/x-mng",
+    GST_RANK_SECONDARY, "mng", "\212MNG\015\012\032\012", 8,
+    GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (jng, "image/x-jng",
+    GST_RANK_SECONDARY, "jng", "\213JNG\015\012\032\012", 8,
+    GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (xpm, "image/x-xpixmap",
+    GST_RANK_SECONDARY, "xpm", "/* XPM */", 9, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (ras, "image/x-sun-raster",
+    GST_RANK_SECONDARY, "ras", "\131\246\152\225", 4, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (bz2, "application/x-bzip",
+    GST_RANK_SECONDARY, "bz2", "BZh", 3, GST_TYPE_FIND_LIKELY);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (gz, "application/x-gzip",
+    GST_RANK_SECONDARY, "gz", "\037\213", 2, GST_TYPE_FIND_LIKELY);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (zip, "application/zip",
+    GST_RANK_SECONDARY, "zip", "PK\003\004", 4, GST_TYPE_FIND_LIKELY);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (z, "application/x-compress",
+    GST_RANK_SECONDARY, "Z", "\037\235", 2, GST_TYPE_FIND_LIKELY);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (elf, "application/x-executable",
+    GST_RANK_MARGINAL, NULL, "\177ELF", 4, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (spc, "audio/x-spc",
+    GST_RANK_SECONDARY, "spc", "SNES-SPC700 Sound File Data", 27,
+    GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (caf, "audio/x-caf",
+    GST_RANK_SECONDARY, "caf", "caff\000\001", 6, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (rar, "application/x-rar",
+    GST_RANK_SECONDARY, "rar", "Rar!", 4, GST_TYPE_FIND_LIKELY);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (nsf, "audio/x-nsf",
+    GST_RANK_SECONDARY, "nsf", "NESM\x1a", 5, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (gym, "audio/x-gym",
+    GST_RANK_SECONDARY, "gym", "GYMX", 4, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (ay, "audio/x-ay", GST_RANK_SECONDARY,
+    "ay", "ZXAYEMUL", 8, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (gbs, "audio/x-gbs",
+    GST_RANK_SECONDARY, "gbs", "GBS\x01", 4, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (vgm, "audio/x-vgm",
+    GST_RANK_SECONDARY, "vgm", "Vgm\x20", 4, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (sap, "audio/x-sap",
+    GST_RANK_SECONDARY, "sap", "SAP\x0d\x0a" "AUTHOR\x20", 12,
+    GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (ivf, "video/x-ivf",
+    GST_RANK_SECONDARY, "ivf", "DKIF", 4, GST_TYPE_FIND_NEARLY_CERTAIN);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (kss, "audio/x-kss",
+    GST_RANK_SECONDARY, "kss", "KSSX\0", 5, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (pdf, "application/pdf",
+    GST_RANK_SECONDARY, "pdf", "%PDF-", 5, GST_TYPE_FIND_LIKELY);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (doc, "application/msword",
+    GST_RANK_SECONDARY, "doc", "\320\317\021\340\241\261\032\341", 8,
+    GST_TYPE_FIND_LIKELY);
+/* Mac OS X .DS_Store files tend to be taken for video/mpeg */
+TYPE_FIND_REGISTER_START_WITH_DEFINE (ds_store, "application/octet-stream",
+    GST_RANK_SECONDARY, "DS_Store", "\000\000\000\001Bud1", 8,
+    GST_TYPE_FIND_LIKELY);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (psd, "image/vnd.adobe.photoshop",
+    GST_RANK_SECONDARY, "psd", "8BPS\000\001\000\000\000\000", 10,
+    GST_TYPE_FIND_LIKELY);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (xi, "audio/x-xi", GST_RANK_SECONDARY,
+    "xi", "Extended Instrument: ", 21, GST_TYPE_FIND_MAXIMUM);
+TYPE_FIND_REGISTER_START_WITH_DEFINE (dmp, "audio/x-tap-dmp",
+    GST_RANK_SECONDARY, "dmp", "DC2N-TAP-RAW", 12, GST_TYPE_FIND_LIKELY);
index 3c5a5d2..5a9582c 100644 (file)
@@ -5,8 +5,16 @@ if not get_option('gio-typefinder').disabled()
   typefindfunctions_extra_deps += [gio_dep]
 endif
 
+typefindfunctions_sources = [
+'gsttypefindfunctions.c',
+'gsttypefindfunctionsdata.c',
+'gsttypefindfunctionsplugin.c',
+'gsttypefindfunctionsriff.c',
+'gsttypefindfunctionsstartwith.c',
+]
+
 gsttypefind = library('gsttypefindfunctions',
-  'gsttypefindfunctions.c',
+  typefindfunctions_sources,
   c_args : gst_plugins_base_args + typefindfunctions_extra_defs,
   include_directories: [configinc, libsinc],
   dependencies : [pbutils_dep, gst_base_dep, typefindfunctions_extra_deps],