Commit 9a3111a3 authored by François Cartegnie's avatar François Cartegnie 🤞

es: pass no cc reorder in es fmt

parent 1c36cd78
......@@ -537,7 +537,8 @@ struct subs_format_t
struct
{
uint8_t i_channel;
uint8_t i_reorder_depth; /* Reorder depth or transport video */
/* Reorder depth of transport video, -1 for no reordering */
int i_reorder_depth;
} cc;
text_style_t *p_style; /* Default styles to use */
......
......@@ -341,7 +341,8 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
Push( p_dec, p_block );
}
for( ; DoDecode( p_dec, (p_block == NULL) ); );
const bool b_no_reorder = (p_dec->fmt_in.subs.cc.i_reorder_depth < 0);
for( ; DoDecode( p_dec, (p_block == NULL) || b_no_reorder ); );
return VLCDEC_SUCCESS;
}
......
......@@ -1248,6 +1248,7 @@ int SetupSpuES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
case ATOM_c608: /* EIA608 closed captions */
//case ATOM_c708: /* EIA708 closed captions */
p_track->fmt.i_codec = VLC_CODEC_CEA608;
p_track->fmt.subs.cc.i_reorder_depth = -1;
break;
case( VLC_FOURCC( 't', 'e', 'x', 't' ) ):
......
......@@ -721,6 +721,7 @@ static int Open ( vlc_object_t *p_this )
else if( p_sys->props.i_type == SUB_TYPE_SCC )
{
es_format_Init( &fmt, SPU_ES, VLC_CODEC_CEA608 );
fmt.subs.cc.i_reorder_depth = -1;
}
else
es_format_Init( &fmt, SPU_ES, VLC_CODEC_SUBT );
......
......@@ -488,8 +488,7 @@ static block_t *PacketizeAVC1( decoder_t *p_dec, block_t **pp_block )
*****************************************************************************/
static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_depth )
{
*pi_reorder_depth = 4;
return cc_storage_get_current( p_dec->p_sys->p_ccs, pb_present );
return cc_storage_get_current( p_dec->p_sys->p_ccs, pb_present, pi_reorder_depth );
}
/****************************************************************************
......
......@@ -306,8 +306,7 @@ static void PacketizeFlush( decoder_t *p_dec )
*****************************************************************************/
static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_depth )
{
*pi_reorder_depth = 4;
return cc_storage_get_current( p_dec->p_sys->p_ccs, pb_present );
return cc_storage_get_current( p_dec->p_sys->p_ccs, pb_present, pi_reorder_depth );
}
/****************************************************************************
......
......@@ -80,10 +80,13 @@ void cc_storage_commit( cc_storage_t *p_ccs, block_t *p_pic )
cc_Flush( &p_ccs->next );
}
block_t * cc_storage_get_current( cc_storage_t *p_ccs, bool pb_present[4] )
block_t * cc_storage_get_current( cc_storage_t *p_ccs, bool pb_present[4],
int *pi_reorder_depth )
{
block_t *p_block;
*pi_reorder_depth = p_ccs->current.b_reorder ? 4 : -1;
for( int i = 0; i < 4; i++ )
pb_present[i] = p_ccs->current.pb_present[i];
......@@ -96,7 +99,7 @@ block_t * cc_storage_get_current( cc_storage_t *p_ccs, bool pb_present[4] )
memcpy( p_block->p_buffer, p_ccs->current.p_data, p_ccs->current.i_data );
p_block->i_dts =
p_block->i_pts = p_ccs->current.b_reorder ? p_ccs->i_pts : p_ccs->i_dts;
p_block->i_flags = ( p_ccs->current.b_reorder ? p_ccs->i_flags : BLOCK_FLAG_TYPE_P ) & BLOCK_FLAG_TYPE_MASK;
p_block->i_flags = p_ccs->i_flags & BLOCK_FLAG_TYPE_MASK;
}
cc_Flush( &p_ccs->current );
......
......@@ -33,7 +33,8 @@ void cc_storage_append( cc_storage_t *p_ccs, bool b_top_field_first,
const uint8_t *p_buf, size_t i_buf );
void cc_storage_commit( cc_storage_t *p_ccs, block_t *p_pic );
block_t * cc_storage_get_current( cc_storage_t *p_ccs, bool pb_present[4] );
block_t * cc_storage_get_current( cc_storage_t *p_ccs, bool pb_present[4],
int *pi_reorder_depth );
/* */
......
......@@ -317,7 +317,7 @@ static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_dep
decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_cc;
int i;
*pi_reorder_depth = 0;
*pi_reorder_depth = p_sys->cc.b_reorder ? 0 : -1;
for( i = 0; i < 4; i++ )
pb_present[i] = p_sys->cc.pb_present[i];
......@@ -331,7 +331,7 @@ static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_dep
memcpy( p_cc->p_buffer, p_sys->cc.p_data, p_sys->cc.i_data );
p_cc->i_dts =
p_cc->i_pts = p_sys->cc.b_reorder ? p_sys->i_cc_pts : p_sys->i_cc_dts;
p_cc->i_flags = p_sys->cc.b_reorder ? p_sys->i_cc_flags : BLOCK_FLAG_TYPE_P;
p_cc->i_flags = p_sys->i_cc_flags & BLOCK_FLAG_TYPE_MASK;
}
cc_Flush( &p_sys->cc );
return p_cc;
......
......@@ -766,13 +766,10 @@ static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_dep
{
decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_cc;
*pi_reorder_depth = p_sys->cc.b_reorder ? 4 : -1;
for( int i = 0; i < 4; i++ )
pb_present[i] = p_sys->cc.pb_present[i];
*pi_reorder_depth = 0;
if( p_sys->cc.i_data <= 0 )
return NULL;
p_cc = block_Alloc( p_sys->cc.i_data);
if( p_cc )
......@@ -780,7 +777,7 @@ static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_dep
memcpy( p_cc->p_buffer, p_sys->cc.p_data, p_sys->cc.i_data );
p_cc->i_dts =
p_cc->i_pts = p_sys->cc.b_reorder ? p_sys->i_cc_pts : p_sys->i_cc_dts;
p_cc->i_flags = ( p_sys->cc.b_reorder ? p_sys->i_cc_flags : BLOCK_FLAG_TYPE_P ) & BLOCK_FLAG_TYPE_MASK;
p_cc->i_flags = p_sys->i_cc_flags & BLOCK_FLAG_TYPE_MASK;
}
cc_Flush( &p_sys->cc );
return p_cc;
......
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