diff options
author | Stéphane Cerveau <scerveau@collabora.com> | 2020-12-10 17:16:26 +0100 |
---|---|---|
committer | Stéphane Cerveau <scerveau@collabora.com> | 2020-12-11 10:12:39 +0100 |
commit | 4000e4b55e64ab4a7bf7edce2bce032609613af7 (patch) | |
tree | a62f42ecdf9fdc7e11c71a7c157a82430b94959c | |
parent | 5a004ed35b60495f90d2649b22c29337498e2927 (diff) |
plugin: update the doc to declare a typefind
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-docs/-/merge_requests/117>
-rw-r--r-- | markdown/plugin-development/advanced/media-types.md | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/markdown/plugin-development/advanced/media-types.md b/markdown/plugin-development/advanced/media-types.md index 8d71a78..20606a8 100644 --- a/markdown/plugin-development/advanced/media-types.md +++ b/markdown/plugin-development/advanced/media-types.md @@ -82,28 +82,28 @@ will recognize AVI files, which start with a “RIFF” tag, then the size of the file and then an “AVI” tag: ``` c +static GstStaticCaps avi_caps = GST_STATIC_CAPS ("video/x-msvideo"); +#define AVI_CAPS gst_static_caps_get(&avi_caps) static void -gst_my_typefind_function (GstTypeFind *tf, - gpointer data) +gst_avi_typefind_function (GstTypeFind *tf, + gpointer pointer) { guint8 *data = gst_type_find_peek (tf, 0, 12); if (data && GUINT32_FROM_LE (&((guint32 *) data)[0]) == GST_MAKE_FOURCC ('R','I','F','F') && GUINT32_FROM_LE (&((guint32 *) data)[2]) == GST_MAKE_FOURCC ('A','V','I',' ')) { - gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, - gst_caps_new_simple ("video/x-msvideo", NULL)); + gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, AVI_CAPS); } } +GST_TYPE_FIND_REGISTER_DEFINE(avi, "video/x-msvideo", GST_RANK_PRIMARY, + gst_avi_typefind_function, "avi", AVI_CAPS, NULL, NULL); + static gboolean plugin_init (GstPlugin *plugin) { - if (!gst_type_find_register (plugin, "", GST_RANK_PRIMARY, - gst_my_typefind_function, "avi", - gst_caps_new_simple ("video/x-msvideo", - NULL), NULL)) - return FALSE; + return GST_TYPEFIND_REGISTER(avi, plugin); } ``` |