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.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. data/ext/avinput.cc +10 -7
  3. metadata +2 -2
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require 'rake/loaders/makefile'
7
7
  require 'rbconfig'
8
8
 
9
9
  PKG_NAME = 'hornetseye-ffmpeg'
10
- PKG_VERSION = '0.5.3'
10
+ PKG_VERSION = '0.5.4'
11
11
  CXX = ENV[ 'CXX' ] || 'g++'
12
12
  STRIP = ENV[ 'STRIP' ] || 'strip'
13
13
  RB_FILES = FileList[ 'lib/**/*.rb' ]
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[ ( AVCODEC_MAX_AUDIO_FRAME_SIZE +
172
- FF_INPUT_BUFFER_PADDING_SIZE ) / sizeof( short int ) ];
173
- int bufSize = sizeof( buffer );
174
- int len = avcodec_decode_audio2( m_audioDec, &buffer[0], &bufSize,
175
- data, size );
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(), &buffer[0], bufSize );
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(), &buffer[0], bufSize );
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;
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 3
9
- version: 0.5.3
8
+ - 4
9
+ version: 0.5.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jan Wedekind