OSDN Git Service

LinGui: When translating legacy presets, vquality 0 means RF 0, not 0%
[handbrake-jp/handbrake-jp-git.git] / gtk / src / hb-backend.c
index b577a5b..fb76aa7 100644 (file)
@@ -2099,7 +2099,10 @@ ghb_find_audio_track(
        gint track = -1;
        gint max_chan = 0;
        gboolean *used;
+       gboolean *passthru_used;
        gint try_acodec;
+       gint passthru_acodec;
+       gboolean passthru;
        
        g_debug("find_audio_track ()\n");
        if (h_scan == NULL) return -1;
@@ -2112,7 +2115,8 @@ ghb_find_audio_track(
        if (count > 10) count = 10;
        // Try to find an item that matches the preferred language and
        // the passthru codec type
-       if (acodec & (HB_ACODEC_AC3 | HB_ACODEC_DCA))
+       passthru = (acodec & (HB_ACODEC_AC3 | HB_ACODEC_DCA)) != 0;
+       if (passthru)
        {
                for (ii = 0; ii < count; ii++)
                {
@@ -2120,11 +2124,11 @@ ghb_find_audio_track(
 
                        audio = (hb_audio_config_t*)hb_list_audio_config_item( 
                                                                                                        title->list_audio, ii );
-                       try_acodec = (HB_ACODEC_AC3 | HB_ACODEC_DCA) & audio->in.codec;
+                       passthru_acodec = (HB_ACODEC_AC3 | HB_ACODEC_DCA) & audio->in.codec;
                        // Is the source track use a passthru capable codec?
-                       if (try_acodec == 0)
+                       if (passthru_acodec == 0)
                                continue;
-                       used = get_track_used(try_acodec, track_indices, count);
+                       used = get_track_used(passthru_acodec, track_indices, count);
                        // Has the track already been used with this codec?
                        if (used[ii])
                                continue;
@@ -2163,7 +2167,15 @@ ghb_find_audio_track(
                if (used[ii])
                        continue;
                audio = (hb_audio_config_t*)hb_list_audio_config_item( 
-                                                                                                       title->list_audio, ii );
+                                                                                               title->list_audio, ii );
+               passthru_acodec = (HB_ACODEC_AC3 | HB_ACODEC_DCA) & audio->in.codec;
+               if (passthru_acodec && passthru)
+               {
+                       passthru_used = get_track_used(passthru_acodec, track_indices, count);
+                       // Has the track already been used with this codec for passthru?
+                       if (passthru_used[ii])
+                               continue;
+               }
                // Find a track that is not visually impaired or dirctor's commentary
                if ((audio->lang.type < 2) &&
                        ((strcmp(lang, audio->lang.iso639_2) == 0) ||
@@ -2180,7 +2192,7 @@ ghb_find_audio_track(
        }
        // Try to fine an item that does not match the preferred language and
        // matches the passthru codec type
-       if (acodec & (HB_ACODEC_AC3 | HB_ACODEC_DCA))
+       if (passthru)
        {
                for (ii = 0; ii < count; ii++)
                {
@@ -2188,11 +2200,11 @@ ghb_find_audio_track(
 
                        audio = (hb_audio_config_t*)hb_list_audio_config_item( 
                                                                                                        title->list_audio, ii );
-                       try_acodec = (HB_ACODEC_AC3 | HB_ACODEC_DCA) & audio->in.codec;
+                       passthru_acodec = (HB_ACODEC_AC3 | HB_ACODEC_DCA) & audio->in.codec;
                        // Is the source track use a passthru capable codec?
-                       if (try_acodec == 0)
+                       if (passthru_acodec == 0)
                                continue;
-                       used = get_track_used(try_acodec, track_indices, count);
+                       used = get_track_used(passthru_acodec, track_indices, count);
                        // Has the track already been used with this codec?
                        if (used[ii])
                                continue;
@@ -2230,6 +2242,14 @@ ghb_find_audio_track(
                        continue;
                audio = (hb_audio_config_t*)hb_list_audio_config_item( 
                                                                                                        title->list_audio, ii );
+               passthru_acodec = (HB_ACODEC_AC3 | HB_ACODEC_DCA) & audio->in.codec;
+               if (passthru_acodec && passthru)
+               {
+                       passthru_used = get_track_used(passthru_acodec, track_indices, count);
+                       // Has the track already been used with this codec for passthru?
+                       if (passthru_used[ii])
+                               continue;
+               }
                // Find a track that is not visually impaired or dirctor's commentary
                if (audio->lang.type < 2)
                {
@@ -2246,7 +2266,15 @@ ghb_find_audio_track(
        for (ii = 0; ii < count; ii++)
        {
                audio = (hb_audio_config_t*)hb_list_audio_config_item( 
-                                                                                                       title->list_audio, ii );
+                                                                                               title->list_audio, ii );
+               passthru_acodec = (HB_ACODEC_AC3 | HB_ACODEC_DCA) & audio->in.codec;
+               if (passthru_acodec && passthru)
+               {
+                       passthru_used = get_track_used(passthru_acodec, track_indices, count);
+                       // Has the track already been used with this codec for passthru?
+                       if (passthru_used[ii])
+                               continue;
+               }
                // Has the track already been used with this codec?
                if (!used[ii])
                {
@@ -3138,6 +3166,7 @@ ghb_track_status()
                        hb_status.queue.state &= ~GHB_STATE_MUXING;
                        hb_status.queue.state &= ~GHB_STATE_PAUSED;
                        hb_status.queue.state &= ~GHB_STATE_WORKING;
+                       hb_status.queue.state &= ~GHB_STATE_SEARCHING;
                        switch (p.error)
                        {
                        case HB_ERROR_NONE:
@@ -4290,22 +4319,19 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex)
 
                        chapters = ghb_settings_get_value(js, "chapter_list");
                        count = ghb_array_len(chapters);
-                       for(chap = start; chap <= end; chap++)
+                       for(chap = 0; chap < count; chap++)
                        {
                                hb_chapter_t * chapter_s;
                                gchar *name;
 
                                name = NULL;
-                               if (chap-1 < count)
-                               {
-                                       chapter = ghb_array_get_nth(chapters, chap-1);
-                                       name = ghb_value_string(chapter); 
-                               }
+                               chapter = ghb_array_get_nth(chapters, chap);
+                               name = ghb_value_string(chapter); 
                                if (name == NULL)
                                {
-                                       name = g_strdup_printf ("Chapter %2d", chap);
+                                       name = g_strdup_printf ("Chapter %2d", chap+1);
                                }
-                               chapter_s = hb_list_item( job->title->list_chapter, chap - 1);
+                               chapter_s = hb_list_item( job->title->list_chapter, chap);
                                strncpy(chapter_s->title, name, 1023);
                                chapter_s->title[1023] = '\0';
                                g_free(name);