Small cleanups, more descriptive properties
authorWim Taymans <wim.taymans@gmail.com>
Thu, 21 Nov 2002 23:52:30 +0000 (23:52 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Thu, 21 Nov 2002 23:52:30 +0000 (23:52 +0000)
Original commit message from CVS:
Small cleanups, more descriptive properties

14 files changed:
gst/elements/gstfakesink.c
gst/elements/gstfakesrc.c
gst/elements/gstfdsink.c
gst/elements/gstfdsrc.c
gst/elements/gstfdsrc.h
gst/elements/gstfilesink.c
gst/elements/gstfilesrc.c
plugins/elements/gstfakesink.c
plugins/elements/gstfakesrc.c
plugins/elements/gstfdsink.c
plugins/elements/gstfdsrc.c
plugins/elements/gstfdsrc.h
plugins/elements/gstfilesink.c
plugins/elements/gstfilesrc.c

index f32dd467fa12d46e1556c64cd86e7efdb8bca534..36bc6649281b39bebaec85c6473bdfb2bfee7d36 100644 (file)
@@ -114,18 +114,18 @@ gst_fakesink_class_init (GstFakeSinkClass *klass)
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
     g_param_spec_string ("last_message", "Last Message", "The message describing current status",
                          NULL, G_PARAM_READABLE));
-  g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SYNC,
-    g_param_spec_boolean("sync","Sync","Sync on the clock",
-                         FALSE, G_PARAM_READWRITE)); /* CHECKME */
-
-  gst_element_class_install_std_props (
-         GST_ELEMENT_CLASS (klass),
-         "silent", ARG_SILENT, G_PARAM_READWRITE,
-         "dump",   ARG_DUMP,   G_PARAM_READWRITE,
-         NULL);
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC,
+    g_param_spec_boolean ("sync", "Sync", "Sync on the clock",
+                          FALSE, G_PARAM_READWRITE)); 
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
+    g_param_spec_boolean ("silent", "Silent", "Don't produce last_message events",
+                          FALSE, G_PARAM_READWRITE)); 
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMP,
+    g_param_spec_boolean ("dump", "Dump", "Dump received bytes to stdout",
+                          FALSE, G_PARAM_READWRITE)); 
 
   gst_fakesink_signals[SIGNAL_HANDOFF] =
-    g_signal_new ("handoff", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
+    g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
                     G_STRUCT_OFFSET (GstFakeSinkClass, handoff), NULL, NULL,
                     g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1,
                     G_TYPE_POINTER);
@@ -140,6 +140,7 @@ static void
 gst_fakesink_init (GstFakeSink *fakesink) 
 {
   GstPad *pad;
+
   pad = gst_pad_new ("sink", GST_PAD_SINK);
   gst_element_add_pad (GST_ELEMENT (fakesink), pad);
   gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_fakesink_chain));
@@ -258,6 +259,15 @@ gst_fakesink_chain (GstPad *pad, GstBuffer *buf)
 
   if (GST_IS_EVENT (buf)) {
     GstEvent *event = GST_EVENT (buf);
+    
+    if (!fakesink->silent) { 
+      g_free (fakesink->last_message);
+
+      fakesink->last_message = g_strdup_printf ("chain   ******* (%s:%s)E (type: %d) %p",
+               GST_DEBUG_PAD_NAME (pad), GST_EVENT_TYPE (event), event);
+    
+      g_object_notify (G_OBJECT (fakesink), "last_message");
+    }
          
     switch (GST_EVENT_TYPE (event)) {
       case GST_EVENT_DISCONTINUOUS:
index 90a7a22b67b4681ed0ca9d1aa20b1f29835c9a2b..75865d2babc89d21ab581416b867e58c05b6214b 100644 (file)
@@ -26,6 +26,9 @@
 
 #include <gstfakesrc.h>
 
+#define DEFAULT_SIZEMIN                0
+#define DEFAULT_SIZEMAX                4096
+#define DEFAULT_PARENTSIZE     4096*10
 
 GstElementDetails gst_fakesrc_details = {
   "Fake Source",
@@ -201,12 +204,12 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_SOURCES,
     g_param_spec_int ("num-sources", "num-sources", "Number of sources",
                       1, G_MAXINT, 1, G_PARAM_READABLE));
-  g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_LOOP_BASED,
-    g_param_spec_boolean("loop-based","loop-based","Enable loop-based operation",
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOOP_BASED,
+    g_param_spec_boolean ("loop-based", "loop-based", "Enable loop-based operation",
                          FALSE, G_PARAM_READWRITE));
-  g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_OUTPUT,
-    g_param_spec_enum("output","output","Output method (currently unused)",
-                      GST_TYPE_FAKESRC_OUTPUT,FAKESRC_FIRST_LAST_LOOP,G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_OUTPUT,
+    g_param_spec_enum ("output", "output", "Output method (currently unused)",
+                       GST_TYPE_FAKESRC_OUTPUT, FAKESRC_FIRST_LAST_LOOP, G_PARAM_READWRITE));
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DATA,
     g_param_spec_enum ("data", "data", "Data allocation method",
                        GST_TYPE_FAKESRC_DATA, FAKESRC_DATA_ALLOCATE, G_PARAM_READWRITE)); 
@@ -215,37 +218,37 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
                        GST_TYPE_FAKESRC_SIZETYPE, FAKESRC_SIZETYPE_NULL, G_PARAM_READWRITE)); 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZEMIN,
     g_param_spec_int ("sizemin","sizemin","Minimum buffer size",
-                      0, G_MAXINT, 0, G_PARAM_READWRITE)); 
+                      0, G_MAXINT, DEFAULT_SIZEMIN, G_PARAM_READWRITE)); 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZEMAX,
     g_param_spec_int ("sizemax","sizemax","Maximum buffer size",
-                      0, G_MAXINT, 4096, G_PARAM_READWRITE)); 
+                      0, G_MAXINT, DEFAULT_SIZEMAX, G_PARAM_READWRITE)); 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PARENTSIZE,
     g_param_spec_int ("parentsize","parentsize","Size of parent buffer for sub-buffered allocation",
-                      0, G_MAXINT, 4096 * 10, G_PARAM_READWRITE)); 
+                      0, G_MAXINT, DEFAULT_PARENTSIZE, G_PARAM_READWRITE)); 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FILLTYPE,
     g_param_spec_enum ("filltype", "filltype", "How to fill the buffer, if at all",
                        GST_TYPE_FAKESRC_FILLTYPE, FAKESRC_FILLTYPE_NULL, G_PARAM_READWRITE)); 
-  g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_PATTERN,
-    g_param_spec_string("pattern","pattern","pattern",
-                        NULL, G_PARAM_READWRITE));
-  g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_NUM_BUFFERS,
-    g_param_spec_int("num-buffers","num-buffers","Number of buffers to output before sending EOS",
-                     G_MININT,G_MAXINT,0,G_PARAM_READWRITE));
-  g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_EOS,
-    g_param_spec_boolean("eos","eos","Send out the EOS event?",
-                         TRUE,G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PATTERN,
+    g_param_spec_string ("pattern", "pattern", "pattern",
+                         NULL, G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_BUFFERS,
+    g_param_spec_int ("num-buffers", "num-buffers", "Number of buffers to output before sending EOS",
+                      G_MININT, G_MAXINT, 0, G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_EOS,
+    g_param_spec_boolean ("eos", "eos", "Send out the EOS event?",
+                          TRUE, G_PARAM_READWRITE));
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
     g_param_spec_string ("last-message", "last-message", "The last status message",
                          NULL, G_PARAM_READABLE)); 
-
-  gst_element_class_install_std_props (
-         GST_ELEMENT_CLASS (klass),
-         "silent", ARG_SILENT, G_PARAM_READWRITE,
-         "dump",   ARG_DUMP,   G_PARAM_READWRITE,
-         NULL);
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
+    g_param_spec_boolean ("silent", "Silent", "Don't produce last_message events",
+                          FALSE, G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMP,
+    g_param_spec_boolean ("dump", "Dump", "Dump produced bytes to stdout",
+                          FALSE, G_PARAM_READWRITE));
 
   gst_fakesrc_signals[SIGNAL_HANDOFF] =
-    g_signal_new ("handoff", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
+    g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
                   G_STRUCT_OFFSET (GstFakeSrcClass, handoff), NULL, NULL,
                   g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1,
                   G_TYPE_POINTER);
@@ -282,10 +285,10 @@ gst_fakesrc_init (GstFakeSrc *fakesrc)
   fakesrc->data = FAKESRC_DATA_ALLOCATE;
   fakesrc->sizetype = FAKESRC_SIZETYPE_NULL;
   fakesrc->filltype = FAKESRC_FILLTYPE_NOTHING;
-  fakesrc->sizemin = 0;
-  fakesrc->sizemax = 4096;
+  fakesrc->sizemin = DEFAULT_SIZEMIN;
+  fakesrc->sizemax = DEFAULT_SIZEMAX;
   fakesrc->parent = NULL;
-  fakesrc->parentsize = 4096 * 10;
+  fakesrc->parentsize = DEFAULT_PARENTSIZE;
   fakesrc->last_message = NULL;
 }
 
index a64690bc8fb5239dd337e49dde0fb38aeb2f2342..d888f222e851aedb7bbbb2e10167fdd747aeee7c 100644 (file)
@@ -90,10 +90,9 @@ gst_fdsink_class_init (GstFdSinkClass *klass)
 
   parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
-  gst_element_class_install_std_props (
-         GST_ELEMENT_CLASS (klass),
-         "fd", ARG_FD, G_PARAM_READWRITE,
-         NULL);
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
+    g_param_spec_int ("fd", "fd", "An open file descriptor to write to",
+                      0, G_MAXINT, 1, G_PARAM_READWRITE));
 
   gobject_class->set_property = gst_fdsink_set_property;
   gobject_class->get_property = gst_fdsink_get_property;
index 1b3d73e94f3e5d21c6f2ecb4886a26b26701e8a1..a1a716b96b305b113a31e10707639da5376d3b0c 100644 (file)
 
 #include <gstfdsrc.h>
 
+#define DEFAULT_BLOCKSIZE      4096
 
-GstElementDetails gst_fdsrc_details = {
+GstElementDetails gst_fdsrc_details = 
+{
   "Disk Source",
   "Source/File",
   "LGPL",
@@ -49,10 +51,8 @@ enum {
 
 enum {
   ARG_0,
-  ARG_LOCATION,
-  ARG_BYTESPERREAD,
-  ARG_OFFSET,
   ARG_FD,
+  ARG_BLOCKSIZE,
 };
 
 
@@ -77,7 +77,8 @@ gst_fdsrc_get_type (void)
 
   if (!fdsrc_type) {
     static const GTypeInfo fdsrc_info = {
-      sizeof(GstFdSrcClass),      NULL,
+      sizeof(GstFdSrcClass),      
+      NULL,
       NULL,
       (GClassInitFunc)gst_fdsrc_class_init,
       NULL,
@@ -100,16 +101,12 @@ gst_fdsrc_class_init (GstFdSrcClass *klass)
 
   parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
 
-  gst_element_class_install_std_props (
-         GST_ELEMENT_CLASS (klass),
-         "location",     ARG_LOCATION,     G_PARAM_WRITABLE,
-         "bytesperread", ARG_BYTESPERREAD, G_PARAM_READWRITE,
-         "offset",       ARG_OFFSET,       G_PARAM_READABLE,
-         NULL);
-
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
     g_param_spec_int ("fd", "fd", "An open file descriptor to read from",
                       0, G_MAXINT, 0, G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BLOCKSIZE,
+    g_param_spec_ulong ("blocksize", "Block size", "Size in bytes to read per buffer",
+                        1, G_MAXULONG, DEFAULT_BLOCKSIZE, G_PARAM_READWRITE));
 
   gobject_class->set_property = gst_fdsrc_set_property;
   gobject_class->get_property = gst_fdsrc_get_property;
@@ -122,7 +119,7 @@ static void gst_fdsrc_init(GstFdSrc *fdsrc) {
 
   fdsrc->fd = 0;
   fdsrc->curoffset = 0;
-  fdsrc->bytes_per_read = 4096;
+  fdsrc->blocksize = DEFAULT_BLOCKSIZE;
   fdsrc->seq = 0;
 }
 
@@ -131,7 +128,6 @@ static void
 gst_fdsrc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) 
 {
   GstFdSrc *src;
-  int fd;
 
   /* it's not null if we got it, but it might not be ours */
   g_return_if_fail (GST_IS_FDSRC (object));
@@ -139,25 +135,11 @@ gst_fdsrc_set_property (GObject *object, guint prop_id, const GValue *value, GPa
   src = GST_FDSRC (object);
 
   switch (prop_id) {
-    case ARG_LOCATION:
-      /* the element must not be playing in order to do this */
-      g_return_if_fail (GST_STATE (src) < GST_STATE_PLAYING);
-
-      /* if we get a NULL, consider it to be a fd of 0 */
-      if (g_value_get_string (value) == NULL) {
-        gst_element_set_state (GST_ELEMENT (object), GST_STATE_NULL);
-        src->fd = 0;
-      /* otherwise set the new filename */
-      } else {
-        if (sscanf (g_value_get_string (value), "%d", &fd))
-          src->fd = fd;
-      }
-      break;
     case ARG_FD:
       src->fd = g_value_get_int (value);
       break;
-    case ARG_BYTESPERREAD:
-      src->bytes_per_read = g_value_get_int (value);
+    case ARG_BLOCKSIZE:
+      src->blocksize = g_value_get_ulong (value);
       break;
     default:
       break;
@@ -175,11 +157,8 @@ gst_fdsrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpe
   src = GST_FDSRC (object);
 
   switch (prop_id) {
-    case ARG_BYTESPERREAD:
-      g_value_set_int (value, src->bytes_per_read);
-      break;
-    case ARG_OFFSET:
-      g_value_set_int64 (value, src->curoffset);
+    case ARG_BLOCKSIZE:
+      g_value_set_ulong (value, src->blocksize);
       break;
     case ARG_FD:
       g_value_set_int (value, src->fd);
@@ -206,11 +185,11 @@ gst_fdsrc_get(GstPad *pad)
   g_return_val_if_fail (buf, NULL);
 
   /* allocate the space for the buffer data */
-  GST_BUFFER_DATA(buf) = g_malloc(src->bytes_per_read);
+  GST_BUFFER_DATA(buf) = g_malloc(src->blocksize);
   g_return_val_if_fail(GST_BUFFER_DATA(buf) != NULL, NULL);
 
   /* read it in from the file */
-  readbytes = read(src->fd,GST_BUFFER_DATA(buf),src->bytes_per_read);
+  readbytes = read(src->fd,GST_BUFFER_DATA(buf),src->blocksize);
   /* if nothing was read, we're in eos */
   if (readbytes == 0) {
     gst_element_set_eos (GST_ELEMENT (src));
index b4abdfd9ef0e87e42c60434e63822ea89ae2ed39..dfa49b660a56dc30de3d68cfe03aa7ef2b121c70 100644 (file)
@@ -57,7 +57,7 @@ struct _GstFdSrc {
   gint fd;
 
   gulong curoffset;                    /* current offset in file */
-  gulong bytes_per_read;               /* bytes per read */
+  gulong blocksize;            /* bytes per read */
 
   gulong seq;                          /* buffer sequence number */
 };
index 9b319b41de2b4b0ed657dbbb11506e36cf7cb4ad..3570e2f7b375ec68ec5534f97c7385d89da4c231 100644 (file)
@@ -112,14 +112,12 @@ gst_filesink_class_init (GstFileSinkClass *klass)
 
   parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
-  gst_element_class_install_std_props (
-         GST_ELEMENT_CLASS (klass),
-         "location", ARG_LOCATION, G_PARAM_READWRITE,
-         NULL);
-
-  g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_MAXFILESIZE,
-    g_param_spec_int("maxfilesize","MaxFileSize","Maximum Size Per File",
-    G_MININT,G_MAXINT,0,G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATION,
+    g_param_spec_string ("location", "File Location", "Location of the file to write",
+                         NULL, G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAXFILESIZE,
+    g_param_spec_int ("maxfilesize", "MaxFileSize", "Maximum Size Per File in MB (-1 == no limit)",
+                     -1, G_MAXINT, -1, G_PARAM_READWRITE));
 
   gst_filesink_signals[SIGNAL_HANDOFF] =
     g_signal_new ("handoff", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
index 576b2e44cdc5b11b6c0cd383b971ca285ff5785a..5f159e160a3fc39b6f63ff24a97d9d0875405522 100644 (file)
@@ -79,6 +79,9 @@ GstElementDetails gst_filesrc_details = {
   "(C) 1999",
 };
 
+#define DEFAULT_BLOCKSIZE      4*1024
+#define DEFAULT_MMAPSIZE       4*1024*1024
+
 /* #define fs_print(format,args...) g_print(format, ## args)  */
 #define fs_print(format,args...)
 
@@ -93,7 +96,7 @@ enum {
   ARG_LOCATION,
   ARG_FD,
   ARG_BLOCKSIZE,
-  ARG_MAPSIZE,
+  ARG_MMAPSIZE,
   ARG_TOUCH,
 };
 
@@ -167,14 +170,23 @@ gst_filesrc_class_init (GstFileSrcClass *klass)
 
   parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
-  gst_element_class_install_std_props (
-         GST_ELEMENT_CLASS (klass),
-         "fd",           ARG_FD,           G_PARAM_READABLE,
-         "location",     ARG_LOCATION,     G_PARAM_READWRITE,
-         "blocksize",    ARG_BLOCKSIZE,    G_PARAM_READWRITE,
-         "mmapsize",     ARG_MAPSIZE,      G_PARAM_READWRITE,
-         "touch",        ARG_TOUCH,        G_PARAM_READWRITE,
-         NULL);
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
+    g_param_spec_int ("fd", "File-descriptor", "File-descriptor for the file being mmap()d",
+                      0, G_MAXINT, 0, G_PARAM_READABLE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATION,
+    g_param_spec_string ("location", "File Location", "Location of the file to read",
+                         NULL, G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BLOCKSIZE,
+    g_param_spec_ulong ("blocksize", "Block size", "Size in bytes to read per buffer",
+                        1, G_MAXULONG, DEFAULT_BLOCKSIZE, G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), 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_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOUCH,
+    g_param_spec_boolean ("touch", "Touch read data",
+                          "Touch data to force disk read", 
+                         FALSE, G_PARAM_READWRITE));
 
   gobject_class->dispose       = gst_filesrc_dispose;
   gobject_class->set_property  = gst_filesrc_set_property;
@@ -215,11 +227,11 @@ gst_filesrc_init (GstFileSrc *src)
   src->filelen = 0;
 
   src->curoffset = 0;
-  src->block_size = 4096;
-  src->touch = TRUE;
+  src->block_size = DEFAULT_BLOCKSIZE;
+  src->touch = FALSE;
 
   src->mapbuf = NULL;
-  src->mapsize = 4 * 1024 * 1024;              /* default is 4MB */
+  src->mapsize = DEFAULT_MMAPSIZE;             /* default is 4MB */
 
   src->map_regions = g_tree_new (gst_filesrc_bufcmp);
   src->map_regions_lock = g_mutex_new();
@@ -273,12 +285,13 @@ gst_filesrc_set_property (GObject *object, guint prop_id, const GValue *value, G
       src->block_size = g_value_get_ulong (value);
       g_object_notify (G_OBJECT (src), "blocksize");
       break;
-    case ARG_MAPSIZE:
+    case ARG_MMAPSIZE:
       if ((src->mapsize % src->pagesize) == 0) {
         src->mapsize = g_value_get_ulong (value);
         g_object_notify (G_OBJECT (src), "mmapsize");
       } else {
-        GST_INFO(0, "invalid mapsize, must a multiple of pagesize, which is %d\n",src->pagesize);
+        GST_INFO (0, "invalid mapsize, must a multiple of pagesize, which is %d\n", 
+                 src->pagesize);
       }
       break;
     case ARG_TOUCH:
@@ -310,7 +323,7 @@ gst_filesrc_get_property (GObject *object, guint prop_id, GValue *value, GParamS
     case ARG_BLOCKSIZE:
       g_value_set_ulong (value, src->block_size);
       break;
-    case ARG_MAPSIZE:
+    case ARG_MMAPSIZE:
       g_value_set_ulong (value, src->mapsize);
       break;
     case ARG_TOUCH:
@@ -325,25 +338,26 @@ gst_filesrc_get_property (GObject *object, guint prop_id, GValue *value, GParamS
 static void
 gst_filesrc_free_parent_mmap (GstBuffer *buf)
 {
-  GstFileSrc *src = GST_FILESRC(GST_BUFFER_POOL_PRIVATE(buf));
+  GstFileSrc *src = GST_FILESRC (GST_BUFFER_POOL_PRIVATE (buf));
 
-  fs_print ("freeing mmap()d buffer at %d+%d\n",GST_BUFFER_OFFSET(buf),GST_BUFFER_SIZE(buf));
+  fs_print ("freeing mmap()d buffer at %d+%d\n", 
+           GST_BUFFER_OFFSET (buf), GST_BUFFER_SIZE (buf));
 
   /* remove the buffer from the list of available mmap'd regions */
-  g_mutex_lock(src->map_regions_lock);
-  g_tree_remove(src->map_regions,buf);
+  g_mutex_lock (src->map_regions_lock);
+  g_tree_remove (src->map_regions, buf);
   /* check to see if the tree is empty */
-  if (g_tree_nnodes(src->map_regions) == 0) {
+  if (g_tree_nnodes (src->map_regions) == 0) {
     /* we have to free the bufferpool we don't have yet */
   }
-  g_mutex_unlock(src->map_regions_lock);
+  g_mutex_unlock (src->map_regions_lock);
 
 #ifdef MADV_DONTNEED
   /* madvise to tell the kernel what to do with it */
-  madvise(GST_BUFFER_DATA(buf),GST_BUFFER_SIZE(buf),MADV_DONTNEED);
+  madvise (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf), MADV_DONTNEED);
 #endif
   /* now unmap the memory */
-  munmap(GST_BUFFER_DATA(buf),GST_BUFFER_MAXSIZE(buf));
+  munmap (GST_BUFFER_DATA (buf), GST_BUFFER_MAXSIZE (buf));
 
   GST_BUFFER_DATA (buf) = NULL;
 
@@ -373,27 +387,27 @@ gst_filesrc_map_region (GstFileSrc *src, off_t offset, size_t size)
   }
 
   /* time to allocate a new mapbuf */
-  buf = gst_buffer_new();
+  buf = gst_buffer_new ();
   /* mmap() the data into this new buffer */
-  GST_BUFFER_DATA(buf) = mmapregion;
+  GST_BUFFER_DATA (buf) = mmapregion;
 
 #ifdef MADV_SEQUENTIAL
   /* madvise to tell the kernel what to do with it */
-  retval = madvise(GST_BUFFER_DATA(buf),GST_BUFFER_SIZE(buf),MADV_SEQUENTIAL);
+  retval = madvise (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf), MADV_SEQUENTIAL);
 #endif
   /* fill in the rest of the fields */
-  GST_BUFFER_FLAG_SET(buf, GST_BUFFER_READONLY);
-  GST_BUFFER_FLAG_SET(buf, GST_BUFFER_ORIGINAL);
-  GST_BUFFER_SIZE(buf) = size;
-  GST_BUFFER_MAXSIZE(buf) = size;
-  GST_BUFFER_OFFSET(buf) = offset;
-  GST_BUFFER_TIMESTAMP(buf) = -1LL;
-  GST_BUFFER_POOL_PRIVATE(buf) = src;
-  GST_BUFFER_FREE_FUNC(buf) = (GstDataFreeFunction) gst_filesrc_free_parent_mmap;
-
-  g_mutex_lock(src->map_regions_lock);
-  g_tree_insert(src->map_regions,buf,buf);
-  g_mutex_unlock(src->map_regions_lock);
+  GST_BUFFER_FLAG_SET (buf, GST_BUFFER_READONLY);
+  GST_BUFFER_FLAG_SET (buf, GST_BUFFER_ORIGINAL);
+  GST_BUFFER_SIZE (buf) = size;
+  GST_BUFFER_MAXSIZE (buf) = size;
+  GST_BUFFER_OFFSET (buf) = offset;
+  GST_BUFFER_TIMESTAMP (buf) = -1LL;
+  GST_BUFFER_POOL_PRIVATE (buf) = src;
+  GST_BUFFER_FREE_FUNC (buf) = (GstDataFreeFunction) gst_filesrc_free_parent_mmap;
+
+  g_mutex_lock (src->map_regions_lock);
+  g_tree_insert (src->map_regions,buf,buf);
+  g_mutex_unlock (src->map_regions_lock);
 
   return buf;
 }
@@ -587,7 +601,8 @@ gst_filesrc_get (GstPad *pad)
   /* if we need to touch the buffer (to bring it into memory), do so */
   if (src->touch) {
     volatile guchar *p = GST_BUFFER_DATA (buf), c;
-    for (i=0;i<GST_BUFFER_SIZE(buf);i+=src->pagesize)
+
+    for (i=0; i < GST_BUFFER_SIZE (buf); i += src->pagesize)
       c = p[i];
   }
 
index f32dd467fa12d46e1556c64cd86e7efdb8bca534..36bc6649281b39bebaec85c6473bdfb2bfee7d36 100644 (file)
@@ -114,18 +114,18 @@ gst_fakesink_class_init (GstFakeSinkClass *klass)
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
     g_param_spec_string ("last_message", "Last Message", "The message describing current status",
                          NULL, G_PARAM_READABLE));
-  g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SYNC,
-    g_param_spec_boolean("sync","Sync","Sync on the clock",
-                         FALSE, G_PARAM_READWRITE)); /* CHECKME */
-
-  gst_element_class_install_std_props (
-         GST_ELEMENT_CLASS (klass),
-         "silent", ARG_SILENT, G_PARAM_READWRITE,
-         "dump",   ARG_DUMP,   G_PARAM_READWRITE,
-         NULL);
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC,
+    g_param_spec_boolean ("sync", "Sync", "Sync on the clock",
+                          FALSE, G_PARAM_READWRITE)); 
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
+    g_param_spec_boolean ("silent", "Silent", "Don't produce last_message events",
+                          FALSE, G_PARAM_READWRITE)); 
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMP,
+    g_param_spec_boolean ("dump", "Dump", "Dump received bytes to stdout",
+                          FALSE, G_PARAM_READWRITE)); 
 
   gst_fakesink_signals[SIGNAL_HANDOFF] =
-    g_signal_new ("handoff", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
+    g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
                     G_STRUCT_OFFSET (GstFakeSinkClass, handoff), NULL, NULL,
                     g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1,
                     G_TYPE_POINTER);
@@ -140,6 +140,7 @@ static void
 gst_fakesink_init (GstFakeSink *fakesink) 
 {
   GstPad *pad;
+
   pad = gst_pad_new ("sink", GST_PAD_SINK);
   gst_element_add_pad (GST_ELEMENT (fakesink), pad);
   gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_fakesink_chain));
@@ -258,6 +259,15 @@ gst_fakesink_chain (GstPad *pad, GstBuffer *buf)
 
   if (GST_IS_EVENT (buf)) {
     GstEvent *event = GST_EVENT (buf);
+    
+    if (!fakesink->silent) { 
+      g_free (fakesink->last_message);
+
+      fakesink->last_message = g_strdup_printf ("chain   ******* (%s:%s)E (type: %d) %p",
+               GST_DEBUG_PAD_NAME (pad), GST_EVENT_TYPE (event), event);
+    
+      g_object_notify (G_OBJECT (fakesink), "last_message");
+    }
          
     switch (GST_EVENT_TYPE (event)) {
       case GST_EVENT_DISCONTINUOUS:
index 90a7a22b67b4681ed0ca9d1aa20b1f29835c9a2b..75865d2babc89d21ab581416b867e58c05b6214b 100644 (file)
@@ -26,6 +26,9 @@
 
 #include <gstfakesrc.h>
 
+#define DEFAULT_SIZEMIN                0
+#define DEFAULT_SIZEMAX                4096
+#define DEFAULT_PARENTSIZE     4096*10
 
 GstElementDetails gst_fakesrc_details = {
   "Fake Source",
@@ -201,12 +204,12 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_SOURCES,
     g_param_spec_int ("num-sources", "num-sources", "Number of sources",
                       1, G_MAXINT, 1, G_PARAM_READABLE));
-  g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_LOOP_BASED,
-    g_param_spec_boolean("loop-based","loop-based","Enable loop-based operation",
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOOP_BASED,
+    g_param_spec_boolean ("loop-based", "loop-based", "Enable loop-based operation",
                          FALSE, G_PARAM_READWRITE));
-  g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_OUTPUT,
-    g_param_spec_enum("output","output","Output method (currently unused)",
-                      GST_TYPE_FAKESRC_OUTPUT,FAKESRC_FIRST_LAST_LOOP,G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_OUTPUT,
+    g_param_spec_enum ("output", "output", "Output method (currently unused)",
+                       GST_TYPE_FAKESRC_OUTPUT, FAKESRC_FIRST_LAST_LOOP, G_PARAM_READWRITE));
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DATA,
     g_param_spec_enum ("data", "data", "Data allocation method",
                        GST_TYPE_FAKESRC_DATA, FAKESRC_DATA_ALLOCATE, G_PARAM_READWRITE)); 
@@ -215,37 +218,37 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
                        GST_TYPE_FAKESRC_SIZETYPE, FAKESRC_SIZETYPE_NULL, G_PARAM_READWRITE)); 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZEMIN,
     g_param_spec_int ("sizemin","sizemin","Minimum buffer size",
-                      0, G_MAXINT, 0, G_PARAM_READWRITE)); 
+                      0, G_MAXINT, DEFAULT_SIZEMIN, G_PARAM_READWRITE)); 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZEMAX,
     g_param_spec_int ("sizemax","sizemax","Maximum buffer size",
-                      0, G_MAXINT, 4096, G_PARAM_READWRITE)); 
+                      0, G_MAXINT, DEFAULT_SIZEMAX, G_PARAM_READWRITE)); 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PARENTSIZE,
     g_param_spec_int ("parentsize","parentsize","Size of parent buffer for sub-buffered allocation",
-                      0, G_MAXINT, 4096 * 10, G_PARAM_READWRITE)); 
+                      0, G_MAXINT, DEFAULT_PARENTSIZE, G_PARAM_READWRITE)); 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FILLTYPE,
     g_param_spec_enum ("filltype", "filltype", "How to fill the buffer, if at all",
                        GST_TYPE_FAKESRC_FILLTYPE, FAKESRC_FILLTYPE_NULL, G_PARAM_READWRITE)); 
-  g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_PATTERN,
-    g_param_spec_string("pattern","pattern","pattern",
-                        NULL, G_PARAM_READWRITE));
-  g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_NUM_BUFFERS,
-    g_param_spec_int("num-buffers","num-buffers","Number of buffers to output before sending EOS",
-                     G_MININT,G_MAXINT,0,G_PARAM_READWRITE));
-  g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_EOS,
-    g_param_spec_boolean("eos","eos","Send out the EOS event?",
-                         TRUE,G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PATTERN,
+    g_param_spec_string ("pattern", "pattern", "pattern",
+                         NULL, G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_BUFFERS,
+    g_param_spec_int ("num-buffers", "num-buffers", "Number of buffers to output before sending EOS",
+                      G_MININT, G_MAXINT, 0, G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_EOS,
+    g_param_spec_boolean ("eos", "eos", "Send out the EOS event?",
+                          TRUE, G_PARAM_READWRITE));
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
     g_param_spec_string ("last-message", "last-message", "The last status message",
                          NULL, G_PARAM_READABLE)); 
-
-  gst_element_class_install_std_props (
-         GST_ELEMENT_CLASS (klass),
-         "silent", ARG_SILENT, G_PARAM_READWRITE,
-         "dump",   ARG_DUMP,   G_PARAM_READWRITE,
-         NULL);
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
+    g_param_spec_boolean ("silent", "Silent", "Don't produce last_message events",
+                          FALSE, G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMP,
+    g_param_spec_boolean ("dump", "Dump", "Dump produced bytes to stdout",
+                          FALSE, G_PARAM_READWRITE));
 
   gst_fakesrc_signals[SIGNAL_HANDOFF] =
-    g_signal_new ("handoff", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
+    g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
                   G_STRUCT_OFFSET (GstFakeSrcClass, handoff), NULL, NULL,
                   g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1,
                   G_TYPE_POINTER);
@@ -282,10 +285,10 @@ gst_fakesrc_init (GstFakeSrc *fakesrc)
   fakesrc->data = FAKESRC_DATA_ALLOCATE;
   fakesrc->sizetype = FAKESRC_SIZETYPE_NULL;
   fakesrc->filltype = FAKESRC_FILLTYPE_NOTHING;
-  fakesrc->sizemin = 0;
-  fakesrc->sizemax = 4096;
+  fakesrc->sizemin = DEFAULT_SIZEMIN;
+  fakesrc->sizemax = DEFAULT_SIZEMAX;
   fakesrc->parent = NULL;
-  fakesrc->parentsize = 4096 * 10;
+  fakesrc->parentsize = DEFAULT_PARENTSIZE;
   fakesrc->last_message = NULL;
 }
 
index a64690bc8fb5239dd337e49dde0fb38aeb2f2342..d888f222e851aedb7bbbb2e10167fdd747aeee7c 100644 (file)
@@ -90,10 +90,9 @@ gst_fdsink_class_init (GstFdSinkClass *klass)
 
   parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
-  gst_element_class_install_std_props (
-         GST_ELEMENT_CLASS (klass),
-         "fd", ARG_FD, G_PARAM_READWRITE,
-         NULL);
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
+    g_param_spec_int ("fd", "fd", "An open file descriptor to write to",
+                      0, G_MAXINT, 1, G_PARAM_READWRITE));
 
   gobject_class->set_property = gst_fdsink_set_property;
   gobject_class->get_property = gst_fdsink_get_property;
index 1b3d73e94f3e5d21c6f2ecb4886a26b26701e8a1..a1a716b96b305b113a31e10707639da5376d3b0c 100644 (file)
 
 #include <gstfdsrc.h>
 
+#define DEFAULT_BLOCKSIZE      4096
 
-GstElementDetails gst_fdsrc_details = {
+GstElementDetails gst_fdsrc_details = 
+{
   "Disk Source",
   "Source/File",
   "LGPL",
@@ -49,10 +51,8 @@ enum {
 
 enum {
   ARG_0,
-  ARG_LOCATION,
-  ARG_BYTESPERREAD,
-  ARG_OFFSET,
   ARG_FD,
+  ARG_BLOCKSIZE,
 };
 
 
@@ -77,7 +77,8 @@ gst_fdsrc_get_type (void)
 
   if (!fdsrc_type) {
     static const GTypeInfo fdsrc_info = {
-      sizeof(GstFdSrcClass),      NULL,
+      sizeof(GstFdSrcClass),      
+      NULL,
       NULL,
       (GClassInitFunc)gst_fdsrc_class_init,
       NULL,
@@ -100,16 +101,12 @@ gst_fdsrc_class_init (GstFdSrcClass *klass)
 
   parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
 
-  gst_element_class_install_std_props (
-         GST_ELEMENT_CLASS (klass),
-         "location",     ARG_LOCATION,     G_PARAM_WRITABLE,
-         "bytesperread", ARG_BYTESPERREAD, G_PARAM_READWRITE,
-         "offset",       ARG_OFFSET,       G_PARAM_READABLE,
-         NULL);
-
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
     g_param_spec_int ("fd", "fd", "An open file descriptor to read from",
                       0, G_MAXINT, 0, G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BLOCKSIZE,
+    g_param_spec_ulong ("blocksize", "Block size", "Size in bytes to read per buffer",
+                        1, G_MAXULONG, DEFAULT_BLOCKSIZE, G_PARAM_READWRITE));
 
   gobject_class->set_property = gst_fdsrc_set_property;
   gobject_class->get_property = gst_fdsrc_get_property;
@@ -122,7 +119,7 @@ static void gst_fdsrc_init(GstFdSrc *fdsrc) {
 
   fdsrc->fd = 0;
   fdsrc->curoffset = 0;
-  fdsrc->bytes_per_read = 4096;
+  fdsrc->blocksize = DEFAULT_BLOCKSIZE;
   fdsrc->seq = 0;
 }
 
@@ -131,7 +128,6 @@ static void
 gst_fdsrc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) 
 {
   GstFdSrc *src;
-  int fd;
 
   /* it's not null if we got it, but it might not be ours */
   g_return_if_fail (GST_IS_FDSRC (object));
@@ -139,25 +135,11 @@ gst_fdsrc_set_property (GObject *object, guint prop_id, const GValue *value, GPa
   src = GST_FDSRC (object);
 
   switch (prop_id) {
-    case ARG_LOCATION:
-      /* the element must not be playing in order to do this */
-      g_return_if_fail (GST_STATE (src) < GST_STATE_PLAYING);
-
-      /* if we get a NULL, consider it to be a fd of 0 */
-      if (g_value_get_string (value) == NULL) {
-        gst_element_set_state (GST_ELEMENT (object), GST_STATE_NULL);
-        src->fd = 0;
-      /* otherwise set the new filename */
-      } else {
-        if (sscanf (g_value_get_string (value), "%d", &fd))
-          src->fd = fd;
-      }
-      break;
     case ARG_FD:
       src->fd = g_value_get_int (value);
       break;
-    case ARG_BYTESPERREAD:
-      src->bytes_per_read = g_value_get_int (value);
+    case ARG_BLOCKSIZE:
+      src->blocksize = g_value_get_ulong (value);
       break;
     default:
       break;
@@ -175,11 +157,8 @@ gst_fdsrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpe
   src = GST_FDSRC (object);
 
   switch (prop_id) {
-    case ARG_BYTESPERREAD:
-      g_value_set_int (value, src->bytes_per_read);
-      break;
-    case ARG_OFFSET:
-      g_value_set_int64 (value, src->curoffset);
+    case ARG_BLOCKSIZE:
+      g_value_set_ulong (value, src->blocksize);
       break;
     case ARG_FD:
       g_value_set_int (value, src->fd);
@@ -206,11 +185,11 @@ gst_fdsrc_get(GstPad *pad)
   g_return_val_if_fail (buf, NULL);
 
   /* allocate the space for the buffer data */
-  GST_BUFFER_DATA(buf) = g_malloc(src->bytes_per_read);
+  GST_BUFFER_DATA(buf) = g_malloc(src->blocksize);
   g_return_val_if_fail(GST_BUFFER_DATA(buf) != NULL, NULL);
 
   /* read it in from the file */
-  readbytes = read(src->fd,GST_BUFFER_DATA(buf),src->bytes_per_read);
+  readbytes = read(src->fd,GST_BUFFER_DATA(buf),src->blocksize);
   /* if nothing was read, we're in eos */
   if (readbytes == 0) {
     gst_element_set_eos (GST_ELEMENT (src));
index b4abdfd9ef0e87e42c60434e63822ea89ae2ed39..dfa49b660a56dc30de3d68cfe03aa7ef2b121c70 100644 (file)
@@ -57,7 +57,7 @@ struct _GstFdSrc {
   gint fd;
 
   gulong curoffset;                    /* current offset in file */
-  gulong bytes_per_read;               /* bytes per read */
+  gulong blocksize;            /* bytes per read */
 
   gulong seq;                          /* buffer sequence number */
 };
index 9b319b41de2b4b0ed657dbbb11506e36cf7cb4ad..3570e2f7b375ec68ec5534f97c7385d89da4c231 100644 (file)
@@ -112,14 +112,12 @@ gst_filesink_class_init (GstFileSinkClass *klass)
 
   parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
-  gst_element_class_install_std_props (
-         GST_ELEMENT_CLASS (klass),
-         "location", ARG_LOCATION, G_PARAM_READWRITE,
-         NULL);
-
-  g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_MAXFILESIZE,
-    g_param_spec_int("maxfilesize","MaxFileSize","Maximum Size Per File",
-    G_MININT,G_MAXINT,0,G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATION,
+    g_param_spec_string ("location", "File Location", "Location of the file to write",
+                         NULL, G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAXFILESIZE,
+    g_param_spec_int ("maxfilesize", "MaxFileSize", "Maximum Size Per File in MB (-1 == no limit)",
+                     -1, G_MAXINT, -1, G_PARAM_READWRITE));
 
   gst_filesink_signals[SIGNAL_HANDOFF] =
     g_signal_new ("handoff", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
index 576b2e44cdc5b11b6c0cd383b971ca285ff5785a..5f159e160a3fc39b6f63ff24a97d9d0875405522 100644 (file)
@@ -79,6 +79,9 @@ GstElementDetails gst_filesrc_details = {
   "(C) 1999",
 };
 
+#define DEFAULT_BLOCKSIZE      4*1024
+#define DEFAULT_MMAPSIZE       4*1024*1024
+
 /* #define fs_print(format,args...) g_print(format, ## args)  */
 #define fs_print(format,args...)
 
@@ -93,7 +96,7 @@ enum {
   ARG_LOCATION,
   ARG_FD,
   ARG_BLOCKSIZE,
-  ARG_MAPSIZE,
+  ARG_MMAPSIZE,
   ARG_TOUCH,
 };
 
@@ -167,14 +170,23 @@ gst_filesrc_class_init (GstFileSrcClass *klass)
 
   parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
-  gst_element_class_install_std_props (
-         GST_ELEMENT_CLASS (klass),
-         "fd",           ARG_FD,           G_PARAM_READABLE,
-         "location",     ARG_LOCATION,     G_PARAM_READWRITE,
-         "blocksize",    ARG_BLOCKSIZE,    G_PARAM_READWRITE,
-         "mmapsize",     ARG_MAPSIZE,      G_PARAM_READWRITE,
-         "touch",        ARG_TOUCH,        G_PARAM_READWRITE,
-         NULL);
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
+    g_param_spec_int ("fd", "File-descriptor", "File-descriptor for the file being mmap()d",
+                      0, G_MAXINT, 0, G_PARAM_READABLE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATION,
+    g_param_spec_string ("location", "File Location", "Location of the file to read",
+                         NULL, G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BLOCKSIZE,
+    g_param_spec_ulong ("blocksize", "Block size", "Size in bytes to read per buffer",
+                        1, G_MAXULONG, DEFAULT_BLOCKSIZE, G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), 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_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOUCH,
+    g_param_spec_boolean ("touch", "Touch read data",
+                          "Touch data to force disk read", 
+                         FALSE, G_PARAM_READWRITE));
 
   gobject_class->dispose       = gst_filesrc_dispose;
   gobject_class->set_property  = gst_filesrc_set_property;
@@ -215,11 +227,11 @@ gst_filesrc_init (GstFileSrc *src)
   src->filelen = 0;
 
   src->curoffset = 0;
-  src->block_size = 4096;
-  src->touch = TRUE;
+  src->block_size = DEFAULT_BLOCKSIZE;
+  src->touch = FALSE;
 
   src->mapbuf = NULL;
-  src->mapsize = 4 * 1024 * 1024;              /* default is 4MB */
+  src->mapsize = DEFAULT_MMAPSIZE;             /* default is 4MB */
 
   src->map_regions = g_tree_new (gst_filesrc_bufcmp);
   src->map_regions_lock = g_mutex_new();
@@ -273,12 +285,13 @@ gst_filesrc_set_property (GObject *object, guint prop_id, const GValue *value, G
       src->block_size = g_value_get_ulong (value);
       g_object_notify (G_OBJECT (src), "blocksize");
       break;
-    case ARG_MAPSIZE:
+    case ARG_MMAPSIZE:
       if ((src->mapsize % src->pagesize) == 0) {
         src->mapsize = g_value_get_ulong (value);
         g_object_notify (G_OBJECT (src), "mmapsize");
       } else {
-        GST_INFO(0, "invalid mapsize, must a multiple of pagesize, which is %d\n",src->pagesize);
+        GST_INFO (0, "invalid mapsize, must a multiple of pagesize, which is %d\n", 
+                 src->pagesize);
       }
       break;
     case ARG_TOUCH:
@@ -310,7 +323,7 @@ gst_filesrc_get_property (GObject *object, guint prop_id, GValue *value, GParamS
     case ARG_BLOCKSIZE:
       g_value_set_ulong (value, src->block_size);
       break;
-    case ARG_MAPSIZE:
+    case ARG_MMAPSIZE:
       g_value_set_ulong (value, src->mapsize);
       break;
     case ARG_TOUCH:
@@ -325,25 +338,26 @@ gst_filesrc_get_property (GObject *object, guint prop_id, GValue *value, GParamS
 static void
 gst_filesrc_free_parent_mmap (GstBuffer *buf)
 {
-  GstFileSrc *src = GST_FILESRC(GST_BUFFER_POOL_PRIVATE(buf));
+  GstFileSrc *src = GST_FILESRC (GST_BUFFER_POOL_PRIVATE (buf));
 
-  fs_print ("freeing mmap()d buffer at %d+%d\n",GST_BUFFER_OFFSET(buf),GST_BUFFER_SIZE(buf));
+  fs_print ("freeing mmap()d buffer at %d+%d\n", 
+           GST_BUFFER_OFFSET (buf), GST_BUFFER_SIZE (buf));
 
   /* remove the buffer from the list of available mmap'd regions */
-  g_mutex_lock(src->map_regions_lock);
-  g_tree_remove(src->map_regions,buf);
+  g_mutex_lock (src->map_regions_lock);
+  g_tree_remove (src->map_regions, buf);
   /* check to see if the tree is empty */
-  if (g_tree_nnodes(src->map_regions) == 0) {
+  if (g_tree_nnodes (src->map_regions) == 0) {
     /* we have to free the bufferpool we don't have yet */
   }
-  g_mutex_unlock(src->map_regions_lock);
+  g_mutex_unlock (src->map_regions_lock);
 
 #ifdef MADV_DONTNEED
   /* madvise to tell the kernel what to do with it */
-  madvise(GST_BUFFER_DATA(buf),GST_BUFFER_SIZE(buf),MADV_DONTNEED);
+  madvise (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf), MADV_DONTNEED);
 #endif
   /* now unmap the memory */
-  munmap(GST_BUFFER_DATA(buf),GST_BUFFER_MAXSIZE(buf));
+  munmap (GST_BUFFER_DATA (buf), GST_BUFFER_MAXSIZE (buf));
 
   GST_BUFFER_DATA (buf) = NULL;
 
@@ -373,27 +387,27 @@ gst_filesrc_map_region (GstFileSrc *src, off_t offset, size_t size)
   }
 
   /* time to allocate a new mapbuf */
-  buf = gst_buffer_new();
+  buf = gst_buffer_new ();
   /* mmap() the data into this new buffer */
-  GST_BUFFER_DATA(buf) = mmapregion;
+  GST_BUFFER_DATA (buf) = mmapregion;
 
 #ifdef MADV_SEQUENTIAL
   /* madvise to tell the kernel what to do with it */
-  retval = madvise(GST_BUFFER_DATA(buf),GST_BUFFER_SIZE(buf),MADV_SEQUENTIAL);
+  retval = madvise (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf), MADV_SEQUENTIAL);
 #endif
   /* fill in the rest of the fields */
-  GST_BUFFER_FLAG_SET(buf, GST_BUFFER_READONLY);
-  GST_BUFFER_FLAG_SET(buf, GST_BUFFER_ORIGINAL);
-  GST_BUFFER_SIZE(buf) = size;
-  GST_BUFFER_MAXSIZE(buf) = size;
-  GST_BUFFER_OFFSET(buf) = offset;
-  GST_BUFFER_TIMESTAMP(buf) = -1LL;
-  GST_BUFFER_POOL_PRIVATE(buf) = src;
-  GST_BUFFER_FREE_FUNC(buf) = (GstDataFreeFunction) gst_filesrc_free_parent_mmap;
-
-  g_mutex_lock(src->map_regions_lock);
-  g_tree_insert(src->map_regions,buf,buf);
-  g_mutex_unlock(src->map_regions_lock);
+  GST_BUFFER_FLAG_SET (buf, GST_BUFFER_READONLY);
+  GST_BUFFER_FLAG_SET (buf, GST_BUFFER_ORIGINAL);
+  GST_BUFFER_SIZE (buf) = size;
+  GST_BUFFER_MAXSIZE (buf) = size;
+  GST_BUFFER_OFFSET (buf) = offset;
+  GST_BUFFER_TIMESTAMP (buf) = -1LL;
+  GST_BUFFER_POOL_PRIVATE (buf) = src;
+  GST_BUFFER_FREE_FUNC (buf) = (GstDataFreeFunction) gst_filesrc_free_parent_mmap;
+
+  g_mutex_lock (src->map_regions_lock);
+  g_tree_insert (src->map_regions,buf,buf);
+  g_mutex_unlock (src->map_regions_lock);
 
   return buf;
 }
@@ -587,7 +601,8 @@ gst_filesrc_get (GstPad *pad)
   /* if we need to touch the buffer (to bring it into memory), do so */
   if (src->touch) {
     volatile guchar *p = GST_BUFFER_DATA (buf), c;
-    for (i=0;i<GST_BUFFER_SIZE(buf);i+=src->pagesize)
+
+    for (i=0; i < GST_BUFFER_SIZE (buf); i += src->pagesize)
       c = p[i];
   }