mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
cellVdec: replace deprecated ffmpeg function
avcodec_decode_video2() is deprecated, now replaced with avcodec_send_packet() and avcodec_receive_frame().
This commit is contained in:
parent
f1241c572c
commit
1a702de9e4
1 changed files with 25 additions and 24 deletions
|
@ -260,37 +260,38 @@ struct vdec_context final
|
|||
break;
|
||||
}
|
||||
|
||||
vdec_frame frame;
|
||||
frame.avf.reset(av_frame_alloc());
|
||||
|
||||
if (!frame.avf)
|
||||
{
|
||||
fmt::throw_exception("av_frame_alloc() failed" HERE);
|
||||
}
|
||||
|
||||
int got_picture = 0;
|
||||
|
||||
int decode = avcodec_decode_video2(ctx, frame.avf.get(), &got_picture, &packet);
|
||||
|
||||
if (decode < 0)
|
||||
if (int ret = avcodec_send_packet(ctx, &packet); ret < 0)
|
||||
{
|
||||
char av_error[AV_ERROR_MAX_STRING_SIZE];
|
||||
av_make_error_string(av_error, AV_ERROR_MAX_STRING_SIZE, decode);
|
||||
fmt::throw_exception("AU decoding error(0x%x): %s" HERE, decode, av_error);
|
||||
av_make_error_string(av_error, AV_ERROR_MAX_STRING_SIZE, ret);
|
||||
fmt::throw_exception("AU queuing error(0x%x): %s" HERE, ret, av_error);
|
||||
}
|
||||
|
||||
if (got_picture == 0)
|
||||
while (true)
|
||||
{
|
||||
break;
|
||||
}
|
||||
// Keep receiving frames
|
||||
vdec_frame frame;
|
||||
frame.avf.reset(av_frame_alloc());
|
||||
|
||||
if (decode != packet.size)
|
||||
{
|
||||
cellVdec.error("Incorrect AU size (0x%x, decoded 0x%x)", packet.size, decode);
|
||||
}
|
||||
if (!frame.avf)
|
||||
{
|
||||
fmt::throw_exception("av_frame_alloc() failed" HERE);
|
||||
}
|
||||
|
||||
if (int ret = avcodec_receive_frame(ctx, frame.avf.get()); ret < 0)
|
||||
{
|
||||
if (ret == AVERROR(EAGAIN))
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
char av_error[AV_ERROR_MAX_STRING_SIZE];
|
||||
av_make_error_string(av_error, AV_ERROR_MAX_STRING_SIZE, ret);
|
||||
fmt::throw_exception("AU decoding error(0x%x): %s" HERE, ret, av_error);
|
||||
}
|
||||
}
|
||||
|
||||
if (got_picture)
|
||||
{
|
||||
if (frame->interlaced_frame)
|
||||
{
|
||||
// NPEB01838, NPUB31260
|
||||
|
|
Loading…
Add table
Reference in a new issue