hb_dvd_t * dvd;
hb_buffer_t * ps;
hb_stream_t * stream;
+
+ uint sequence;
} hb_reader_t;
r->job = job;
r->title = job->title;
r->die = job->die;
+ r->sequence = 0;
return hb_thread_init( "reader", ReaderFunc, r,
HB_NORMAL_PRIORITY );
hb_buffer_t * buf;
hb_list_t * list;
int chapter = -1;
+ int chapter_end = r->job->chapter_end;
if( !( r->dvd = hb_dvd_init( r->title->dvd ) ) )
{
if (r->dvd)
{
- if( !hb_dvd_start( r->dvd, r->title->index, r->job->chapter_start ) )
+ /*
+ * XXX this code is a temporary hack that should go away if/when
+ * chapter merging goes away in libhb/dvd.c
+ * map the start and end chapter numbers to on-media chapter
+ * numbers since chapter merging could cause the handbrake numbers
+ * to diverge from the media numbers and, if our chapter_end is after
+ * a media chapter that got merged, we'll stop ripping too early.
+ */
+ int start = r->job->chapter_start;
+ hb_chapter_t * chap = hb_list_item( r->title->list_chapter, chapter_end - 1 );
+
+ chapter_end = chap->index;
+ if (start > 1)
+ {
+ chap = hb_list_item( r->title->list_chapter, start - 1 );
+ start = chap->index;
+ }
+ /* end chapter mapping XXX */
+
+ if( !hb_dvd_start( r->dvd, r->title->index, start ) )
{
hb_dvd_close( &r->dvd );
return;
}
}
- if (r->stream)
- {
- // At this point r->audios[0] gives us the index of the selected audio track for output track 0
- // we cannot effectively demux multiple PID's into the seperate output tracks unfortunately
- // so we'll just specifiy things here for a single track.
- hb_stream_set_selected_audio_pid_index(r->stream, r->job->audios[0]);
- }
-
list = hb_list_init();
r->ps = hb_buffer_init( HB_DVD_READ_BUFFER_SIZE );
hb_log( "reader: end of the title reached" );
break;
}
- if( chapter > r->job->chapter_end )
+ if( chapter > chapter_end )
{
- hb_log( "reader: end of chapter %d reached (%d)",
- r->job->chapter_end, chapter );
+ hb_log( "reader: end of chapter %d (media %d) reached at media chapter %d",
+ r->job->chapter_end, chapter_end, chapter );
break;
}
}
}
- if( r->job->subtitle_scan )
+ if( r->job->indepth_scan )
{
/*
* Need to update the progress during a subtitle scan
p.seconds = -1;
hb_set_state( r->job->h, &state );
}
-
+
hb_demux_ps( r->ps, list );
while( ( buf = hb_list_item( list, 0 ) ) )
{
hb_snooze( 50 );
}
+ buf->sequence = r->sequence++;
hb_fifo_push( fifo, buf );
}
else
if( id == 0xE0 )
{
- if( !job->subtitle_scan )
+ if( job->indepth_scan )
{
- return job->fifo_mpeg2;
- } else {
/*
- * Ditch the mpeg2 video when doing a subtitle scan.
+ * Ditch the video here during the indepth scan until
+ * we can improve the MPEG2 decode performance.
*/
return NULL;
+ }
+ else
+ {
+ return job->fifo_mpeg2;
}
}
- if (job->subtitle_scan) {
+ if( job->indepth_scan ) {
/*
* Count the occurances of the subtitles, don't actually
* return any to encode unless we are looking fro forced
return subtitle->fifo_in;
}
}
- for( i = 0; i < hb_list_count( title->list_audio ); i++ )
+ if( !job->indepth_scan )
{
- audio = hb_list_item( title->list_audio, i );
- if( id == audio->id )
+ for( i = 0; i < hb_list_count( title->list_audio ); i++ )
{
- return audio->fifo_in;
+ audio = hb_list_item( title->list_audio, i );
+ if( id == audio->id )
+ {
+ return audio->fifo_in;
+ }
}
}