Commit 8ca6f29c authored by gbazin's avatar gbazin
Browse files

* ALL: use rgb mask members in video_format_t.

* modules/demux/avi/avi.c: raw RGB 24 is in fact BGR 24.
parent 5054a569
......@@ -102,7 +102,7 @@ struct video_format_t
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 */
};
......
......@@ -88,6 +88,7 @@ int E_(OpenChroma)( vlc_object_t *p_this )
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') ||
......@@ -95,10 +96,9 @@ int E_(OpenChroma)( vlc_object_t *p_this )
{
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 );
......@@ -152,6 +152,10 @@ static void ChromaConversion( vout_thread_t *p_vout,
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,
......
......@@ -195,6 +195,9 @@ static picture_t *Process( filter_t *p_filter, picture_t *p_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 &&
......
......@@ -139,11 +139,19 @@ static int OpenDecoder( vlc_object_t *p_this )
/* 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 **))
......
......@@ -415,11 +415,20 @@ static int Open( vlc_object_t * p_this )
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' );
}
......
......@@ -235,9 +235,9 @@ void input_DecoderDecode( decoder_t * p_dec, block_t *p_block )
}
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
{
......@@ -503,9 +503,9 @@ static int DecoderThread( decoder_t * p_dec )
*/
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;
......@@ -515,7 +515,8 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
{
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 )
{
......@@ -828,6 +829,13 @@ static picture_t *vout_new_buffer( decoder_t *p_dec )
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 */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment