filesrc: Don't use expensive cast checks in _create
authorEdward Hervey <bilboed@bilboed.com>
Wed, 17 Feb 2010 11:16:37 +0000 (12:16 +0100)
committerEdward Hervey <bilboed@bilboed.com>
Wed, 17 Feb 2010 11:37:11 +0000 (12:37 +0100)
_create() is a pad function set by ourselves, therefore we're sure basesrc
is a GstFileSrc.

Speeds up _create() by 17% and the total call by 8% (instruction calls measurements
done with valgrind).

Fixes #610246

plugins/elements/gstfilesrc.c
plugins/elements/gstfilesrc.h

index 2c40c32..6aadc42 100644 (file)
@@ -898,7 +898,7 @@ gst_file_src_create (GstBaseSrc * basesrc, guint64 offset, guint length,
   GstFileSrc *src;
   GstFlowReturn ret;
 
-  src = GST_FILE_SRC (basesrc);
+  src = GST_FILE_SRC_CAST (basesrc);
 
 #ifdef HAVE_MMAP
   if (src->using_mmap) {
index 3a3eee7..dbd6fe4 100644 (file)
@@ -41,6 +41,7 @@ G_BEGIN_DECLS
   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FILE_SRC))
 #define GST_IS_FILE_SRC_CLASS(klass) \
   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FILE_SRC))
+#define GST_FILE_SRC_CAST(obj) ((GstFileSrc*) obj)
 
 typedef struct _GstFileSrc GstFileSrc;
 typedef struct _GstFileSrcClass GstFileSrcClass;