Commit 8728715d authored by François Cartegnie's avatar François Cartegnie 🤞

decoder: pass cc sub decoders reorder depth through QueueCC

no comment
parent 8654ef67
...@@ -130,7 +130,7 @@ struct decoder_t ...@@ -130,7 +130,7 @@ struct decoder_t
* pb_present will be used to known which cc channel are present (but * pb_present will be used to known which cc channel are present (but
* globaly, not necessary for the current packet. Video decoders should use * globaly, not necessary for the current packet. Video decoders should use
* the decoder_QueueCc() function to pass closed captions. */ * the decoder_QueueCc() function to pass closed captions. */
block_t * ( * pf_get_cc ) ( decoder_t *, bool pb_present[4] ); block_t * ( * pf_get_cc ) ( decoder_t *, bool pb_present[4], int * );
/* Meta data at codec level /* Meta data at codec level
* The decoder owner set it back to NULL once it has retreived what it needs. * The decoder owner set it back to NULL once it has retreived what it needs.
...@@ -178,7 +178,7 @@ struct decoder_t ...@@ -178,7 +178,7 @@ struct decoder_t
/* XXX use decoder_QueueAudio */ /* XXX use decoder_QueueAudio */
int (*pf_queue_audio)( decoder_t *, block_t * ); int (*pf_queue_audio)( decoder_t *, block_t * );
/* XXX use decoder_QueueCC */ /* XXX use decoder_QueueCC */
int (*pf_queue_cc)( decoder_t *, block_t *, bool p_cc_present[4] ); int (*pf_queue_cc)( decoder_t *, block_t *, bool p_cc_present[4], int );
/* XXX use decoder_QueueSub */ /* XXX use decoder_QueueSub */
int (*pf_queue_sub)( decoder_t *, subpicture_t *); int (*pf_queue_sub)( decoder_t *, subpicture_t *);
void *p_queue_ctx; void *p_queue_ctx;
...@@ -311,17 +311,19 @@ static inline int decoder_QueueVideo( decoder_t *dec, picture_t *p_pic ) ...@@ -311,17 +311,19 @@ static inline int decoder_QueueVideo( decoder_t *dec, picture_t *p_pic )
* \param p_cc the closed-caption to queue * \param p_cc the closed-caption to queue
* \param p_cc_present array-of-bool where each entry indicates whether the * \param p_cc_present array-of-bool where each entry indicates whether the
* given channel is present or not * given channel is present or not
* \param i_depth the closed-caption to queue reorder depth, or simply 0
* if using the old mpgv block flag tagging
* \return 0 if queued, -1 on error * \return 0 if queued, -1 on error
*/ */
static inline int decoder_QueueCc( decoder_t *dec, block_t *p_cc, static inline int decoder_QueueCc( decoder_t *dec, block_t *p_cc,
bool p_cc_present[4] ) bool p_cc_present[4], int i_depth )
{ {
if( dec->pf_queue_cc == NULL ) if( dec->pf_queue_cc == NULL )
{ {
block_Release( p_cc ); block_Release( p_cc );
return -1; return -1;
} }
return dec->pf_queue_cc( dec, p_cc, p_cc_present ); return dec->pf_queue_cc( dec, p_cc, p_cc_present, i_depth );
} }
/** /**
......
...@@ -1154,8 +1154,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block, bool *error ...@@ -1154,8 +1154,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block, bool *error
p_cc->i_dts = p_cc->i_pts = i_pts; p_cc->i_dts = p_cc->i_pts = i_pts;
else else
p_cc->i_pts = p_cc->i_dts; p_cc->i_pts = p_cc->i_dts;
p_dec->fmt_out.subs.cc.i_reorder_depth = 4; decoder_QueueCc( p_dec, p_cc, p_sys->cc.pb_present, 4 );
decoder_QueueCc( p_dec, p_cc, p_sys->cc.pb_present );
} }
cc_Flush( &p_sys->cc ); cc_Flush( &p_sys->cc );
} }
......
...@@ -719,7 +719,7 @@ static void SendCc( decoder_t *p_dec ) ...@@ -719,7 +719,7 @@ static void SendCc( decoder_t *p_dec )
p_cc->i_dts = 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_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_I|BLOCK_FLAG_TYPE_P|BLOCK_FLAG_TYPE_B); p_cc->i_flags = ( p_sys->cc.b_reorder ? p_sys->i_cc_flags : BLOCK_FLAG_TYPE_P ) & ( BLOCK_FLAG_TYPE_I|BLOCK_FLAG_TYPE_P|BLOCK_FLAG_TYPE_B);
decoder_QueueCc( p_dec, p_cc, p_sys->cc.pb_present ); decoder_QueueCc( p_dec, p_cc, p_sys->cc.pb_present, 0 );
} }
cc_Flush( &p_sys->cc ); cc_Flush( &p_sys->cc );
return; return;
......
...@@ -135,7 +135,7 @@ struct decoder_sys_t ...@@ -135,7 +135,7 @@ struct decoder_sys_t
static block_t *Packetize( decoder_t *, block_t ** ); static block_t *Packetize( decoder_t *, block_t ** );
static block_t *PacketizeAVC1( decoder_t *, block_t ** ); static block_t *PacketizeAVC1( decoder_t *, block_t ** );
static block_t *GetCc( decoder_t *p_dec, bool pb_present[4] ); static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int * );
static void PacketizeFlush( decoder_t * ); static void PacketizeFlush( decoder_t * );
static void PacketizeReset( void *p_private, bool b_broken ); static void PacketizeReset( void *p_private, bool b_broken );
...@@ -490,8 +490,9 @@ static block_t *PacketizeAVC1( decoder_t *p_dec, block_t **pp_block ) ...@@ -490,8 +490,9 @@ static block_t *PacketizeAVC1( decoder_t *p_dec, block_t **pp_block )
/***************************************************************************** /*****************************************************************************
* GetCc: * GetCc:
*****************************************************************************/ *****************************************************************************/
static block_t *GetCc( decoder_t *p_dec, bool pb_present[4] ) static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_depth )
{ {
*pi_reorder_depth = 0;
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 );
} }
......
...@@ -69,7 +69,7 @@ static block_t *PacketizeParse(void *p_private, bool *pb_ts_used, block_t *); ...@@ -69,7 +69,7 @@ static block_t *PacketizeParse(void *p_private, bool *pb_ts_used, block_t *);
static block_t *ParseNALBlock(decoder_t *, bool *pb_ts_used, block_t *); static block_t *ParseNALBlock(decoder_t *, bool *pb_ts_used, block_t *);
static int PacketizeValidate(void *p_private, block_t *); static int PacketizeValidate(void *p_private, block_t *);
static bool ParseSEICallback( const hxxx_sei_data_t *, void * ); static bool ParseSEICallback( const hxxx_sei_data_t *, void * );
static block_t *GetCc( decoder_t *, bool pb_present[4] ); static block_t *GetCc( decoder_t *, bool pb_present[4], int * );
struct decoder_sys_t struct decoder_sys_t
{ {
...@@ -300,8 +300,9 @@ static void PacketizeFlush( decoder_t *p_dec ) ...@@ -300,8 +300,9 @@ static void PacketizeFlush( decoder_t *p_dec )
/***************************************************************************** /*****************************************************************************
* GetCc: * GetCc:
*****************************************************************************/ *****************************************************************************/
static block_t *GetCc( decoder_t *p_dec, bool pb_present[4] ) static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_depth )
{ {
*pi_reorder_depth = 0;
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 );
} }
......
...@@ -145,7 +145,7 @@ struct decoder_sys_t ...@@ -145,7 +145,7 @@ struct decoder_sys_t
static block_t *Packetize( decoder_t *, block_t ** ); static block_t *Packetize( decoder_t *, block_t ** );
static void PacketizeFlush( decoder_t * ); static void PacketizeFlush( decoder_t * );
static block_t *GetCc( decoder_t *p_dec, bool pb_present[4] ); static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int * );
static void PacketizeReset( void *p_private, bool b_broken ); static void PacketizeReset( void *p_private, bool b_broken );
static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t * ); static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t * );
...@@ -281,11 +281,12 @@ static void PacketizeFlush( decoder_t *p_dec ) ...@@ -281,11 +281,12 @@ static void PacketizeFlush( decoder_t *p_dec )
/***************************************************************************** /*****************************************************************************
* GetCc: * GetCc:
*****************************************************************************/ *****************************************************************************/
static block_t *GetCc( decoder_t *p_dec, bool pb_present[4] ) static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_depth )
{ {
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_cc; block_t *p_cc;
int i; int i;
*pi_reorder_depth = 0;
for( i = 0; i < 4; i++ ) for( i = 0; i < 4; i++ )
pb_present[i] = p_sys->cc.pb_present[i]; pb_present[i] = p_sys->cc.pb_present[i];
......
...@@ -129,7 +129,7 @@ static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t * ); ...@@ -129,7 +129,7 @@ static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t * );
static int PacketizeValidate( void *p_private, block_t * ); static int PacketizeValidate( void *p_private, block_t * );
static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag ); static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag );
static block_t *GetCc( decoder_t *p_dec, bool pb_present[4] ); static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int * );
static const uint8_t p_vc1_startcode[3] = { 0x00, 0x00, 0x01 }; static const uint8_t p_vc1_startcode[3] = { 0x00, 0x00, 0x01 };
/***************************************************************************** /*****************************************************************************
...@@ -762,13 +762,14 @@ static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag ) ...@@ -762,13 +762,14 @@ static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag )
/***************************************************************************** /*****************************************************************************
* GetCc: * GetCc:
*****************************************************************************/ *****************************************************************************/
static block_t *GetCc( decoder_t *p_dec, bool pb_present[4] ) static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_depth )
{ {
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_cc; block_t *p_cc;
for( int i = 0; i < 4; i++ ) for( int i = 0; i < 4; i++ )
pb_present[i] = p_sys->cc.pb_present[i]; pb_present[i] = p_sys->cc.pb_present[i];
*pi_reorder_depth = 0;
if( p_sys->cc.i_data <= 0 ) if( p_sys->cc.i_data <= 0 )
return NULL; return NULL;
......
...@@ -874,7 +874,7 @@ static void DecoderProcessSout( decoder_t *p_dec, block_t *p_block ) ...@@ -874,7 +874,7 @@ static void DecoderProcessSout( decoder_t *p_dec, block_t *p_block )
#endif #endif
static void DecoderPlayCc( decoder_t *p_dec, block_t *p_cc, static void DecoderPlayCc( decoder_t *p_dec, block_t *p_cc,
bool pb_present[4], const subs_format_t *p_fmt ) bool pb_present[4], int i_reorder_depth )
{ {
decoder_owner_sys_t *p_owner = p_dec->p_owner; decoder_owner_sys_t *p_owner = p_dec->p_owner;
bool b_processed = false; bool b_processed = false;
...@@ -887,7 +887,7 @@ static void DecoderPlayCc( decoder_t *p_dec, block_t *p_cc, ...@@ -887,7 +887,7 @@ static void DecoderPlayCc( decoder_t *p_dec, block_t *p_cc,
if( p_owner->cc.pp_decoder[i] ) if( p_owner->cc.pp_decoder[i] )
i_cc_decoder++; i_cc_decoder++;
} }
p_owner->cc.i_reorder_depth = p_fmt->cc.i_reorder_depth; p_owner->cc.i_reorder_depth = i_reorder_depth;
for( int i = 0; i < 4; i++ ) for( int i = 0; i < 4; i++ )
{ {
...@@ -918,14 +918,15 @@ static void PacketizerGetCc( decoder_t *p_dec, decoder_t *p_dec_cc ) ...@@ -918,14 +918,15 @@ static void PacketizerGetCc( decoder_t *p_dec, decoder_t *p_dec_cc )
assert( p_dec_cc->pf_get_cc != NULL ); assert( p_dec_cc->pf_get_cc != NULL );
p_cc = p_dec_cc->pf_get_cc( p_dec_cc, pb_present ); int i_reorder_depth;
p_cc = p_dec_cc->pf_get_cc( p_dec_cc, pb_present, &i_reorder_depth );
if( !p_cc ) if( !p_cc )
return; return;
DecoderPlayCc( p_dec, p_cc, pb_present, &p_dec_cc->fmt_out.subs ); DecoderPlayCc( p_dec, p_cc, pb_present, i_reorder_depth );
} }
static int DecoderQueueCc( decoder_t *p_videodec, block_t *p_cc, static int DecoderQueueCc( decoder_t *p_videodec, block_t *p_cc,
bool p_cc_present[4] ) bool p_cc_present[4], int i_reorder_depth )
{ {
decoder_owner_sys_t *p_owner = p_videodec->p_owner; decoder_owner_sys_t *p_owner = p_videodec->p_owner;
...@@ -933,7 +934,7 @@ static int DecoderQueueCc( decoder_t *p_videodec, block_t *p_cc, ...@@ -933,7 +934,7 @@ static int DecoderQueueCc( decoder_t *p_videodec, block_t *p_cc,
{ {
if( p_owner->cc.b_supported && if( p_owner->cc.b_supported &&
( !p_owner->p_packetizer || !p_owner->p_packetizer->pf_get_cc ) ) ( !p_owner->p_packetizer || !p_owner->p_packetizer->pf_get_cc ) )
DecoderPlayCc( p_videodec, p_cc, p_cc_present, &p_videodec->fmt_out.subs ); DecoderPlayCc( p_videodec, p_cc, p_cc_present, i_reorder_depth );
else else
block_Release( p_cc ); block_Release( 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