[vlc-devel] commit: Revert "vout_pictures: Use unsigned for width and height in picture_Export." (Laurent Aimar )

git version control git at videolan.org
Mon Aug 24 22:43:23 CEST 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon Aug 24 22:10:51 2009 +0200| [533ea9d053094332562fa201567810ee9bc63fc2] | committer: Laurent Aimar 

Revert "vout_pictures: Use unsigned for width and height in picture_Export."

This reverts commit 13268071115898a03f9b1d3c470a72de82eabf0c.

It is wrong as -1 and 0 does not have the same meaning for picture_Export.
(I will document it).

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

 include/vlc_picture.h            |    2 +-
 src/video_output/vout_intf.c     |    4 ++--
 src/video_output/vout_pictures.c |    8 +++++---
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/include/vlc_picture.h b/include/vlc_picture.h
index 2787543..f057558 100644
--- a/include/vlc_picture.h
+++ b/include/vlc_picture.h
@@ -281,7 +281,7 @@ static inline void picture_Copy( picture_t *p_dst, const picture_t *p_src )
  * picture to be encoded. If at most one of them is > 0 then the picture aspect
  * ratio will be kept.
  */
-VLC_EXPORT( int, picture_Export, ( vlc_object_t *p_obj, block_t **pp_image, video_format_t *p_fmt, picture_t *p_picture, vlc_fourcc_t i_format, unsigned i_override_width, unsigned i_override_height ) );
+VLC_EXPORT( int, picture_Export, ( vlc_object_t *p_obj, block_t **pp_image, video_format_t *p_fmt, picture_t *p_picture, vlc_fourcc_t i_format, int i_override_width, int i_override_height ) );
 
 /**
  * This function will setup all fields of a picture_t without allocating any
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index 14d72e1..f8e7db6 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -435,8 +435,8 @@ int vout_GetSnapshot( vout_thread_t *p_vout,
         if( psz_format && image_Type2Fourcc( psz_format ) )
             i_format = image_Type2Fourcc( psz_format );
 
-        const unsigned i_override_width  = var_GetInteger( p_vout, "snapshot-width" );
-        const unsigned i_override_height = var_GetInteger( p_vout, "snapshot-height" );
+        const int i_override_width  = var_GetInteger( p_vout, "snapshot-width" );
+        const int i_override_height = var_GetInteger( p_vout, "snapshot-height" );
 
         if( picture_Export( VLC_OBJECT(p_vout), pp_image, p_fmt,
                             p_picture, i_format, i_override_width, i_override_height ) )
diff --git a/src/video_output/vout_pictures.c b/src/video_output/vout_pictures.c
index 83bfb59..6d5da79 100644
--- a/src/video_output/vout_pictures.c
+++ b/src/video_output/vout_pictures.c
@@ -1042,7 +1042,7 @@ int picture_Export( vlc_object_t *p_obj,
                     video_format_t *p_fmt,
                     picture_t *p_picture,
                     vlc_fourcc_t i_format,
-                    unsigned i_override_width, unsigned i_override_height )
+                    int i_override_width, int i_override_height )
 {
     /* */
     video_format_t fmt_in = p_picture->format;
@@ -1074,8 +1074,10 @@ int picture_Export( vlc_object_t *p_obj,
     }
 
     /* */
-    fmt_out.i_width  = i_override_width > 0 ? i_override_width : i_original_width;
-    fmt_out.i_height = i_override_height > 0 ? i_override_height : i_original_height;
+    fmt_out.i_width  = ( i_override_width < 0 ) ?
+                       i_original_width : i_override_width;
+    fmt_out.i_height = ( i_override_height < 0 ) ?
+                       i_original_height : i_override_height;
 
     /* scale if only one direction is provided */
     if( fmt_out.i_height == 0 && fmt_out.i_width > 0 )




More information about the vlc-devel mailing list