* completed encapsulation units from the front */
block_t *p_outqueue;
block_t **pp_outqueue_last;
- /* p_out_dts points to an element in p_outqueue. It is used for VLC's
- * fake pts hidden in DTS hack, as used by AVI */
- block_t *p_out_dts;
uint32_t u_tg_last_picnum; /*< most recent picturenumber output from RoB */
bool b_tg_last_picnum; /*< u_tg_last_picnum valid */
p_block->i_flags = DIRAC_NON_DATED;
- return p_block;
-
(void) p_dec;
+ return p_block;
}
/***
{
return NULL; /* retry later */
}
- /* attempt to syncronise backwards from pu.u_next_offset */
+ /* attempt to synchronise backwards from pu.u_next_offset */
p_sys->i_offset = pu.u_next_offset;
/* fall through */
case TRY_SYNC: /* -> SYNCED | NOT_SYNCED */
Actually, this is a bad idea:
- It sets the discontinuity for every dirac EOS packet
which doesnt imply a time discontinuity.
- - When the syncronizer detects a real discontinuity, it
+ - When the synchronizer detects a real discontinuity, it
should copy the flags through.
p_eu->i_flags |= BLOCK_FLAG_DISCONTINUITY;
*/
if( p_sys->b_dts == p_sys->b_pts )
return 0;
- if( !p_sys->p_out_dts )
- p_sys->p_out_dts = p_sys->p_outqueue;
-
/* model the reorder buffer */
block_t *p_block = dirac_Reorder( p_dec, p_block_in, u_picnum );
if( !p_block )
p_sys->b_tg_last_picnum = true;
p_sys->u_tg_last_picnum = u_picnum;
- if( !p_sys->b_pts )
+ return 0;
+}
+
+
+static void dirac_ReorderDequeueAndReleaseBlock( decoder_t *p_dec, block_t *p_block )
+{
+ decoder_sys_t *p_sys = p_dec->p_sys;
+ /* Check if that block is present in reorder queue and release it
+ if needed */
+ struct dirac_reorder_entry **pp_at = &p_sys->reorder_buf.p_head;
+ for( ; *pp_at; pp_at = &(*pp_at)->p_next )
{
- /* some demuxers (eg, AVI) will provide a series of fake dts values,
- * which are actually inorder pts values (ie, what should be seen at
- * the output of a decoder. A main reason for simulating the reorder
- * buffer is to turn the inorder fakedts into an out-of-order pts */
- p_block->i_pts = p_sys->p_out_dts->i_dts;
- p_sys->p_out_dts->i_dts = VLC_TS_INVALID;
- }
+ /* backup address in case we remove member */
+ struct dirac_reorder_entry *p_entry = *pp_at;
+ if ( p_entry->p_eu == p_block )
+ {
+ /* unlink member */
+ *pp_at = (*pp_at)->p_next;
- /* If pts was copied from dts, the dts needs to be corrected to account for reordering*/
- /* If dts has never been seen, the same needs to happen */
- p_sys->p_out_dts->i_dts = p_block->i_pts - p_sys->i_pts_offset;
+ /* Add to empty reorder entry list*/
+ p_entry->p_next = p_sys->reorder_buf.p_empty;
+ p_sys->reorder_buf.p_empty = p_entry;
- /* move dts pointer */
- if( p_sys->p_out_dts )
- p_sys->p_out_dts = p_sys->p_out_dts->p_next;
+ p_sys->reorder_buf.u_size--;
+ break;
+ }
+ }
- return 0;
+ block_Release( p_block );
}
/*****************************************************************************
if( p_block )
{
p_block->p_next = dirac_EmitEOS( p_dec, 13 );
- /* need two EOS to ensure it gets detected by syncro
+ /* need two EOS to ensure it gets detected by synchro
* duplicates get discarded in forming encapsulation unit */
}
}
}
/* form as many encapsulation units as possible, give up
- * when the syncronizer runs out of input data */
+ * when the synchronizer runs out of input data */
while( ( p_block = dirac_DoSync( p_dec ) ) )
{
p_block = dirac_BuildEncapsulationUnit( p_dec, p_block );
dirac_ReorderInit( &p_sys->reorder_buf );
assert( p_sys->p_outqueue == NULL );
- p_sys->p_out_dts = NULL;
}
/* perform sanity check:
block_t *p_block_next = p_block->p_next;
if( p_block->i_pts > VLC_TS_INVALID && p_block->i_dts > VLC_TS_INVALID )
break;
- block_Release( p_block );
+ dirac_ReorderDequeueAndReleaseBlock( p_dec, p_block );
p_sys->p_outqueue = p_block = p_block_next;
}
}