int64_t last_pts;
int cadence[12];
int flag;
- hb_subtitle_t * subtitle;
+ hb_list_t * list_subtitle;
} hb_libmpeg2_t;
/**********************************************************************
uint8_t cc_valid = (*cc_block & 4) >>2;
uint8_t cc_type = *cc_block & 3;
hb_buffer_t *cc_buf;
+ int i;
+ hb_subtitle_t * subtitle;
if( !m->job )
{
{
case 0:
// CC1 stream
- cc_buf = hb_buffer_init( 2 );
- if( cc_buf )
+ for (i = 0; i < hb_list_count( m->list_subtitle ); i++)
{
- cc_buf->start = m->last_pts;
- memcpy( cc_buf->data, cc_block+1, 2 );
- hb_fifo_push( m->subtitle->fifo_in, cc_buf );
+ subtitle = hb_list_item( m->list_subtitle, i );
+ cc_buf = hb_buffer_init( 2 );
+ if( cc_buf )
+ {
+ cc_buf->start = m->last_pts;
+ memcpy( cc_buf->data, cc_block+1, 2 );
+ hb_fifo_push( subtitle->fifo_in, cc_buf );
+ }
}
break;
case 1:
*
* Send them on to the closed caption decoder if requested and found.
*/
- if( ( !m->job || m->subtitle) &&
+ if( ( !m->job || hb_list_count( m->list_subtitle) ) &&
( m->info->user_data_len != 0 &&
m->info->user_data[0] == 0x43 &&
m->info->user_data[1] == 0x43 ) )
}
subtitle->format = TEXTSUB;
subtitle->source = CC608SUB;
- subtitle->dest = PASSTHRUSUB;
+ subtitle->config.dest = PASSTHRUSUB;
subtitle->type = 5;
hb_list_add( m->title->list_subtitle, subtitle );
* If not scanning, then are we supposed to extract Closed Captions
* and send them to the decoder?
*/
+ pv->libmpeg2->list_subtitle = hb_list_init();
if( job )
{
hb_subtitle_t * subtitle;
subtitle = hb_list_item( job->list_subtitle, i);
if( subtitle && subtitle->source == CC608SUB )
{
- pv->libmpeg2->subtitle = subtitle;
- break;
+ hb_list_add(pv->libmpeg2->list_subtitle, subtitle);
}
}
/* if we got an empty buffer signaling end-of-stream send it downstream */
if ( (*buf_in)->size == 0 )
{
+ int i;
+
hb_list_add( pv->list, *buf_in );
*buf_in = NULL;
status = HB_WORK_DONE;
/*
* Let the Closed Captions know that it is the end of the data.
*/
- if( pv->libmpeg2->subtitle )
+ for (i = 0; i < hb_list_count( pv->libmpeg2->list_subtitle ); i++)
{
+ hb_subtitle_t * subtitle;
hb_buffer_t *buf_eof = hb_buffer_init( 0 );
+ subtitle = hb_list_item( pv->libmpeg2->list_subtitle, i );
if( buf_eof )
{
- hb_fifo_push( pv->libmpeg2->subtitle->fifo_in, buf_eof );
+ hb_fifo_push( subtitle->fifo_in, buf_eof );
}
}
}
hb_log( "mpeg2 done: %d frames", pv->libmpeg2->nframes );
}
hb_list_close( &pv->list );
+ hb_list_close( &pv->libmpeg2->list_subtitle );
hb_libmpeg2_close( &pv->libmpeg2 );
free( pv );
}