--- /usr/audio/dev/User/lglayal/GStreamer/GStreamer/Revision_Mars2009/gstreamer/plugins/elements/gstfilesink.c.20090729 2009-07-29 15:00:47.000000000 +0200
+++ /usr/audio/dev/User/lglayal/GStreamer/GStreamer/Revision_Mars2009/gstreamer/plugins/elements/gstfilesink.c  2009-07-29 15:29:21.000000000 +0200
@@ -78,6 +78,7 @@
 #define DEFAULT_LOCATION       NULL
 #define DEFAULT_BUFFER_MODE    -1
 #define DEFAULT_BUFFER_SIZE    64 * 1024
+#define DEFAULT_APPEND                 FALSE

 enum
 {
@@ -85,6 +86,7 @@
   PROP_LOCATION,
   PROP_BUFFER_MODE,
   PROP_BUFFER_SIZE,
+  PROP_APPEND,
   PROP_LAST
 };

@@ -173,6 +175,11 @@
           G_MAXUINT, DEFAULT_BUFFER_SIZE,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

+  g_object_class_install_property (gobject_class, PROP_APPEND,
+      g_param_spec_boolean ("append", "Append to file",
+          "Yes or No ?", DEFAULT_APPEND,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
   gstbasesink_class->get_times = NULL;
   gstbasesink_class->start = GST_DEBUG_FUNCPTR (gst_file_sink_start);
   gstbasesink_class->stop = GST_DEBUG_FUNCPTR (gst_file_sink_stop);
@@ -199,6 +206,7 @@
   filesink->buffer_mode = DEFAULT_BUFFER_MODE;
   filesink->buffer_size = DEFAULT_BUFFER_SIZE;
   filesink->buffer = NULL;
+  filesink->append = FALSE ;

   gst_base_sink_set_sync (GST_BASE_SINK (filesink), FALSE);
 }
@@ -263,6 +271,9 @@
     case PROP_BUFFER_SIZE:
       sink->buffer_size = g_value_get_uint (value);
       break;
+    case PROP_APPEND:
+      sink->append = g_value_get_boolean (value);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -285,6 +296,9 @@
     case PROP_BUFFER_SIZE:
       g_value_set_uint (value, sink->buffer_size);
       break;
+    case PROP_APPEND:
+      g_value_set_boolean (value, sink->append);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -303,7 +317,10 @@
   /* FIXME, can we use g_fopen here? some people say that the FILE object is
    * local to the .so that performed the fopen call, which would not be us when
    * we use g_fopen. */
-  sink->file = fopen (sink->filename, "wb");
+  if ( sink->append )
+         sink->file = fopen (sink->filename, "ab");
+  else
+         sink->file = fopen (sink->filename, "wb");
   if (sink->file == NULL)
     goto open_failed;

