summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2011-08-01 17:55:20 +0000
committerGregory Maxwell <greg@xiph.org>2011-08-01 17:55:20 +0000
commit429bc4ad4c9bf03f193848d59317382e99bf1b48 (patch)
tree5fbf9e81152302bef7c7427bbcb17262ade0c758
parentdac0c310c6a0849f601dbea941e8b39a12aea173 (diff)
downloadogg-429bc4ad4c9bf03f193848d59317382e99bf1b48.tar.gz
Add ogg_stream_flush_fill to compliment ogg_stream_pageout_fill because ogg_stream_flush will produce multiple pages when >4096 bytes and >4 packets are available.
git-svn-id: http://svn.xiph.org/trunk/ogg@18044 0101bb08-14d6-0310-b084-bc0e0c8e3800
-rw-r--r--doc/libogg/ogg_stream_flush_fill.html69
-rw-r--r--include/ogg/ogg.h1
-rw-r--r--src/framing.c8
3 files changed, 78 insertions, 0 deletions
diff --git a/doc/libogg/ogg_stream_flush_fill.html b/doc/libogg/ogg_stream_flush_fill.html
new file mode 100644
index 0000000..8fbc8d2
--- /dev/null
+++ b/doc/libogg/ogg_stream_flush_fill.html
@@ -0,0 +1,69 @@
+<html>
+
+<head>
+<title>libogg - function - ogg_stream_flush_fill</title>
+<link rel=stylesheet href="style.css" type="text/css">
+</head>
+
+<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
+<table border=0 width=100%>
+<tr>
+<td><p class=tiny>libogg documentation</p></td>
+<td align=right><p class=tiny>libogg release 1.2.1 - 20101029</p></td>
+</tr>
+</table>
+
+<h1>ogg_stream_flush_fill</h1>
+
+<p><i>declared in "ogg/ogg.h";</i></p>
+
+<p>This function checks for remaining packets inside the stream and forces remaining packets into a page, regardless of the size of the page.
+<p>This should only be used when you want to flush an undersized page from the middle of the stream. Otherwise, <a href="ogg_stream_pageout.html">ogg_stream_pageout</a> or <a href="ogg_stream_pageout_fill.html">ogg_stream_pageout_fill</a>should always be used.
+<p>This function can be used to verify that all packets have been flushed. If the return value is 0, all packets have been placed into a page.
+
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+ <td>
+<pre><b>
+int ogg_stream_flush_fill(<a href="ogg_stream_state.html">ogg_stream_state</a> *os, <a href="ogg_page.html">ogg_page</a> *og, int fillbytes);
+</b></pre>
+ </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>os</i></dt>
+<dd>Pointer to a previously declared <a href="ogg_stream_state.html">ogg_stream_state</a> struct, which represents the current logical bitstream.</dd>
+<dt><i>og</i></dt>
+<dd>Pointer to a page of data. The remaining packets in the stream will be placed into this page, if any remain.
+<dt><i>fillbytes</i></dt>
+<dd>Packet data watermark in bytes.</dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li>0 means that all packet data has already been flushed into pages, and there are no packets to put into the page. 0 is also returned in the case of an <a href="ogg_stream_state.html">ogg_stream_state</a> that has been cleared explicitly or implicitly due to an internal error.</li>
+<li>
+Nonzero means that remaining packets have successfully been flushed into the page.</li>
+</blockquote>
+<p>
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000-2010 Xiph.Org</p></td>
+<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
+</tr><tr>
+<td><p class=tiny>libogg documentation</p></td>
+<td align=right><p class=tiny>libogg release 1.2.1 - 20101029</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/include/ogg/ogg.h b/include/ogg/ogg.h
index e4a322f..7609fc2 100644
--- a/include/ogg/ogg.h
+++ b/include/ogg/ogg.h
@@ -161,6 +161,7 @@ extern int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov,
extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og);
extern int ogg_stream_pageout_fill(ogg_stream_state *os, ogg_page *og, int nfill);
extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og);
+extern int ogg_stream_flush_fill(ogg_stream_state *os, ogg_page *og, int nfill);
/* Ogg BITSTREAM PRIMITIVES: decoding **************************/
diff --git a/src/framing.c b/src/framing.c
index 3fffa1b..493f1e8 100644
--- a/src/framing.c
+++ b/src/framing.c
@@ -518,6 +518,14 @@ int ogg_stream_flush(ogg_stream_state *os,ogg_page *og){
return ogg_stream_flush_i(os,og,1,4096);
}
+/* Like the above, but an argument is provided to adjust the nominal
+page size for applications which are smart enough to provide their
+own delay based flushing */
+
+int ogg_stream_flush_fill(ogg_stream_state *os,ogg_page *og, int nfill){
+ return ogg_stream_flush_i(os,og,1,nfill);
+}
+
/* This constructs pages from buffered packet segments. The pointers
returned are to static buffers; do not free. The returned buffers are
good only until the next call (using the same ogg_stream_state) */