diff options
author | Rodeo <[email protected]> | 2012-02-17 21:45:52 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2012-02-17 21:45:52 +0000 |
commit | d3d7b47d15398fca3d8594b7c117fcf541548681 (patch) | |
tree | f0903e70463b2ab592aa53cc50bccad8807f9ff0 /libhb/common.c | |
parent | 7912c65ff58fdc25d5a9e390ac73370fc898dfdb (diff) |
Print more Auto Passthru information to the Activity Log: passthru mask (allowed codecs), fallback encoder.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4454 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/common.c')
-rw-r--r-- | libhb/common.c | 76 |
1 files changed, 74 insertions, 2 deletions
diff --git a/libhb/common.c b/libhb/common.c index 006b374db..a55b78962 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -123,13 +123,16 @@ const char * hb_mixdown_get_short_name_from_mixdown( int amixdown ) void hb_autopassthru_apply_settings( hb_job_t * job, hb_title_t * title ) { - int i, j; + int i, j, already_printed; hb_audio_t * audio; - for( i = 0; i < hb_list_count( title->list_audio ); ) + for( i = 0, already_printed = 0; i < hb_list_count( title->list_audio ); ) { audio = hb_list_item( title->list_audio, i ); if( audio->config.out.codec == HB_ACODEC_AUTO_PASS ) { + if( !already_printed ) + hb_autopassthru_print_settings( job ); + already_printed = 1; audio->config.out.codec = hb_autopassthru_get_encoder( audio->config.in.codec, job->acodec_copy_mask, job->acodec_fallback, @@ -184,6 +187,50 @@ void hb_autopassthru_apply_settings( hb_job_t * job, hb_title_t * title ) } } +void hb_autopassthru_print_settings( hb_job_t * job ) +{ + int i, codec_len; + char *mask = NULL, *tmp, *fallback = NULL; + for( i = 0; i < hb_audio_encoders_count; i++ ) + { + if( ( hb_audio_encoders[i].encoder & HB_ACODEC_PASS_FLAG ) && + ( hb_audio_encoders[i].encoder != HB_ACODEC_AUTO_PASS ) && + ( hb_audio_encoders[i].encoder & job->acodec_copy_mask ) ) + { + if( mask ) + { + tmp = hb_strncat_dup( mask, ", ", 2 ); + if( tmp ) + { + free( mask ); + mask = tmp; + } + } + // passthru name without " Passthru" + codec_len = strlen( hb_audio_encoders[i].human_readable_name ) - 9; + tmp = hb_strncat_dup( mask, hb_audio_encoders[i].human_readable_name, codec_len ); + if( tmp ) + { + free( mask ); + mask = tmp; + } + } + else if( !( hb_audio_encoders[i].encoder & HB_ACODEC_PASS_FLAG ) && + ( hb_audio_encoders[i].encoder == job->acodec_fallback ) ) + { + fallback = hb_audio_encoders[i].human_readable_name; + } + } + if( !mask ) + hb_log( "Auto Passthru: no codecs allowed" ); + else + hb_log( "Auto Passthru: allowed codecs are %s", mask ); + if( !fallback ) + hb_log( "Auto Passthru: no valid fallback specified" ); + else + hb_log( "Auto Passthru: fallback is %s", fallback ); +} + int hb_autopassthru_get_encoder( int in_codec, int copy_mask, int fallback, int muxer ) { int i; @@ -1716,6 +1763,31 @@ char * hb_strdup_printf( const char * fmt, ... ) } } +char * hb_strncat_dup( const char * s1, const char * s2, size_t n ) +{ + size_t len; + char * str; + + len = 0; + if( s1 ) + len += strlen( s1 ); + if( s2 ) + len += MAX( strlen( s2 ), n ); + if( !len ) + return NULL; + + str = malloc( len + 1 ); + if( !str ) + return NULL; + + if( s1 ) + strcpy( str, s1 ); + else + strcpy( str, "" ); + strncat( str, s2, n ); + return str; +} + /********************************************************************** * hb_attachment_copy ********************************************************************** |