/* $Id: dvd.c,v 1.12 2005/11/25 15:05:25 titer Exp $
This file is part of the HandBrake source code.
- Homepage: <http://handbrake.m0k.org/>.
+ Homepage: <http://handbrake.fr/>.
It may be used under the terms of the GNU General Public License. */
#include "hb.h"
/* 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;
}
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;
}
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 );
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;
/***********************************************************************
* 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 )
{
// 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;
}
}