From 429bc4ad4c9bf03f193848d59317382e99bf1b48 Mon Sep 17 00:00:00 2001 From: Gregory Maxwell Date: Mon, 1 Aug 2011 17:55:20 +0000 Subject: 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 --- doc/libogg/ogg_stream_flush_fill.html | 69 +++++++++++++++++++++++++++++++++++ include/ogg/ogg.h | 1 + src/framing.c | 8 ++++ 3 files changed, 78 insertions(+) create mode 100644 doc/libogg/ogg_stream_flush_fill.html 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 @@ + + + +libogg - function - ogg_stream_flush_fill + + + + + + + + + +

libogg documentation

libogg release 1.2.1 - 20101029

+ +

ogg_stream_flush_fill

+ +

declared in "ogg/ogg.h";

+ +

This function checks for remaining packets inside the stream and forces remaining packets into a page, regardless of the size of the page. +

This should only be used when you want to flush an undersized page from the middle of the stream. Otherwise, ogg_stream_pageout or ogg_stream_pageout_fillshould always be used. +

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

+ + + + +
+

+int ogg_stream_flush_fill(ogg_stream_state *os, ogg_page *og, int fillbytes);
+
+
+ +

Parameters

+
+
os
+
Pointer to a previously declared ogg_stream_state struct, which represents the current logical bitstream.
+
og
+
Pointer to a page of data. The remaining packets in the stream will be placed into this page, if any remain. +
fillbytes
+
Packet data watermark in bytes.
+
+ + +

Return Values

+
+
  • 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 ogg_stream_state that has been cleared explicitly or implicitly due to an internal error.
  • +
  • +Nonzero means that remaining packets have successfully been flushed into the page.
  • +
    +

    + +

    +


    + + + + + + + + +

    copyright © 2000-2010 Xiph.Org

    Ogg Container Format

    libogg documentation

    libogg release 1.2.1 - 20101029

    + + + + + 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) */ -- cgit v1.2.1