summaryrefslogtreecommitdiff
path: root/gst/qtdemux/qtdemux.c
diff options
context:
space:
mode:
Diffstat (limited to 'gst/qtdemux/qtdemux.c')
-rw-r--r--gst/qtdemux/qtdemux.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c
index 3358db334..f5a95c034 100644
--- a/gst/qtdemux/qtdemux.c
+++ b/gst/qtdemux/qtdemux.c
@@ -104,7 +104,7 @@ gst_qtdemux_details =
"(C) 2003",
};
-static GstCaps* quicktime_type_find (GstBuffer *buf, gpointer private);
+static GstCaps* quicktime_type_find (GstByteStream *bs, gpointer private);
static GstTypeDefinition quicktimedefinition = {
"qtdemux_video/quicktime",
@@ -187,24 +187,29 @@ gst_qtdemux_init (GstQTDemux *qtdemux)
}
static GstCaps*
-quicktime_type_find (GstBuffer *buf, gpointer private)
+quicktime_type_find (GstByteStream *bs, gpointer private)
{
- gchar *data = GST_BUFFER_DATA (buf);
-
- g_return_val_if_fail (data != NULL, NULL);
-
- if(GST_BUFFER_SIZE(buf) < 8){
- return NULL;
+ GstBuffer *buf = NULL;
+ GstCaps *new = NULL;
+
+ if (gst_bytestream_peek (bs, &buf, 8) == 8) {
+ gchar *data = GST_BUFFER_DATA (buf);
+
+ if (!strncmp (&data[4], "wide", 4) ||
+ !strncmp (&data[4], "moov", 4) ||
+ !strncmp (&data[4], "mdat", 4) ||
+ !strncmp (&data[4], "free", 4)) {
+ new = GST_CAPS_NEW ("quicktime_type_find",
+ "video/quicktime",
+ NULL);
+ }
}
- if (strncmp (&data[4], "wide", 4)==0 ||
- strncmp (&data[4], "moov", 4)==0 ||
- strncmp (&data[4], "mdat", 4)==0 ||
- strncmp (&data[4], "free", 4)==0) {
- return gst_caps_new ("quicktime_type_find",
- "video/quicktime",
- NULL);
+
+ if (buf != NULL) {
+ gst_buffer_unref (buf);
}
- return NULL;
+
+ return new;
}
static gboolean
@@ -222,9 +227,6 @@ plugin_init (GModule *module, GstPlugin *plugin)
};
gint i;
- if (!gst_library_load ("gstbytestream"))
- return FALSE;
-
factory = gst_element_factory_new ("qtdemux", GST_TYPE_QTDEMUX,
&gst_qtdemux_details);
g_return_val_if_fail(factory != NULL, FALSE);