mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
gst/typefind/gsttypefindfunctions.c: Add typefinder for VIVO files (my christmas present to the 90s).
Original commit message from CVS: * gst/typefind/gsttypefindfunctions.c: (vivo_type_find), (plugin_init): Add typefinder for VIVO files (my christmas present to the 90s).
This commit is contained in:
parent
a4c0d0b8c3
commit
2a18fb3546
2 changed files with 49 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
2006-12-20 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* gst/typefind/gsttypefindfunctions.c: (vivo_type_find),
|
||||
(plugin_init):
|
||||
Add typefinder for VIVO files (my christmas present to the 90s).
|
||||
|
||||
2006-12-16 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* gst/playback/gstdecodebin.c: (type_found):
|
||||
|
|
|
@ -2430,6 +2430,47 @@ mmsh_type_find (GstTypeFind * tf, gpointer unused)
|
|||
}
|
||||
}
|
||||
|
||||
/*** video/vivo ***/
|
||||
|
||||
static GstStaticCaps vivo_caps = GST_STATIC_CAPS ("video/vivo");
|
||||
|
||||
#define VIVO_CAPS gst_static_caps_get(&vivo_caps)
|
||||
|
||||
static void
|
||||
vivo_type_find (GstTypeFind * tf, gpointer unused)
|
||||
{
|
||||
static const guint8 vivo_marker[] = { 'V', 'e', 'r', 's', 'i', 'o', 'n',
|
||||
':', 'V', 'i', 'v', 'o', '/'
|
||||
};
|
||||
guint8 *data;
|
||||
guint hdr_len, pos;
|
||||
|
||||
data = gst_type_find_peek (tf, 0, 1024);
|
||||
if (data == NULL || data[0] != 0x00)
|
||||
return;
|
||||
|
||||
if ((data[1] & 0x80)) {
|
||||
if ((data[2] & 0x80))
|
||||
return;
|
||||
hdr_len = ((guint) (data[1] & 0x7f)) << 7;
|
||||
hdr_len += data[2];
|
||||
if (hdr_len > 2048)
|
||||
return;
|
||||
pos = 3;
|
||||
} else {
|
||||
hdr_len = data[1];
|
||||
pos = 2;
|
||||
}
|
||||
|
||||
/* 1008 = 1022 - strlen ("Version:Vivo/") - 1 */
|
||||
while (pos < 1008 && data[pos] == '\r' && data[pos + 1] == '\n')
|
||||
pos += 2;
|
||||
|
||||
if (memcmp (data + pos, vivo_marker, sizeof (vivo_marker)) == 0) {
|
||||
gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, VIVO_CAPS);
|
||||
}
|
||||
}
|
||||
|
||||
/*** generic typefind for streams that have some data at a specific position***/
|
||||
typedef struct
|
||||
{
|
||||
|
@ -2798,6 +2839,8 @@ plugin_init (GstPlugin * plugin)
|
|||
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, NULL, VIVO_CAPS, NULL, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue