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.

svn path=/trunk/ogg/; revision=18044
This commit is contained in:
Gregory Maxwell 2011-08-01 17:55:20 +00:00
parent 0664bdc1dd
commit 237a3081dc
3 changed files with 78 additions and 0 deletions

View File

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

View File

@ -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 **************************/

View File

@ -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) */