OSDN Git Service

x264 bump to r1339-82b80ef
[handbrake-jp/handbrake-jp-git.git] / libhb / common.c
index cea4a50..52ea27f 100644 (file)
@@ -9,6 +9,7 @@
 #include <sys/time.h>
 
 #include "common.h"
+#include "lang.h"
 #include "hb.h"
 
 /**********************************************************************
@@ -123,8 +124,8 @@ void hb_fix_aspect( hb_job_t * job, int keep )
     if ( title->height == 0 || title->width == 0 || title->aspect == 0 )
     {
         hb_log( "hb_fix_aspect: incomplete info for title %d: "
-                "height = %d, width = %d, aspect = %d",
-                title->height, title->width, title->aspect );
+                "height = %d, width = %d, aspect = %.3f",
+                title->index, title->height, title->width, title->aspect );
         return;
     }
 
@@ -864,8 +865,38 @@ int hb_subtitle_add(const hb_job_t * job, const hb_subtitle_config_t * subtitlec
         /* We fail! */
         return 0;
     }
-       subtitle->config = *subtitlecfg;
+    subtitle->config = *subtitlecfg;
     hb_list_add(job->list_subtitle, subtitle);
     return 1;
 }
 
+int hb_srt_add( const hb_job_t * job, 
+                const hb_subtitle_config_t * subtitlecfg, 
+                const char *lang )
+{
+    hb_subtitle_t *subtitle;
+    iso639_lang_t *language = NULL;
+    int retval = 0;
+
+    subtitle = calloc( 1, sizeof( *subtitle ) );
+    
+    subtitle->id = (hb_list_count(job->list_subtitle) << 8) | 0xFF;
+    subtitle->format = TEXTSUB;
+    subtitle->source = SRTSUB;
+
+    language = lang_for_code2( lang );
+
+    if( language )
+    {
+
+        strcpy( subtitle->lang, language->eng_name );
+        strncpy( subtitle->iso639_2, lang, 4 );
+        
+        subtitle->config = *subtitlecfg;
+        subtitle->config.dest = PASSTHRUSUB;
+
+        hb_list_add(job->list_subtitle, subtitle);
+        retval = 1;
+    }
+    return retval;
+}