summaryrefslogtreecommitdiffstats
path: root/libhb/dvdnav.c
diff options
context:
space:
mode:
Diffstat (limited to 'libhb/dvdnav.c')
-rw-r--r--libhb/dvdnav.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/libhb/dvdnav.c b/libhb/dvdnav.c
index 3c820b789..2e7973c0d 100644
--- a/libhb/dvdnav.c
+++ b/libhb/dvdnav.c
@@ -99,11 +99,12 @@ static char * hb_dvdnav_name( char * path )
**********************************************************************/
static int hb_dvdnav_reset( hb_dvdnav_t * d )
{
+ char * path_ccp = hb_utf8_to_cp( d->path );
if ( d->dvdnav )
dvdnav_close( d->dvdnav );
/* Open device */
- if( dvdnav_open(&d->dvdnav, d->path) != DVDNAV_STATUS_OK )
+ if( dvdnav_open(&d->dvdnav, path_ccp) != DVDNAV_STATUS_OK )
{
/*
* Not an error, may be a stream - which we'll try in a moment.
@@ -131,10 +132,14 @@ static int hb_dvdnav_reset( hb_dvdnav_t * d )
dvdnav_err_to_string(d->dvdnav));
goto fail;
}
+
+ free( path_ccp );
+
return 1;
fail:
if( d->dvdnav ) dvdnav_close( d->dvdnav );
+ free( path_ccp );
return 0;
}
@@ -148,12 +153,20 @@ static hb_dvd_t * hb_dvdnav_init( char * path )
hb_dvd_t * e;
hb_dvdnav_t * d;
int region_mask;
+ char * path_ccp;
e = calloc( sizeof( hb_dvd_t ), 1 );
d = &(e->dvdnav);
+ /*
+ * Convert UTF-8 path to current code page on Windows
+ * hb_utf8_to_cp() is the same as strdup on non-Windows,
+ * so no #ifdef required here
+ */
+ path_ccp = hb_utf8_to_cp( path );
+
/* Log DVD drive region code */
- if ( hb_dvd_region( path, &region_mask ) == 0 )
+ if ( hb_dvd_region( path_ccp, &region_mask ) == 0 )
{
hb_log( "dvd: Region mask 0x%02x", region_mask );
if ( region_mask == 0xFF )
@@ -163,7 +176,7 @@ static hb_dvd_t * hb_dvdnav_init( char * path )
}
/* Open device */
- if( dvdnav_open(&d->dvdnav, path) != DVDNAV_STATUS_OK )
+ if( dvdnav_open(&d->dvdnav, path_ccp) != DVDNAV_STATUS_OK )
{
/*
* Not an error, may be a stream - which we'll try in a moment.
@@ -193,7 +206,7 @@ static hb_dvd_t * hb_dvdnav_init( char * path )
}
/* Open device */
- if( !( d->reader = DVDOpen( path ) ) )
+ if( !( d->reader = DVDOpen( path_ccp ) ) )
{
/*
* Not an error, may be a stream - which we'll try in a moment.
@@ -209,7 +222,8 @@ static hb_dvd_t * hb_dvdnav_init( char * path )
goto fail;
}
- d->path = strdup( path );
+ d->path = strdup( path ); /* hb_dvdnav_title_scan assumes UTF-8 path, so not path_ccp here */
+ free( path_ccp );
return e;
@@ -218,6 +232,7 @@ fail:
if( d->vmg ) ifoClose( d->vmg );
if( d->reader ) DVDClose( d->reader );
free( e );
+ free( path_ccp );
return NULL;
}