coded small bit in to allow changing of output location
authorThomas Vander Stichele <thomas@apestaart.org>
Fri, 1 Jun 2001 15:29:03 +0000 (15:29 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Fri, 1 Jun 2001 15:29:03 +0000 (15:29 +0000)
Original commit message from CVS:
coded small bit in to allow changing of output location

gst/elements/gstdisksink.c
plugins/elements/gstdisksink.c

index 0861149..b47f783 100644 (file)
@@ -135,9 +135,19 @@ gst_disksink_set_arg (GtkObject *object, GtkArg *arg, guint id)
 
   switch(id) {
     case ARG_LOCATION:
+      /* the element must be stopped or paused in order to do this */
+      g_return_if_fail ((GST_STATE (sink) < GST_STATE_PLAYING)
+                      || (GST_STATE (sink) == GST_STATE_PAUSED));
       if (sink->filename)
        g_free (sink->filename);
       sink->filename = g_strdup (GTK_VALUE_STRING (*arg));
+      if ( (GST_STATE (sink) == GST_STATE_PAUSED) 
+        && (sink->filename != NULL))
+      {
+              gst_disksink_close_file (sink);
+              gst_disksink_open_file (sink);   
+      }
       break;
     default:
       break;
index 0861149..b47f783 100644 (file)
@@ -135,9 +135,19 @@ gst_disksink_set_arg (GtkObject *object, GtkArg *arg, guint id)
 
   switch(id) {
     case ARG_LOCATION:
+      /* the element must be stopped or paused in order to do this */
+      g_return_if_fail ((GST_STATE (sink) < GST_STATE_PLAYING)
+                      || (GST_STATE (sink) == GST_STATE_PAUSED));
       if (sink->filename)
        g_free (sink->filename);
       sink->filename = g_strdup (GTK_VALUE_STRING (*arg));
+      if ( (GST_STATE (sink) == GST_STATE_PAUSED) 
+        && (sink->filename != NULL))
+      {
+              gst_disksink_close_file (sink);
+              gst_disksink_open_file (sink);   
+      }
       break;
     default:
       break;