Commit fb57b0db authored by François Cartegnie's avatar François Cartegnie 🤞

packetizer: hxxx: allow early stop in SEI parsing

parent fb0c9c6d
......@@ -167,7 +167,7 @@ static void PutSPS( decoder_t *p_dec, block_t *p_frag );
static void PutPPS( decoder_t *p_dec, block_t *p_frag );
static bool ParseSlice( decoder_t *p_dec, bool *pb_new_picture, slice_t *p_slice,
int i_nal_ref_idc, int i_nal_type, const block_t *p_frag );
static void ParseSeiCallback( const hxxx_sei_data_t *, void * );
static bool ParseSeiCallback( const hxxx_sei_data_t *, void * );
static const uint8_t p_h264_startcode[3] = { 0x00, 0x00, 0x01 };
......@@ -950,7 +950,7 @@ static bool ParseSlice( decoder_t *p_dec, bool *pb_new_picture, slice_t *p_slice
return true;
}
static void ParseSeiCallback( const hxxx_sei_data_t *p_sei_data, void *cbdata )
static bool ParseSeiCallback( const hxxx_sei_data_t *p_sei_data, void *cbdata )
{
decoder_t *p_dec = (decoder_t *) cbdata;
decoder_sys_t *p_sys = p_dec->p_sys;
......@@ -993,5 +993,6 @@ static void ParseSeiCallback( const hxxx_sei_data_t *p_sei_data, void *cbdata )
break;
}
return true;
}
......@@ -40,6 +40,7 @@ void HxxxParseSEI(const uint8_t *p_buf, size_t i_buf,
{
bs_t s;
unsigned i_bitflow = 0;
bool b_continue = true;
if( i_buf <= i_header )
return;
......@@ -48,7 +49,7 @@ void HxxxParseSEI(const uint8_t *p_buf, size_t i_buf,
s.p_fwpriv = &i_bitflow;
s.pf_forward = hxxx_bsfw_ep3b_to_rbsp; /* Does the emulated 3bytes conversion to rbsp */
while( bs_remain( &s ) >= 8 && bs_aligned( &s ) )
while( bs_remain( &s ) >= 8 && bs_aligned( &s ) && b_continue )
{
/* Read type */
unsigned i_type = 0;
......@@ -85,7 +86,7 @@ void HxxxParseSEI(const uint8_t *p_buf, size_t i_buf,
case HXXX_SEI_PIC_TIMING:
{
sei_data.p_bs = &s;
pf_callback( &sei_data, cbdata );
b_continue = pf_callback( &sei_data, cbdata );
} break;
/* Look for user_data_registered_itu_t_t35 */
......@@ -120,7 +121,7 @@ void HxxxParseSEI(const uint8_t *p_buf, size_t i_buf,
{
sei_data.itu_t35.i_cc = i_t35 - 3;
sei_data.itu_t35.p_cc = &p_t35[3];
pf_callback( &sei_data, cbdata );
b_continue = pf_callback( &sei_data, cbdata );
}
free( p_t35 );
......@@ -133,7 +134,7 @@ void HxxxParseSEI(const uint8_t *p_buf, size_t i_buf,
//bool b_exact_match = bs_read( &s, 1 );
//bool b_broken_link = bs_read( &s, 1 );
//int i_changing_slice_group = bs_read( &s, 2 );
pf_callback( &sei_data, cbdata );
b_continue = pf_callback( &sei_data, cbdata );
} break;
default:
......
......@@ -46,7 +46,7 @@ typedef struct
};
} hxxx_sei_data_t;
typedef void (*pf_hxxx_sei_callback)(const hxxx_sei_data_t *, void *);
typedef bool (*pf_hxxx_sei_callback)(const hxxx_sei_data_t *, void *);
void HxxxParseSEI(const uint8_t *, size_t, uint8_t, pf_hxxx_sei_callback, void *);
void HxxxParse_AnnexB_SEI(const uint8_t *, size_t, uint8_t, pf_hxxx_sei_callback, void *);
......
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