summaryrefslogtreecommitdiffstats
path: root/libhb/dvd.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2014-10-13 01:37:48 +0000
committerjstebbins <[email protected]>2014-10-13 01:37:48 +0000
commitc69f6b2ab71e16260e66534ded705fa8314bb5f5 (patch)
treeb684221c2aede7d63653c1d20d0f08cd8af0d103 /libhb/dvd.c
parent255522e6b2bd014f954bfb0d58ac6f40cf2999e0 (diff)
ilibhb: Fix reading from DVDISO files with non-ASCII filenames on Windows
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6443 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/dvd.c')
-rw-r--r--libhb/dvd.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/libhb/dvd.c b/libhb/dvd.c
index 418382317..0e0fccf7a 100644
--- a/libhb/dvd.c
+++ b/libhb/dvd.c
@@ -111,12 +111,20 @@ hb_dvd_t * hb_dvdread_init( char * path )
hb_dvd_t * e;
hb_dvdread_t * d;
int region_mask;
+ char * path_ccp;
e = calloc( sizeof( hb_dvd_t ), 1 );
d = &(e->dvdread);
+ /*
+ * 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 )
@@ -126,7 +134,7 @@ hb_dvd_t * hb_dvdread_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.
@@ -142,7 +150,8 @@ hb_dvd_t * hb_dvdread_init( char * path )
goto fail;
}
- d->path = strdup( path );
+ d->path = strdup( path ); /* hb_dvdread_title_scan assumes UTF-8 path, so not path_ccp here */
+ free( path_ccp );
return e;
@@ -150,6 +159,7 @@ fail:
if( d->vmg ) ifoClose( d->vmg );
if( d->reader ) DVDClose( d->reader );
free( e );
+ free( path_ccp );
return NULL;
}