]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
bring back the old stupid interleaving, and leave this open for maybe someone from...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 18 Feb 2009 19:42:02 +0000 (19:42 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 18 Feb 2009 19:42:02 +0000 (19:42 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8728 d7cf8633-e32d-0410-b094-e92efae38249

cap_ogg.c

index 3c3d3f74ab4b23a9ee734368099c890045dff7a8..81bde28d1a49d8c2ac96735becf16c868c36cad2 100644 (file)
--- a/cap_ogg.c
+++ b/cap_ogg.c
@@ -630,6 +630,8 @@ static void SCR_CaptureVideo_Ogg_Interleave()
 {
        LOAD_FORMATSPECIFIC_OGG();
 
+       //fprintf(stderr, "<");
+
        if(!cls.capturevideo.soundrate)
        {
                for(;;)
@@ -653,11 +655,33 @@ static void SCR_CaptureVideo_Ogg_Interleave()
                // first: make sure we have a page of both types
                if(!format->have_videopage)
                        if(qogg_stream_pageout(&format->to, &format->videopage) > 0)
+                       {
+                               //fprintf(stderr, "V");
                                format->have_videopage = true;
+
+                               // why do I have to do this? the code should work without the
+                               // following three lines, which turn this attempt at correct
+                               // interleaving back into the old stupid one that oggz-validate
+                               // hates
+                               FS_Write(cls.capturevideo.videofile, format->videopage.header, format->videopage.header_len);
+                               FS_Write(cls.capturevideo.videofile, format->videopage.body, format->videopage.body_len);
+                               format->have_videopage = false;
+                       }
                if(!format->have_audiopage)
                        if(qogg_stream_pageout(&format->vo, &format->audiopage) > 0)
+                       {
+                               //fprintf(stderr, "A");
                                format->have_audiopage = true;
 
+                               // why do I have to do this? the code should work without the
+                               // following three lines, which turn this attempt at correct
+                               // interleaving back into the old stupid one that oggz-validate
+                               // hates
+                               FS_Write(cls.capturevideo.videofile, format->audiopage.header, format->audiopage.header_len);
+                               FS_Write(cls.capturevideo.videofile, format->audiopage.body, format->audiopage.body_len);
+                               format->have_audiopage = false;
+                       }
+
                if(format->have_videopage && format->have_audiopage)
                {
                        // output the page that ends first
@@ -668,17 +692,24 @@ static void SCR_CaptureVideo_Ogg_Interleave()
                                FS_Write(cls.capturevideo.videofile, format->audiopage.header, format->audiopage.header_len);
                                FS_Write(cls.capturevideo.videofile, format->audiopage.body, format->audiopage.body_len);
                                format->have_audiopage = false;
+
+                               //fprintf(stderr, "a");
                        }
                        else
                        {
                                FS_Write(cls.capturevideo.videofile, format->videopage.header, format->videopage.header_len);
                                FS_Write(cls.capturevideo.videofile, format->videopage.body, format->videopage.body_len);
                                format->have_videopage = false;
+
+                               //fprintf(stderr, "v");
                        }
                }
                else
                        break;
        }
+
+       fprintf(stderr, ">");
+
 }
 
 static void SCR_CaptureVideo_Ogg_FlushInterleaving()
@@ -834,8 +865,9 @@ static void SCR_CaptureVideo_Ogg_VideoFrames(int num)
        while(num-- > 0)
        {
                qtheora_encode_YUVin(&format->ts, &format->yuv);
-               qtheora_encode_packetout(&format->ts, false, &pt);
-               qogg_stream_packetin(&format->to, &pt);
+
+               while(qtheora_encode_packetout(&format->ts, false, &pt))
+                       qogg_stream_packetin(&format->to, &pt);
 
                SCR_CaptureVideo_Ogg_Interleave();
        }
@@ -864,9 +896,9 @@ static void SCR_CaptureVideo_Ogg_SoundFrame(const portable_sampleframe_t *paintb
 
                while(qvorbis_bitrate_flushpacket(&format->vd, &pt))
                        qogg_stream_packetin(&format->vo, &pt);
-
-               SCR_CaptureVideo_Ogg_Interleave();
        }
+
+       SCR_CaptureVideo_Ogg_Interleave();
 }
 
 void SCR_CaptureVideo_Ogg_BeginVideo()