filesrc: Don't use expensive cast checks in _create

_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
This commit is contained in:
Edward Hervey 2010-02-17 12:16:37 +01:00
parent bc9e129990
commit 1f0b6f35d5
2 changed files with 2 additions and 1 deletions

View file

@ -898,7 +898,7 @@ gst_file_src_create (GstBaseSrc * basesrc, guint64 offset, guint length,
GstFileSrc *src; GstFileSrc *src;
GstFlowReturn ret; GstFlowReturn ret;
src = GST_FILE_SRC (basesrc); src = GST_FILE_SRC_CAST (basesrc);
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
if (src->using_mmap) { if (src->using_mmap) {

View file

@ -41,6 +41,7 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FILE_SRC)) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FILE_SRC))
#define GST_IS_FILE_SRC_CLASS(klass) \ #define GST_IS_FILE_SRC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FILE_SRC)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FILE_SRC))
#define GST_FILE_SRC_CAST(obj) ((GstFileSrc*) obj)
typedef struct _GstFileSrc GstFileSrc; typedef struct _GstFileSrc GstFileSrc;
typedef struct _GstFileSrcClass GstFileSrcClass; typedef struct _GstFileSrcClass GstFileSrcClass;