Commit 8431be31 authored by François Cartegnie's avatar François Cartegnie 🤞

vlc_block: add BLOCK_FLAG_SINGLE_FIELD

parent 23fad61d
......@@ -85,14 +85,16 @@
#define BLOCK_FLAG_PREROLL 0x0800
/** This block is corrupted and/or there is data loss */
#define BLOCK_FLAG_CORRUPTED 0x1000
/** This block contains an interlaced picture with top field first */
/** This block contains an interlaced picture with top field stored first */
#define BLOCK_FLAG_TOP_FIELD_FIRST 0x2000
/** This block contains an interlaced picture with bottom field first */
/** This block contains an interlaced picture with bottom field stored first */
#define BLOCK_FLAG_BOTTOM_FIELD_FIRST 0x4000
/** This block contains a single field from interlaced picture. */
#define BLOCK_FLAG_SINGLE_FIELD 0x8000
/** This block contains an interlaced picture */
#define BLOCK_FLAG_INTERLACED_MASK \
(BLOCK_FLAG_TOP_FIELD_FIRST|BLOCK_FLAG_BOTTOM_FIELD_FIRST)
(BLOCK_FLAG_TOP_FIELD_FIRST|BLOCK_FLAG_BOTTOM_FIELD_FIRST|BLOCK_FLAG_SINGLE_FIELD)
#define BLOCK_FLAG_TYPE_MASK \
(BLOCK_FLAG_TYPE_I|BLOCK_FLAG_TYPE_P|BLOCK_FLAG_TYPE_B|BLOCK_FLAG_TYPE_PB)
......
......@@ -351,9 +351,11 @@ static int InitVideo (demux_t *demux, int fd, uint32_t caps)
break;
case V4L2_FIELD_TOP:
msg_Dbg (demux, "Interlacing setting: top field only");
sys->block_flags = BLOCK_FLAG_TOP_FIELD_FIRST|BLOCK_FLAG_SINGLE_FIELD;
break;
case V4L2_FIELD_BOTTOM:
msg_Dbg (demux, "Interlacing setting: bottom field only");
sys->block_flags = BLOCK_FLAG_BOTTOM_FIELD_FIRST|BLOCK_FLAG_SINGLE_FIELD;
break;
case V4L2_FIELD_INTERLACED:
msg_Dbg (demux, "Interlacing setting: interleaved");
......
......@@ -249,7 +249,7 @@ static int DecodeFrame( decoder_t *p_dec, block_t *p_block )
if( p_block->i_flags & BLOCK_FLAG_INTERLACED_MASK )
{
p_pic->b_progressive = false;
p_pic->i_nb_fields = 2;
p_pic->i_nb_fields = (p_block->i_flags & BLOCK_FLAG_SINGLE_FIELD) ? 1 : 2;
if( p_block->i_flags & BLOCK_FLAG_TOP_FIELD_FIRST )
p_pic->b_top_field_first = true;
else
......
......@@ -1310,8 +1310,7 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
int i_ret = avcCFromAnnexBCreate(p_dec);
if (i_ret == VLC_SUCCESS)
{
if ((p_block->i_flags & BLOCK_FLAG_TOP_FIELD_FIRST
|| p_block->i_flags & BLOCK_FLAG_BOTTOM_FIELD_FIRST)
if ((p_block->i_flags & BLOCK_FLAG_INTERLACED_MASK)
&& var_InheritBool(p_dec, "videotoolbox-temporal-deinterlacing"))
p_sys->b_enable_temporal_processing = true;
......
......@@ -2219,7 +2219,11 @@ static int MP4_ReadBox_fiel( stream_t *p_stream, MP4_Box_t *p_box )
p_fiel = p_box->data.p_fiel;
if(i_read < 2)
MP4_READBOX_EXIT( 0 );
if(p_peek[0] == 2) /* Interlaced */
if(p_peek[0] == 1)
{
p_fiel->i_flags = BLOCK_FLAG_SINGLE_FIELD;
}
else if(p_peek[0] == 2) /* Interlaced */
{
/*
* 0 – There is only one field.
......
......@@ -803,6 +803,7 @@ static block_t *OutputPicture( decoder_t *p_dec )
/* Top and Bottom field slices */
case 1:
case 2:
p_pic->i_flags |= BLOCK_FLAG_SINGLE_FIELD;
p_pic->i_flags |= (!p_sys->slice.i_bottom_field_flag) ? BLOCK_FLAG_TOP_FIELD_FIRST
: BLOCK_FLAG_BOTTOM_FIELD_FIRST;
break;
......
......@@ -465,10 +465,19 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
break;
}
if( p_sys->i_picture_structure == 0x03 && !p_sys->b_seq_progressive )
if( !p_sys->b_seq_progressive )
{
p_pic->i_flags |= (p_sys->i_top_field_first) ? BLOCK_FLAG_TOP_FIELD_FIRST
: BLOCK_FLAG_BOTTOM_FIELD_FIRST;
if( p_sys->i_picture_structure < 0x03 )
{
p_pic->i_flags |= BLOCK_FLAG_SINGLE_FIELD;
p_pic->i_flags |= (p_sys->i_picture_structure == 0x01) ? BLOCK_FLAG_TOP_FIELD_FIRST
: BLOCK_FLAG_BOTTOM_FIELD_FIRST;
}
else /* if( p_sys->i_picture_structure == 0x03 ) */
{
p_pic->i_flags |= (p_sys->i_top_field_first) ? BLOCK_FLAG_TOP_FIELD_FIRST
: BLOCK_FLAG_BOTTOM_FIELD_FIRST;
}
}
/* Special case for DVR-MS where we need to fully build pts from scratch
......
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