[vlc-devel] [PATCH] Setup picture planes size correctly

Rafaël Carré funman at videolan.org
Thu Jan 23 18:13:37 CET 2014


Fixes incomplete b71c85b3d88b8d0ad2d4a63bf58ebcd2ad771cbf
---
TODO: check video_format_Setup

 include/vlc_picture.h          |  2 +-
 modules/access/screen/screen.c |  2 ++
 modules/codec/rawvideo.c       |  4 ++++
 src/Makefile.am                |  2 +-
 src/misc/picture.c             | 10 ++++++----
 5 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/include/vlc_picture.h b/include/vlc_picture.h
index a97f0c5..bad28ad 100644
--- a/include/vlc_picture.h
+++ b/include/vlc_picture.h
@@ -235,7 +235,7 @@ VLC_API int picture_Export( vlc_object_t *p_obj, block_t **pp_image, video_forma
  *
  * It can be useful to get the properties of planes.
  */
-VLC_API int picture_Setup( picture_t *, vlc_fourcc_t i_chroma, int i_width, int i_height, int i_sar_num, int i_sar_den );
+VLC_API int picture_Setup( picture_t *, vlc_fourcc_t i_chroma, int i_visible_width, int i_visible_height, int i_width, int i_height, int i_sar_num, int i_sar_den );
 
 
 /**
diff --git a/modules/access/screen/screen.c b/modules/access/screen/screen.c
index 4c9c138..8009e85 100644
--- a/modules/access/screen/screen.c
+++ b/modules/access/screen/screen.c
@@ -350,6 +350,8 @@ void RenderCursor( demux_t *p_demux, int i_x, int i_y,
     if( !p_sys->dst.i_planes )
         picture_Setup( &p_sys->dst,
                        p_sys->fmt.video.i_chroma,
+                       p_sys->fmt.video.i_visible_width,
+                       p_sys->fmt.video.i_visible_height,
                        p_sys->fmt.video.i_width,
                        p_sys->fmt.video.i_height,
                        p_sys->fmt.video.i_sar_num,
diff --git a/modules/codec/rawvideo.c b/modules/codec/rawvideo.c
index bbe2c78..1b0f4e6 100644
--- a/modules/codec/rawvideo.c
+++ b/modules/codec/rawvideo.c
@@ -181,6 +181,8 @@ static int OpenDecoder( vlc_object_t *p_this )
                         p_dec->fmt_in.video.i_sar_den );
     picture_t picture;
     picture_Setup( &picture, p_dec->fmt_out.i_codec,
+                   p_dec->fmt_in.video.i_visible_width,
+                   p_dec->fmt_in.video.i_visible_height,
                    p_dec->fmt_in.video.i_width,
                    p_dec->fmt_in.video.i_height, 0, 1 );
     p_sys->i_raw_size = 0;
@@ -360,6 +362,8 @@ static block_t *SendFrame( decoder_t *p_dec, block_t *p_block )
 
         /* Fill in picture_t fields */
         picture_Setup( &pic, p_dec->fmt_out.i_codec,
+                       p_dec->fmt_in.video.i_visible_width,
+                       p_dec->fmt_in.video.i_visible_height,
                        p_dec->fmt_out.video.i_width,
                        p_dec->fmt_out.video.i_height, 0, 1 );
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 474da25..16c7b1e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -181,7 +181,7 @@ libvlccore_la_LDFLAGS = \
 	$(LDFLAGS_libvlccore) \
 	-no-undefined \
 	-export-symbols $(srcdir)/libvlccore.sym \
-	-version-info 7:0:0
+	-version-info 8:0:0
 libvlccore_la_LIBADD = $(LIBS_libvlccore) \
 	../compat/libcompat.la \
 	$(LTLIBINTL) $(LTLIBICONV) \
diff --git a/src/misc/picture.c b/src/misc/picture.c
index 3e1fb68..ec7385d 100644
--- a/src/misc/picture.c
+++ b/src/misc/picture.c
@@ -129,6 +129,7 @@ static int LCM( int a, int b )
 }
 
 int picture_Setup( picture_t *p_picture, vlc_fourcc_t i_chroma,
+                   int i_visible_width, int i_visible_height,
                    int i_width, int i_height, int i_sar_num, int i_sar_den )
 {
     /* Store default values */
@@ -146,7 +147,7 @@ int picture_Setup( picture_t *p_picture, vlc_fourcc_t i_chroma,
 
     p_picture->i_nb_fields = 2;
 
-    video_format_Setup( &p_picture->format, i_chroma, i_width, i_height,
+    video_format_Setup( &p_picture->format, i_chroma, i_visible_width, i_visible_height,
                         i_sar_num, i_sar_den );
 
     const vlc_chroma_description_t *p_dsc =
@@ -180,9 +181,9 @@ int picture_Setup( picture_t *p_picture, vlc_fourcc_t i_chroma,
         plane_t *p = &p_picture->p[i];
 
         p->i_lines         = (i_height_aligned + i_height_extra ) * p_dsc->p[i].h.num / p_dsc->p[i].h.den;
-        p->i_visible_lines = i_height * p_dsc->p[i].h.num / p_dsc->p[i].h.den;
+        p->i_visible_lines = i_visible_height * p_dsc->p[i].h.num / p_dsc->p[i].h.den;
         p->i_pitch         = i_width_aligned * p_dsc->p[i].w.num / p_dsc->p[i].w.den * p_dsc->pixel_size;
-        p->i_visible_pitch = i_width * p_dsc->p[i].w.num / p_dsc->p[i].w.den * p_dsc->pixel_size;
+        p->i_visible_pitch = i_visible_width * p_dsc->p[i].w.num / p_dsc->p[i].w.den * p_dsc->pixel_size;
         p->i_pixel_pitch   = p_dsc->pixel_size;
 
         assert( (p->i_pitch % 16) == 0 );
@@ -215,7 +216,8 @@ picture_t *picture_NewFromResource( const video_format_t *p_fmt, const picture_r
         return NULL;
 
     /* Make sure the real dimensions are a multiple of 16 */
-    if( picture_Setup( p_picture, fmt.i_chroma, fmt.i_width, fmt.i_height,
+    if( picture_Setup( p_picture, fmt.i_chroma, fmt.i_visible_width, fmt.i_visible_height,
+                fmt.i_width, fmt.i_height,
                        fmt.i_sar_num, fmt.i_sar_den ) )
     {
         free( p_picture );
-- 
1.8.5.3




More information about the vlc-devel mailing list