-static subpicture_t *transcode_spu_get( sout_stream_t *p_stream,
- sout_stream_id_t *id,
- mtime_t display_date )
-{
- sout_stream_sys_t *p_sys = p_stream->p_sys;
- subpicture_t *p_subpic = 0;
- subpicture_t *p_ephemer = 0;
- subpicture_t **pp_subpic = &p_subpic;
- int i;
-
- /* Find current subpictures and remove old ones */
- for( i = 0; i < SUBPICTURE_RING_SIZE; i++ )
- {
- if( !p_sys->pp_subpics[i] ) continue;
-
- if( !p_sys->pp_subpics[i]->b_ephemer &&
- p_sys->pp_subpics[i]->i_stop < display_date )
- {
- spu_del_buffer( id->p_decoder, p_sys->pp_subpics[i] );
- p_sys->pp_subpics[i] = NULL;
- continue;
- }
-
- if( p_sys->pp_subpics[i]->i_start > display_date ) continue;
-
- if( p_sys->pp_subpics[i]->b_ephemer && !p_ephemer )
- {
- p_ephemer = p_sys->pp_subpics[i];
- }
- else if( p_sys->pp_subpics[i]->b_ephemer )
- {
- if( p_ephemer->i_start < p_sys->pp_subpics[i]->i_start )
- {
- subpicture_t tmp;
- tmp = *p_ephemer;
- *p_ephemer = *p_sys->pp_subpics[i];
- *p_sys->pp_subpics[i] = tmp;
- }
-
- spu_del_buffer( id->p_decoder, p_sys->pp_subpics[i] );
- p_sys->pp_subpics[i] = NULL;
- continue;
- }
-
- /* Add subpicture to the list */
- *pp_subpic = p_sys->pp_subpics[i];
- pp_subpic = &p_sys->pp_subpics[i]->p_next;
- }
-
- return p_subpic;
-}
-