API docs updates.

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
This commit is contained in:
Wim Taymans 2001-04-22 16:04:19 +00:00
parent 610e9e8227
commit 892f4b3204
20 changed files with 398 additions and 287 deletions

View 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;

View 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
@ -927,6 +930,20 @@ GST_IS_TYPEFIND
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>

View file

@ -9,6 +9,7 @@ GtkObject
GstFakeSrc
GstFakeSink
GstDiskSrc
GstDiskSink
GstHttpSrc
GstFdSrc
GstSineSrc

View 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>

View file

@ -24,3 +24,8 @@ Pass data without modification.
</para>
<!-- ##### ARG GstIdentity:silent ##### -->
<para>
</para>

View 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:

View 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.

View file

@ -67,14 +67,6 @@ Query the element for the current mime type
</para>
<!-- ##### FUNCTION gst_pad_remove_ghost_parent ##### -->
<para>
</para>
@pad:
@parent:
<!-- ##### FUNCTION gst_fdsink_chain ##### -->
<para>
@ -83,6 +75,14 @@ Query the element for the current mime type
@pad:
@buf:
<!-- ##### FUNCTION gst_pad_remove_ghost_parent ##### -->
<para>
</para>
@pad:
@parent:
<!-- ##### FUNCTION gst_identity_chain ##### -->
<para>
@ -91,6 +91,14 @@ Query the element for the current mime type
@pad:
@buf:
<!-- ##### FUNCTION gst_audiosink_chain ##### -->
<para>
</para>
@pad:
@buf:
<!-- ##### FUNCTION gst_connection_get_type ##### -->
<para>
@ -98,14 +106,6 @@ Query the element for the current mime type
@Returns:
<!-- ##### FUNCTION gst_audiosink_chain ##### -->
<para>
</para>
@pad:
@buf:
<!-- ##### MACRO GST_PIPELINE_CLASS ##### -->
<para>
@ -200,12 +200,6 @@ the stream.
@gstsrc: the object which received the signal.
@arg1: the object which received the signal
<!-- ##### TYPEDEF GstCapsFactoryEntry ##### -->
<para>
</para>
<!-- ##### FUNCTION gst_disksrc_get_type ##### -->
<para>
@ -213,6 +207,12 @@ the stream.
@Returns:
<!-- ##### TYPEDEF GstCapsFactoryEntry ##### -->
<para>
</para>
<!-- ##### 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,24 +695,17 @@ Specify the current offset in the file.
@name:
@Returns:
<!-- ##### STRUCT GstConnection ##### -->
<para>
</para>
<!-- ##### STRUCT GstQueueClass ##### -->
<para>
</para>
<!-- ##### FUNCTION gst_fakesrc_push ##### -->
<!-- ##### STRUCT GstConnection ##### -->
<para>
</para>
@src:
<!-- ##### FUNCTION gst_type_add_sink ##### -->
<para>
@ -722,6 +715,13 @@ Specify the current offset in the file.
@id:
@sink:
<!-- ##### FUNCTION gst_fakesrc_push ##### -->
<para>
</para>
@src:
<!-- ##### MACRO GST_IS_IDENTITY_CLASS ##### -->
<para>
@ -1135,13 +1135,6 @@ GstFilter
@obj:
<!-- ##### MACRO GST_IS_QUEUE_CLASS ##### -->
<para>
</para>
@obj:
<!-- ##### FUNCTION gst_fdsrc_get_type ##### -->
<para>
@ -1149,6 +1142,13 @@ GstFilter
@Returns:
<!-- ##### MACRO GST_IS_QUEUE_CLASS ##### -->
<para>
</para>
@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,13 +1249,6 @@ Defines an entry for a padfactory.
@obj:
<!-- ##### FUNCTION gst_asyncdisksrc_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### MACRO GST_AUDIOSINK_CLASS ##### -->
<para>
@ -1263,6 +1256,13 @@ Defines an entry for a padfactory.
@klass:
<!-- ##### FUNCTION gst_asyncdisksrc_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### MACRO GST_PAD_FACTORY_SINK ##### -->
<para>
Indicates a sinkpad for the padfactory.
@ -1298,12 +1298,6 @@ Indicates a sinkpad for the padfactory.
@pad:
@Returns:
<!-- ##### MACRO GST_PROPS_FOURCC_ID ##### -->
<para>
</para>
<!-- ##### FUNCTION gst_esdsink_new ##### -->
<para>
@ -1312,6 +1306,12 @@ Indicates a sinkpad for the padfactory.
@name:
@Returns:
<!-- ##### MACRO GST_PROPS_FOURCC_ID ##### -->
<para>
</para>
<!-- ##### 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,13 +1784,6 @@ or a video card.
</para>
<!-- ##### MACRO GST_IS_BIN_CLASS ##### -->
<para>
</para>
@obj:
<!-- ##### FUNCTION gst_esdsink_get_type ##### -->
<para>
@ -1785,6 +1791,13 @@ or a video card.
@Returns:
<!-- ##### MACRO GST_IS_BIN_CLASS ##### -->
<para>
</para>
@obj:
<!-- ##### SECTION ./tmpl/GstElement.sgml:See_Also ##### -->
<para>
@ -1805,12 +1818,6 @@ Query whether this object has multiple input pads.
@obj: Element to query for multiple input pads.
<!-- ##### SECTION ./tmpl/gstfilter.sgml:See_Also ##### -->
<para>
</para>
<!-- ##### MACRO DEBUG_NOPREFIX ##### -->
<para>
@ -1819,6 +1826,12 @@ Query whether this object has multiple input pads.
@format:
@args...:
<!-- ##### SECTION ./tmpl/gstfilter.sgml:See_Also ##### -->
<para>
</para>
<!-- ##### 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,6 +2336,13 @@ The number of bytes per read.
@obj:
<!-- ##### FUNCTION gst_sinesrc_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### MACRO ERROR_OBJECT ##### -->
<para>
@ -2333,13 +2353,6 @@ The number of bytes per read.
@format:
@args...:
<!-- ##### FUNCTION gst_sinesrc_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### MACRO GST_IS_IDENTITY ##### -->
<para>
@ -2444,17 +2457,6 @@ This macro sets the given state on the element.
@obj:
<!-- ##### SECTION ./tmpl/videoraw.sgml:Short_Description ##### -->
Information about video buffers.
<!-- ##### FUNCTION gst_fdsink_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION gst_src_push_region ##### -->
<para>
@ -2464,6 +2466,17 @@ Information about video buffers.
@offset:
@size:
<!-- ##### FUNCTION gst_fdsink_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### SECTION ./tmpl/videoraw.sgml:Short_Description ##### -->
Information about video buffers.
<!-- ##### 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,12 +2672,6 @@ Information about audio buffers.
</para>
<!-- ##### FUNCTION plugin_initialize ##### -->
<para>
</para>
<!-- ##### FUNCTION gst_caps_register ##### -->
<para>
@ -2667,6 +2680,12 @@ Information about audio buffers.
@factory:
@Returns:
<!-- ##### FUNCTION plugin_initialize ##### -->
<para>
</para>
<!-- ##### ARG GstAsyncDiskSrc:location ##### -->
<para>
Specify the location of the file to read.
@ -2730,6 +2749,13 @@ the offset.
</para>
<!-- ##### MACRO GST_IS_ASYNCDISKSRC_CLASS ##### -->
<para>
</para>
@obj:
<!-- ##### FUNCTION gst_sinesrc_new ##### -->
<para>
@ -2738,13 +2764,6 @@ the offset.
@name:
@Returns:
<!-- ##### MACRO GST_IS_ASYNCDISKSRC_CLASS ##### -->
<para>
</para>
@obj:
<!-- ##### ARG GstAudioSrc:curoffset ##### -->
<para>
Get the current number of bytes read.
@ -2793,13 +2812,6 @@ plugin
@klass:
<!-- ##### MACRO GST_HTTPSRC_CLASS ##### -->
<para>
</para>
@klass:
<!-- ##### MACRO GST_ASYNCDISKSRC ##### -->
<para>
@ -2807,6 +2819,13 @@ plugin
@obj:
<!-- ##### MACRO GST_HTTPSRC_CLASS ##### -->
<para>
</para>
@klass:
<!-- ##### ARG GstPad:active ##### -->
<para>
Indicates this pad is active

View 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)

View 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;
}

View 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 {

View 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);

View file

@ -61,7 +61,7 @@ gst_caps_new ( \
name, \
type, \
gst_props_new ( \
a, \
a, \
NULL))
#define GST_CAPS_FACTORY(factoryname, a...) \

View 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); \
a ); \
} \
return templ; \
}

View 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;
}

View 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;
}

View 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 {

View 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);

View 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

View 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)