diff flvenc.c @ 359:e9232aa21976 libavformat

- made --extra-cflags option work on darwin - allow INTER4V macroblocks for FLV1 codec - fixed issue in flv file format saving 8 mp3 frames per packet instead of 1 - fixed crasher in flv file format involving mp3 buffer handling - added FLV1 codec support for swf file format (FlashPlayer6 or above required) and made it default - fixed broken mp3 support in swf file format patch by (Tinic Uro <turo at macromedia dot com>) cleanup by me
author michael
date Fri, 06 Feb 2004 23:56:37 +0000
parents 3d92f793fd67
children 7568c9f3dc40
line wrap: on
line diff
--- a/flvenc.c	Thu Feb 05 05:22:44 2004 +0000
+++ b/flvenc.c	Fri Feb 06 23:56:37 2004 +0000
@@ -121,7 +121,7 @@
         }
     }
 
-    *byteSize = ( ( ( ( *samplesPerFrame * (bitRate / bitsPerSlot) ) / *sampleRate ) + isPadded ) * bitsPerSlot);
+    *byteSize = ( ( ( ( *samplesPerFrame * (bitRate / bitsPerSlot) ) / *sampleRate ) + isPadded ) );
 
     return 1;
 }
@@ -295,8 +295,15 @@
             int mp3SampleRate = 0;
             int mp3IsMono = 0;
             int mp3SamplesPerFrame = 0;
+            int c=0;
 
-            if ( mp3info(&flv->audioFifo[flv->audioInPos],&mp3FrameSize,&mp3SamplesPerFrame,&mp3SampleRate,&mp3IsMono) ) {
+            /* copy out mp3 header from ring buffer */
+            uint8_t header[4];
+            for (c=0; c<4; c++) {
+                header[c] = flv->audio_fifo[(flv->audioInPos+c) % AUDIO_FIFO_SIZE];
+            }
+
+            if ( mp3info(header,&mp3FrameSize,&mp3SamplesPerFrame,&mp3SampleRate,&mp3IsMono) ) {
                 if ( flv->audioSize >= mp3FrameSize ) {
 
                     int soundFormat = 0x22;