From 6137de1f171474810323b73a3c3902efbb85b7d5 Mon Sep 17 00:00:00 2001 From: Josh Yelon Date: Tue, 2 Oct 2007 17:17:48 +0000 Subject: [PATCH] Fixed a minor bug in avcodec_close --- panda/src/movies/ffmpegAudioCursor.cxx | 4 ++-- panda/src/movies/ffmpegVideoCursor.cxx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/panda/src/movies/ffmpegAudioCursor.cxx b/panda/src/movies/ffmpegAudioCursor.cxx index 1e45294eaf..5613fb2da5 100644 --- a/panda/src/movies/ffmpegAudioCursor.cxx +++ b/panda/src/movies/ffmpegAudioCursor.cxx @@ -135,10 +135,10 @@ cleanup() { _buffer_alloc = 0; _buffer = 0; } - if (_audio_ctx) { + if ((_audio_ctx)&&(_audio_ctx->codec)) { avcodec_close(_audio_ctx); - _audio_ctx = 0; } + _audio_ctx = 0; if (_format_ctx) { av_close_input_file(_format_ctx); _format_ctx = 0; diff --git a/panda/src/movies/ffmpegVideoCursor.cxx b/panda/src/movies/ffmpegVideoCursor.cxx index 09702c9a54..dd4a3f3b8f 100644 --- a/panda/src/movies/ffmpegVideoCursor.cxx +++ b/panda/src/movies/ffmpegVideoCursor.cxx @@ -144,10 +144,10 @@ cleanup() { delete _packet; _packet = 0; } - if (_video_ctx) { + if ((_video_ctx)&&(_video_ctx->codec)) { avcodec_close(_video_ctx); - _video_ctx = 0; } + _video_ctx = 0; if (_format_ctx) { av_close_input_file(_format_ctx); _format_ctx = 0;