X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=libhb%2Fdvd.c;h=85fe47e8def82de8cbfc28c52eccdda1a3cd4871;hb=d65c00fe4e07d0adaf304f5cd25265d35ae7bef9;hp=3c78e2cbd54974cc5dcb302878d543c6627ba0cf;hpb=bcd20ea430ced01a2c10605c8f6a77de9c6af410;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/libhb/dvd.c b/libhb/dvd.c index 3c78e2cb..85fe47e8 100644 --- a/libhb/dvd.c +++ b/libhb/dvd.c @@ -1,7 +1,7 @@ /* $Id: dvd.c,v 1.12 2005/11/25 15:05:25 titer Exp $ This file is part of the HandBrake source code. - Homepage: . + Homepage: . It may be used under the terms of the GNU General Public License. */ #include "hb.h" @@ -83,7 +83,10 @@ hb_dvd_t * hb_dvd_init( char * path ) /* Open device */ if( !( d->reader = DVDOpen( path ) ) ) { - hb_error( "dvd: DVDOpen failed (%s)", path ); + /* + * Not an error, may be a stream - which we'll try in a moment. + */ + hb_log( "dvd: not a dvd - trying as a stream/file instead" ); goto fail; } @@ -162,6 +165,11 @@ hb_title_t * hb_dvd_title_scan( hb_dvd_t * d, int t ) goto fail; } + if( global_verbosity_level == 3 ) + { + ifoPrint( d->reader, title->vts ); + } + /* Position of the title in the VTS */ title->ttn = d->vmg->tt_srpt->title[t-1].vts_ttn; @@ -234,6 +242,7 @@ hb_title_t * hb_dvd_title_scan( hb_dvd_t * d, int t ) int audio_format, lang_code, audio_control, position, j; iso639_lang_t * lang; + int lang_extension = 0; hb_log( "scan: checking audio %d", i + 1 ); @@ -241,6 +250,7 @@ hb_title_t * hb_dvd_title_scan( hb_dvd_t * d, int t ) audio_format = vts->vtsi_mat->vts_audio_attr[i].audio_format; lang_code = vts->vtsi_mat->vts_audio_attr[i].lang_code; + lang_extension = vts->vtsi_mat->vts_audio_attr[i].code_extension; audio_control = vts->vts_pgcit->pgci_srp[pgc_id-1].pgc->audio_control[i]; @@ -306,6 +316,8 @@ hb_title_t * hb_dvd_title_scan( hb_dvd_t * d, int t ) continue; } + audio->config.lang.type = lang_extension; + lang = lang_for_code( vts->vtsi_mat->vts_audio_attr[i].lang_code ); snprintf( audio->config.lang.description, sizeof( audio->config.lang.description ), "%s (%s)", @@ -318,8 +330,27 @@ hb_title_t * hb_dvd_title_scan( hb_dvd_t * d, int t ) snprintf( audio->config.lang.iso639_2, sizeof( audio->config.lang.iso639_2 ), "%s", lang->iso639_2); - hb_log( "scan: id=%x, lang=%s, 3cc=%s", audio->id, - audio->config.lang.description, audio->config.lang.iso639_2 ); + switch( lang_extension ) + { + case 0: + case 1: + break; + case 2: + strcat( audio->config.lang.description, " (Visually Impaired)" ); + break; + case 3: + strcat( audio->config.lang.description, " (Director's Commentary 1)" ); + break; + case 4: + strcat( audio->config.lang.description, " (Director's Commentary 2)" ); + break; + default: + break; + } + + hb_log( "scan: id=%x, lang=%s, 3cc=%s ext=%i", audio->id, + audio->config.lang.description, audio->config.lang.iso639_2, + lang_extension ); audio->config.in.track = i; hb_list_add( title->list_audio, audio ); @@ -342,6 +373,7 @@ hb_title_t * hb_dvd_title_scan( hb_dvd_t * d, int t ) int spu_control; int position; iso639_lang_t * lang; + int lang_extension = 0; hb_log( "scan: checking subtitle %d", i + 1 ); @@ -373,14 +405,64 @@ hb_title_t * hb_dvd_title_scan( hb_dvd_t * d, int t ) position = ( spu_control >> 24 ) & 0x7F; } + lang_extension = vts->vtsi_mat->vts_subp_attr[i].code_extension; + lang = lang_for_code( vts->vtsi_mat->vts_subp_attr[i].lang_code ); subtitle = calloc( sizeof( hb_subtitle_t ), 1 ); subtitle->id = ( ( 0x20 + position ) << 8 ) | 0xbd; snprintf( subtitle->lang, sizeof( subtitle->lang ), "%s", strlen(lang->native_name) ? lang->native_name : lang->eng_name); - snprintf( subtitle->iso639_2, sizeof( subtitle->iso639_2 ), "%s", - lang->iso639_2); + snprintf( subtitle->iso639_2, sizeof( subtitle->iso639_2 ), "%s", + lang->iso639_2); + + subtitle->type = lang_extension; + + switch( lang_extension ) + { + case 0: + break; + case 1: + break; + case 2: + strcat( subtitle->lang, " (Caption with bigger size character)"); + break; + case 3: + strcat( subtitle->lang, " (Caption for Children)"); + break; + case 4: + break; + case 5: + strcat( subtitle->lang, " (Closed Caption)"); + break; + case 6: + strcat( subtitle->lang, " (Closed Caption with bigger size character)"); + break; + case 7: + strcat( subtitle->lang, " (Closed Caption for Children)"); + break; + case 8: + break; + case 9: + strcat( subtitle->lang, " (Forced Caption)"); + break; + case 10: + break; + case 11: + break; + case 12: + break; + case 13: + strcat( subtitle->lang, " (Director's Commentary)"); + break; + case 14: + strcat( subtitle->lang, " (Director's Commentary with bigger size character)"); + break; + case 15: + strcat( subtitle->lang, " (Director's Commentary for Children)"); + default: + break; + } hb_log( "scan: id=%x, lang=%s, 3cc=%s", subtitle->id, subtitle->lang, subtitle->iso639_2 ); @@ -485,17 +567,17 @@ hb_title_t * hb_dvd_title_scan( hb_dvd_t * d, int t ) switch( vts->vtsi_mat->vts_video_attr.display_aspect_ratio ) { case 0: - title->aspect = HB_ASPECT_BASE * 4 / 3; + title->container_aspect = 4. / 3.; break; case 3: - title->aspect = HB_ASPECT_BASE * 16 / 9; + title->container_aspect = 16. / 9.; break; default: hb_log( "scan: unknown aspect" ); goto fail; } - hb_log( "scan: aspect = %d", title->aspect ); + hb_log( "scan: aspect = %g", title->aspect ); /* This title is ok so far */ goto cleanup; @@ -868,11 +950,14 @@ int hb_dvd_read( hb_dvd_t * d, hb_buffer_t * b ) } else { - hb_log( "dvd: Beginning of Cell (%d) at block %d", d->cell_cur, - d->block ); + if ( d->block != d->pgc->cell_playback[d->cell_cur].first_sector ) + { + hb_log( "dvd: beginning of cell %d at block %d", d->cell_cur, + d->block ); + } if( d->in_cell ) { - hb_error( "dvd: Assuming missed End of Cell (%d)", d->cell_cur ); + hb_error( "dvd: assuming missed end of cell %d", d->cell_cur ); d->cell_cur = d->cell_next; d->next_vobu = d->pgc->cell_playback[d->cell_cur].first_sector; FindNextCell( d ); @@ -895,8 +980,12 @@ int hb_dvd_read( hb_dvd_t * d, hb_buffer_t * b ) if( ( dsi_pack.vobu_sri.next_vobu & (1 << 31 ) ) == 0 || ( dsi_pack.vobu_sri.next_vobu & 0x3fffffff ) == 0x3fffffff ) { - hb_log( "dvd: End of Cell (%d) at block %d", d->cell_cur, - d->block ); + if ( d->block <= d->pgc->cell_playback[d->cell_cur].first_sector || + d->block > d->pgc->cell_playback[d->cell_cur].last_sector ) + { + hb_log( "dvd: end of cell %d at block %d", d->cell_cur, + d->block ); + } d->cell_cur = d->cell_next; d->in_cell = 0; d->next_vobu = d->pgc->cell_playback[d->cell_cur].first_sector; @@ -962,7 +1051,7 @@ int hb_dvd_chapter( hb_dvd_t * d ) /*********************************************************************** * hb_dvd_is_break *********************************************************************** - * Returns 1 if the current block is a new chapter start + * Returns chapter number if the current block is a new chapter start **********************************************************************/ int hb_dvd_is_break( hb_dvd_t * d ) { @@ -988,8 +1077,7 @@ int hb_dvd_is_break( hb_dvd_t * d ) // This must not match against the start cell. if( pgc->cell_playback[cell].first_sector == d->block && cell != d->cell_start ) { - hb_log("dvd: Chapter Break Cell Found"); - return 1; + return i + 1; } }