Skip to content

Commit

Permalink
FFmpeg 3.0 Transition: Use av_packet_unref instead of av_free_packet
Browse files Browse the repository at this point in the history
  • Loading branch information
fritsch committed Mar 31, 2016
1 parent d44c30e commit 3774381
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion xbmc/cdrip/EncoderFFmpeg.cpp
Expand Up @@ -322,7 +322,7 @@ bool CEncoderFFmpeg::WriteFrame()
}
}

av_free_packet(&m_Pkt);
av_packet_unref(&m_Pkt);

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp
Expand Up @@ -296,7 +296,7 @@ int CAEEncoderFFmpeg::Encode(uint8_t *in, int in_size, uint8_t *out, int out_siz
int size = m_Pkt.size;

/* free the packet */
av_free_packet(&m_Pkt);
av_packet_unref(&m_Pkt);

/* return the number of frames used */
return size;
Expand Down
12 changes: 6 additions & 6 deletions xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
Expand Up @@ -508,7 +508,7 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput, bool streaminfo, bool filein
void CDVDDemuxFFmpeg::Dispose()
{
m_pkt.result = -1;
av_free_packet(&m_pkt.pkt);
av_packet_unref(&m_pkt.pkt);

if (m_pFormatContext)
{
Expand Down Expand Up @@ -556,7 +556,7 @@ void CDVDDemuxFFmpeg::Flush()
m_currentPts = DVD_NOPTS_VALUE;

m_pkt.result = -1;
av_free_packet(&m_pkt.pkt);
av_packet_unref(&m_pkt.pkt);

m_displayTime = 0;
m_dtsAtDisplayTime = DVD_NOPTS_VALUE;
Expand Down Expand Up @@ -763,7 +763,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
CLog::Log(LOGERROR, "CDVDDemuxFFmpeg::Read() returned invalid packet and eof reached");

m_pkt.result = -1;
av_free_packet(&m_pkt.pkt);
av_packet_unref(&m_pkt.pkt);
}
else
{
Expand Down Expand Up @@ -887,7 +887,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
pPacket->iStreamId = m_pkt.pkt.stream_index;
}
m_pkt.result = -1;
av_free_packet(&m_pkt.pkt);
av_packet_unref(&m_pkt.pkt);
}
}
} // end of lock scope
Expand Down Expand Up @@ -949,7 +949,7 @@ bool CDVDDemuxFFmpeg::SeekTime(int time, bool backwords, double *startpts)
time = 0;

m_pkt.result = -1;
av_free_packet(&m_pkt.pkt);
av_packet_unref(&m_pkt.pkt);

CDVDInputStream::IPosTime* ist = m_pInput->GetIPosTime();
if (ist)
Expand Down Expand Up @@ -1016,7 +1016,7 @@ bool CDVDDemuxFFmpeg::SeekByte(int64_t pos)
UpdateCurrentPTS();

m_pkt.result = -1;
av_free_packet(&m_pkt.pkt);
av_packet_unref(&m_pkt.pkt);

return (ret >= 0);
}
Expand Down
2 changes: 1 addition & 1 deletion xbmc/guilib/FFmpegImage.cpp
Expand Up @@ -327,7 +327,7 @@ AVFrame* CFFmpegImage::ExtractFrame()
}

av_frame_free(&frame);
av_free_packet(&pkt);
av_packet_unref(&pkt);

return clone;
}
Expand Down
4 changes: 2 additions & 2 deletions xbmc/video/FFmpegVideoDecoder.cpp
Expand Up @@ -282,7 +282,7 @@ bool FFmpegVideoDecoder::nextFrame( CBaseTexture * texture )
}
}

av_free_packet( &packet );
av_packet_unref( &packet );
}

// We got the video frame, render it into the picture buffer
Expand All @@ -292,7 +292,7 @@ bool FFmpegVideoDecoder::nextFrame( CBaseTexture * texture )
sws_scale( context, m_pFrame->data, m_pFrame->linesize, 0, m_pCodecCtx->height,
m_pFrameRGB->data, m_pFrameRGB->linesize );
sws_freeContext( context );
av_free_packet( &packet );
av_packet_unref( &packet );

// And into the texture
texture->Update( m_frameRGBwidth, m_frameRGBheight, m_frameRGBwidth * 4, XB_FMT_A8R8G8B8, m_pFrameRGB->data[0], false );
Expand Down

0 comments on commit 3774381

Please sign in to comment.