OSDN Git Service

Add ac3 encoding
[handbrake-jp/handbrake-jp-git.git] / libhb / hb.c
index d466d83..f7489c1 100644 (file)
@@ -82,6 +82,15 @@ int hb_avcodec_open(AVCodecContext *avctx, AVCodec *codec)
     return ret;
 }
 
+int hb_av_find_stream_info(AVFormatContext *ic)
+{
+    int ret;
+    hb_lock( hb_avcodec_lock );
+    ret = av_find_stream_info( ic );
+    hb_unlock( hb_avcodec_lock );
+    return ret;
+}
+
 int hb_avcodec_close(AVCodecContext *avctx)
 {
     int ret;
@@ -337,6 +346,7 @@ hb_handle_t * hb_init( int verbose, int update_check )
 #ifdef __APPLE__
        hb_register( &hb_encca_aac );
 #endif
+       hb_register( &hb_encac3 );
     
     return h;
 }
@@ -441,6 +451,7 @@ hb_handle_t * hb_init_dl( int verbose, int update_check )
 #ifdef __APPLE__
        hb_register( &hb_encca_aac );
 #endif
+       hb_register( &hb_encac3 );
 
        return h;
 }
@@ -539,7 +550,7 @@ void hb_remove_previews( hb_handle_t * h )
  * @param store_previews Whether or not to write previews to disk.
  */
 void hb_scan( hb_handle_t * h, const char * path, int title_index,
-              int preview_count, int store_previews )
+              int preview_count, int store_previews, uint64_t min_duration )
 {
     hb_title_t * title;
 
@@ -556,7 +567,7 @@ void hb_scan( hb_handle_t * h, const char * path, int title_index,
     hb_log( "hb_scan: path=%s, title_index=%d", path, title_index );
     h->scan_thread = hb_scan_init( h, &h->scan_die, path, title_index, 
                                    h->list_title, preview_count, 
-                                   store_previews );
+                                   store_previews, min_duration );
 }
 
 /**
@@ -1225,6 +1236,7 @@ void hb_add( hb_handle_t * h, hb_job_t * job )
     hb_chapter_t  * chapter,  * chapter_copy;
     hb_audio_t    * audio;
     hb_subtitle_t * subtitle, * subtitle_copy;
+    hb_attachment_t * attachment;
     int             i;
     char            audio_lang[4];
 
@@ -1272,7 +1284,6 @@ void hb_add( hb_handle_t * h, hb_job_t * job )
 
     /* Copy the audio track(s) we want */
     title_copy->list_audio = hb_list_init();
-
     for( i = 0; i < hb_list_count(job->list_audio); i++ )
     {
         if( ( audio = hb_list_item( job->list_audio, i ) ) )
@@ -1281,7 +1292,18 @@ void hb_add( hb_handle_t * h, hb_job_t * job )
         }
     }
 
+    /* Initialize subtitle list - filled out further below */
     title_copy->list_subtitle = hb_list_init();
+    
+    /* Copy all the attachments */
+    title_copy->list_attachment = hb_list_init();
+    for( i = 0; i < hb_list_count(title->list_attachment); i++ )
+    {
+        if( ( attachment = hb_list_item( title->list_attachment, i ) ) )
+        {
+            hb_list_add( title_copy->list_attachment, hb_attachment_copy(attachment) );
+        }
+    }
 
     /*
      * The following code is confusing, there are two ways in which