From af08d9aeea870de017139f7b1c44b7d816cf8e56 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 8 Dec 2011 06:57:44 +0100 Subject: lavc: add avcodec_is_open(). It allows to check whether an AVCodecContext is open in a documented way. Right now the undocumented way this check is done in lavf/lavc is by checking whether AVCodecContext.codec is NULL. However it's desirable to be able to set AVCodecContext.codec before avcodec_open2(). --- libavcodec/options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libavcodec/options.c') diff --git a/libavcodec/options.c b/libavcodec/options.c index c416b4aa4f..52fc66400a 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -485,7 +485,7 @@ AVCodecContext *avcodec_alloc_context3(AVCodec *codec){ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) { - if (dest->codec) { // check that the dest context is uninitialized + if (avcodec_is_open(dest)) { // check that the dest context is uninitialized av_log(dest, AV_LOG_ERROR, "Tried to copy AVCodecContext %p into already-initialized %p\n", src, dest); -- cgit v1.2.3