Commit aba25924 authored by Ken Martin's avatar Ken Martin Committed by Kitware Robot

Merge topic 'fix_waring_ffmpegvideosource'

64f464a9 fix a compiler warning and better cleanup
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !4735
parents bd5566b4 64f464a9
......@@ -70,7 +70,7 @@ public:
int AudioStreamIndex = -1;
AVFrame *Frame = nullptr;
AVPacket Packet;
struct SwsContext* RGBContext;
struct SwsContext* RGBContext = nullptr;
};
vtkStandardNewMacro(vtkFFMPEGVideoSource);
......@@ -329,13 +329,16 @@ void vtkFFMPEGVideoSource::InternalGrab()
//----------------------------------------------------------------------------
void vtkFFMPEGVideoSource::ReleaseSystemResources()
{
avcodec_close(this->Internal->VideoDecodeContext);
avcodec_close(this->Internal->AudioDecodeContext);
avformat_close_input(&this->Internal->FormatContext);
av_frame_free(&this->Internal->Frame);
this->Initialized = 0;
this->Modified();
if (this->Initialized)
{
avcodec_close(this->Internal->VideoDecodeContext);
avcodec_close(this->Internal->AudioDecodeContext);
avformat_close_input(&this->Internal->FormatContext);
av_frame_free(&this->Internal->Frame);
sws_freeContext(this->Internal->RGBContext);
this->Initialized = 0;
this->Modified();
}
}
//----------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment