oggenc: Move ogg_write_pages up above ogg_write_header
authorAndrew Kelley <superjoe30@gmail.com>
Mon, 26 May 2014 04:04:19 +0000 (21:04 -0700)
committerMartin Storsjö <martin@martin.st>
Tue, 27 May 2014 17:16:58 +0000 (20:16 +0300)
Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/oggenc.c

index c52368d..53a1e21 100644 (file)
@@ -388,6 +388,28 @@ static int ogg_build_opus_headers(AVCodecContext *avctx,
     return 0;
 }
 
+static void ogg_write_pages(AVFormatContext *s, int flush)
+{
+    OGGContext *ogg = s->priv_data;
+    OGGPageList *next, *p;
+
+    if (!ogg->page_list)
+        return;
+
+    for (p = ogg->page_list; p; ) {
+        OGGStreamContext *oggstream =
+            s->streams[p->page.stream_index]->priv_data;
+        if (oggstream->page_count < 2 && !flush)
+            break;
+        ogg_write_page(s, &p->page,
+                       flush && oggstream->page_count == 1 ? 4 : 0); // eos
+        next = p->next;
+        av_freep(&p);
+        p = next;
+    }
+    ogg->page_list = p;
+}
+
 static int ogg_write_header(AVFormatContext *s)
 {
     OGGContext *ogg = s->priv_data;
@@ -522,28 +544,6 @@ static int ogg_write_header(AVFormatContext *s)
     return 0;
 }
 
-static void ogg_write_pages(AVFormatContext *s, int flush)
-{
-    OGGContext *ogg = s->priv_data;
-    OGGPageList *next, *p;
-
-    if (!ogg->page_list)
-        return;
-
-    for (p = ogg->page_list; p; ) {
-        OGGStreamContext *oggstream =
-            s->streams[p->page.stream_index]->priv_data;
-        if (oggstream->page_count < 2 && !flush)
-            break;
-        ogg_write_page(s, &p->page,
-                       flush && oggstream->page_count == 1 ? 4 : 0); // eos
-        next = p->next;
-        av_freep(&p);
-        p = next;
-    }
-    ogg->page_list = p;
-}
-
 static int ogg_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     AVStream *st = s->streams[pkt->stream_index];