GST_DEBUG_CATEGORY_STATIC (type_find_debug);
#define GST_CAT_DEFAULT type_find_debug
-/*** text/plain ****************************************************************/
+/*** text/plain ***/
static GstStaticCaps utf8_caps = GST_STATIC_CAPS ("text/plain");
/* randomly decided values */
guint size = 1024; /* starting size */
guint probability = 95; /* starting probability */
- guint step = 10; /* how much we reduce probability in each iteration */
+ guint step = 10; /* how much we reduce probability in each
+ * iteration */
while (probability > step) {
data = gst_type_find_peek (tf, 0, size);
}
}
-/*** text/uri-list ************************************************************/
+/*** text/uri-list ***/
static GstStaticCaps uri_caps = GST_STATIC_CAPS ("text/uri-list");
#define URI_CAPS (gst_static_caps_get(&uri_caps))
#define BUFFER_SIZE 16 /* If the string is < 16 bytes we're screwed */
-#define INC_BUFFER { \
+#define INC_BUFFER { \
pos++; \
if (pos == BUFFER_SIZE) { \
pos = 0; \
}
}
-/*** video/x-fli **************************************************************/
+/*** video/x-fli ***/
static GstStaticCaps flx_caps = GST_STATIC_CAPS ("video/x-fli");
}
}
-/*** application/x-id3 **************************************************************/
+/*** application/x-id3 ***/
static GstStaticCaps id3_caps = GST_STATIC_CAPS ("application/x-id3");
}
}
-/*** application/x-ape **************************************************************/
+/*** application/x-ape ***/
static GstStaticCaps apetag_caps = GST_STATIC_CAPS ("application/x-apetag");
}
}
-/*** audio/x-ttafile *********************************************************/
+/*** audio/x-ttafile ***/
static GstStaticCaps tta_caps = GST_STATIC_CAPS ("audio/x-ttafile");
}
}
-/*** audio/mpeg version 2, 4 *************************************************/
+/*** audio/mpeg version 2, 4 ***/
static GstStaticCaps aac_caps = GST_STATIC_CAPS ("audio/mpeg, "
"mpegversion = (int) { 2, 4 }, framed = (bool) false");
}
}
-/*** audio/mpeg version 1 ****************************************************/
+/*** audio/mpeg version 1 ***/
/*
* The chance that random data is identified as a valid mp3 header is 63 / 2^18
* random values for typefinding
* if no more data is available, we will return a probability of
* (found_headers/TRY_HEADERS) * (MAXIMUM * (TRY_SYNC - bytes_skipped)
- * / TRY_SYNC)
+ * / TRY_SYNC)
* if found_headers >= MIN_HEADERS
*/
#define GST_MP3_TYPEFIND_MIN_HEADERS (2)
}
}
-/*** audio/x-ac3 **************************************************************/
+/*** audio/x-ac3 ***/
static GstStaticCaps ac3_caps = GST_STATIC_CAPS ("audio/x-ac3");
#define AC3_CAPS (gst_static_caps_get(&ac3_caps))
}
}
-/*** video/mpeg systemstream **************************************************/
+/*** video/mpeg systemstream ***/
static GstStaticCaps mpeg_sys_caps = GST_STATIC_CAPS ("video/mpeg, "
"systemstream = (boolean) true, mpegversion = (int) [ 1, 2 ]");
};
-/* ATTANTION: ugly return value:
+/* ATTENTION: ugly return value:
* 0 - invalid data
* 1 - not enough data
* anything else - size until next package
/* calculation of possibility to identify random data as mpeg systemstream:
* bits that must match in header detection: 32 (or more)
* chance that random data is identifed: 1/2^32
- * chance that GST_MPEG_TYPEFIND_TRY_HEADERS headers are identified:
+ * chance that GST_MPEG_TYPEFIND_TRY_HEADERS headers are identified:
* 1/2^(32*GST_MPEG_TYPEFIND_TRY_HEADERS)
* chance that this happens in GST_MPEG_TYPEFIND_TRY_SYNC bytes:
* 1-(1+1/2^(32*GST_MPEG_TYPEFIND_TRY_HEADERS)^GST_MPEG_TYPEFIND_TRY_SYNC)
}
}
-/*** video/mpeg video stream **************************************************/
+/*** video/mpeg video stream ***/
static GstStaticCaps mpeg_video_caps = GST_STATIC_CAPS ("video/mpeg, "
"systemstream = (boolean) false");
}
}
-/*** video/quicktime***********************************************************/
+/*** video/quicktime***/
static GstStaticCaps qt_caps = GST_STATIC_CAPS ("video/quicktime");
}
};
-/*** audio/x-aiff *********************************************/
+/*** audio/x-aiff ***/
static GstStaticCaps aiff_caps = GST_STATIC_CAPS ("audio/x-aiff");
}
}
-/*** audio/x-aiff *********************************************/
+/*** audio/x-aiff ***/
static GstStaticCaps svx_caps = GST_STATIC_CAPS ("audio/x-svx");
}
}
-/*** audio/x-shorten ****************************************/
+/*** audio/x-shorten ***/
static GstStaticCaps shn_caps = GST_STATIC_CAPS ("audio/x-shorten");
}
}
-/*** application/x-ape *********************************************/
+/*** application/x-ape ***/
static GstStaticCaps ape_caps = GST_STATIC_CAPS ("application/x-ape");
}
}
-/*** audio/x-m4a *********************************************/
+/*** audio/x-m4a ***/
static GstStaticCaps m4a_caps = GST_STATIC_CAPS ("audio/x-m4a");
}
}
-/*** application/x-3gp *********************************************/
+/*** application/x-3gp ***/
/*
* The Q is there because variables can't start with a number.
}
}
-/*** audio/x-mod *********************************************/
+/*** audio/x-mod ***/
static GstStaticCaps mod_caps = GST_STATIC_CAPS ("audio/x-mod");
}
}
-/*** application/x-shockwave-flash ********************************************/
+/*** application/x-shockwave-flash ***/
static GstStaticCaps swf_caps =
GST_STATIC_CAPS ("application/x-shockwave-flash");
}
}
-/*** image/jpeg ***************************************************************/
+/*** image/jpeg ***/
static GstStaticCaps jpeg_caps = GST_STATIC_CAPS ("image/jpeg");
}
}
-/*** image/bmp *********************/
+/*** image/bmp ***/
static GstStaticCaps bmp_caps = GST_STATIC_CAPS ("image/bmp");
}
}
-/*** image/tiff ********************/
+/*** image/tiff ***/
static GstStaticCaps tiff_caps = GST_STATIC_CAPS ("image/tiff, "
"endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }");
#define TIFF_CAPS (gst_static_caps_get(&tiff_caps))
}
-/*** video/x-matroska ********************/
+/*** video/x-matroska ***/
static GstStaticCaps matroska_caps = GST_STATIC_CAPS ("video/x-matroska");
#define MATROSKA_CAPS (gst_static_caps_get(&matroska_caps))
}
}
-/*** video/x-dv ***************************************************************/
+/*** video/x-dv ***/
static GstStaticCaps dv_caps = GST_STATIC_CAPS ("video/x-dv, "
"systemstream = (boolean) true");
}
-/*** application/ogg and application/x-annodex *****************************/
+/*** application/ogg and application/x-annodex ***/
static GstStaticCaps ogg_caps = GST_STATIC_CAPS ("application/ogg");
static GstStaticCaps annodex_caps = GST_STATIC_CAPS ("application/x-annodex");
static GstStaticCaps ogganx_caps =
}
}
-/*** audio/x-vorbis ***********************************************************/
+/*** audio/x-vorbis ***/
static GstStaticCaps vorbis_caps = GST_STATIC_CAPS ("audio/x-vorbis");
#define VORBIS_CAPS (gst_static_caps_get(&vorbis_caps))
}
}
-/*** video/x-theora ***********************************************************/
+/*** video/x-theora ***/
static GstStaticCaps theora_caps = GST_STATIC_CAPS ("video/x-theora");
}
}
-/*** application/x-ogm-video or audio*****************************************/
+/*** application/x-ogm-video or audio***/
static GstStaticCaps ogmvideo_caps =
GST_STATIC_CAPS ("application/x-ogm-video");
}
}
-/*** audio/x-speex ***********************************************************/
+/*** audio/x-speex ***/
static GstStaticCaps speex_caps = GST_STATIC_CAPS ("audio/x-speex");
}
}
-/*** application/x-ogg-skeleton ***********************************************************/
+/*** application/x-ogg-skeleton ***/
static GstStaticCaps ogg_skeleton_caps =
GST_STATIC_CAPS ("application/x-ogg-skeleton");
#define OGG_SKELETON_CAPS (gst_static_caps_get(&ogg_skeleton_caps))
GstCaps *caps;
}
GstTypeFindData;
+
static void
start_with_type_find (GstTypeFind * tf, gpointer private)
{
}
#define TYPE_FIND_REGISTER_START_WITH(plugin,name,rank,ext,_data,_size,_probability)\
-G_BEGIN_DECLS{ \
- GstTypeFindData *sw_data = g_new (GstTypeFindData, 1); \
- sw_data->data = (gpointer)_data; \
- sw_data->size = _size; \
- sw_data->probability = _probability; \
+G_BEGIN_DECLS{ \
+ GstTypeFindData *sw_data = g_new (GstTypeFindData, 1); \
+ sw_data->data = (gpointer)_data; \
+ sw_data->size = _size; \
+ sw_data->probability = _probability; \
sw_data->caps = gst_caps_new_simple (name, NULL); \
- TYPE_FIND_REGISTER (plugin, name, rank, start_with_type_find, \
- ext, sw_data->caps, sw_data); \
+ if (!gst_type_find_register (plugin, name, rank, start_with_type_find,\
+ ext, sw_data->caps, sw_data)) { \
+ gst_caps_unref (sw_data->caps); \
+ g_free (sw_data); \
+ } \
}G_END_DECLS
-/*** same for riff types ******************************************************/
+/*** same for riff types ***/
static void
riff_type_find (GstTypeFind * tf, gpointer private)
}
}
-#define TYPE_FIND_REGISTER_RIFF(plugin,name,rank,ext,_data) \
-G_BEGIN_DECLS{ \
- GstTypeFindData *sw_data = g_new (GstTypeFindData, 1); \
- sw_data->data = (gpointer)_data; \
- sw_data->size = 4; \
- sw_data->probability = GST_TYPE_FIND_MAXIMUM; \
+#define TYPE_FIND_REGISTER_RIFF(plugin,name,rank,ext,_data) \
+G_BEGIN_DECLS{ \
+ GstTypeFindData *sw_data = g_new (GstTypeFindData, 1); \
+ sw_data->data = (gpointer)_data; \
+ sw_data->size = 4; \
+ sw_data->probability = GST_TYPE_FIND_MAXIMUM; \
sw_data->caps = gst_caps_new_simple (name, NULL); \
- TYPE_FIND_REGISTER (plugin, name, rank, riff_type_find, \
- ext, sw_data->caps, sw_data); \
+ if (!gst_type_find_register (plugin, name, rank, riff_type_find, \
+ ext, sw_data->caps, sw_data)) { \
+ gst_caps_unref (sw_data->caps); \
+ g_free (sw_data); \
+ } \
}G_END_DECLS
-/*** plugin initialization ****************************************************/
+/*** plugin initialization ***/
-#define TYPE_FIND_REGISTER(plugin,name,rank,func,ext,caps,priv) G_BEGIN_DECLS{\
+#define TYPE_FIND_REGISTER(plugin,name,rank,func,ext,caps,priv) \
+G_BEGIN_DECLS{\
if (!gst_type_find_register (plugin, name, rank, func, ext, caps, priv))\
return FALSE; \
}G_END_DECLS