X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcodec%2Frawvideo.c;h=dbb8fdeae64d095f89a0f5823168979a2887bab9;hb=e6cd528635caf98867b5182bb9d7c6aca02ae1dc;hp=db610289791b3849b68c8806d67cfb4d839d6396;hpb=fd7f8f854a13f7b65cb2b8622755aa47ee932919;p=vlc diff --git a/modules/codec/rawvideo.c b/modules/codec/rawvideo.c index db61028979..dbb8fdeae6 100644 --- a/modules/codec/rawvideo.c +++ b/modules/codec/rawvideo.c @@ -31,7 +31,6 @@ #include #include #include -#include /***************************************************************************** * decoder_sys_t : raw video decoder descriptor @@ -93,9 +92,13 @@ static int OpenDecoder( vlc_object_t *p_this ) { /* Planar YUV */ case VLC_CODEC_I444: + case VLC_CODEC_J444: case VLC_CODEC_I422: + case VLC_CODEC_J422: case VLC_CODEC_I420: + case VLC_CODEC_J420: case VLC_CODEC_YV12: + case VLC_CODEC_YV9: case VLC_CODEC_I411: case VLC_CODEC_I410: case VLC_CODEC_GREY: @@ -157,17 +160,24 @@ static int OpenDecoder( vlc_object_t *p_this ) } /* Find out p_vdec->i_raw_size */ - vout_InitFormat( &p_dec->fmt_out.video, p_dec->fmt_in.i_codec, - p_dec->fmt_in.video.i_width, - p_dec->fmt_in.video.i_height, - p_dec->fmt_in.video.i_aspect ); - 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; - - if( !p_dec->fmt_in.video.i_aspect ) + video_format_Setup( &p_dec->fmt_out.video, p_dec->fmt_in.i_codec, + p_dec->fmt_in.video.i_width, + p_dec->fmt_in.video.i_height, + p_dec->fmt_in.video.i_sar_num, + 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_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 ) { - p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * - p_dec->fmt_out.video.i_width / p_dec->fmt_out.video.i_height; + p_dec->fmt_out.video.i_sar_num = 1; + p_dec->fmt_out.video.i_sar_den = 1; } /* Set callbacks */ @@ -206,7 +216,8 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) p_block = *pp_block; - if( !p_block->i_pts && !p_block->i_dts && !date_Get( &p_sys->pts ) ) + if( p_block->i_pts <= VLC_TS_INVALID && p_block->i_dts <= VLC_TS_INVALID && + !date_Get( &p_sys->pts ) ) { /* We've just started the stream, wait for the first PTS. */ block_Release( p_block ); @@ -214,11 +225,11 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) } /* Date management: If there is a pts avaliable, use that. */ - if( p_block->i_pts ) + if( p_block->i_pts > VLC_TS_INVALID ) { date_Set( &p_sys->pts, p_block->i_pts ); } - else if( p_block->i_dts ) + else if( p_block->i_dts > VLC_TS_INVALID ) { /* NB, davidf doesn't quite agree with this in general, it is ok * for rawvideo since it is in order (ie pts=dts), however, it @@ -299,7 +310,17 @@ static picture_t *DecodeFrame( decoder_t *p_dec, block_t *p_block ) FillPicture( p_dec, p_block, p_pic ); p_pic->date = date_Get( &p_sys->pts ); - p_pic->b_progressive = true; + if( p_block->i_flags & BLOCK_FLAG_INTERLACED_MASK ) + { + p_pic->b_progressive = false; + p_pic->i_nb_fields = 2; + if( p_block->i_flags & BLOCK_FLAG_TOP_FIELD_FIRST ) + p_pic->b_top_field_first = true; + else + p_pic->b_top_field_first = false; + } + else + p_pic->b_progressive = true; block_Release( p_block ); return p_pic; @@ -321,9 +342,9 @@ static block_t *SendFrame( decoder_t *p_dec, block_t *p_block ) int i, j; /* Fill in picture_t fields */ - vout_InitPicture( VLC_OBJECT(p_dec), &pic, p_dec->fmt_out.i_codec, - p_dec->fmt_out.video.i_width, - p_dec->fmt_out.video.i_height, VOUT_ASPECT_FACTOR ); + picture_Setup( &pic, p_dec->fmt_out.i_codec, + p_dec->fmt_out.video.i_width, + p_dec->fmt_out.video.i_height, 0, 1 ); if( !pic.i_planes ) {