summaryrefslogtreecommitdiff
path: root/libavformat/flvenc.c
diff options
context:
space:
mode:
authorTinic Uro <turo@macromedia.com>2004-02-06 23:56:37 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-02-06 23:56:37 +0000
commit747a0554ea8ad09404c1f5b80239ebd8d71b291e (patch)
treecbdc2b6bea2d6aa2a9b83b634ef12bad24b8ed13 /libavformat/flvenc.c
parent8cb5d4c060cf2bd6c7d10bb151e4bceedf821379 (diff)
- 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 Originally committed as revision 2756 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/flvenc.c')
-rw-r--r--libavformat/flvenc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index e6e3d7a011..b544b55568 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -121,7 +121,7 @@ static int mp3info(void *data, int *byteSize, int *samplesPerFrame, int *sampleR
}
}
- *byteSize = ( ( ( ( *samplesPerFrame * (bitRate / bitsPerSlot) ) / *sampleRate ) + isPadded ) * bitsPerSlot);
+ *byteSize = ( ( ( ( *samplesPerFrame * (bitRate / bitsPerSlot) ) / *sampleRate ) + isPadded ) );
return 1;
}
@@ -295,8 +295,15 @@ static int flv_write_packet(AVFormatContext *s, int stream_index,
int mp3SampleRate = 0;
int mp3IsMono = 0;
int mp3SamplesPerFrame = 0;
+ int c=0;
+
+ /* 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(&flv->audioFifo[flv->audioInPos],&mp3FrameSize,&mp3SamplesPerFrame,&mp3SampleRate,&mp3IsMono) ) {
+ if ( mp3info(header,&mp3FrameSize,&mp3SamplesPerFrame,&mp3SampleRate,&mp3IsMono) ) {
if ( flv->audioSize >= mp3FrameSize ) {
int soundFormat = 0x22;