[vlc-commits] Provide extradata also if the video is not palettized. All samples in tickets #4017 , #5952 and #9546 plays nicely.
Frode Tennebø
git at videolan.org
Fri Oct 18 22:54:05 CEST 2013
vlc | branch: master | Frode Tennebø <frode at tennebo.com> | Thu Oct 17 21:24:11 2013 +0200| [6220fd4ab0055ae0f2925c49499139f3ea80bec3] | committer: Rafaël Carré
Provide extradata also if the video is not palettized. All samples in tickets #4017, #5952 and #9546 plays nicely.
Signed-off-by: Rafaël Carré <funman at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6220fd4ab0055ae0f2925c49499139f3ea80bec3
---
modules/demux/avi/avi.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 8d1fca3..ef95678 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -537,6 +537,14 @@ static int Open( vlc_object_t * p_this )
fmt.video.i_sar_num = ((i_frame_aspect_ratio >> 16) & 0xffff) * fmt.video.i_height;
fmt.video.i_sar_den = ((i_frame_aspect_ratio >> 0) & 0xffff) * fmt.video.i_width;
}
+ /* Extradata is the remainder of the chunk less the BIH */
+ fmt.i_extra = p_vids->i_chunk_size - sizeof(VLC_BITMAPINFOHEADER);
+ if( fmt.i_extra > 0 )
+ {
+ fmt.p_extra = malloc( fmt.i_extra );
+ if( !fmt.p_extra ) goto error;
+ memcpy( fmt.p_extra, &p_vids->p_bih[1], fmt.i_extra );
+ }
msg_Dbg( p_demux, "stream[%d] video(%4.4s) %"PRIu32"x%"PRIu32" %dbpp %ffps",
i, (char*)&p_vids->p_bih->biCompression,
@@ -552,20 +560,13 @@ static int Open( vlc_object_t * p_this )
(unsigned int)(-(int)p_vids->p_bih->biHeight);
}
- /* Extract palette from extradata if bpp <= 8
- * (assumes that extradata contains only palette but appears
- * to be true for all palettized codecs we support) */
+ /* Extract palette from extradata if bpp <= 8 */
if( fmt.video.i_bits_per_pixel > 0 && fmt.video.i_bits_per_pixel <= 8 )
{
/* The palette should not be included in biSize, but come
* directly after BITMAPINFORHEADER in the BITMAPINFO structure */
- fmt.i_extra = p_vids->i_chunk_size - sizeof(VLC_BITMAPINFOHEADER);
- if( fmt.i_extra > 0 )
+ if( fmt.i_extra > 0 && fmt.p_extra )
{
- fmt.p_extra = malloc( fmt.i_extra );
- if( !fmt.p_extra ) goto error;
- memcpy( fmt.p_extra, &p_vids->p_bih[1], fmt.i_extra );
-
const uint8_t *p_pal = fmt.p_extra;
fmt.video.p_palette = calloc( 1, sizeof(video_palette_t) );
More information about the vlc-commits
mailing list