FrameDump: Remove deprecated call to av_init_packet()
This function was deprecated in ffmpeg in January[1], while its replacement got introduced in 2015[2], so now might be the time to start using it in Dolphin. :) [1]f7db77bd87
[2]a9a6010637
This commit is contained in:
parent
24db6e467a
commit
7590f07b80
|
@ -333,12 +333,18 @@ void FrameDump::AddFrame(const FrameData& frame)
|
||||||
|
|
||||||
void FrameDump::ProcessPackets()
|
void FrameDump::ProcessPackets()
|
||||||
{
|
{
|
||||||
|
auto pkt = std::unique_ptr<AVPacket, std::function<void(AVPacket*)>>(
|
||||||
|
av_packet_alloc(), [](AVPacket* packet) { av_packet_free(&packet); });
|
||||||
|
|
||||||
|
if (!pkt)
|
||||||
|
{
|
||||||
|
ERROR_LOG_FMT(FRAMEDUMP, "Could not allocate packet");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
AVPacket pkt;
|
const int receive_error = avcodec_receive_packet(m_context->codec, pkt.get());
|
||||||
av_init_packet(&pkt);
|
|
||||||
|
|
||||||
const int receive_error = avcodec_receive_packet(m_context->codec, &pkt);
|
|
||||||
|
|
||||||
if (receive_error == AVERROR(EAGAIN) || receive_error == AVERROR_EOF)
|
if (receive_error == AVERROR(EAGAIN) || receive_error == AVERROR_EOF)
|
||||||
{
|
{
|
||||||
|
@ -352,10 +358,10 @@ void FrameDump::ProcessPackets()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
av_packet_rescale_ts(&pkt, m_context->codec->time_base, m_context->stream->time_base);
|
av_packet_rescale_ts(pkt.get(), m_context->codec->time_base, m_context->stream->time_base);
|
||||||
pkt.stream_index = m_context->stream->index;
|
pkt->stream_index = m_context->stream->index;
|
||||||
|
|
||||||
if (const int write_error = av_interleaved_write_frame(m_context->format, &pkt))
|
if (const int write_error = av_interleaved_write_frame(m_context->format, pkt.get()))
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(FRAMEDUMP, "Error writing packet: {}", write_error);
|
ERROR_LOG_FMT(FRAMEDUMP, "Error writing packet: {}", write_error);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue