mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 23:34:06 +00:00
Fix play ADPCM wav files via internal player
This commit is contained in:
parent
704a2113cf
commit
2f8b4975a3
|
@ -348,12 +348,21 @@ bool DecoderContext::play( QString & errorString )
|
||||||
{
|
{
|
||||||
if ( packet.stream_index == audioStream_->index )
|
if ( packet.stream_index == audioStream_->index )
|
||||||
{
|
{
|
||||||
|
AVPacket pack = packet;
|
||||||
int gotFrame = 0;
|
int gotFrame = 0;
|
||||||
avcodec_decode_audio4( codecContext_, frame, &gotFrame, &packet );
|
do
|
||||||
if ( !isCancelled_ && gotFrame )
|
|
||||||
{
|
{
|
||||||
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() must be called after each call to av_read_frame()
|
||||||
av_free_packet( &packet );
|
av_free_packet( &packet );
|
||||||
|
|
Loading…
Reference in a new issue