summaryrefslogtreecommitdiffstats
path: root/test/test.c
diff options
context:
space:
mode:
authorjbrjake <[email protected]>2008-04-04 14:58:10 +0000
committerjbrjake <[email protected]>2008-04-04 14:58:10 +0000
commit65fd8a79dbc5756d41349c22f82c659c892b75bc (patch)
tree42b6e70ce11d857a6fc21e05ae06e5e3b765f7da /test/test.c
parent884d11208add280e7f6f769745fbcd8abde0dbe0 (diff)
Cli: If the user specifies more audio codecs than audio tracks, make a copy of the last track specified for each additional output codec.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1374 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'test/test.c')
-rw-r--r--test/test.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/test/test.c b/test/test.c
index de216142e..b583b2341 100644
--- a/test/test.c
+++ b/test/test.c
@@ -465,23 +465,6 @@ static int HandleEvents( hb_handle_t * h )
if (!strcmp(preset_name, "AppleTV"))
{
- hb_audio_config_t * first_audio;
- if (hb_list_count(audios) == 0)
- {
- first_audio = calloc(1, sizeof(*first_audio));
- hb_audio_config_init(first_audio);
- first_audio->in.track = first_audio->out.track = 0;
- hb_list_add(audios, first_audio);
- }
- if( hb_list_count( audios ) <= 1 )
- {
- first_audio = hb_list_item( audios, 0 );
- audio = calloc(1, sizeof(*audio));
- hb_audio_config_init(audio);
- audio->in.track = first_audio->in.track;
- audio->out.track = 1;
- hb_list_add(audios, audio);
- }
if (!acodecs)
{
acodecs = strdup("faac,ac3");
@@ -912,11 +895,27 @@ static int HandleEvents( hb_handle_t * h )
fprintf(stderr, "Invalid codec %s, using default for container.\n", token);
acodec = default_acodec;
}
- audio = hb_list_audio_config_item(job->list_audio, i);
- audio->out.codec = acodec;
- if( (++i) >= num_audio_tracks )
- break; /* We have more inputs than audio tracks, oops */
+ if( i < num_audio_tracks )
+ {
+ audio = hb_list_audio_config_item(job->list_audio, i);
+ audio->out.codec = acodec;
+ }
+ if( i >= num_audio_tracks )
+ {
+ int last_track = hb_list_count(job->list_audio);
+ fprintf(stderr, "More audio codecs than audio tracks, copying track %i and using encoder %s\n",
+ last_track, token);
+ hb_audio_config_t * last_audio = hb_list_audio_config_item( job->list_audio, last_track - 1 );
+ audio = calloc(1, sizeof(*audio));
+ hb_audio_config_init(audio);
+ audio->in.track = last_audio->in.track;
+ audio->out.track = num_audio_tracks++;
+ audio->out.codec = acodec;
+ hb_audio_add(job, audio);
+ free( audio );
+ }
token = strtok(NULL, ",");
+ i++;
}
}
if( i < num_audio_tracks )