Fix play ADPCM wav files via internal player

This commit is contained in:
Abs62 2014-07-15 18:47:08 +04:00
parent 704a2113cf
commit 2f8b4975a3

View file

@ -348,12 +348,21 @@ bool DecoderContext::play( QString & errorString )
{
if ( packet.stream_index == audioStream_->index )
{
AVPacket pack = packet;
int gotFrame = 0;
avcodec_decode_audio4( codecContext_, frame, &gotFrame, &packet );
if ( !isCancelled_ && gotFrame )
do
{
playFrame( frame );
int len = avcodec_decode_audio4( codecContext_, frame, &gotFrame, &pack );
if ( !isCancelled_ && gotFrame )
{
playFrame( frame );
}
if( len <= 0 || isCancelled_ )
break;
pack.size -= len;
pack.data += len;
}
while( pack.size > 0 );
}
// av_free_packet() must be called after each call to av_read_frame()
av_free_packet( &packet );