]> git.sesse.net Git - vlc/commitdiff
* modules/codec/ffmpeg/ffmpeg.c: fixed crash in LibavcodecCallback() when used from...
authorGildas Bazin <gbazin@videolan.org>
Sun, 30 Oct 2005 19:35:21 +0000 (19:35 +0000)
committerGildas Bazin <gbazin@videolan.org>
Sun, 30 Oct 2005 19:35:21 +0000 (19:35 +0000)
modules/codec/ffmpeg/ffmpeg.c

index 491b2e0d84c37364e3177b668a6a78f36236f591..8fde0aff4350ad500a52ca438ef1f5bfd6f8879c 100644 (file)
@@ -336,10 +336,17 @@ static void LibavcodecCallback( void *p_opaque, int i_level,
     char *psz_new_format;
     const char *psz_item_name;
 
-    if( p_avctx == NULL || p_avctx->opaque == NULL )
+    p_avc = p_avctx ? p_avctx->av_class : 0;
+
+    /* Make sure we can get p_this back */
+    if( !p_avctx || !p_avc || !p_avc->class_name ||
+        strcmp( p_avc->class_name, "AVCodecContext" ) )
+    {
+        if( i_level == AV_LOG_ERROR ) vfprintf( stderr, psz_format, va );
         return;
+    }
+
     p_this = (vlc_object_t *)p_avctx->opaque;
-    p_avc = p_avctx->av_class;
 
     switch( i_level )
     {