summaryrefslogtreecommitdiffstats
path: root/test/test.c
diff options
context:
space:
mode:
authorjbrjake <[email protected]>2008-06-15 15:13:00 +0000
committerjbrjake <[email protected]>2008-06-15 15:13:00 +0000
commit3e116e48824b011d7ecd54e59cd25f92fb3213ca (patch)
treecaab2b16c8590239936cd3c3e551ebcbb09a5a05 /test/test.c
parent02825397639573f1b80f2afaa860a09a6addc595 (diff)
Updates the Mac->CLI preset conversion script to handle the new keys for separate audio settings, and rearranges a little code in the CLI so the audio track settings are easier to generate.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1513 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'test/test.c')
-rw-r--r--test/test.c107
1 files changed, 60 insertions, 47 deletions
diff --git a/test/test.c b/test/test.c
index 81b6486a6..01fa16c73 100644
--- a/test/test.c
+++ b/test/test.c
@@ -51,6 +51,7 @@ static hb_audio_config_t * audio = NULL;
static int num_audio_tracks = 0;
static char * mixdowns = NULL;
static char * dynamic_range_compression = NULL;
+static char * atracks = NULL;
static char * arates = NULL;
static char * abitrates = NULL;
static char * acodecs = NULL;
@@ -271,6 +272,7 @@ int main( int argc, char ** argv )
}
if( mixdowns ) free( mixdowns );
if( dynamic_range_compression ) free( dynamic_range_compression );
+ if( atracks ) free( atracks );
if( arates ) free( arates );
if( abitrates ) free( abitrates );
if( acodecs ) free( acodecs );
@@ -890,6 +892,58 @@ static int HandleEvents( hb_handle_t * h )
job->vrate_base = vrate;
}
+ /* Grab audio tracks */
+ if( atracks )
+ {
+ char * token = strtok(atracks, ",");
+ if (token == NULL)
+ token = optarg;
+ int track_start, track_end;
+ while( token != NULL )
+ {
+ audio = calloc(1, sizeof(*audio));
+ hb_audio_config_init(audio);
+ if (strlen(token) >= 3)
+ {
+ if (sscanf(token, "%d-%d", &track_start, &track_end) == 2)
+ {
+ int i;
+ for (i = track_start - 1; i < track_end; i++)
+ {
+ if (i != track_start - 1)
+ {
+ audio = calloc(1, sizeof(*audio));
+ hb_audio_config_init(audio);
+ }
+ audio->in.track = i;
+ audio->out.track = num_audio_tracks++;
+ hb_list_add(audios, audio);
+ }
+ }
+ else if( !strcasecmp(token, "none" ) )
+ {
+ audio->in.track = audio->out.track = -1;
+ audio->out.codec = 0;
+ hb_list_add(audios, audio);
+ break;
+ }
+ else
+ {
+ fprintf(stderr, "ERROR: Unable to parse audio input \"%s\", skipping.",
+ token);
+ free(audio);
+ }
+ }
+ else
+ {
+ audio->in.track = atoi(token) - 1;
+ audio->out.track = num_audio_tracks++;
+ hb_list_add(audios, audio);
+ }
+ token = strtok(NULL, ",");
+ }
+ }
+
/* Parse audio tracks */
if( hb_list_count(audios) == 0 )
{
@@ -1742,56 +1796,15 @@ static int ParseOptions( int argc, char ** argv )
chapter_markers = 1;
break;
case 'a':
- {
- char * token = strtok(optarg, ",");
- if (token == NULL)
- token = optarg;
- int track_start, track_end;
- while( token != NULL )
+ if( optarg != NULL )
{
- audio = calloc(1, sizeof(*audio));
- hb_audio_config_init(audio);
- if (strlen(token) >= 3)
- {
- if (sscanf(token, "%d-%d", &track_start, &track_end) == 2)
- {
- int i;
- for (i = track_start - 1; i < track_end; i++)
- {
- if (i != track_start - 1)
- {
- audio = calloc(1, sizeof(*audio));
- hb_audio_config_init(audio);
- }
- audio->in.track = i;
- audio->out.track = num_audio_tracks++;
- hb_list_add(audios, audio);
- }
- }
- else if( !strcasecmp(token, "none" ) )
- {
- audio->in.track = audio->out.track = -1;
- audio->out.codec = 0;
- hb_list_add(audios, audio);
- break;
- }
- else
- {
- fprintf(stderr, "ERROR: Unable to parse audio input \"%s\", skipping.",
- token);
- free(audio);
- }
- }
- else
- {
- audio->in.track = atoi(token) - 1;
- audio->out.track = num_audio_tracks++;
- hb_list_add(audios, audio);
- }
- token = strtok(NULL, ",");
+ atracks = strdup( optarg );
}
+ else
+ {
+ atracks = "1" ;
+ }
break;
- }
case '6':
if( optarg != NULL )
{