diff options
author | Rodeo <[email protected]> | 2013-12-14 23:56:17 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2013-12-14 23:56:17 +0000 |
commit | c62a0cb6a0822db6fbd3ee999d795f058569c1a2 (patch) | |
tree | 093356be9a64102390c2633d1f9e98ca1be892de | |
parent | 4161109303811da898d700e1454d9da9b64ff3c6 (diff) |
CLI: sanity-check muxer compatibility for video and audio encoders
This allows us to exit earlier in case of encoder/muxer incompatibility, with a more obvious error message.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5929 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | test/test.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/test/test.c b/test/test.c index f3eba7c48..6d28c8a1b 100644 --- a/test/test.c +++ b/test/test.c @@ -636,6 +636,7 @@ static void apply_loose_crop(int total, int * v1, int * v2, int mod, int max) static int HandleEvents( hb_handle_t * h ) { hb_state_t s; + hb_encoder_t *encoder; int tmp_num_audio_tracks; int filter_cfr, filter_vrate, filter_vrate_base; @@ -1944,10 +1945,26 @@ static int HandleEvents( hb_handle_t * h ) job->vquality = -1.0; job->vbitrate = vbitrate; } - if( vcodec ) + + /* Set video encoder and check muxer compatibility */ + if (vcodec) { job->vcodec = vcodec; } + encoder = NULL; + while ((encoder = hb_video_encoder_get_next(encoder)) != NULL) + { + if ((encoder->codec == job->vcodec) && + (encoder->muxers & job->mux) == 0) + { + hb_error("incompatible video encoder '%s' for muxer '%s'", + hb_video_encoder_get_short_name(job->vcodec), + hb_container_get_short_name (job->mux)); + done_error = HB_ERROR_INIT; + die = 1; + return -1; + } + } #ifdef USE_QSV if (qsv_async_depth >= 0) @@ -2160,6 +2177,28 @@ static int HandleEvents( hb_handle_t * h ) audio->out.codec = acodec; } } + // sanity check muxer compatibility + for (i = 0; i < num_audio_tracks; i++) + { + encoder = NULL; + audio = hb_list_audio_config_item(job->list_audio, i); + if (audio != NULL) + { + while ((encoder = hb_audio_encoder_get_next(encoder)) != NULL) + { + if ((encoder->codec == audio->out.codec) && + (encoder->muxers & job->mux) == 0) + { + hb_error("audio track %d: incompatible encoder '%s' for muxer '%s'", i + 1, + hb_audio_encoder_get_short_name(audio->out.codec), + hb_container_get_short_name (job->mux)); + done_error = HB_ERROR_INIT; + die = 1; + return -1; + } + } + } + } /* Audio Codecs */ /* Sample Rate */ |