diff options
author | Rodeo <[email protected]> | 2013-01-04 13:52:11 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2013-01-04 13:52:11 +0000 |
commit | ae13b6551611d91df517b187a28d5c13bcf82d08 (patch) | |
tree | ac6a3ad91d441e941d2f66ded93c7412675107fd /test/test.c | |
parent | ccbdd4417db3b6f1262c9f12838e631ff97a3703 (diff) |
CLI: use hb_get_default_audio_encoder().
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5145 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'test/test.c')
-rw-r--r-- | test/test.c | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/test/test.c b/test/test.c index c03859b55..03b9658f6 100644 --- a/test/test.c +++ b/test/test.c @@ -80,11 +80,7 @@ static char ** acompressions = NULL; static char * acodec_fallback = NULL; static char * acodecs = NULL; static char ** anames = NULL; -#ifdef __APPLE_CC__ -static int default_acodec = HB_ACODEC_CA_AAC; -#else -static int default_acodec = HB_ACODEC_FAAC; -#endif +static int default_acodec = 0; static int audio_explicit = 0; static char ** subtracks = NULL; static char ** subforce = NULL; @@ -153,7 +149,9 @@ static int ParseOptions( int argc, char ** argv ); static int CheckOptions( int argc, char ** argv ); static int HandleEvents( hb_handle_t * h ); -static int get_acodec_for_string( char *codec ); +static int get_acodec_for_string(const char *codec); +static const char* get_string_for_acodec(int acodec); + static int is_sample_rate_valid(int rate); static void str_vfree( char **strv ); static char** str_split( char *str, char delem ); @@ -2868,11 +2866,10 @@ static void ShowHelp() " audio unmodified to the muxer if it is a\n" " supported passthrough audio type.\n" " Separated by commas for more than one audio track.\n" -#ifdef __APPLE_CC__ - " (default: ca_aac)\n" -#else - " (default: faac for mp4, lame for mkv)\n" -#endif + " (default: %s for mp4, %s for mkv)\n", + get_string_for_acodec(hb_get_default_audio_encoder(HB_MUX_MP4)), + get_string_for_acodec(hb_get_default_audio_encoder(HB_MUX_MKV))); + fprintf(out, " --audio-copy-mask Set audio codecs that are permitted when the\n" " <string> \"copy\" audio encoder option is specified\n" " (" ); @@ -3947,10 +3944,6 @@ static int CheckOptions( int argc, char ** argv ) else if( p && !strcasecmp(p, ".mkv" ) ) { mux = HB_MUX_MKV; -#ifndef __APPLE_CC__ - // default to Lame for MKV (except under OS X where Core Audio is available) - default_acodec = HB_ACODEC_LAME; -#endif } else { @@ -3967,10 +3960,6 @@ static int CheckOptions( int argc, char ** argv ) else if( !strcasecmp( format, "mkv" ) ) { mux = HB_MUX_MKV; -#ifndef __APPLE_CC__ - // default to Lame for MKV (except under OS X where Core Audio is available) - default_acodec = HB_ACODEC_LAME; -#endif } else { @@ -3978,23 +3967,36 @@ static int CheckOptions( int argc, char ** argv ) "choices are mp4, m4v and mkv\n.", format ); return 1; } + default_acodec = hb_get_default_audio_encoder(mux); } return 0; } -static int get_acodec_for_string( char *codec ) +static int get_acodec_for_string(const char *codec) +{ + int i; + for (i = 0; i < hb_audio_encoders_count; i++) + { + if (!strcasecmp(hb_audio_encoders[i].short_name, codec)) + { + return hb_audio_encoders[i].encoder; + } + } + return -1; +} + +static const char* get_string_for_acodec(int acodec) { - int i, acodec; - for( i = 0, acodec = 0; i < hb_audio_encoders_count; i++ ) + int i; + for (i = 0; i < hb_audio_encoders_count; i++) { - if( !strcasecmp( hb_audio_encoders[i].short_name, codec ) ) + if (hb_audio_encoders[i].encoder == acodec) { - acodec = hb_audio_encoders[i].encoder; - break; + return hb_audio_encoders[i].short_name; } } - return acodec ? acodec : -1; + return NULL; } static int is_sample_rate_valid(int rate) |