OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / libhb / decvobsub.c
index e5633d5..e180b23 100644 (file)
@@ -98,6 +98,15 @@ int decsubWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
                 pv->pts = in->start;
             }
         }
+        else
+        {
+            // bad size, must have lost sync
+            // force re-sync
+            if ( pv->buf != NULL )
+                hb_buffer_close( &pv->buf );
+            pv->size_sub = 0;
+        }
+
     }
 
     *buf_out = NULL;
@@ -127,6 +136,10 @@ int decsubWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
 
 void decsubClose( hb_work_object_t * w )
 {
+    hb_work_private_t * pv = w->private_data;
+
+    if ( pv->buf )
+        hb_buffer_close( &pv->buf );
     free( w->private_data );
 }
 
@@ -484,7 +497,7 @@ static hb_buffer_t * Decode( hb_work_object_t * w )
     /* Get infos about the subtitle */
     ParseControls( w );
 
-    if( job->indepth_scan || ( w->subtitle->force && pv->pts_forced == 0 ) )
+    if( job->indepth_scan || ( w->subtitle->config.force && pv->pts_forced == 0 ) )
     {
         /*
          * Don't encode subtitles when doing a scan.
@@ -492,14 +505,17 @@ static hb_buffer_t * Decode( hb_work_object_t * w )
          * When forcing subtitles, ignore all those that don't
          * have the forced flag set.
          */
+        hb_buffer_close( &pv->buf );
         return NULL;
     }
 
-    if (w->subtitle->dest == PASSTHRUSUB)
+    if (w->subtitle->config.dest == PASSTHRUSUB)
     {
         pv->buf->start  = pv->pts_start;
         pv->buf->stop   = pv->pts_stop;
-        return pv->buf;
+        buf = pv->buf;
+        pv->buf = NULL;
+        return buf;
     }
 
     /* Do the actual decoding now */