hornetseye-ffmpeg 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/ext/avinput.cc +10 -7
- metadata +2 -2
data/Rakefile
CHANGED
data/ext/avinput.cc
CHANGED
@@ -16,6 +16,7 @@
|
|
16
16
|
#ifndef NDEBUG
|
17
17
|
#include <iostream>
|
18
18
|
#endif
|
19
|
+
#include <malloc.h>
|
19
20
|
#include "avinput.hh"
|
20
21
|
|
21
22
|
#if !defined(INT64_C)
|
@@ -168,12 +169,13 @@ void AVInput::readAV(void) throw (Error)
|
|
168
169
|
unsigned char *data = packet.data;
|
169
170
|
int size = packet.size;
|
170
171
|
while ( size > 0 ) {
|
171
|
-
short int buffer
|
172
|
-
|
173
|
-
|
174
|
-
int
|
175
|
-
|
172
|
+
short int *buffer =
|
173
|
+
(short int *)memalign( 16, AVCODEC_MAX_AUDIO_FRAME_SIZE * 3 / 2 );
|
174
|
+
buffer[ AVCODEC_MAX_AUDIO_FRAME_SIZE * 3 / 4 - 1 ] = '\000';
|
175
|
+
int bufSize = AVCODEC_MAX_AUDIO_FRAME_SIZE * 3 / 2;
|
176
|
+
int len = avcodec_decode_audio2( m_audioDec, buffer, &bufSize, data, size );
|
176
177
|
if ( len < 0 ) {
|
178
|
+
free( buffer );
|
177
179
|
m_audioFrame.reset();
|
178
180
|
ERRORMACRO( false, Error, , "Error decoding audio frame of video \""
|
179
181
|
<< m_mrl << "\"" );
|
@@ -184,13 +186,14 @@ void AVInput::readAV(void) throw (Error)
|
|
184
186
|
if ( m_audioFrame.get() ) {
|
185
187
|
SequencePtr extended( new Sequence( m_audioFrame->size() + bufSize ) );
|
186
188
|
memcpy( extended->data(), m_audioFrame->data(), m_audioFrame->size() );
|
187
|
-
memcpy( extended->data() + m_audioFrame->size(),
|
189
|
+
memcpy( extended->data() + m_audioFrame->size(), buffer, bufSize );
|
188
190
|
m_audioFrame = extended;
|
189
191
|
} else {
|
190
192
|
m_audioFrame = SequencePtr( new Sequence( bufSize ) );
|
191
|
-
memcpy( m_audioFrame->data(),
|
193
|
+
memcpy( m_audioFrame->data(), buffer, bufSize );
|
192
194
|
};
|
193
195
|
};
|
196
|
+
free( buffer );
|
194
197
|
};
|
195
198
|
av_free_packet( &packet );
|
196
199
|
if ( m_audioFrame.get() ) break;
|