From: Benjamin O. <co...@pd...> - 2004-06-24 02:19:13
|
CVS Root: /home/cvs/gstreamer Module: gstreamer Changes by: company Date: Wed Jun 23 2004 19:19:11 PDT Log message: * libs/gst/bytestream/filepad.c: (gst_file_pad_available), (gst_file_pad_get_length): * libs/gst/bytestream/filepad.h: add 2 new functions Modified files: . : ChangeLog libs/gst/bytestream: filepad.c filepad.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.607&r2=1.608 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/bytestream/filepad.c.diff?r1=1.1&r2=1.2 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/bytestream/filepad.h.diff?r1=1.1&r2=1.2 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /home/cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.607 retrieving revision 1.608 diff -u -d -r1.607 -r1.608 --- ChangeLog 22 Jun 2004 06:44:18 -0000 1.607 +++ ChangeLog 24 Jun 2004 02:18:59 -0000 1.608 @@ -1,3 +1,10 @@ +2004-06-24 Benjamin Otte <in...@pu...> + + * libs/gst/bytestream/filepad.c: (gst_file_pad_available), + (gst_file_pad_get_length): + * libs/gst/bytestream/filepad.h: + add 2 new functions 2004-06-22 Zaheer Abbas Merali <zaheerabbas at merali.org> * docs/gst/gstreamer-sections.txt: Index: filepad.c RCS file: /home/cvs/gstreamer/gstreamer/libs/gst/bytestream/filepad.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- filepad.c 20 Jun 2004 17:05:39 -0000 1.1 +++ filepad.c 24 Jun 2004 02:18:59 -0000 1.2 @@ -412,7 +412,7 @@ /** * gst_file_pad_eof: - * @pad: ia #GstFilePad + * @pad: a #GstFilePad * * Checks if the EOS has been reached. This function is modeled after the * function feof() from libc. @@ -433,3 +433,50 @@ return 1; } +/** + * gst_file_pad_available: + * + * Use this function to figure out the maximum number of bytes that can be read + * via gst_file_pad_read() without that function returning -EAGAIN. + * + * Returns: the number of bytes available in the file pad. + */ +guint +gst_file_pad_available (GstFilePad * pad) +{ + g_return_val_if_fail (GST_IS_FILE_PAD (pad), 0); + return gst_adapter_available (pad->adapter); +} + * gst_file_pad_get_length: + * Gets the length in bytes of the @pad. + * Returns: length in bytes or -1 if not available +gint64 +gst_file_pad_get_length (GstFilePad * pad) + GstFormat format = GST_FORMAT_BYTES; + gint64 length; + GstPad *peer; + g_return_val_if_fail (GST_IS_FILE_PAD (pad), -1); + /* we query the length every time to avoid issues with changing lengths */ + peer = GST_PAD_PEER (pad); + if (!peer) + return -1; + if (gst_pad_query (peer, GST_QUERY_TOTAL, &format, &length)) + return length; + format = GST_FORMAT_DEFAULT; + return -1; Index: filepad.h RCS file: /home/cvs/gstreamer/gstreamer/libs/gst/bytestream/filepad.h,v --- filepad.h 20 Jun 2004 17:05:39 -0000 1.1 +++ filepad.h 24 Jun 2004 02:18:59 -0000 1.2 @@ -74,6 +74,8 @@ void gst_file_pad_set_iterate_function (GstFilePad *file_pad, GstFilePadIterateFunction iterate); +guint gst_file_pad_available (GstFilePad *pad); +gint64 gst_file_pad_get_length (GstFilePad *pad); /* this is a file like interface */ /* FIXME: is gint64 the correct type? (it must be signed to get error return vals */ gint64 gst_file_pad_read (GstFilePad *pad, |