bonobo_ui_util_set_pixbuf (control_data->uic, "/commands/Stop", pixbuf);
gdk_pixbuf_unref (pixbuf);
+ g_print("create menu done\n");
}
static void
AC_DEFINE_UNQUOTED(PLUGINS_SRCDIR,"$PLUGINS_SRCDIR")
AC_SUBST(PLUGINS_SRCDIR)
-dnl check if css.c exists (FIXME)
+dnl check if css-auth.c exists (FIXME)
AC_MSG_CHECKING(DVD CSS code)
-if test -f plugins/dvdsrc/css.c
+if test -f plugins/dvdsrc/css-auth.c
then
AC_MSG_RESULT(yes)
HAVE_CSSAUTH="yes"
+ AC_DEFINE(HAVE_CSSAUTH)
else
AC_MSG_RESULT(no)
HAVE_CSSAUTH="no"
<partintro>
<para>
- In this part we will describe how you create a new plugin
+ In this part we will describe how you can create a new plugin
to be used in <application>GStreamer</application>.
</para>
</partintro>
}
static void
-gst_disksrc_class_init(GstDiskSrcClass *klass) {
+gst_disksrc_class_init (GstDiskSrcClass *klass)
+{
GtkObjectClass *gtkobject_class;
GstElementClass *gstelement_class;
GstSrcClass *gstsrc_class;
gstelement_class = (GstElementClass*)klass;
gstsrc_class = (GstSrcClass*)klass;
- parent_class = gtk_type_class(GST_TYPE_SRC);
+ parent_class = gtk_type_class (GST_TYPE_SRC);
- gtk_object_add_arg_type("GstDiskSrc::location", GST_TYPE_FILENAME,
- GTK_ARG_READWRITE, ARG_LOCATION);
- gtk_object_add_arg_type("GstDiskSrc::bytesperread", GTK_TYPE_INT,
- GTK_ARG_READWRITE, ARG_BYTESPERREAD);
- gtk_object_add_arg_type("GstDiskSrc::offset", GTK_TYPE_INT,
- GTK_ARG_READABLE, ARG_OFFSET);
- gtk_object_add_arg_type("GstDiskSrc::size", GTK_TYPE_INT,
- GTK_ARG_READABLE, ARG_SIZE);
+ gtk_object_add_arg_type ("GstDiskSrc::location", GST_TYPE_FILENAME,
+ GTK_ARG_READWRITE, ARG_LOCATION);
+ gtk_object_add_arg_type ("GstDiskSrc::bytesperread", GTK_TYPE_INT,
+ GTK_ARG_READWRITE, ARG_BYTESPERREAD);
+ gtk_object_add_arg_type ("GstDiskSrc::offset", GTK_TYPE_INT,
+ GTK_ARG_READABLE, ARG_OFFSET);
+ gtk_object_add_arg_type ("GstDiskSrc::size", GTK_TYPE_INT,
+ GTK_ARG_READABLE, ARG_SIZE);
gtkobject_class->set_arg = gst_disksrc_set_arg;
gtkobject_class->get_arg = gst_disksrc_get_arg;
gstsrc_class->push_region = NULL;
}
-static void gst_disksrc_init(GstDiskSrc *disksrc) {
- disksrc->srcpad = gst_pad_new("src",GST_PAD_SRC);
- gst_element_add_pad(GST_ELEMENT(disksrc),disksrc->srcpad);
+static void
+gst_disksrc_init (GstDiskSrc *disksrc)
+{
+ disksrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
+ gst_element_add_pad (GST_ELEMENT (disksrc), disksrc->srcpad);
disksrc->filename = NULL;
disksrc->fd = 0;
}
-static void gst_disksrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
+static void
+gst_disksrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
+{
GstDiskSrc *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_DISKSRC(object));
- src = GST_DISKSRC(object);
+ g_return_if_fail (GST_IS_DISKSRC (object));
+
+ src = GST_DISKSRC (object);
switch(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);
+ g_return_if_fail (GST_STATE(src) < GST_STATE_PLAYING);
- 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?) */
- if (GTK_VALUE_STRING(*arg) == NULL) {
- gst_element_set_state(GST_ELEMENT(object),GST_STATE_NULL);
+ if (GTK_VALUE_STRING (*arg) == NULL) {
+ gst_element_set_state (GST_ELEMENT (object), GST_STATE_NULL);
src->filename = NULL;
/* otherwise set the new filename */
} else {
- src->filename = g_strdup(GTK_VALUE_STRING(*arg));
+ src->filename = g_strdup (GTK_VALUE_STRING (*arg));
}
break;
case ARG_BYTESPERREAD:
- src->bytes_per_read = GTK_VALUE_INT(*arg);
+ src->bytes_per_read = GTK_VALUE_INT (*arg);
break;
/*
case ARG_OFFSET:
}
}
-static void gst_disksrc_get_arg(GtkObject *object,GtkArg *arg,guint id) {
+static void
+gst_disksrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
+{
GstDiskSrc *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_DISKSRC(object));
- src = GST_DISKSRC(object);
+ g_return_if_fail (GST_IS_DISKSRC (object));
+ src = GST_DISKSRC (object);
switch (id) {
case ARG_LOCATION:
- GTK_VALUE_STRING(*arg) = src->filename;
+ GTK_VALUE_STRING (*arg) = src->filename;
break;
case ARG_BYTESPERREAD:
- GTK_VALUE_INT(*arg) = src->bytes_per_read;
+ GTK_VALUE_INT (*arg) = src->bytes_per_read;
break;
case ARG_OFFSET:
- GTK_VALUE_INT(*arg) = src->curoffset;
+ GTK_VALUE_INT (*arg) = src->curoffset;
break;
case ARG_SIZE:
- GTK_VALUE_INT(*arg) = src->size;
+ GTK_VALUE_INT (*arg) = src->size;
break;
default:
arg->type = GTK_TYPE_INVALID;
}
}
-void gst_disksrc_push(GstSrc *src) {
+static void
+gst_disksrc_push (GstSrc *src)
+{
GstDiskSrc *disksrc;
GstBuffer *buf;
glong readbytes;
- g_return_if_fail(src != NULL);
- g_return_if_fail(GST_IS_DISKSRC(src));
- g_return_if_fail(GST_FLAG_IS_SET(src,GST_DISKSRC_OPEN));
- g_return_if_fail(GST_STATE(src) >= GST_STATE_READY);
- disksrc = GST_DISKSRC(src);
+ g_return_if_fail (src != NULL);
+ g_return_if_fail (GST_IS_DISKSRC (src));
+ g_return_if_fail (GST_FLAG_IS_SET (src, GST_DISKSRC_OPEN));
+ g_return_if_fail (GST_STATE (src) >= GST_STATE_READY);
+
+ disksrc = GST_DISKSRC (src);
/* create the buffer */
// FIXME: should eventually use a bufferpool for this
- buf = gst_buffer_new();
- g_return_if_fail(buf);
+ buf = gst_buffer_new ();
+ g_return_if_fail (buf);
/* allocate the space for the buffer data */
- GST_BUFFER_DATA(buf) = g_malloc(disksrc->bytes_per_read);
- g_return_if_fail(GST_BUFFER_DATA(buf) != NULL);
+ GST_BUFFER_DATA (buf) = g_malloc (disksrc->bytes_per_read);
+ g_return_if_fail (GST_BUFFER_DATA (buf) != NULL);
/* read it in from the file */
- readbytes = read(disksrc->fd,GST_BUFFER_DATA(buf),disksrc->bytes_per_read);
+ readbytes = read (disksrc->fd, GST_BUFFER_DATA (buf), disksrc->bytes_per_read);
if (readbytes == -1) {
- perror("read()");
- gst_buffer_unref(buf);
+ perror ("read()");
+ gst_buffer_unref (buf);
return;
}
else if (readbytes == 0) {
- gst_src_signal_eos(GST_SRC(disksrc));
- gst_buffer_unref(buf);
+ gst_src_signal_eos (GST_SRC (disksrc));
+ gst_buffer_unref (buf);
return;
}
/* if we didn't get as many bytes as we asked for, we're at EOF */
if (readbytes < disksrc->bytes_per_read)
- GST_BUFFER_FLAG_SET(buf, GST_BUFFER_EOS);
+ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_EOS);
/* if we have a new buffer froma seek, mark it */
if (disksrc->new_seek) {
- GST_BUFFER_FLAG_SET(buf, GST_BUFFER_FLUSH);
+ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
disksrc->new_seek = FALSE;
}
- GST_BUFFER_OFFSET(buf) = disksrc->curoffset;
- GST_BUFFER_SIZE(buf) = readbytes;
+ GST_BUFFER_OFFSET (buf) = disksrc->curoffset;
+ GST_BUFFER_SIZE (buf) = readbytes;
disksrc->curoffset += readbytes;
- DEBUG("pushing with offset %d\n", GST_BUFFER_OFFSET(buf));
+ DEBUG("pushing with offset %d\n", GST_BUFFER_OFFSET (buf));
/* we're done, push the buffer off now */
- gst_pad_push(disksrc->srcpad,buf);
- DEBUG("pushing with offset %d done\n", GST_BUFFER_OFFSET(buf));
+ gst_pad_push (disksrc->srcpad, buf);
+ DEBUG("pushing with offset %d done\n", GST_BUFFER_OFFSET (buf));
}
/* open the file, necessary to go to RUNNING state */
-static gboolean gst_disksrc_open_file(GstDiskSrc *src) {
+static gboolean
+gst_disksrc_open_file (GstDiskSrc *src)
+{
struct stat f_stat;
- g_return_val_if_fail(!GST_FLAG_IS_SET(src,GST_DISKSRC_OPEN), FALSE);
- g_return_val_if_fail(src->filename != NULL, FALSE);
+ g_return_val_if_fail (!GST_FLAG_IS_SET (src, GST_DISKSRC_OPEN), FALSE);
+ g_return_val_if_fail (src->filename != NULL, FALSE);
/* open the file */
- src->fd = open(src->filename,O_RDONLY);
+ src->fd = open (src->filename, O_RDONLY);
if (src->fd < 0) {
- perror("open()");
- gst_element_error(GST_ELEMENT(src),"opening file");
+ perror ("open()");
+ gst_element_error (GST_ELEMENT (src), "opening file");
return FALSE;
}
- if (fstat(src->fd, &f_stat) < 0) {
+ if (fstat (src->fd, &f_stat) < 0) {
perror("fstat()");
}
else {
src->size = f_stat.st_size;
DEBUG("gstdisksrc: file size %ld\n", src->size);
}
- GST_FLAG_SET(src,GST_DISKSRC_OPEN);
+ GST_FLAG_SET (src, GST_DISKSRC_OPEN);
return TRUE;
}
/* close the file */
-static void gst_disksrc_close_file(GstDiskSrc *src) {
- g_return_if_fail(GST_FLAG_IS_SET(src,GST_DISKSRC_OPEN));
+static void
+gst_disksrc_close_file (GstDiskSrc *src)
+{
+ g_return_if_fail (GST_FLAG_IS_SET (src, GST_DISKSRC_OPEN));
/* close the file */
- close(src->fd);
+ close (src->fd);
/* zero out a lot of our state */
src->fd = 0;
src->seq = 0;
src->size = 0;
- GST_FLAG_UNSET(src,GST_DISKSRC_OPEN);
+ GST_FLAG_UNSET (src, GST_DISKSRC_OPEN);
}
-static GstElementStateReturn gst_disksrc_change_state(GstElement *element) {
- g_return_val_if_fail(GST_IS_DISKSRC(element),GST_STATE_FAILURE);
+static GstElementStateReturn
+gst_disksrc_change_state (GstElement *element)
+{
+ g_return_val_if_fail (GST_IS_DISKSRC (element), GST_STATE_FAILURE);
- DEBUG("gstdisksrc: state pending %d\n", GST_STATE_PENDING(element));
+ DEBUG("gstdisksrc: state pending %d\n", GST_STATE_PENDING (element));
/* if going down into NULL state, close the file if it's open */
- if (GST_STATE_PENDING(element) == GST_STATE_NULL) {
- if (GST_FLAG_IS_SET(element,GST_DISKSRC_OPEN))
- gst_disksrc_close_file(GST_DISKSRC(element));
+ if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
+ if (GST_FLAG_IS_SET (element, GST_DISKSRC_OPEN))
+ gst_disksrc_close_file (GST_DISKSRC (element));
/* otherwise (READY or higher) we need to open the file */
} else {
- if (!GST_FLAG_IS_SET(element,GST_DISKSRC_OPEN)) {
- if (!gst_disksrc_open_file(GST_DISKSRC(element)))
+ if (!GST_FLAG_IS_SET (element, GST_DISKSRC_OPEN)) {
+ if (!gst_disksrc_open_file (GST_DISKSRC (element)))
return GST_STATE_FAILURE;
}
}
/* if we haven't failed already, give the parent class a chance to ;-) */
- if (GST_ELEMENT_CLASS(parent_class)->change_state)
- return GST_ELEMENT_CLASS(parent_class)->change_state(element);
+ if (GST_ELEMENT_CLASS (parent_class)->change_state)
+ return GST_ELEMENT_CLASS (parent_class)->change_state (element);
return GST_STATE_SUCCESS;
}
gst_main_quit ();
}
+void
+on_exit_menu_activate (GtkWidget *widget,
+ GstMediaPlay *mplay)
+{
+ gdk_threads_leave ();
+ gst_play_stop (mplay->play);
+ gdk_threads_enter ();
+ gst_main_quit ();
+}
+
gint
on_gst_media_play_delete_event (GtkWidget *widget,
GdkEvent *event,
priv->uri = g_strdup (uri);
priv->src = gst_elementfactory_make ("asyncdisksrc", "disk_src");
+ //priv->src = gst_elementfactory_make ("dvdsrc", "disk_src");
g_return_val_if_fail (priv->src != NULL, -1);
gtk_object_set (GTK_OBJECT (priv->src),"location",uri,NULL);
gtk_signal_connect (GTK_OBJECT (priv->src), "eos", GTK_SIGNAL_FUNC (gst_play_eos), play);
}
static void
-gst_disksrc_class_init(GstDiskSrcClass *klass) {
+gst_disksrc_class_init (GstDiskSrcClass *klass)
+{
GtkObjectClass *gtkobject_class;
GstElementClass *gstelement_class;
GstSrcClass *gstsrc_class;
gstelement_class = (GstElementClass*)klass;
gstsrc_class = (GstSrcClass*)klass;
- parent_class = gtk_type_class(GST_TYPE_SRC);
+ parent_class = gtk_type_class (GST_TYPE_SRC);
- gtk_object_add_arg_type("GstDiskSrc::location", GST_TYPE_FILENAME,
- GTK_ARG_READWRITE, ARG_LOCATION);
- gtk_object_add_arg_type("GstDiskSrc::bytesperread", GTK_TYPE_INT,
- GTK_ARG_READWRITE, ARG_BYTESPERREAD);
- gtk_object_add_arg_type("GstDiskSrc::offset", GTK_TYPE_INT,
- GTK_ARG_READABLE, ARG_OFFSET);
- gtk_object_add_arg_type("GstDiskSrc::size", GTK_TYPE_INT,
- GTK_ARG_READABLE, ARG_SIZE);
+ gtk_object_add_arg_type ("GstDiskSrc::location", GST_TYPE_FILENAME,
+ GTK_ARG_READWRITE, ARG_LOCATION);
+ gtk_object_add_arg_type ("GstDiskSrc::bytesperread", GTK_TYPE_INT,
+ GTK_ARG_READWRITE, ARG_BYTESPERREAD);
+ gtk_object_add_arg_type ("GstDiskSrc::offset", GTK_TYPE_INT,
+ GTK_ARG_READABLE, ARG_OFFSET);
+ gtk_object_add_arg_type ("GstDiskSrc::size", GTK_TYPE_INT,
+ GTK_ARG_READABLE, ARG_SIZE);
gtkobject_class->set_arg = gst_disksrc_set_arg;
gtkobject_class->get_arg = gst_disksrc_get_arg;
gstsrc_class->push_region = NULL;
}
-static void gst_disksrc_init(GstDiskSrc *disksrc) {
- disksrc->srcpad = gst_pad_new("src",GST_PAD_SRC);
- gst_element_add_pad(GST_ELEMENT(disksrc),disksrc->srcpad);
+static void
+gst_disksrc_init (GstDiskSrc *disksrc)
+{
+ disksrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
+ gst_element_add_pad (GST_ELEMENT (disksrc), disksrc->srcpad);
disksrc->filename = NULL;
disksrc->fd = 0;
}
-static void gst_disksrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
+static void
+gst_disksrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
+{
GstDiskSrc *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_DISKSRC(object));
- src = GST_DISKSRC(object);
+ g_return_if_fail (GST_IS_DISKSRC (object));
+
+ src = GST_DISKSRC (object);
switch(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);
+ g_return_if_fail (GST_STATE(src) < GST_STATE_PLAYING);
- 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?) */
- if (GTK_VALUE_STRING(*arg) == NULL) {
- gst_element_set_state(GST_ELEMENT(object),GST_STATE_NULL);
+ if (GTK_VALUE_STRING (*arg) == NULL) {
+ gst_element_set_state (GST_ELEMENT (object), GST_STATE_NULL);
src->filename = NULL;
/* otherwise set the new filename */
} else {
- src->filename = g_strdup(GTK_VALUE_STRING(*arg));
+ src->filename = g_strdup (GTK_VALUE_STRING (*arg));
}
break;
case ARG_BYTESPERREAD:
- src->bytes_per_read = GTK_VALUE_INT(*arg);
+ src->bytes_per_read = GTK_VALUE_INT (*arg);
break;
/*
case ARG_OFFSET:
}
}
-static void gst_disksrc_get_arg(GtkObject *object,GtkArg *arg,guint id) {
+static void
+gst_disksrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
+{
GstDiskSrc *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_DISKSRC(object));
- src = GST_DISKSRC(object);
+ g_return_if_fail (GST_IS_DISKSRC (object));
+ src = GST_DISKSRC (object);
switch (id) {
case ARG_LOCATION:
- GTK_VALUE_STRING(*arg) = src->filename;
+ GTK_VALUE_STRING (*arg) = src->filename;
break;
case ARG_BYTESPERREAD:
- GTK_VALUE_INT(*arg) = src->bytes_per_read;
+ GTK_VALUE_INT (*arg) = src->bytes_per_read;
break;
case ARG_OFFSET:
- GTK_VALUE_INT(*arg) = src->curoffset;
+ GTK_VALUE_INT (*arg) = src->curoffset;
break;
case ARG_SIZE:
- GTK_VALUE_INT(*arg) = src->size;
+ GTK_VALUE_INT (*arg) = src->size;
break;
default:
arg->type = GTK_TYPE_INVALID;
}
}
-void gst_disksrc_push(GstSrc *src) {
+static void
+gst_disksrc_push (GstSrc *src)
+{
GstDiskSrc *disksrc;
GstBuffer *buf;
glong readbytes;
- g_return_if_fail(src != NULL);
- g_return_if_fail(GST_IS_DISKSRC(src));
- g_return_if_fail(GST_FLAG_IS_SET(src,GST_DISKSRC_OPEN));
- g_return_if_fail(GST_STATE(src) >= GST_STATE_READY);
- disksrc = GST_DISKSRC(src);
+ g_return_if_fail (src != NULL);
+ g_return_if_fail (GST_IS_DISKSRC (src));
+ g_return_if_fail (GST_FLAG_IS_SET (src, GST_DISKSRC_OPEN));
+ g_return_if_fail (GST_STATE (src) >= GST_STATE_READY);
+
+ disksrc = GST_DISKSRC (src);
/* create the buffer */
// FIXME: should eventually use a bufferpool for this
- buf = gst_buffer_new();
- g_return_if_fail(buf);
+ buf = gst_buffer_new ();
+ g_return_if_fail (buf);
/* allocate the space for the buffer data */
- GST_BUFFER_DATA(buf) = g_malloc(disksrc->bytes_per_read);
- g_return_if_fail(GST_BUFFER_DATA(buf) != NULL);
+ GST_BUFFER_DATA (buf) = g_malloc (disksrc->bytes_per_read);
+ g_return_if_fail (GST_BUFFER_DATA (buf) != NULL);
/* read it in from the file */
- readbytes = read(disksrc->fd,GST_BUFFER_DATA(buf),disksrc->bytes_per_read);
+ readbytes = read (disksrc->fd, GST_BUFFER_DATA (buf), disksrc->bytes_per_read);
if (readbytes == -1) {
- perror("read()");
- gst_buffer_unref(buf);
+ perror ("read()");
+ gst_buffer_unref (buf);
return;
}
else if (readbytes == 0) {
- gst_src_signal_eos(GST_SRC(disksrc));
- gst_buffer_unref(buf);
+ gst_src_signal_eos (GST_SRC (disksrc));
+ gst_buffer_unref (buf);
return;
}
/* if we didn't get as many bytes as we asked for, we're at EOF */
if (readbytes < disksrc->bytes_per_read)
- GST_BUFFER_FLAG_SET(buf, GST_BUFFER_EOS);
+ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_EOS);
/* if we have a new buffer froma seek, mark it */
if (disksrc->new_seek) {
- GST_BUFFER_FLAG_SET(buf, GST_BUFFER_FLUSH);
+ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
disksrc->new_seek = FALSE;
}
- GST_BUFFER_OFFSET(buf) = disksrc->curoffset;
- GST_BUFFER_SIZE(buf) = readbytes;
+ GST_BUFFER_OFFSET (buf) = disksrc->curoffset;
+ GST_BUFFER_SIZE (buf) = readbytes;
disksrc->curoffset += readbytes;
- DEBUG("pushing with offset %d\n", GST_BUFFER_OFFSET(buf));
+ DEBUG("pushing with offset %d\n", GST_BUFFER_OFFSET (buf));
/* we're done, push the buffer off now */
- gst_pad_push(disksrc->srcpad,buf);
- DEBUG("pushing with offset %d done\n", GST_BUFFER_OFFSET(buf));
+ gst_pad_push (disksrc->srcpad, buf);
+ DEBUG("pushing with offset %d done\n", GST_BUFFER_OFFSET (buf));
}
/* open the file, necessary to go to RUNNING state */
-static gboolean gst_disksrc_open_file(GstDiskSrc *src) {
+static gboolean
+gst_disksrc_open_file (GstDiskSrc *src)
+{
struct stat f_stat;
- g_return_val_if_fail(!GST_FLAG_IS_SET(src,GST_DISKSRC_OPEN), FALSE);
- g_return_val_if_fail(src->filename != NULL, FALSE);
+ g_return_val_if_fail (!GST_FLAG_IS_SET (src, GST_DISKSRC_OPEN), FALSE);
+ g_return_val_if_fail (src->filename != NULL, FALSE);
/* open the file */
- src->fd = open(src->filename,O_RDONLY);
+ src->fd = open (src->filename, O_RDONLY);
if (src->fd < 0) {
- perror("open()");
- gst_element_error(GST_ELEMENT(src),"opening file");
+ perror ("open()");
+ gst_element_error (GST_ELEMENT (src), "opening file");
return FALSE;
}
- if (fstat(src->fd, &f_stat) < 0) {
+ if (fstat (src->fd, &f_stat) < 0) {
perror("fstat()");
}
else {
src->size = f_stat.st_size;
DEBUG("gstdisksrc: file size %ld\n", src->size);
}
- GST_FLAG_SET(src,GST_DISKSRC_OPEN);
+ GST_FLAG_SET (src, GST_DISKSRC_OPEN);
return TRUE;
}
/* close the file */
-static void gst_disksrc_close_file(GstDiskSrc *src) {
- g_return_if_fail(GST_FLAG_IS_SET(src,GST_DISKSRC_OPEN));
+static void
+gst_disksrc_close_file (GstDiskSrc *src)
+{
+ g_return_if_fail (GST_FLAG_IS_SET (src, GST_DISKSRC_OPEN));
/* close the file */
- close(src->fd);
+ close (src->fd);
/* zero out a lot of our state */
src->fd = 0;
src->seq = 0;
src->size = 0;
- GST_FLAG_UNSET(src,GST_DISKSRC_OPEN);
+ GST_FLAG_UNSET (src, GST_DISKSRC_OPEN);
}
-static GstElementStateReturn gst_disksrc_change_state(GstElement *element) {
- g_return_val_if_fail(GST_IS_DISKSRC(element),GST_STATE_FAILURE);
+static GstElementStateReturn
+gst_disksrc_change_state (GstElement *element)
+{
+ g_return_val_if_fail (GST_IS_DISKSRC (element), GST_STATE_FAILURE);
- DEBUG("gstdisksrc: state pending %d\n", GST_STATE_PENDING(element));
+ DEBUG("gstdisksrc: state pending %d\n", GST_STATE_PENDING (element));
/* if going down into NULL state, close the file if it's open */
- if (GST_STATE_PENDING(element) == GST_STATE_NULL) {
- if (GST_FLAG_IS_SET(element,GST_DISKSRC_OPEN))
- gst_disksrc_close_file(GST_DISKSRC(element));
+ if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
+ if (GST_FLAG_IS_SET (element, GST_DISKSRC_OPEN))
+ gst_disksrc_close_file (GST_DISKSRC (element));
/* otherwise (READY or higher) we need to open the file */
} else {
- if (!GST_FLAG_IS_SET(element,GST_DISKSRC_OPEN)) {
- if (!gst_disksrc_open_file(GST_DISKSRC(element)))
+ if (!GST_FLAG_IS_SET (element, GST_DISKSRC_OPEN)) {
+ if (!gst_disksrc_open_file (GST_DISKSRC (element)))
return GST_STATE_FAILURE;
}
}
/* if we haven't failed already, give the parent class a chance to ;-) */
- if (GST_ELEMENT_CLASS(parent_class)->change_state)
- return GST_ELEMENT_CLASS(parent_class)->change_state(element);
+ if (GST_ELEMENT_CLASS (parent_class)->change_state)
+ return GST_ELEMENT_CLASS (parent_class)->change_state (element);
return GST_STATE_SUCCESS;
}
_gst_plugin_spew = TRUE;
gst_init(&argc,&argv);
- gst_plugin_load_all();
// gst_plugin_load("dvdsrc");
fd = creat("output.vob",0644);
src = gst_elementfactory_make("dvdsrc","src");
g_return_if_fail(src != NULL);
+
gtk_object_set(GTK_OBJECT(src),"location",argv[1],NULL);
if (argc >= 3)
gtk_object_set(GTK_OBJECT(src),"offset",atoi(argv[2]),NULL);
+
sink = gst_elementfactory_make("fdsink","sink");
g_return_if_fail(sink != NULL);
gtk_object_set(GTK_OBJECT(sink),"fd",fd,NULL);
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_READY);
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
-// while (GST_STATE_IS_SET(src,GST_STATE_READY))
-// while (1)
- while (GST_STATE(src) & 1<<16)
+ while (1)
gst_src_push(GST_SRC(src));
}