]> granicus.if.org Git - handbrake/commitdiff
VOBSUB encoder skeleton for use with mkv VOBSUB pass-through
authoreddyg <eddyg.hb@myreflection.org>
Wed, 6 May 2009 04:16:40 +0000 (04:16 +0000)
committereddyg <eddyg.hb@myreflection.org>
Wed, 6 May 2009 04:16:40 +0000 (04:16 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2389 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/common.h
libhb/decvobsub.c
libhb/hb.c
libhb/hb.h
libhb/internal.h
libhb/sync.c
libhb/work.c

index 81877d6d28aa148040a6ad683232a80fb46d75e1..dfa1dcabdf1925f1722afb9262e2847f8295d5a6 100644 (file)
@@ -456,6 +456,7 @@ struct hb_subtitle_s
     /* Internal data */
     hb_fifo_t * fifo_in;  /* SPU ES */
     hb_fifo_t * fifo_raw; /* Decoded SPU */
+    hb_fifo_t * fifo_sync;/* Synced */
     hb_fifo_t * fifo_out; /* Correct Timestamps, ready to be muxed */
 #endif
 };
@@ -653,6 +654,7 @@ struct hb_work_object_s
 extern hb_work_object_t hb_sync;
 extern hb_work_object_t hb_decmpeg2;
 extern hb_work_object_t hb_decsub;
+extern hb_work_object_t hb_encsub;
 extern hb_work_object_t hb_render;
 extern hb_work_object_t hb_encavcodec;
 extern hb_work_object_t hb_encxvid;
index 98ffa1a0d7ad9008a951aa84604d9883431dcd7c..102d18fe763de5b656d8e827000c8be4652a01cf 100644 (file)
@@ -125,7 +125,7 @@ void decsubClose( hb_work_object_t * w )
 hb_work_object_t hb_decsub =
 {
     WORK_DECSUB,
-    "Subtitle decoder",
+    "VOBSUB decoder",
     decsubInit,
     decsubWork,
     decsubClose
index 2ffa169762b92845a1e651bfd2034d9895b8c3d2..cdde54f4f4e029dd92399d6ee359edb46b2d76ed 100644 (file)
@@ -230,6 +230,7 @@ hb_handle_t * hb_init_dl( int verbose, int update_check )
     hb_register( &hb_sync );
        hb_register( &hb_decmpeg2 );
        hb_register( &hb_decsub );
+        hb_register( &hb_encsub );
        hb_register( &hb_render );
        hb_register( &hb_encavcodec );
        hb_register( &hb_encxvid );
index 0c96656d6ffce4e2d2dc33bd9d9f14474d816bae..860f441e0f4eca7d2f5036af3a3e1e7ddefafa00 100644 (file)
@@ -22,6 +22,7 @@ hb_init_real( v, u ); \
 hb_register( &hb_sync ); \
 hb_register( &hb_decmpeg2 ); \
 hb_register( &hb_decsub ); \
+hb_register( &hb_encsub ); \
 hb_register( &hb_render ); \
 hb_register( &hb_encavcodec ); \
 hb_register( &hb_encxvid ); \
@@ -43,6 +44,7 @@ hb_init_real( v, u ); \
 hb_register( &hb_sync ); \
 hb_register( &hb_decmpeg2 ); \
 hb_register( &hb_decsub ); \
+hb_register( &hb_encsub ); \
 hb_register( &hb_render ); \
 hb_register( &hb_encavcodec ); \
 hb_register( &hb_encx264 ); \
index 7d7594802a5d40644cee096741273ef2cb946a42..f5df6cec96d0f272aa701d1c09cc6efcfd0f889c 100644 (file)
@@ -255,6 +255,7 @@ enum
     WORK_SYNC = 1,
     WORK_DECMPEG2,
     WORK_DECSUB,
+    WORK_ENCSUB,
     WORK_RENDER,
     WORK_ENCAVCODEC,
     WORK_ENCXVID,
index 39be41310cd0e71afb19dd92d0bd1421cc5ec1ab..fb02b1387b0316b058ee0658db508c04b6af5b43 100644 (file)
@@ -413,6 +413,8 @@ static void SyncVideo( hb_work_object_t * w )
                      *
                      * What about discontinuity boundaries - not delt
                      * with here - Van?
+                     *
+                     * Bypass the sync fifo altogether.
                      */
                     if( sub->size == 0 || sub->start < cur->start )
                     {
@@ -638,14 +640,14 @@ static void SyncVideo( hb_work_object_t * w )
                 } else {
                     /*
                      * Pass-Through, pop it off of the raw queue, rewrite times and
-                     * make it available to be muxed.
+                     * make it available to be reencoded.
                      */
                     uint64_t sub_duration;
                     sub = hb_fifo_get( subtitle->fifo_raw );
                     sub_duration = sub->stop - sub->start;
                     sub->start = buf_tmp->start;
                     sub->stop = sub->start + duration;
-                    hb_fifo_push( subtitle->fifo_out, sub );
+                    hb_fifo_push( subtitle->fifo_sync, sub );
                 }
             } else {
                 /*
index 0f7c1315457e0b1aeb2eeb917f726bbb99b65461..323f4cf4a73dd7856af8c08fd630ef568efdbd2e 100644 (file)
@@ -488,9 +488,10 @@ static void do_job( hb_job_t * job, int cpu_count )
 
         if( subtitle )
         {
-            subtitle->fifo_in  = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
-            subtitle->fifo_raw = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
-            subtitle->fifo_out = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
+            subtitle->fifo_in   = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
+            subtitle->fifo_raw  = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
+            subtitle->fifo_sync = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
+            subtitle->fifo_out  = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
 
             /*
              * Disable forced subtitles if we didn't find any in the scan
@@ -517,6 +518,20 @@ static void do_job( hb_job_t * job, int cpu_count )
                 w->fifo_out = subtitle->fifo_raw;
                 hb_list_add( job->list_work, w );
             }
+
+            if( !job->indepth_scan && 
+                subtitle->format == PICTURESUB
+                && subtitle->dest == PASSTHRUSUB )
+            {
+                /*
+                 * Passing through a subtitle picture, this will have to
+                 * be rle encoded before muxing.
+                 */
+                w = hb_get_work( WORK_ENCSUB );
+                w->fifo_in  = subtitle->fifo_sync;
+                w->fifo_out = subtitle->fifo_out;
+                hb_list_add( job->list_work, w );
+            }
         }
     }
 
@@ -861,6 +876,7 @@ cleanup:
         {
             hb_fifo_close( &subtitle->fifo_in );
             hb_fifo_close( &subtitle->fifo_raw );
+            hb_fifo_close( &subtitle->fifo_sync );
             hb_fifo_close( &subtitle->fifo_out );
         }
     }