]> git.sesse.net Git - vlc/blobdiff - modules/video_output/image.c
Merge branch 'df-for-upstream' of git://repo.or.cz/vlc/davidf-public
[vlc] / modules / video_output / image.c
index 215ab24ca546b26623121dac4c23d20b04c27f26..3bcecbcbe8272bda2b86b1af99548373b5f878e5 100644 (file)
@@ -29,7 +29,7 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_vout.h>
 #include <vlc_interface.h>
@@ -77,8 +77,8 @@ static void Display   ( vout_thread_t *, picture_t * );
                             "creating one file per image. In this case, " \
                              "the number is not appended to the filename." )
 
-static const char *psz_format_list[] = { "png", "jpeg" };
-static const char *psz_format_list_text[] = { "PNG", "JPEG" };
+static const char *const psz_format_list[] = { "png", "jpeg" };
+static const char *const psz_format_list_text[] = { "PNG", "JPEG" };
 
 #define CFG_PREFIX "image-out-"
 
@@ -107,7 +107,7 @@ vlc_module_begin( );
     set_callbacks( Create, Destroy );
 vlc_module_end();
 
-static const char *ppsz_vout_options[] = {
+static const char *const ppsz_vout_options[] = {
     "format", "width", "height", "ratio", "prefix", "replace", NULL
 };
 
@@ -174,6 +174,7 @@ static int Create( vlc_object_t *p_this )
     {
         msg_Err( p_this, "unable to create image handler") ;
         FREENULL( p_vout->p_sys->psz_prefix );
+        FREENULL( p_vout->p_sys->psz_format );
         FREENULL( p_vout->p_sys );
         return VLC_EGENERIC;
     }
@@ -315,6 +316,9 @@ static void Display( vout_thread_t *p_vout, picture_t *p_pic )
         psz_prefix = psz_tmp;
     psz_filename = (char *)malloc( 10 + strlen( psz_prefix )
                                       + strlen( p_vout->p_sys->psz_format ) );
+    if( !psz_filename )
+        return;
+
     if( p_vout->p_sys->b_replace )
     {
         sprintf( psz_filename, "%s.%s", psz_prefix,