+2006-05-26 Jan Schmidt <thaytan@mad.scientist.com>
+
+ * plugins/elements/gstelements.c:
+ * plugins/elements/gstfilesrc.c: (gst_file_src_class_init),
+ (gst_file_src_init), (gst_file_src_set_property),
+ (gst_file_src_get_property), (gst_file_src_start):
+ * plugins/elements/gstfilesrc.h:
+
+ Add a use-mmap property to enable easier testing of all code paths.
+ Bump rank to PRIMARY, so filesrc is the preferred file reader and used
+ in the absence of gnomevfssrc. (Closes #340501)
+
2006-05-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* tools/gst-inspect.c:
{"fdsrc", GST_RANK_NONE, gst_fd_src_get_type},
{"fdsink", GST_RANK_NONE, gst_fd_sink_get_type},
#endif
- {"filesrc", GST_RANK_NONE, gst_file_src_get_type},
+ {"filesrc", GST_RANK_PRIMARY, gst_file_src_get_type},
{"identity", GST_RANK_NONE, gst_identity_get_type},
{"queue", GST_RANK_NONE, gst_queue_get_type},
{"filesink", GST_RANK_NONE, gst_file_sink_get_type},
#define DEFAULT_BLOCKSIZE 4*1024
#define DEFAULT_MMAPSIZE 4*1024*1024
#define DEFAULT_TOUCH FALSE
+#define DEFAULT_USEMMAP TRUE
enum
{
ARG_LOCATION,
ARG_FD,
ARG_MMAPSIZE,
- ARG_TOUCH
+ ARG_TOUCH,
+ ARG_USEMMAP
};
static void gst_file_src_finalize (GObject * object);
"Size in bytes of mmap()d regions", 0, G_MAXULONG, DEFAULT_MMAPSIZE,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_TOUCH,
- g_param_spec_boolean ("touch", "Touch read data",
- "Touch data to force disk read", DEFAULT_TOUCH, G_PARAM_READWRITE));
+ g_param_spec_boolean ("touch", "Touch mapped region read data",
+ "Touch mmapped data regions to force them to be read from disk",
+ DEFAULT_TOUCH, G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, ARG_USEMMAP,
+ g_param_spec_boolean ("use-mmap", "Use mmap to read data",
+ "Whether to use mmap. FALSE to force normal read() calls",
+ DEFAULT_USEMMAP, G_PARAM_READWRITE));
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_file_src_finalize);
src->mapbuf = NULL;
src->mapsize = DEFAULT_MMAPSIZE; /* default is 4MB */
+ src->use_mmap = DEFAULT_USEMMAP;
src->is_regular = FALSE;
}
src->touch = g_value_get_boolean (value);
g_object_notify (G_OBJECT (src), "touch");
break;
+ case ARG_USEMMAP:
+ src->use_mmap = g_value_get_boolean (value);
+ g_object_notify (G_OBJECT (src), "use-mmap");
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case ARG_TOUCH:
g_value_set_boolean (value, src->touch);
break;
+ case ARG_USEMMAP:
+ g_value_set_boolean (value, src->use_mmap);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
src->is_regular = TRUE;
#ifdef HAVE_MMAP
- /* FIXME: maybe we should only try to mmap if it's a regular file */
- /* allocate the first mmap'd region if it's a regular file ? */
- src->mapbuf = gst_file_src_map_region (src, 0, src->mapsize, TRUE);
- if (src->mapbuf != NULL) {
- GST_DEBUG_OBJECT (src, "using mmap for file");
- src->using_mmap = TRUE;
- src->seekable = TRUE;
- } else
+ if (src->use_mmap) {
+ /* FIXME: maybe we should only try to mmap if it's a regular file */
+ /* allocate the first mmap'd region if it's a regular file ? */
+ src->mapbuf = gst_file_src_map_region (src, 0, src->mapsize, TRUE);
+ if (src->mapbuf != NULL) {
+ GST_DEBUG_OBJECT (src, "using mmap for file");
+ src->using_mmap = TRUE;
+ src->seekable = TRUE;
+ }
+ }
+ if (src->mapbuf == NULL)
#endif
{
/* If not in mmap mode, we need to check if the underlying file is