- /* If we have a subtitle for this picture, copy it */
- /* FIXME: we should avoid this memcpy */
- if( sub && subtitle &&
- subtitle->format == PICTURESUB )
- {
- if( sub->size > 0 )
- {
- if( subtitle->dest == RENDERSUB )
- {
- /*
- * Tack onto the video buffer for rendering
- */
- buf_tmp->sub = hb_buffer_init( sub->size );
- buf_tmp->sub->x = sub->x;
- buf_tmp->sub->y = sub->y;
- buf_tmp->sub->width = sub->width;
- buf_tmp->sub->height = sub->height;
- memcpy( buf_tmp->sub->data, sub->data, sub->size );
- } else {
- /*
- * Pass-Through, pop it off of the raw queue, rewrite times and
- * make it available to be reencoded.
- */
- uint64_t sub_duration;
- sub = hb_fifo_get( subtitle->fifo_raw );
- sub_duration = sub->stop - sub->start;
- sub->start = buf_tmp->start;
- sub->stop = sub->start + duration;
- hb_fifo_push( subtitle->fifo_sync, sub );
- }
- } else {
- /*
- * EOF - consume for rendered, else pass through
- */
- if( subtitle->dest == RENDERSUB )
- {
- sub = hb_fifo_get( subtitle->fifo_raw );
- hb_buffer_close( &sub );
- } else {
- sub = hb_fifo_get( subtitle->fifo_raw );
- hb_fifo_push( subtitle->fifo_out, sub );
- }
- }
- }
-