mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 01:45:33 +00:00
- it is now possible to change the opened file when state is PAUSED
Original commit message from CVS: - it is now possible to change the opened file when state is PAUSED
This commit is contained in:
parent
90b551890f
commit
427203dc28
2 changed files with 20 additions and 4 deletions
|
@ -67,6 +67,8 @@ static GstBuffer * gst_disksrc_get_region (GstPad *pad,GstRegionType type,guint6
|
||||||
|
|
||||||
static GstElementStateReturn gst_disksrc_change_state (GstElement *element);
|
static GstElementStateReturn gst_disksrc_change_state (GstElement *element);
|
||||||
|
|
||||||
|
static gboolean gst_disksrc_open_file (GstDiskSrc *src);
|
||||||
|
static void gst_disksrc_close_file (GstDiskSrc *src);
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
static GstElementClass *parent_class = NULL;
|
||||||
//static guint gst_disksrc_signals[LAST_SIGNAL] = { 0 };
|
//static guint gst_disksrc_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
@ -151,8 +153,9 @@ gst_disksrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||||
|
|
||||||
switch(id) {
|
switch(id) {
|
||||||
case ARG_LOCATION:
|
case ARG_LOCATION:
|
||||||
/* the element must be stopped in order to do this */
|
/* the element must be stopped or paused in order to do this */
|
||||||
g_return_if_fail (GST_STATE (src) < GST_STATE_PLAYING);
|
g_return_if_fail ((GST_STATE (src) < GST_STATE_PLAYING)
|
||||||
|
|| (GST_STATE (src) == GST_STATE_PAUSED));
|
||||||
|
|
||||||
if (src->filename) g_free (src->filename);
|
if (src->filename) g_free (src->filename);
|
||||||
/* clear the filename if we get a NULL (is that possible?) */
|
/* clear the filename if we get a NULL (is that possible?) */
|
||||||
|
@ -163,6 +166,11 @@ gst_disksrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||||
} else {
|
} else {
|
||||||
src->filename = g_strdup (GTK_VALUE_STRING (*arg));
|
src->filename = g_strdup (GTK_VALUE_STRING (*arg));
|
||||||
}
|
}
|
||||||
|
if ((GST_STATE (src) == GST_STATE_PAUSED) && (src->filename != NULL))
|
||||||
|
{
|
||||||
|
gst_disksrc_close_file(src);
|
||||||
|
gst_disksrc_open_file(src);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ARG_BYTESPERREAD:
|
case ARG_BYTESPERREAD:
|
||||||
src->bytes_per_read = GTK_VALUE_INT (*arg);
|
src->bytes_per_read = GTK_VALUE_INT (*arg);
|
||||||
|
|
|
@ -67,6 +67,8 @@ static GstBuffer * gst_disksrc_get_region (GstPad *pad,GstRegionType type,guint6
|
||||||
|
|
||||||
static GstElementStateReturn gst_disksrc_change_state (GstElement *element);
|
static GstElementStateReturn gst_disksrc_change_state (GstElement *element);
|
||||||
|
|
||||||
|
static gboolean gst_disksrc_open_file (GstDiskSrc *src);
|
||||||
|
static void gst_disksrc_close_file (GstDiskSrc *src);
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
static GstElementClass *parent_class = NULL;
|
||||||
//static guint gst_disksrc_signals[LAST_SIGNAL] = { 0 };
|
//static guint gst_disksrc_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
@ -151,8 +153,9 @@ gst_disksrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||||
|
|
||||||
switch(id) {
|
switch(id) {
|
||||||
case ARG_LOCATION:
|
case ARG_LOCATION:
|
||||||
/* the element must be stopped in order to do this */
|
/* the element must be stopped or paused in order to do this */
|
||||||
g_return_if_fail (GST_STATE (src) < GST_STATE_PLAYING);
|
g_return_if_fail ((GST_STATE (src) < GST_STATE_PLAYING)
|
||||||
|
|| (GST_STATE (src) == GST_STATE_PAUSED));
|
||||||
|
|
||||||
if (src->filename) g_free (src->filename);
|
if (src->filename) g_free (src->filename);
|
||||||
/* clear the filename if we get a NULL (is that possible?) */
|
/* clear the filename if we get a NULL (is that possible?) */
|
||||||
|
@ -163,6 +166,11 @@ gst_disksrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||||
} else {
|
} else {
|
||||||
src->filename = g_strdup (GTK_VALUE_STRING (*arg));
|
src->filename = g_strdup (GTK_VALUE_STRING (*arg));
|
||||||
}
|
}
|
||||||
|
if ((GST_STATE (src) == GST_STATE_PAUSED) && (src->filename != NULL))
|
||||||
|
{
|
||||||
|
gst_disksrc_close_file(src);
|
||||||
|
gst_disksrc_open_file(src);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ARG_BYTESPERREAD:
|
case ARG_BYTESPERREAD:
|
||||||
src->bytes_per_read = GTK_VALUE_INT (*arg);
|
src->bytes_per_read = GTK_VALUE_INT (*arg);
|
||||||
|
|
Loading…
Reference in a new issue