changeset 33866:846cc6abc5ba

Avoid crash and instead print a warning if the av_log callback context has a broken (NULL) class. Based on patch by Etienne Buira [etienne buira free fr]
author reimar
date Tue, 09 Aug 2011 17:20:44 +0000
parents 0a39f8762b97
children 76b818cbb359
files libmpcodecs/vd_ffmpeg.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c	Thu Aug 04 19:30:26 2011 +0000
+++ b/libmpcodecs/vd_ffmpeg.c	Tue Aug 09 17:20:44 2011 +0000
@@ -197,7 +197,9 @@
     default          :  mp_level= level > AV_LOG_DEBUG ? MSGL_DBG2 : MSGL_ERR; break;
     }
 
-    if(ptr){
+    if (ptr && !avc)
+        mp_msg(MSGT_DECVIDEO, MSGL_ERR, "libav* called av_log with context containing a broken AVClass!\n");
+    if (avc) {
         if(!strcmp(avc->class_name, "AVCodecContext")){
             AVCodecContext *s= ptr;
             if(s->codec){