Permalink
Browse files

Fix opening file name with ext. chars on Windows in avformat consumer.

  • Loading branch information...
ddennedy committed May 19, 2014
1 parent fc87159 commit 2bf5f4791d1a567ebbc7678d891ad3e15241860c
Showing with 12 additions and 7 deletions.
  1. +12 −7 src/modules/avformat/consumer_avformat.c
@@ -953,25 +953,27 @@ static AVStream *add_video_stream( mlt_consumer consumer, AVFormatContext *oc, A
snprintf( logfilename, sizeof(logfilename), "%s_2pass.log",
mlt_properties_get( properties, "passlogfile" ) ? mlt_properties_get( properties, "passlogfile" ) : mlt_properties_get( properties, "target" ) );
+ mlt_properties_set( properties, "_passlogfile", logfilename );
+ mlt_properties_from_utf8( properties, "_passlogfile", "_logfilename" );
+ const char *filename = mlt_properties_get( properties, "_logfilename" );
if ( c->flags & CODEC_FLAG_PASS1 )
{
- f = fopen( logfilename, "w" );
+ f = fopen( filename, "w" );
if ( !f )
- perror( logfilename );
+ perror( filename );
else
mlt_properties_set_data( properties, "_logfile", f, 0, ( mlt_destructor )fclose, NULL );
}
else
{
/* read the log file */
- f = fopen( logfilename, "r" );
+ f = fopen( filename, "r" );
if ( !f )
{
- perror(logfilename);
+ perror( filename );
}
else
{
- mlt_properties_set( properties, "_logfilename", logfilename );
fseek( f, 0, SEEK_END );
size = ftell( f );
fseek( f, 0, SEEK_SET );
@@ -1214,7 +1216,8 @@ static void *consumer_thread( void *arg )
// Determine the format
AVOutputFormat *fmt = NULL;
- const char *filename = mlt_properties_get( properties, "target" );
+ mlt_properties_from_utf8( properties, "target", "_target" );
+ const char *filename = mlt_properties_get( properties, "_target" );
char *format = mlt_properties_get( properties, "f" );
char *vcodec = mlt_properties_get( properties, "vcodec" );
char *acodec = mlt_properties_get( properties, "acodec" );
@@ -2252,7 +2255,9 @@ static void *consumer_thread( void *arg )
if ( !mlt_properties_get( properties, "_logfilename" ) &&
mlt_properties_get( properties, "passlogfile" ) )
{
- file = mlt_properties_get( properties, "passlogfile" );
+ mlt_properties_get( properties, "passlogfile" );
+ mlt_properties_from_utf8( properties, "passlogfile", "_passlogfile" );
+ file = mlt_properties_get( properties, "_passlogfile" );
remove( file );
full = malloc( strlen( file ) + strlen( ".mbtree" ) + 1 );
sprintf( full, "%s.mbtree", file );

0 comments on commit 2bf5f47

Please sign in to comment.