ref: 4179e367709090f98795d456ce7339cbeab2db89
parent: dd41cd4fed85524d9fdf6f2e5be442080f5f0537
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Fri May 5 12:43:13 EDT 2017
more splitting
--- a/src/opusenc.c
+++ b/src/opusenc.c
@@ -121,7 +121,13 @@
enc->callbacks.write(enc->streams->user_data, page, len);
}
}
+static void oe_flush_page(OggOpusEnc *enc) {
+ oggp_flush_page(enc->oggp);
+ output_pages(enc);
+}
+
#else
+
static int oe_write_page(OggOpusEnc *enc, ogg_page *page, void *user_data)
{
int length;
@@ -134,31 +140,21 @@
if (enc->page_callback) enc->page_callback(user_data, length, 0);
return length;
}
-#endif
-static int oe_flush_page(OggOpusEnc *enc) {
+static void oe_flush_page(OggOpusEnc *enc) {
ogg_page og;
int ret;
- int written = 0;
-#ifdef USE_OGGP
- oggp_flush_page(enc->oggp);
- output_pages(enc);
-#endif
-
while ( (ret = ogg_stream_flush_fill(&enc->streams->os, &og, 255*255))) {
- if (!ret) break;
if (ogg_page_packets(&og) != 0) enc->last_page_granule = ogg_page_granulepos(&og) + enc->streams->granule_offset;
-#ifndef USE_OGGP
ret = oe_write_page(enc, &og, enc->streams->user_data);
-#endif
if (ret == -1) {
- return -1;
+ return;
}
- written += ret;
}
- return written;
}
+#endif
+
int stdio_write(void *user_data, const unsigned char *ptr, int len) {
struct StdioObject *obj = (struct StdioObject*)user_data;