/* */
if( p_dec->fmt_in.i_extra > 0 )
- {
- block_t *p_init = block_New( p_dec, p_dec->fmt_in.i_extra );
- block_t *p_pic;
-
- memcpy( p_init->p_buffer, p_dec->fmt_in.p_extra,
- p_dec->fmt_in.i_extra );
-
- while( ( p_pic = Packetize( p_dec, &p_init ) ) )
- {
- /* Should not occur because we should only receive SPS/PPS */
- block_Release( p_pic );
- }
- }
+ packetizer_Header( &p_sys->packetizer,
+ p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra );
}
return VLC_SUCCESS;
}
}
+static inline void packetizer_Header( packetizer_t *p_pack,
+ const uint8_t *p_header, int i_header )
+{
+ block_t *p_init = block_Alloc( i_header );
+ if( !p_init )
+ return;
+
+ memcpy( p_init->p_buffer, p_header, i_header );
+
+ block_t *p_pic;
+ while( ( p_pic = packetizer_Packetize( p_pack, &p_init ) ) )
+ block_Release( p_pic ); /* Should not happen (only sequence header) */
+}
+
#endif
/* */
if( p_dec->fmt_out.i_extra > 0 )
- {
- block_t *p_init = block_New( p_dec, p_dec->fmt_out.i_extra );
-
- memcpy( p_init->p_buffer, p_dec->fmt_out.p_extra,
- p_dec->fmt_out.i_extra );
-
- block_t *p_pic;
- while( ( p_pic = Packetize( p_dec, &p_init ) ) )
- block_Release( p_pic ); /* Should not happen (only sequence header) */
- }
+ packetizer_Header( &p_sys->packetizer,
+ p_dec->fmt_out.p_extra, p_dec->fmt_out.i_extra );
}
return VLC_SUCCESS;