[vlc-devel] commit: Fixed bug in snapshot format (Christophe Courtaut )

git version control git at videolan.org
Tue Mar 31 19:13:40 CEST 2009


vlc | branch: master | Christophe Courtaut <christophe.courtaut at gmail.com> | Sun Mar 29 16:34:37 2009 +0200| [5d6d1a6b778fcea23181b8e6be5f33a09c8288f6] | committer: Antoine Cellerier 

Fixed bug in snapshot format

--snapshot-format was proposing png or jpg, but if format passed to this
option was unrecognized, then fallback to png.
This commit fix the fact that vlc was always falling back to png.

Signed-off-by: Antoine Cellerier <dionoea at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5d6d1a6b778fcea23181b8e6be5f33a09c8288f6
---

 include/vlc_image.h          |    1 +
 src/misc/image.c             |   20 +++++++++++++-------
 src/video_output/vout_intf.c |    4 ++--
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/include/vlc_image.h b/include/vlc_image.h
index b8785ae..7dfe604 100644
--- a/include/vlc_image.h
+++ b/include/vlc_image.h
@@ -70,6 +70,7 @@ VLC_EXPORT( void, image_HandlerDelete, ( image_handler_t * ) );
 #define image_Convert( a, b, c, d ) a->pf_convert( a, b, c, d )
 #define image_Filter( a, b, c, d ) a->pf_filter( a, b, c, d )
 
+VLC_EXPORT( vlc_fourcc_t, image_Type2Fourcc, ( const char *psz_name ) );
 VLC_EXPORT( vlc_fourcc_t, image_Ext2Fourcc, ( const char *psz_name ) );
 
 # ifdef __cplusplus
diff --git a/src/misc/image.c b/src/misc/image.c
index 2b45d25..9120f7c 100644
--- a/src/misc/image.c
+++ b/src/misc/image.c
@@ -71,6 +71,7 @@ static filter_t *CreateFilter( vlc_object_t *, es_format_t *,
                                video_format_t *, const char * );
 static void DeleteFilter( filter_t * );
 
+vlc_fourcc_t image_Type2Fourcc( const char * );
 vlc_fourcc_t image_Ext2Fourcc( const char * );
 /*static const char *Fourcc2Ext( vlc_fourcc_t );*/
 
@@ -534,21 +535,17 @@ static const struct
     { 0, NULL }
 };
 
-vlc_fourcc_t image_Ext2Fourcc( const char *psz_name )
+vlc_fourcc_t image_Type2Fourcc( const char *psz_type )
 {
     int i;
 
-    psz_name = strrchr( psz_name, '.' );
-    if( !psz_name ) return 0;
-    psz_name++;
-
     for( i = 0; ext_table[i].i_codec; i++ )
     {
         int j;
-        for( j = 0; toupper(ext_table[i].psz_ext[j]) == toupper(psz_name[j]);
+        for( j = 0; toupper(ext_table[i].psz_ext[j]) == toupper(psz_type[j]);
              j++ )
         {
-            if( !ext_table[i].psz_ext[j] && !psz_name[j] )
+            if( !ext_table[i].psz_ext[j] && !psz_type[j] )
                 return ext_table[i].i_codec;
         }
     }
@@ -556,6 +553,15 @@ vlc_fourcc_t image_Ext2Fourcc( const char *psz_name )
     return 0;
 }
 
+vlc_fourcc_t image_Ext2Fourcc( const char *psz_name )
+{
+    psz_name = strrchr( psz_name, '.' );
+    if( !psz_name ) return 0;
+    psz_name++;
+
+    return image_Type2Fourcc( psz_name );
+}
+
 /*
 static const char *Fourcc2Ext( vlc_fourcc_t i_codec )
 {
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index 04570c9..313ced1 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -753,8 +753,8 @@ int vout_GetSnapshot( vout_thread_t *p_vout,
     if( pp_image )
     {
         vlc_fourcc_t i_format = VLC_FOURCC('p','n','g',' ');
-        if( psz_format && image_Ext2Fourcc( psz_format ) )
-            i_format = image_Ext2Fourcc( psz_format );
+        if( psz_format && image_Type2Fourcc( psz_format ) )
+            i_format = image_Type2Fourcc( psz_format );
 
         const int i_override_width  = var_GetInteger( p_vout, "snapshot-width" );
         const int i_override_height = var_GetInteger( p_vout, "snapshot-height" );




More information about the vlc-devel mailing list