]> git.sesse.net Git - vlc/commitdiff
Fixed raw picture size in rawvideo codec.
authorLaurent Aimar <fenrir@videolan.org>
Mon, 24 May 2010 17:51:51 +0000 (19:51 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Mon, 24 May 2010 21:59:06 +0000 (23:59 +0200)
modules/codec/rawvideo.c

index fd71d99dd5fce5710584a3646732f570f4f32892..dbb8fdeae64d095f89a0f5823168979a2887bab9 100644 (file)
@@ -165,8 +165,14 @@ static int OpenDecoder( vlc_object_t *p_this )
                         p_dec->fmt_in.video.i_height,
                         p_dec->fmt_in.video.i_sar_num,
                         p_dec->fmt_in.video.i_sar_den );
-    p_sys->i_raw_size = p_dec->fmt_out.video.i_bits_per_pixel *
-        p_dec->fmt_out.video.i_width * p_dec->fmt_out.video.i_height / 8;
+    picture_t picture;
+    picture_Setup( &picture, p_dec->fmt_out.i_codec,
+                   p_dec->fmt_in.video.i_width,
+                   p_dec->fmt_in.video.i_height, 0, 1 );
+    p_sys->i_raw_size = 0;
+    for( int i = 0; i < picture.i_planes; i++ )
+        p_sys->i_raw_size += picture.p[i].i_visible_pitch *
+                             picture.p[i].i_visible_lines;
 
     if( !p_dec->fmt_in.video.i_sar_num || !p_dec->fmt_in.video.i_sar_den )
     {