-
- int b_bail = 0;
- size_t i_pulen = GetDWBE( p_block->p_buffer + i_bufused + 5 );
- uint8_t *p_pu = p_block->p_buffer + i_bufused;
-
- /* blocks that do not start with the parse info prefix are invalid */
- if( p_pu[0] != 'B' || p_pu[1] != 'B' ||
- p_pu[2] != 'C' || p_pu[3] != 'D')
- {
- *pp_block = NULL;
- block_Release( p_block );
- msg_Err( p_dec, "block does not start with dirac parse code" );
- break;
- }
-
- if( i_bufused + i_pulen > p_block->i_buffer ) {
- *pp_block = NULL;
- block_Release( p_block );
- break;
- }
-
- if( p_pu[4] & 0x08 )
- StorePicturePTS( p_dec, p_block, i_bufused );
-
- p_schrobuffer = schro_buffer_new_with_data( p_pu, i_pulen );
- if( i_pulen + i_bufused < p_block->i_buffer ) {
- /* don't let schro free this block, more data still in it */
- p_schrobuffer->free = 0;
- }
- else {
- p_schrobuffer->free = SchroBufferFree;
- p_schrobuffer->priv = p_block;
- b_bail = 1;
- }
-
- msg_Dbg( p_dec, "Inserting bytes into decoder len=%zu of %zu pts=%"PRId64,
- i_pulen, p_block->i_buffer, p_block->i_pts);
- /* this stops the same block being fed back into this function if
- * we were on the next iteration of this loop to output a picture */
- *pp_block = NULL;
- state = schro_decoder_push( p_sys->p_schro, p_schrobuffer );
-
- /* DO NOT refer to p_block after this point, it may have been freed */
-
- i_bufused += i_pulen;
-
- if( state == SCHRO_DECODER_FIRST_ACCESS_UNIT ) {
- msg_Dbg( p_dec, "SCHRO_DECODER_FIRST_ACCESS_UNIT");
- SetVideoFormat( p_dec );
- ResetPTStlb( p_dec );
- }
-
- if( b_bail )
- break;