* modules/demux/avi/avi.c: raw RGB 24 is in fact BGR 24.
unsigned int i_frame_rate; /**< frame rate numerator */
unsigned int i_frame_rate_base; /**< frame rate denominator */
- int i_rmask, i_rgmask, i_bmask; /**< color masks for RGB chroma */
+ int i_rmask, i_gmask, i_bmask; /**< color masks for RGB chroma */
video_palette_t *p_palette; /**< video palette from demuxer */
};
p_vout->chroma.p_sys->i_dst_vlc_chroma = p_vout->output.i_chroma;
p_vout->chroma.p_sys->i_src_ffmpeg_chroma = i_ffmpeg_chroma[0];
p_vout->chroma.p_sys->i_dst_ffmpeg_chroma = i_ffmpeg_chroma[1];
+
if( ( p_vout->render.i_height != p_vout->output.i_height ||
p_vout->render.i_width != p_vout->output.i_width ) &&
( p_vout->chroma.p_sys->i_dst_vlc_chroma == VLC_FOURCC('I','4','2','0') ||
{
msg_Dbg( p_vout, "preparing to resample picture" );
- p_vout->chroma.p_sys->p_rsc = img_resample_init( p_vout->output.i_width,
- p_vout->output.i_height,
- p_vout->render.i_width,
- p_vout->render.i_height );
+ p_vout->chroma.p_sys->p_rsc =
+ img_resample_init( p_vout->output.i_width, p_vout->output.i_height,
+ p_vout->render.i_width, p_vout->render.i_height );
avpicture_alloc( &p_vout->chroma.p_sys->tmp_pic,
p_vout->chroma.p_sys->i_dst_ffmpeg_chroma,
p_vout->render.i_width, p_vout->render.i_height );
dest_pic.data[1] = p_dest->p[2].p_pixels;
dest_pic.data[2] = p_dest->p[1].p_pixels;
}
+ if( p_vout->chroma.p_sys->i_src_ffmpeg_chroma == PIX_FMT_RGB24 )
+ if( p_vout->render.i_bmask == 0x00ff0000 )
+ p_vout->chroma.p_sys->i_src_ffmpeg_chroma = PIX_FMT_BGR24;
+
if( p_vout->chroma.p_sys->p_rsc )
{
img_convert( &p_vout->chroma.p_sys->tmp_pic,
dest_pic.data[1] = p_pic_dst->p[2].p_pixels;
dest_pic.data[2] = p_pic_dst->p[1].p_pixels;
}
+ if( p_sys->i_src_ffmpeg_chroma == PIX_FMT_RGB24 )
+ if( p_filter->fmt_in.video.i_bmask == 0x00ff0000 )
+ p_sys->i_src_ffmpeg_chroma = PIX_FMT_BGR24;
#if 0
if( p_sys->b_resize &&
/* Set output properties */
p_dec->fmt_out.i_cat = VIDEO_ES;
p_dec->fmt_out.i_codec = p_dec->fmt_in.i_codec;
- //if( !p_dec->fmt_in.video.i_aspect )
+ if( !p_dec->fmt_in.video.i_aspect )
{
p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR *
p_dec->fmt_out.video.i_width / p_dec->fmt_out.video.i_height;
}
+ else p_dec->fmt_out.video.i_aspect = p_dec->fmt_in.video.i_aspect;
+
+ if( p_dec->fmt_in.video.i_rmask )
+ p_dec->fmt_out.video.i_rmask = p_dec->fmt_in.video.i_rmask;
+ if( p_dec->fmt_in.video.i_gmask )
+ p_dec->fmt_out.video.i_gmask = p_dec->fmt_in.video.i_gmask;
+ if( p_dec->fmt_in.video.i_bmask )
+ p_dec->fmt_out.video.i_bmask = p_dec->fmt_in.video.i_bmask;
/* Set callbacks */
p_dec->pf_decode_video = (picture_t *(*)(decoder_t *, block_t **))
break;
}
es_format_Init( &fmt, VIDEO_ES, tk->i_codec );
+
+ if( p_vids->p_bih->biBitCount == 24 )
+ {
+ /* This is in BGR format */
+ fmt.video.i_bmask = 0x00ff0000;
+ fmt.video.i_gmask = 0x0000ff00;
+ fmt.video.i_rmask = 0x000000ff;
+ }
}
else
{
es_format_Init( &fmt, VIDEO_ES, p_vids->p_bih->biCompression );
- if( tk->i_codec == FOURCC_mp4v && !strncasecmp( (char*)&p_strh->i_handler, "XVID", 4 ) )
+ if( tk->i_codec == FOURCC_mp4v &&
+ !strncasecmp( (char*)&p_strh->i_handler, "XVID", 4 ) )
{
fmt.i_codec = VLC_FOURCC( 'X', 'V', 'I', 'D' );
}
}
else
{
- if( p_dec->b_error || p_block->i_buffer <= 0 )
+ if( p_dec->b_error || (p_block && p_block->i_buffer <= 0) )
{
- block_Release( p_block );
+ if( p_block ) block_Release( p_block );
}
else
{
*/
static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
{
- int i_rate = p_block->i_rate;
+ int i_rate = p_block ? p_block->i_rate : 1000;
- if( p_block->i_buffer <= 0 )
+ if( p_block && p_block->i_buffer <= 0 )
{
block_Release( p_block );
return VLC_SUCCESS;
{
block_t *p_sout_block;
- while( (p_sout_block = p_dec->pf_packetize( p_dec, &p_block )) )
+ while( ( p_sout_block =
+ p_dec->pf_packetize( p_dec, p_block ? &p_block : 0 ) ) )
{
if( !p_dec->p_owner->p_sout_input )
{
p_dec->b_error = VLC_TRUE;
return NULL;
}
+
+ if( p_sys->video.i_rmask )
+ p_sys->p_vout->render.i_rmask = p_sys->video.i_rmask;
+ if( p_sys->video.i_gmask )
+ p_sys->p_vout->render.i_gmask = p_sys->video.i_gmask;
+ if( p_sys->video.i_bmask )
+ p_sys->p_vout->render.i_bmask = p_sys->video.i_bmask;
}
/* Get a new picture */