API docs updates.
authorWim Taymans <wim.taymans@gmail.com>
Sun, 22 Apr 2001 16:04:19 +0000 (16:04 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Sun, 22 Apr 2001 16:04:19 +0000 (16:04 +0000)
Original commit message from CVS:
API docs updates.
Properly implemented the disksink.
Fixed a compile problem with alsa.
Added bufferpool handling to dvdec
Some compiler warning fixes

20 files changed:
docs/gst/gstreamer-docs.sgml
docs/gst/gstreamer-sections.txt
docs/gst/gstreamer.hierarchy
docs/gst/tmpl/gstbuffer.sgml
docs/gst/tmpl/gstidentity.sgml
docs/gst/tmpl/gstplugin.sgml
docs/gst/tmpl/gstprops.sgml
docs/gst/tmpl/gstreamer-unused.sgml
docs/libs/Makefile.am
gst/elements/gstdisksink.c
gst/elements/gstdisksink.h
gst/elements/gstdisksrc.c
gst/gstcaps.h
gst/gstpad.h
gst/gstutils.c
plugins/elements/gstdisksink.c
plugins/elements/gstdisksink.h
plugins/elements/gstdisksrc.c
test/Makefile.am
tests/padfactory.c

index 5d4f957..50ddbc9 100644 (file)
@@ -32,6 +32,7 @@
 <!entity GstFakeSrc SYSTEM "sgml/gstfakesrc.sgml">
 <!entity GstFakeSink SYSTEM "sgml/gstfakesink.sgml">
 <!entity GstDiskSrc SYSTEM "sgml/gstdisksrc.sgml">
+<!entity GstDiskSink SYSTEM "sgml/gstdisksink.sgml">
 <!entity GstHttpSrc SYSTEM "sgml/gsthttpsrc.sgml">
 <!entity GstFdSrc SYSTEM "sgml/gstfdsrc.sgml">
 <!entity GstSineSrc SYSTEM "sgml/gstsinesrc.sgml">
@@ -122,6 +123,8 @@ with some more specialized elements.</para>
     &GstFakeSink;
 
     &GstDiskSrc;
+    &GstDiskSink;
+
     &GstHttpSrc;
     
     &GstSineSrc;
index c370add..6962909 100644 (file)
@@ -133,7 +133,6 @@ GST_BUFFER_FLAGS
 GST_BUFFER_FLAG_IS_SET
 GST_BUFFER_FLAG_SET
 GST_BUFFER_FLAG_UNSET
-GST_BUFFER_TYPE
 GST_BUFFER_DATA
 GST_BUFFER_SIZE
 GST_BUFFER_OFFSET
@@ -144,12 +143,15 @@ GST_BUFFER_POOL_PRIVATE
 GST_BUFFER_LOCK
 GST_BUFFER_TRYLOCK
 GST_BUFFER_UNLOCK
+GST_BUFFER_PARENT
+GST_BUFFER_MAXAGE
 
 
 GstBufferFlags
 GstBuffer
 gst_buffer_new
 gst_buffer_new_from_pool
+gst_buffer_copy
 gst_buffer_create_sub
 gst_buffer_append
 gst_buffer_ref
@@ -524,8 +526,8 @@ gst_pipeline_details
 <FILE>gstplugin</FILE>
 <TITLE>GstPlugin</TITLE>
 GstPlugin
-GstPluginElement
 GstPluginInitFunc
+GstPluginDesc
 gst_plugin_new
 gst_plugin_set_name
 gst_plugin_get_name
@@ -668,6 +670,7 @@ GST_CAPS
 <TITLE>GstProps</TITLE>
 GstProps
 GST_MAKE_FOURCC
+GST_STR_FOURCC
 GST_PROPS_LIST
 GST_PROPS_INT
 GST_PROPS_INT_RANGE
@@ -928,6 +931,20 @@ GST_IS_TYPEFIND_CLASS
 </SECTION>
 
 <SECTION>
+<FILE>gstdisksink</FILE>
+<TITLE>GstDiskSink</TITLE>
+GstDiskSinkFlags
+<SUBSECTION Standard>
+GstDiskSink
+GST_DISKSINK
+GST_IS_DISKSINK
+GST_TYPE_DISKSINK
+gst_disksink_get_type
+GST_DISKSINK_CLASS
+GST_IS_DISKSINK_CLASS
+</SECTION>
+
+<SECTION>
 <FILE>gstmultidisksrc</FILE>
 <TITLE>GstMultiDiskSrc</TITLE>
 GstMultiDiskSrcFlags
index 3fcebbb..758dabb 100644 (file)
@@ -9,6 +9,7 @@ GtkObject
       GstFakeSrc
       GstFakeSink
       GstDiskSrc
+      GstDiskSink
       GstHttpSrc
       GstFdSrc
       GstSineSrc
index aae17fe..c57caf7 100644 (file)
@@ -95,14 +95,6 @@ Clear a flag in a buffer.
 @flag: the flag to clear
 
 
-<!-- ##### MACRO GST_BUFFER_TYPE ##### -->
-<para>
-Retrieves the type id of the data in the buffer.
-</para>
-
-@buf: GstBuffer
-
-
 <!-- ##### MACRO GST_BUFFER_DATA ##### -->
 <para>
 Retrieves a pointer to the data element of this buffer
@@ -188,6 +180,22 @@ This macro releases a lock on the object.
 @buf: GstBuffer to unlock.
 
 
+<!-- ##### MACRO GST_BUFFER_PARENT ##### -->
+<para>
+Get the parent of this buffer. The parent is set on subbuffers.
+</para>
+
+@buf: GstBuffer to get the parent of.
+
+
+<!-- ##### MACRO GST_BUFFER_MAXAGE ##### -->
+<para>
+Get the maximun age of a buffer.
+</para>
+
+@buf: GstBuffer to get the maxage of.
+
+
 <!-- ##### ENUM GstBufferFlags ##### -->
 <para>
 
@@ -207,7 +215,6 @@ used when data in a stream has been skipped
 </para>
 
 @lock: 
-@flags: 
 @data: 
 @size: 
 @maxsize: 
@@ -236,6 +243,15 @@ used when data in a stream has been skipped
 @Returns: 
 
 
+<!-- ##### FUNCTION gst_buffer_copy ##### -->
+<para>
+
+</para>
+
+@buffer: 
+@Returns: 
+
+
 <!-- ##### FUNCTION gst_buffer_create_sub ##### -->
 <para>
 
index 996a7a7..0a059cf 100644 (file)
@@ -24,3 +24,8 @@ Pass data without modification.
 
 </para>
 
+<!-- ##### ARG GstIdentity:silent ##### -->
+<para>
+
+</para>
+
index c22231e..1b67696 100644 (file)
@@ -69,12 +69,6 @@ to bring it into memory.
 @numautopluggers: 
 @loaded: 
 
-<!-- ##### STRUCT GstPluginElement ##### -->
-<para>
-
-</para>
-
-
 <!-- ##### USER_FUNCTION GstPluginInitFunc ##### -->
 <para>
 A plugin should implement this function called plugin_init. It will be called
@@ -82,15 +76,28 @@ by the loader at statup.
 </para>
 
 @module: The <classname>GModule</classname> it was loaded from
+@plugin: 
 @Returns: The plugin or NULL is an error was detected.
 
 
+<!-- ##### STRUCT GstPluginDesc ##### -->
+<para>
+
+</para>
+
+@major_version: 
+@minor_version: 
+@name: 
+@plugin_init: 
+
 <!-- ##### FUNCTION gst_plugin_new ##### -->
 <para>
 
 </para>
 
 @name: 
+@major: 
+@minor: 
 @Returns: 
 
 
index 381f899..7b318cb 100644 (file)
@@ -28,6 +28,11 @@ are usually used in conjunction with GstCaps.
 <para>
 Create a FOURCC value that can easily be used to construct
 a fourcc property.
+<programlisting>
+  ...
+  "format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2')),
+  ...
+</programlisting>
 </para>
 
 @a: first fourcc byte
@@ -36,6 +41,19 @@ a fourcc property.
 @d: fourth fourcc byte
 
 
+<!-- ##### MACRO GST_STR_FOURCC ##### -->
+<para>
+Create a FOURCC value from a string. example:
+<programlisting>
+  ...
+  "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")),
+  ...
+</programlisting>
+</para>
+
+@f: the string describing the fourcc value.
+
+
 <!-- ##### MACRO GST_PROPS_LIST ##### -->
 <para>
 Create a list of properties.
index 1e74019..fe88131 100644 (file)
@@ -67,21 +67,21 @@ Query the element for the current mime type
 </para>
 
 
-<!-- ##### FUNCTION gst_pad_remove_ghost_parent ##### -->
+<!-- ##### FUNCTION gst_fdsink_chain ##### -->
 <para>
 
 </para>
 
 @pad: 
-@parent
+@buf
 
-<!-- ##### FUNCTION gst_fdsink_chain ##### -->
+<!-- ##### FUNCTION gst_pad_remove_ghost_parent ##### -->
 <para>
 
 </para>
 
 @pad: 
-@buf
+@parent
 
 <!-- ##### FUNCTION gst_identity_chain ##### -->
 <para>
@@ -91,20 +91,20 @@ Query the element for the current mime type
 @pad: 
 @buf: 
 
-<!-- ##### FUNCTION gst_connection_get_type ##### -->
+<!-- ##### FUNCTION gst_audiosink_chain ##### -->
 <para>
 
 </para>
 
-@Returns: 
+@pad: 
+@buf: 
 
-<!-- ##### FUNCTION gst_audiosink_chain ##### -->
+<!-- ##### FUNCTION gst_connection_get_type ##### -->
 <para>
 
 </para>
 
-@pad: 
-@buf: 
+@Returns: 
 
 <!-- ##### MACRO GST_PIPELINE_CLASS ##### -->
 <para>
@@ -200,18 +200,18 @@ the stream.
 @gstsrc: the object which received the signal.
 @arg1: the object which received the signal
 
-<!-- ##### TYPEDEF GstCapsFactoryEntry ##### -->
+<!-- ##### FUNCTION gst_disksrc_get_type ##### -->
 <para>
 
 </para>
 
+@Returns: 
 
-<!-- ##### FUNCTION gst_disksrc_get_type ##### -->
+<!-- ##### TYPEDEF GstCapsFactoryEntry ##### -->
 <para>
 
 </para>
 
-@Returns: 
 
 <!-- ##### MACRO GST_IS_DISKSRC_CLASS ##### -->
 <para>
@@ -366,16 +366,16 @@ subclass use this to start their flag enumeration
 @audiosink: 
 @channels: 
 
-<!-- ##### SECTION ./tmpl/gstconnection.sgml:Short_Description ##### -->
-Generic connection between elements.
-
-
 <!-- ##### STRUCT GstSinkClass ##### -->
 <para>
 
 </para>
 
 
+<!-- ##### SECTION ./tmpl/gstconnection.sgml:Short_Description ##### -->
+Generic connection between elements.
+
+
 <!-- ##### STRUCT GstFilterClass ##### -->
 <para>
 
@@ -655,13 +655,13 @@ Specify the current offset in the file.
 @sheight: 
 @bytes_per_line: 
 
-<!-- ##### SECTION ./tmpl/GstElement.sgml:Long_Description ##### -->
+<!-- ##### ARG GstAudioSink:format ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### ARG GstAudioSink:format ##### -->
+<!-- ##### SECTION ./tmpl/GstElement.sgml:Long_Description ##### -->
 <para>
 
 </para>
@@ -695,32 +695,32 @@ Specify the current offset in the file.
 @name: 
 @Returns: 
 
-<!-- ##### STRUCT GstConnection ##### -->
+<!-- ##### STRUCT GstQueueClass ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### STRUCT GstQueueClass ##### -->
+<!-- ##### STRUCT GstConnection ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### FUNCTION gst_fakesrc_push ##### -->
+<!-- ##### FUNCTION gst_type_add_sink ##### -->
 <para>
 
 </para>
 
-@src: 
+@id: 
+@sink: 
 
-<!-- ##### FUNCTION gst_type_add_sink ##### -->
+<!-- ##### FUNCTION gst_fakesrc_push ##### -->
 <para>
 
 </para>
 
-@id: 
-@sink: 
+@src: 
 
 <!-- ##### MACRO GST_IS_IDENTITY_CLASS ##### -->
 <para>
@@ -1135,19 +1135,19 @@ GstFilter
 
 @obj: 
 
-<!-- ##### MACRO GST_IS_QUEUE_CLASS ##### -->
+<!-- ##### FUNCTION gst_fdsrc_get_type ##### -->
 <para>
 
 </para>
 
-@obj
+@Returns
 
-<!-- ##### FUNCTION gst_fdsrc_get_type ##### -->
+<!-- ##### MACRO GST_IS_QUEUE_CLASS ##### -->
 <para>
 
 </para>
 
-@Returns
+@obj
 
 <!-- ##### FUNCTION gst_pad_get_type_id ##### -->
 <para>
@@ -1157,13 +1157,6 @@ GstFilter
 @pad: 
 @Returns: 
 
-<!-- ##### FUNCTION gst_thread_iterate ##### -->
-<para>
-
-</para>
-
-@thread: 
-
 <!-- ##### STRUCT OverlayClip ##### -->
 <para>
 
@@ -1174,6 +1167,13 @@ GstFilter
 @y1: 
 @y2: 
 
+<!-- ##### FUNCTION gst_thread_iterate ##### -->
+<para>
+
+</para>
+
+@thread: 
+
 <!-- ##### ENUM GstSrcFlags ##### -->
 <para>
 Flags for the GstSrc element
@@ -1249,19 +1249,19 @@ Defines an entry for a padfactory.
 
 @obj: 
 
-<!-- ##### FUNCTION gst_asyncdisksrc_get_type ##### -->
+<!-- ##### MACRO GST_AUDIOSINK_CLASS ##### -->
 <para>
 
 </para>
 
-@Returns: 
+@klass: 
 
-<!-- ##### MACRO GST_AUDIOSINK_CLASS ##### -->
+<!-- ##### FUNCTION gst_asyncdisksrc_get_type ##### -->
 <para>
 
 </para>
 
-@klass: 
+@Returns: 
 
 <!-- ##### MACRO GST_PAD_FACTORY_SINK ##### -->
 <para>
@@ -1298,19 +1298,19 @@ Indicates a sinkpad for the padfactory.
 @pad: 
 @Returns: 
 
-<!-- ##### MACRO GST_PROPS_FOURCC_ID ##### -->
+<!-- ##### FUNCTION gst_esdsink_new ##### -->
 <para>
 
 </para>
 
+@name: 
+@Returns: 
 
-<!-- ##### FUNCTION gst_esdsink_new ##### -->
+<!-- ##### MACRO GST_PROPS_FOURCC_ID ##### -->
 <para>
 
 </para>
 
-@name: 
-@Returns: 
 
 <!-- ##### FUNCTION gst_element_request_pad ##### -->
 <para>
@@ -1421,12 +1421,12 @@ This macro sets the given flags.
 @flag: Flag to set, can by any number of bits in guint32.
 @obj: GstSrc to set flag in.
 
-<!-- ##### MACRO GST_PROPS_FLOAT_STRING ##### -->
+<!-- ##### MACRO GST_BUFFER_TYPE ##### -->
 <para>
-
+Retrieves the type id of the data in the buffer.
 </para>
 
-@a: 
+@buf: GstBuffer
 
 <!-- ##### MACRO DEBUG_LEAVE_STRING ##### -->
 <para>
@@ -1434,6 +1434,13 @@ This macro sets the given flags.
 </para>
 
 
+<!-- ##### MACRO GST_PROPS_FLOAT_STRING ##### -->
+<para>
+
+</para>
+
+@a: 
+
 <!-- ##### FUNCTION gst_filter_get_type ##### -->
 <para>
 
@@ -1455,16 +1462,16 @@ This macro sets the given flags.
 </para>
 
 
-<!-- ##### SECTION ./tmpl/gstsink.sgml:Title ##### -->
-GstSink
-
-
 <!-- ##### MACRO GST_CPU_FLAG_MMX ##### -->
 <para>
 A flag indicating that MMX instructions are supported.
 </para>
 
 
+<!-- ##### SECTION ./tmpl/gstsink.sgml:Title ##### -->
+GstSink
+
+
 <!-- ##### FUNCTION gst_object_get_type ##### -->
 <para>
 
@@ -1508,6 +1515,12 @@ Indicates a srcpad for the padfactory.
 </para>
 
 
+<!-- ##### ARG GstDiskSink:closed ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### MACRO GST_IS_SINK_CLASS ##### -->
 <para>
 
@@ -1771,19 +1784,19 @@ or a video card.
 </para>
 
 
-<!-- ##### MACRO GST_IS_BIN_CLASS ##### -->
+<!-- ##### FUNCTION gst_esdsink_get_type ##### -->
 <para>
 
 </para>
 
-@obj
+@Returns
 
-<!-- ##### FUNCTION gst_esdsink_get_type ##### -->
+<!-- ##### MACRO GST_IS_BIN_CLASS ##### -->
 <para>
 
 </para>
 
-@Returns
+@obj
 
 <!-- ##### SECTION ./tmpl/GstElement.sgml:See_Also ##### -->
 <para>
@@ -1805,19 +1818,19 @@ Query whether this object has multiple input pads.
 
 @obj: Element to query for multiple input pads.
 
-<!-- ##### SECTION ./tmpl/gstfilter.sgml:See_Also ##### -->
+<!-- ##### MACRO DEBUG_NOPREFIX ##### -->
 <para>
 
 </para>
 
+@format: 
+@args...: 
 
-<!-- ##### MACRO DEBUG_NOPREFIX ##### -->
+<!-- ##### SECTION ./tmpl/gstfilter.sgml:See_Also ##### -->
 <para>
 
 </para>
 
-@format: 
-@args...: 
 
 <!-- ##### ARG GstAudioSink:frequency ##### -->
 <para>
@@ -2236,13 +2249,6 @@ this in the factory definition.
 
 @audiosink: 
 
-<!-- ##### MACRO GST_IS_FAKESINK ##### -->
-<para>
-
-</para>
-
-@obj: 
-
 <!-- ##### MACRO GST_STATE_UNSET ##### -->
 <para>
 This macro unsets the given state on the element.
@@ -2251,6 +2257,13 @@ This macro unsets the given state on the element.
 @obj: Element to unset state of.
 @flag: State to unset, can be any number of bits in guint32.
 
+<!-- ##### MACRO GST_IS_FAKESINK ##### -->
+<para>
+
+</para>
+
+@obj: 
+
 <!-- ##### MACRO GST_QUEUE_CLASS ##### -->
 <para>
 
@@ -2323,22 +2336,22 @@ The number of bytes per read.
 
 @obj: 
 
-<!-- ##### MACRO ERROR_OBJECT ##### -->
+<!-- ##### FUNCTION gst_sinesrc_get_type ##### -->
 <para>
 
 </para>
 
-@element: 
-@object: 
-@format: 
-@args...: 
+@Returns: 
 
-<!-- ##### FUNCTION gst_sinesrc_get_type ##### -->
+<!-- ##### MACRO ERROR_OBJECT ##### -->
 <para>
 
 </para>
 
-@Returns: 
+@element: 
+@object: 
+@format: 
+@args...: 
 
 <!-- ##### MACRO GST_IS_IDENTITY ##### -->
 <para>
@@ -2444,9 +2457,14 @@ This macro sets the given state on the element.
 
 @obj: 
 
-<!-- ##### SECTION ./tmpl/videoraw.sgml:Short_Description ##### -->
-Information about video buffers.
+<!-- ##### FUNCTION gst_src_push_region ##### -->
+<para>
 
+</para>
+
+@src: 
+@offset: 
+@size: 
 
 <!-- ##### FUNCTION gst_fdsink_get_type ##### -->
 <para>
@@ -2455,14 +2473,9 @@ Information about video buffers.
 
 @Returns: 
 
-<!-- ##### FUNCTION gst_src_push_region ##### -->
-<para>
-
-</para>
+<!-- ##### SECTION ./tmpl/videoraw.sgml:Short_Description ##### -->
+Information about video buffers.
 
-@src: 
-@offset: 
-@size: 
 
 <!-- ##### STRUCT GstPipelineClass ##### -->
 <para>
@@ -2541,6 +2554,12 @@ This macro checks to see if the GST_SRC_ASYNC flag is set.
 </para>
 
 
+<!-- ##### STRUCT GstPluginElement ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### TYPEDEF GstCapsFactory ##### -->
 <para>
 
@@ -2566,13 +2585,13 @@ A flag indicating that SSE instructions are supported.
 
 @obj: 
 
-<!-- ##### ARG GstAsyncDiskSrc:size ##### -->
+<!-- ##### STRUCT GstDiskSrcClass ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### STRUCT GstDiskSrcClass ##### -->
+<!-- ##### ARG GstAsyncDiskSrc:size ##### -->
 <para>
 
 </para>
@@ -2653,19 +2672,19 @@ Information about audio buffers.
 </para>
 
 
-<!-- ##### FUNCTION plugin_initialize ##### -->
+<!-- ##### FUNCTION gst_caps_register ##### -->
 <para>
 
 </para>
 
+@factory: 
+@Returns: 
 
-<!-- ##### FUNCTION gst_caps_register ##### -->
+<!-- ##### FUNCTION plugin_initialize ##### -->
 <para>
 
 </para>
 
-@factory: 
-@Returns: 
 
 <!-- ##### ARG GstAsyncDiskSrc:location ##### -->
 <para>
@@ -2730,20 +2749,20 @@ the offset.
 </para>
 
 
-<!-- ##### FUNCTION gst_sinesrc_new ##### -->
+<!-- ##### MACRO GST_IS_ASYNCDISKSRC_CLASS ##### -->
 <para>
 
 </para>
 
-@name: 
-@Returns: 
+@obj: 
 
-<!-- ##### MACRO GST_IS_ASYNCDISKSRC_CLASS ##### -->
+<!-- ##### FUNCTION gst_sinesrc_new ##### -->
 <para>
 
 </para>
 
-@obj: 
+@name: 
+@Returns: 
 
 <!-- ##### ARG GstAudioSrc:curoffset ##### -->
 <para>
@@ -2793,19 +2812,19 @@ plugin
 
 @klass: 
 
-<!-- ##### MACRO GST_HTTPSRC_CLASS ##### -->
+<!-- ##### MACRO GST_ASYNCDISKSRC ##### -->
 <para>
 
 </para>
 
-@klass
+@obj
 
-<!-- ##### MACRO GST_ASYNCDISKSRC ##### -->
+<!-- ##### MACRO GST_HTTPSRC_CLASS ##### -->
 <para>
 
 </para>
 
-@obj
+@klass
 
 <!-- ##### ARG GstPad:active ##### -->
 <para>
index 765237b..953e676 100644 (file)
@@ -41,7 +41,7 @@ sgml/$(DOC_MODULE)-doc.bottom: tmpl/$(DOC_MODULE)-unused.sgml
 all-local: html
 
 clean-local:
-       $(RM) -rf *~ *.bak *.signals *-unused.txt *.args tmpl html sgml tmpl/*.bak $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt 
+       $(RM) -rf *~ *.bak *.signals *-unused.txt *.args html sgml tmpl/*.bak $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt 
 
 install-data-local: html
        @$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)
index b1587a8..0861149 100644 (file)
@@ -45,11 +45,6 @@ enum {
 enum {
   ARG_0,
   ARG_LOCATION,
-  ARG_CLOSED/*,
-  ARG_SILENT,
-  ARG_BYTESPERWRITE,
-  ARG_NUM_SOURCES,
-  */
 };
 
 
@@ -59,8 +54,13 @@ static void  gst_disksink_init       (GstDiskSink *disksink);
 static void    gst_disksink_set_arg    (GtkObject *object, GtkArg *arg, guint id);
 static void    gst_disksink_get_arg    (GtkObject *object, GtkArg *arg, guint id);
 
+static gboolean gst_disksink_open_file         (GstDiskSink *sink);
+static void    gst_disksink_close_file (GstDiskSink *sink);
+
 static void    gst_disksink_chain      (GstPad *pad,GstBuffer *buf);
 
+static GstElementStateReturn gst_disksink_change_state (GstElement *element);
+
 static GstElementClass *parent_class = NULL;
 static guint gst_disksink_signals[LAST_SIGNAL] = { 0 };
 
@@ -78,7 +78,7 @@ gst_disksink_get_type (void)
       (GtkObjectInitFunc)gst_disksink_init,
       (GtkArgSetFunc)gst_disksink_set_arg,
       (GtkArgGetFunc)gst_disksink_get_arg,
-      (GtkClassInitFunc)NULL,          /* QUESTION : why null ? otherwise coredump */
+      (GtkClassInitFunc)NULL,  /* deprecated, do not use ! */
     };
     disksink_type = gtk_type_unique (GST_TYPE_ELEMENT, &disksink_info);
   }
@@ -89,21 +89,15 @@ static void
 gst_disksink_class_init (GstDiskSinkClass *klass) 
 {
   GtkObjectClass *gtkobject_class;
+  GstElementClass *gstelement_class;
 
   gtkobject_class = (GtkObjectClass*)klass;
+  gstelement_class = (GstElementClass*)klass;
 
   parent_class = gtk_type_class (GST_TYPE_ELEMENT);
 
-
   gtk_object_add_arg_type ("GstDiskSink::location", GST_TYPE_FILENAME,
                            GTK_ARG_READWRITE, ARG_LOCATION);
-/*
-  gtk_object_add_arg_type ("GstDiskSink::silent", GTK_TYPE_BOOL,
-                           GTK_ARG_READWRITE, ARG_SILENT);
-*/
-  gtk_object_add_arg_type ("GstDiskSink::closed", GTK_TYPE_BOOL,
-                           GTK_ARG_READWRITE, ARG_CLOSED);
-
 
   gst_disksink_signals[SIGNAL_HANDOFF] =
     gtk_signal_new ("handoff", GTK_RUN_LAST, gtkobject_class->type,
@@ -113,9 +107,10 @@ gst_disksink_class_init (GstDiskSinkClass *klass)
   gtk_object_class_add_signals (gtkobject_class, gst_disksink_signals,
                                     LAST_SIGNAL);
 
-
   gtkobject_class->set_arg = gst_disksink_set_arg;
   gtkobject_class->get_arg = gst_disksink_get_arg;
+
+  gstelement_class->change_state = gst_disksink_change_state;
 }
 
 static void 
@@ -125,11 +120,9 @@ gst_disksink_init (GstDiskSink *disksink)
   pad = gst_pad_new ("sink", GST_PAD_SINK);
   gst_element_add_pad (GST_ELEMENT (disksink), pad);
   gst_pad_set_chain_function (pad, gst_disksink_chain);
-  disksink->opened = FALSE;
+
   disksink->filename = NULL;
   disksink->file = NULL;
-  
-//  disksink->silent = FALSE;  ? what's this ? it's for output !
 }
 
 static void
@@ -142,38 +135,10 @@ gst_disksink_set_arg (GtkObject *object, GtkArg *arg, guint id)
 
   switch(id) {
     case ARG_LOCATION:
-     /* the element must be stopped in order to do this */
-      g_return_if_fail (GST_STATE (sink) < GST_STATE_PLAYING);  
-
-      if (sink->filename) g_free (sink->filename);
-      
+      if (sink->filename)
+       g_free (sink->filename);
       sink->filename = g_strdup (GTK_VALUE_STRING (*arg));
-      sink->file = fopen (GTK_VALUE_STRING (*arg), "w");
-      if (sink->file == NULL)
-      {
-        g_error ("Cannot open %s for writing !\n", GTK_VALUE_STRING (*arg));
-               //exit (-2);
-      }
-      else sink->opened = TRUE;
-      gst_element_set_state(GST_ELEMENT(sink),GST_STATE_READY);
       break;
-      /*
-    case ARG_SILENT:
-      sink->silent = GTK_VALUE_BOOL (*arg);
-      break;
-      */
-    case ARG_CLOSED:
-      if (GTK_VALUE_BOOL (*arg) == TRUE)
-      {
-        /* close the file descriptor */
-        sink->opened = FALSE;
-        if (! (fclose (sink->file)))
-        {
-          g_warning ("Cannot close file !\n");
-        }
-      }
-      break;
-      
     default:
       break;
   }
@@ -190,14 +155,6 @@ gst_disksink_get_arg (GtkObject *object, GtkArg *arg, guint id)
   sink = GST_DISKSINK (object);
   
   switch (id) {
-  /*
-    case ARG_SILENT:
-      GTK_VALUE_BOOL (*arg) = sink->silent;
-      break;
-      */
-    case ARG_CLOSED:
-      GTK_VALUE_BOOL (*arg) = !sink->opened;
-      break;
     case ARG_LOCATION:
       GTK_VALUE_STRING (*arg) = sink->filename;
       break;
@@ -207,6 +164,39 @@ gst_disksink_get_arg (GtkObject *object, GtkArg *arg, guint id)
   }
 }
 
+static gboolean
+gst_disksink_open_file (GstDiskSink *sink)
+{
+  g_return_val_if_fail (!GST_FLAG_IS_SET (sink, GST_DISKSINK_OPEN), FALSE);
+
+  /* open the file */
+  sink->file = fopen (sink->filename, "w");
+  if (sink->file == NULL) {
+    perror ("open");
+    gst_element_error (GST_ELEMENT (sink), g_strconcat("opening file \"", sink->filename, "\"", NULL));
+    return FALSE;
+  } 
+
+  GST_FLAG_SET (sink, GST_DISKSINK_OPEN);
+
+  return TRUE;
+}
+
+static void
+gst_disksink_close_file (GstDiskSink *sink)
+{
+  g_return_if_fail (GST_FLAG_IS_SET (sink, GST_DISKSINK_OPEN));
+
+  if (fclose (sink->file) != 0)
+  {
+    perror ("close");
+    gst_element_error (GST_ELEMENT (sink), g_strconcat("closing file \"", sink->filename, "\"", NULL));
+  }
+  else {
+    GST_FLAG_UNSET (sink, GST_DISKSINK_OPEN);
+  }
+}
+
 /**
  * gst_disksink_chain:
  * @pad: the pad this disksink is connected to
@@ -225,11 +215,8 @@ gst_disksink_chain (GstPad *pad, GstBuffer *buf)
   g_return_if_fail (buf != NULL);
 
   disksink = GST_DISKSINK (gst_pad_get_parent (pad));
-/*
-  if (!disksink->silent)
-    g_print("disksink: ******* (%s:%s)< \n",GST_DEBUG_PAD_NAME(pad));
-*/
-  if (disksink->opened)
+
+  if (GST_FLAG_IS_SET (disksink, GST_DISKSINK_OPEN))
   {
     bytes_written = fwrite (GST_BUFFER_DATA (buf), 1, GST_BUFFER_SIZE (buf), disksink->file);
     if (bytes_written < GST_BUFFER_SIZE (buf))
@@ -243,3 +230,25 @@ gst_disksink_chain (GstPad *pad, GstBuffer *buf)
   gtk_signal_emit (GTK_OBJECT (disksink), gst_disksink_signals[SIGNAL_HANDOFF],
                              disksink);
 }
+
+static GstElementStateReturn
+gst_disksink_change_state (GstElement *element)
+{
+  g_return_val_if_fail (GST_IS_DISKSINK (element), GST_STATE_FAILURE);
+
+  if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
+    if (GST_FLAG_IS_SET (element, GST_DISKSINK_OPEN))
+      gst_disksink_close_file (GST_DISKSINK (element));
+  } else {
+    if (!GST_FLAG_IS_SET (element, GST_DISKSINK_OPEN)) {
+      if (!gst_disksink_open_file (GST_DISKSINK (element)))
+        return GST_STATE_FAILURE;
+    }
+  }
+
+  if (GST_ELEMENT_CLASS (parent_class)->change_state)
+    return GST_ELEMENT_CLASS (parent_class)->change_state (element);
+
+  return GST_STATE_SUCCESS;
+}
+
index 07229c3..15f3d32 100644 (file)
@@ -51,14 +51,17 @@ GstElementDetails gst_disksink_details;
 typedef struct _GstDiskSink GstDiskSink;
 typedef struct _GstDiskSinkClass GstDiskSinkClass;
 
+typedef enum {
+  GST_DISKSINK_OPEN             = GST_ELEMENT_FLAG_LAST,
+
+  GST_DISKSINK_FLAG_LAST       = GST_ELEMENT_FLAG_LAST + 2,
+} GstDiskSinkFlags;
+
 struct _GstDiskSink {
   GstElement element;
 
   gchar *filename;
   FILE *file;
-  
-  gboolean opened;
-  gboolean silent;
 };
 
 struct _GstDiskSinkClass {
index 9e81eb9..72d454d 100644 (file)
@@ -312,8 +312,8 @@ gst_disksrc_get_region (GstPad *pad, GstRegionType type,guint64 offset,guint64 l
 
 
 /* open the file and mmap it, necessary to go to READY state */
-static
-gboolean gst_disksrc_open_file (GstDiskSrc *src)
+static gboolean 
+gst_disksrc_open_file (GstDiskSrc *src)
 {
   g_return_val_if_fail (!GST_FLAG_IS_SET (src ,GST_DISKSRC_OPEN), FALSE);
 
index 2665a8d..0f47c73 100644 (file)
@@ -61,7 +61,7 @@ gst_caps_new (                                  \
   name,                                         \
   type,                                         \
   gst_props_new (                               \
-    a,                                        \
+    a,                                          \
     NULL))
 
 #define GST_CAPS_FACTORY(factoryname, a...)    \
index 0f8f674..181d50c 100644 (file)
@@ -260,7 +260,7 @@ struct _GstPadTemplateClass {
     padname,                                    \
     dir,                                        \
     pres,                                       \
-    ##a,                                               \
+    a ,                                                \
     NULL)
 
 #define GST_PADTEMPLATE_FACTORY(name, padname, dir, pres, a...)         \
@@ -273,7 +273,7 @@ name (void)                                     \
       padname,                                 \
       dir,                                      \
       pres,                                     \
-      ##a);                                     \
+      );                                     \
   }                                             \
   return templ;                                \
 }
index 2ade4a5..3e4f664 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <stdio.h>
+#include <string.h>
 
 #include "gstextratypes.h"
 
@@ -254,7 +255,7 @@ gst_util_set_object_arg (GtkObject *object, guchar *name, gchar *value)
        }
         case GTK_TYPE_BOOL: {
          gboolean i = FALSE;
-         if (!strcmp ("true", value)) i = TRUE;
+         if (!strncmp ("true", value, 4)) i = TRUE;
           gtk_object_set (GTK_OBJECT (object), name, i, NULL);
          break;
        }
index b1587a8..0861149 100644 (file)
@@ -45,11 +45,6 @@ enum {
 enum {
   ARG_0,
   ARG_LOCATION,
-  ARG_CLOSED/*,
-  ARG_SILENT,
-  ARG_BYTESPERWRITE,
-  ARG_NUM_SOURCES,
-  */
 };
 
 
@@ -59,8 +54,13 @@ static void  gst_disksink_init       (GstDiskSink *disksink);
 static void    gst_disksink_set_arg    (GtkObject *object, GtkArg *arg, guint id);
 static void    gst_disksink_get_arg    (GtkObject *object, GtkArg *arg, guint id);
 
+static gboolean gst_disksink_open_file         (GstDiskSink *sink);
+static void    gst_disksink_close_file (GstDiskSink *sink);
+
 static void    gst_disksink_chain      (GstPad *pad,GstBuffer *buf);
 
+static GstElementStateReturn gst_disksink_change_state (GstElement *element);
+
 static GstElementClass *parent_class = NULL;
 static guint gst_disksink_signals[LAST_SIGNAL] = { 0 };
 
@@ -78,7 +78,7 @@ gst_disksink_get_type (void)
       (GtkObjectInitFunc)gst_disksink_init,
       (GtkArgSetFunc)gst_disksink_set_arg,
       (GtkArgGetFunc)gst_disksink_get_arg,
-      (GtkClassInitFunc)NULL,          /* QUESTION : why null ? otherwise coredump */
+      (GtkClassInitFunc)NULL,  /* deprecated, do not use ! */
     };
     disksink_type = gtk_type_unique (GST_TYPE_ELEMENT, &disksink_info);
   }
@@ -89,21 +89,15 @@ static void
 gst_disksink_class_init (GstDiskSinkClass *klass) 
 {
   GtkObjectClass *gtkobject_class;
+  GstElementClass *gstelement_class;
 
   gtkobject_class = (GtkObjectClass*)klass;
+  gstelement_class = (GstElementClass*)klass;
 
   parent_class = gtk_type_class (GST_TYPE_ELEMENT);
 
-
   gtk_object_add_arg_type ("GstDiskSink::location", GST_TYPE_FILENAME,
                            GTK_ARG_READWRITE, ARG_LOCATION);
-/*
-  gtk_object_add_arg_type ("GstDiskSink::silent", GTK_TYPE_BOOL,
-                           GTK_ARG_READWRITE, ARG_SILENT);
-*/
-  gtk_object_add_arg_type ("GstDiskSink::closed", GTK_TYPE_BOOL,
-                           GTK_ARG_READWRITE, ARG_CLOSED);
-
 
   gst_disksink_signals[SIGNAL_HANDOFF] =
     gtk_signal_new ("handoff", GTK_RUN_LAST, gtkobject_class->type,
@@ -113,9 +107,10 @@ gst_disksink_class_init (GstDiskSinkClass *klass)
   gtk_object_class_add_signals (gtkobject_class, gst_disksink_signals,
                                     LAST_SIGNAL);
 
-
   gtkobject_class->set_arg = gst_disksink_set_arg;
   gtkobject_class->get_arg = gst_disksink_get_arg;
+
+  gstelement_class->change_state = gst_disksink_change_state;
 }
 
 static void 
@@ -125,11 +120,9 @@ gst_disksink_init (GstDiskSink *disksink)
   pad = gst_pad_new ("sink", GST_PAD_SINK);
   gst_element_add_pad (GST_ELEMENT (disksink), pad);
   gst_pad_set_chain_function (pad, gst_disksink_chain);
-  disksink->opened = FALSE;
+
   disksink->filename = NULL;
   disksink->file = NULL;
-  
-//  disksink->silent = FALSE;  ? what's this ? it's for output !
 }
 
 static void
@@ -142,38 +135,10 @@ gst_disksink_set_arg (GtkObject *object, GtkArg *arg, guint id)
 
   switch(id) {
     case ARG_LOCATION:
-     /* the element must be stopped in order to do this */
-      g_return_if_fail (GST_STATE (sink) < GST_STATE_PLAYING);  
-
-      if (sink->filename) g_free (sink->filename);
-      
+      if (sink->filename)
+       g_free (sink->filename);
       sink->filename = g_strdup (GTK_VALUE_STRING (*arg));
-      sink->file = fopen (GTK_VALUE_STRING (*arg), "w");
-      if (sink->file == NULL)
-      {
-        g_error ("Cannot open %s for writing !\n", GTK_VALUE_STRING (*arg));
-               //exit (-2);
-      }
-      else sink->opened = TRUE;
-      gst_element_set_state(GST_ELEMENT(sink),GST_STATE_READY);
       break;
-      /*
-    case ARG_SILENT:
-      sink->silent = GTK_VALUE_BOOL (*arg);
-      break;
-      */
-    case ARG_CLOSED:
-      if (GTK_VALUE_BOOL (*arg) == TRUE)
-      {
-        /* close the file descriptor */
-        sink->opened = FALSE;
-        if (! (fclose (sink->file)))
-        {
-          g_warning ("Cannot close file !\n");
-        }
-      }
-      break;
-      
     default:
       break;
   }
@@ -190,14 +155,6 @@ gst_disksink_get_arg (GtkObject *object, GtkArg *arg, guint id)
   sink = GST_DISKSINK (object);
   
   switch (id) {
-  /*
-    case ARG_SILENT:
-      GTK_VALUE_BOOL (*arg) = sink->silent;
-      break;
-      */
-    case ARG_CLOSED:
-      GTK_VALUE_BOOL (*arg) = !sink->opened;
-      break;
     case ARG_LOCATION:
       GTK_VALUE_STRING (*arg) = sink->filename;
       break;
@@ -207,6 +164,39 @@ gst_disksink_get_arg (GtkObject *object, GtkArg *arg, guint id)
   }
 }
 
+static gboolean
+gst_disksink_open_file (GstDiskSink *sink)
+{
+  g_return_val_if_fail (!GST_FLAG_IS_SET (sink, GST_DISKSINK_OPEN), FALSE);
+
+  /* open the file */
+  sink->file = fopen (sink->filename, "w");
+  if (sink->file == NULL) {
+    perror ("open");
+    gst_element_error (GST_ELEMENT (sink), g_strconcat("opening file \"", sink->filename, "\"", NULL));
+    return FALSE;
+  } 
+
+  GST_FLAG_SET (sink, GST_DISKSINK_OPEN);
+
+  return TRUE;
+}
+
+static void
+gst_disksink_close_file (GstDiskSink *sink)
+{
+  g_return_if_fail (GST_FLAG_IS_SET (sink, GST_DISKSINK_OPEN));
+
+  if (fclose (sink->file) != 0)
+  {
+    perror ("close");
+    gst_element_error (GST_ELEMENT (sink), g_strconcat("closing file \"", sink->filename, "\"", NULL));
+  }
+  else {
+    GST_FLAG_UNSET (sink, GST_DISKSINK_OPEN);
+  }
+}
+
 /**
  * gst_disksink_chain:
  * @pad: the pad this disksink is connected to
@@ -225,11 +215,8 @@ gst_disksink_chain (GstPad *pad, GstBuffer *buf)
   g_return_if_fail (buf != NULL);
 
   disksink = GST_DISKSINK (gst_pad_get_parent (pad));
-/*
-  if (!disksink->silent)
-    g_print("disksink: ******* (%s:%s)< \n",GST_DEBUG_PAD_NAME(pad));
-*/
-  if (disksink->opened)
+
+  if (GST_FLAG_IS_SET (disksink, GST_DISKSINK_OPEN))
   {
     bytes_written = fwrite (GST_BUFFER_DATA (buf), 1, GST_BUFFER_SIZE (buf), disksink->file);
     if (bytes_written < GST_BUFFER_SIZE (buf))
@@ -243,3 +230,25 @@ gst_disksink_chain (GstPad *pad, GstBuffer *buf)
   gtk_signal_emit (GTK_OBJECT (disksink), gst_disksink_signals[SIGNAL_HANDOFF],
                              disksink);
 }
+
+static GstElementStateReturn
+gst_disksink_change_state (GstElement *element)
+{
+  g_return_val_if_fail (GST_IS_DISKSINK (element), GST_STATE_FAILURE);
+
+  if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
+    if (GST_FLAG_IS_SET (element, GST_DISKSINK_OPEN))
+      gst_disksink_close_file (GST_DISKSINK (element));
+  } else {
+    if (!GST_FLAG_IS_SET (element, GST_DISKSINK_OPEN)) {
+      if (!gst_disksink_open_file (GST_DISKSINK (element)))
+        return GST_STATE_FAILURE;
+    }
+  }
+
+  if (GST_ELEMENT_CLASS (parent_class)->change_state)
+    return GST_ELEMENT_CLASS (parent_class)->change_state (element);
+
+  return GST_STATE_SUCCESS;
+}
+
index 07229c3..15f3d32 100644 (file)
@@ -51,14 +51,17 @@ GstElementDetails gst_disksink_details;
 typedef struct _GstDiskSink GstDiskSink;
 typedef struct _GstDiskSinkClass GstDiskSinkClass;
 
+typedef enum {
+  GST_DISKSINK_OPEN             = GST_ELEMENT_FLAG_LAST,
+
+  GST_DISKSINK_FLAG_LAST       = GST_ELEMENT_FLAG_LAST + 2,
+} GstDiskSinkFlags;
+
 struct _GstDiskSink {
   GstElement element;
 
   gchar *filename;
   FILE *file;
-  
-  gboolean opened;
-  gboolean silent;
 };
 
 struct _GstDiskSinkClass {
index 9e81eb9..72d454d 100644 (file)
@@ -312,8 +312,8 @@ gst_disksrc_get_region (GstPad *pad, GstRegionType type,guint64 offset,guint64 l
 
 
 /* open the file and mmap it, necessary to go to READY state */
-static
-gboolean gst_disksrc_open_file (GstDiskSrc *src)
+static gboolean 
+gst_disksrc_open_file (GstDiskSrc *src)
 {
   g_return_val_if_fail (!GST_FLAG_IS_SET (src ,GST_DISKSRC_OPEN), FALSE);
 
index fe01e4d..1812686 100644 (file)
@@ -4,7 +4,7 @@ noinst_PROGRAMS = qtest spectrum record wave mp3 teardown buffer mp3parse \
                  mpeg2parse mp1parse mp3play ac3parse ac3play dvdcat fake cobin videotest \
                  aviparse vidcapture avi2mpg mp2tomp1 mp1tomp1 pipetest \
                  vidcapture2 mp2toavi mp3tovorbis mpeg2parse2 xmmstest videotest2 \
-                 mp3mad video2mp1 dvshow
+                 mp3mad video2mp1 dvshow dv2mp1
 
 SUBDIRS = xml bindings
 
@@ -20,7 +20,7 @@ else
 xvlibs=
 endif
 
-LDADD = ${xvlibs} -lXxf86vm
+LDADD = ${xvlibs} -lXxf86vm $(GNOME_LIBS) $(GST_LIBS)
 
 #LDADD = $(GLIB_LIBS) $(GTK_LIBS) $(top_builddir)/gst/libgst.la \
 #          $(top_builddir)/plugins/videosink/libvideosink.la -L/usr/X11/lib -lXxf86dga
index 5bdcfec..a95f465 100644 (file)
@@ -30,7 +30,7 @@ GST_CAPS_FACTORY (mpeg2dec_src_caps,
       "width",   GST_PROPS_INT_RANGE (16, 4096),
       "height",          GST_PROPS_INT_RANGE (16, 4096)
   ),
-  GST_CAPS_NEW (
+  GST_CAPS_NEW(
     "mpeg2dec_src_caps",
     "video/raw",
       "foo",   GST_PROPS_BOOLEAN (TRUE)