]> granicus.if.org Git - handbrake/commitdiff
hb_json: don't fail if audio is invalid for mux
authorJohn Stebbins <jstebbins.hb@gmail.com>
Fri, 7 Jun 2019 15:06:50 +0000 (08:06 -0700)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Fri, 12 Jul 2019 21:15:36 +0000 (14:15 -0700)
Just drop the track.  If audio is 'none' drop silently.

libhb/hb_json.c

index 89a4da479a7511b34a1cc42da701f28828505ded..8413d3cd61c7aeed4dfc2cfbe2482cf24e1af371 100644 (file)
@@ -955,9 +955,12 @@ static int validate_audio_codec_mux(int codec, int mux, int track)
     {
         if ((enc->codec == codec) && (enc->muxers & mux) == 0)
         {
-            hb_error("track %d: incompatible encoder '%s' for muxer '%s'",
-                     track + 1, enc->short_name,
-                     hb_container_get_short_name(mux));
+            if (codec != HB_ACODEC_NONE)
+            {
+                hb_error("track %d: incompatible encoder '%s' for muxer '%s'",
+                         track + 1, enc->short_name,
+                         hb_container_get_short_name(mux));
+            }
             return -1;
         }
     }
@@ -1537,16 +1540,20 @@ hb_job_t* hb_dict_to_job( hb_handle_t * h, hb_dict_t *dict )
     }
 
     // Audio sanity checks
-    int count = hb_list_count(job->list_audio);
     int ii;
-    for (ii = 0; ii < count; ii++)
+    for (ii = 0; ii < hb_list_count(job->list_audio); )
     {
         hb_audio_config_t *acfg;
         acfg = hb_list_audio_config_item(job->list_audio, ii);
         if (validate_audio_codec_mux(acfg->out.codec, job->mux, ii))
         {
-            goto fail;
+            // drop the track
+            hb_audio_t * audio = hb_list_item(job->list_audio, ii);
+            hb_list_rem(job->list_audio, audio);
+            hb_audio_close(&audio);
+            continue;
         }
+        ii++;
     }
 
     // process subtitle list