- job->fifo_mpeg2 = hb_fifo_init( 256 );
- job->fifo_raw = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
- job->fifo_sync = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
- job->fifo_render = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
- job->fifo_mpeg4 = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
-
- /* Synchronization */
- hb_list_add( job->list_work, ( w = hb_get_work( WORK_SYNC ) ) );
- w->fifo_in = NULL;
- w->fifo_out = NULL;
-
- /* Video decoder */
- int vcodec = title->video_codec? title->video_codec : WORK_DECMPEG2;
- hb_list_add( job->list_work, ( w = hb_get_work( vcodec ) ) );
- w->codec_param = title->video_codec_param;
- w->fifo_in = job->fifo_mpeg2;
- w->fifo_out = job->fifo_raw;
-
- /* Video renderer */
- hb_list_add( job->list_work, ( w = hb_get_work( WORK_RENDER ) ) );
- w->fifo_in = job->fifo_sync;
- w->fifo_out = job->fifo_render;
-
- if( !job->indepth_scan )
- {
-
- /* Video encoder */
- switch( job->vcodec )
- {
- case HB_VCODEC_FFMPEG:
- w = hb_get_work( WORK_ENCAVCODEC );
- break;
- case HB_VCODEC_XVID:
- w = hb_get_work( WORK_ENCXVID );
- break;
- case HB_VCODEC_X264:
- w = hb_get_work( WORK_ENCX264 );
- break;
- case HB_VCODEC_THEORA:
- w = hb_get_work( WORK_ENCTHEORA );
- break;
- }
- w->fifo_in = job->fifo_render;
- w->fifo_out = job->fifo_mpeg4;
- w->config = &job->config;
-
- hb_list_add( job->list_work, w );
- }
-
- if( job->select_subtitle && !job->indepth_scan )
- {
- /*
- * Must be second pass of a two pass with subtitle scan enabled, so
- * add the subtitle that we found on the first pass for use in this
- * pass.
- */
- if (*(job->select_subtitle))
- {
- hb_list_add( title->list_subtitle, *( job->select_subtitle ) );
- }
- }
-
- for( i=0; i < hb_list_count(title->list_subtitle); i++ )
- {
- subtitle = hb_list_item( title->list_subtitle, i );
-
- if( subtitle )
- {
- subtitle->fifo_in = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
- subtitle->fifo_raw = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
- subtitle->fifo_sync = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
- subtitle->fifo_out = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
-
- /*
- * Disable forced subtitles if we didn't find any in the scan
- * so that we display normal subtitles instead.
- *
- * select_subtitle implies that we did a scan.
- */
- if( !job->indepth_scan && subtitle->force &&
- job->select_subtitle )
- {
- if( subtitle->forced_hits == 0 )
- {
- subtitle->force = 0;
- }
- }
-
- if( (!job->indepth_scan || subtitle->force) &&
- subtitle->source == VOBSUB ) {
- /*
- * Don't add threads for subtitles when we are scanning, unless
- * looking for forced subtitles.
- */
- w = hb_get_work( WORK_DECVOBSUB );
- w->fifo_in = subtitle->fifo_in;
- w->fifo_out = subtitle->fifo_raw;
- w->subtitle = subtitle;
- hb_list_add( job->list_work, w );
- }
-
- if( !job->indepth_scan && subtitle->source == CC608SUB )
- {
- w = hb_get_work( WORK_DECCC608 );
- w->fifo_in = subtitle->fifo_in;
- w->fifo_out = subtitle->fifo_raw;
- hb_list_add( job->list_work, w );
- }
-
- if( !job->indepth_scan &&
- subtitle->format == PICTURESUB
- && subtitle->dest == PASSTHRUSUB )
- {
- /*
- * Passing through a subtitle picture, this will have to
- * be rle encoded before muxing.
- */
- w = hb_get_work( WORK_ENCVOBSUB );
- w->fifo_in = subtitle->fifo_sync;
- w->fifo_out = subtitle->fifo_out;
- w->subtitle = subtitle;
- hb_list_add( job->list_work, w );
- }
- }
- }