diff options
author | David Schleef <ds@schleef.org> | 2009-02-20 11:09:19 -0800 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2009-04-12 18:45:24 -0700 |
commit | 1ecf114c0ecb7477cbdf9f8b5c772d2e93489064 (patch) | |
tree | 68ac0932c138f9a764459527c5fb09b8f310dff9 /plugins | |
parent | cf78781c6bd030c3f39a3a49101b4a738e2a68e8 (diff) |
Add param spec flags for when a property can be changed
Adds GST_PARAM_MUTABLE* flags to indicate in which states a
property can be changed and take effect. Fixes #571559
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/elements/gstfilesrc.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index 3a55a7e922..2c03167686 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -248,15 +248,19 @@ gst_file_src_class_init (GstFileSrcClass * klass) g_object_class_install_property (gobject_class, ARG_LOCATION, g_param_spec_string ("location", "File Location", "Location of the file to read", NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | + GST_PARAM_MUTABLE_READY)); g_object_class_install_property (gobject_class, ARG_MMAPSIZE, g_param_spec_ulong ("mmapsize", "mmap() Block Size", "Size in bytes of mmap()d regions", 0, G_MAXULONG, DEFAULT_MMAPSIZE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | + GST_PARAM_MUTABLE_PLAYING)); g_object_class_install_property (gobject_class, ARG_TOUCH, 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_PARAM_STATIC_STRINGS)); + DEFAULT_TOUCH, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | + GST_PARAM_MUTABLE_PLAYING)); /** * GstFileSrc:use-mmap * @@ -278,12 +282,14 @@ gst_file_src_class_init (GstFileSrcClass * klass) g_object_class_install_property (gobject_class, ARG_USEMMAP, g_param_spec_boolean ("use-mmap", "Use mmap to read data", "Whether to use mmap() instead of read()", - DEFAULT_USEMMAP, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + DEFAULT_USEMMAP, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | + GST_PARAM_MUTABLE_READY)); g_object_class_install_property (gobject_class, ARG_SEQUENTIAL, g_param_spec_boolean ("sequential", "Optimise for sequential mmap access", "Whether to use madvise to hint to the kernel that access to " "mmap pages will be sequential", - DEFAULT_SEQUENTIAL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + DEFAULT_SEQUENTIAL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | + GST_PARAM_MUTABLE_PLAYING)); gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_file_src_finalize); @@ -383,6 +389,11 @@ gst_file_src_set_property (GObject * object, guint prop_id, src = GST_FILE_SRC (object); + if (!gst_param_spec_is_mutable (pspec, GST_ELEMENT (src))) { + GST_WARNING_OBJECT (src, "attempting to change property in wrong state"); + return; + } + switch (prop_id) { case ARG_LOCATION: gst_file_src_set_location (src, g_value_get_string (value)); |