Commit 2d1719b7 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Backport of [24381]

parent 9c2863b3
......@@ -247,11 +247,14 @@ static int Open( vlc_object_t *p_this )
p_dec->fmt_out.i_extra = 0; p_dec->fmt_out.p_extra = NULL;
/* Set the new extradata */
p_dec->fmt_out.i_extra = p_sys->p_pps->i_buffer + p_sys->p_sps->i_buffer;
p_dec->fmt_out.p_extra = (uint8_t*)malloc( p_dec->fmt_out.i_extra );
memcpy( (uint8_t*)p_dec->fmt_out.p_extra, p_sys->p_sps->p_buffer, p_sys->p_sps->i_buffer);
memcpy( (uint8_t*)p_dec->fmt_out.p_extra+p_sys->p_sps->i_buffer, p_sys->p_pps->p_buffer, p_sys->p_pps->i_buffer);
p_sys->b_header = VLC_TRUE;
if( p_dec->fmt_out.p_extra )
{
p_dec->fmt_out.i_extra = p_sys->p_pps->i_buffer + p_sys->p_sps->i_buffer;
memcpy( (uint8_t*)p_dec->fmt_out.p_extra, p_sys->p_sps->p_buffer, p_sys->p_sps->i_buffer);
memcpy( (uint8_t*)p_dec->fmt_out.p_extra+p_sys->p_sps->i_buffer, p_sys->p_pps->p_buffer, p_sys->p_pps->i_buffer);
p_sys->b_header = VLC_TRUE;
}
/* Set callback */
p_dec->pf_packetize = PacketizeAVC1;
......@@ -483,23 +486,26 @@ static void nal_get_decoded( uint8_t **pp_ret, int *pi_ret,
uint8_t *end = &src[i_src];
uint8_t *dst = malloc( i_src );
*pp_ret = dst;
while( src < end )
if( dst )
{
if( src < end - 3 && src[0] == 0x00 && src[1] == 0x00 &&
src[2] == 0x03 )
*pp_ret = dst;
while( src < end )
{
*dst++ = 0x00;
*dst++ = 0x00;
if( src < end - 3 && src[0] == 0x00 && src[1] == 0x00 &&
src[2] == 0x03 )
{
*dst++ = 0x00;
*dst++ = 0x00;
src += 3;
continue;
src += 3;
continue;
}
*dst++ = *src++;
}
*dst++ = *src++;
}
*pi_ret = dst - *pp_ret;
*pi_ret = dst - *pp_ret;
}
}
static inline int bs_read_ue( bs_t *s )
......@@ -520,7 +526,6 @@ static inline int bs_read_se( bs_t *s )
return val&0x01 ? (val+1)/2 : -(val/2);
}
/*****************************************************************************
* ParseNALBlock: parses annexB type NALs
* All p_frag blocks are required to start with 0 0 0 1 4-byte startcode
......@@ -578,8 +583,8 @@ static block_t *ParseNALBlock( decoder_t *p_dec, block_t *p_frag )
}
else if( i_nal_type >= NAL_SLICE && i_nal_type <= NAL_SLICE_IDR )
{
uint8_t *dec;
int i_dec, i_first_mb, i_slice_type;
uint8_t *dec = NULL;
int i_dec = 0, i_first_mb, i_slice_type;
slice_t slice;
vlc_bool_t b_pic;
bs_t s;
......@@ -661,7 +666,9 @@ static block_t *ParseNALBlock( decoder_t *p_dec, block_t *p_frag )
slice.i_field_pic_flag != p_sys->slice.i_field_pic_flag ||
slice.i_nal_ref_idc != p_sys->slice.i_nal_ref_idc )
b_pic = VLC_TRUE;
if( slice.i_bottom_field_flag != -1 && p_sys->slice.i_bottom_field_flag != -1 && slice.i_bottom_field_flag != p_sys->slice.i_bottom_field_flag )
if( slice.i_bottom_field_flag != -1 &&
p_sys->slice.i_bottom_field_flag != -1 &&
slice.i_bottom_field_flag != p_sys->slice.i_bottom_field_flag )
b_pic = VLC_TRUE;
if( p_sys->i_pic_order_cnt_type == 0 &&
( slice.i_pic_order_cnt_lsb != p_sys->slice.i_pic_order_cnt_lsb ||
......@@ -687,8 +694,8 @@ static block_t *ParseNALBlock( decoder_t *p_dec, block_t *p_frag )
}
else if( i_nal_type == NAL_SPS )
{
uint8_t *dec;
int i_dec;
uint8_t *dec = NULL;
int i_dec = 0;
bs_t s;
int i_tmp;
......
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