mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
remove ffmpeg deprecated method
This commit is contained in:
parent
c239973e16
commit
82aea3ec33
|
@ -346,16 +346,14 @@ bool DecoderContext::play( QString & errorString )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AVPacket packet;
|
AVPacket * packet = av_packet_alloc();
|
||||||
av_init_packet( &packet );
|
|
||||||
|
|
||||||
while ( !Utils::AtomicInt::loadAcquire( isCancelled_ ) &&
|
while ( !Utils::AtomicInt::loadAcquire( isCancelled_ ) &&
|
||||||
av_read_frame( formatContext_, &packet ) >= 0 )
|
av_read_frame( formatContext_, packet ) >= 0 )
|
||||||
{
|
{
|
||||||
if ( packet.stream_index == audioStream_->index )
|
if ( packet->stream_index == audioStream_->index )
|
||||||
{
|
{
|
||||||
AVPacket pack = packet;
|
int ret = avcodec_send_packet( codecContext_, packet );
|
||||||
int ret = avcodec_send_packet( codecContext_, &pack );
|
|
||||||
/* read all the output frames (in general there may be any number of them) */
|
/* read all the output frames (in general there may be any number of them) */
|
||||||
while( ret >= 0 )
|
while( ret >= 0 )
|
||||||
{
|
{
|
||||||
|
@ -369,15 +367,14 @@ bool DecoderContext::play( QString & errorString )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
av_packet_unref( &packet );
|
av_packet_unref( packet );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* flush the decoder */
|
/* flush the decoder */
|
||||||
av_init_packet( &packet );
|
packet->data = NULL;
|
||||||
packet.data = NULL;
|
packet->size = 0;
|
||||||
packet.size = 0;
|
int ret = avcodec_send_packet(codecContext_, packet );
|
||||||
int ret = avcodec_send_packet(codecContext_, &packet );
|
|
||||||
while( ret >= 0 )
|
while( ret >= 0 )
|
||||||
{
|
{
|
||||||
ret = avcodec_receive_frame(codecContext_, frame);
|
ret = avcodec_receive_frame(codecContext_, frame);
|
||||||
|
@ -386,6 +383,7 @@ bool DecoderContext::play( QString & errorString )
|
||||||
playFrame( frame );
|
playFrame( frame );
|
||||||
}
|
}
|
||||||
av_frame_free( &frame );
|
av_frame_free( &frame );
|
||||||
|
av_packet_free(&packet);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue