OSDN Git Service

Fix matroska audio channel counts for AC3 pass-through.
[handbrake-jp/handbrake-jp-git.git] / libhb / declpcm.c
index 59163c3..f6a703d 100644 (file)
@@ -6,17 +6,25 @@
 
 #include "hb.h"
 
-struct hb_work_object_s
-{
-    HB_WORK_COMMON;
-
-    hb_job_t    * job;
-    hb_audio_t  * audio;
-
-    int64_t       pts_last;
+int  declpcmInit( hb_work_object_t *, hb_job_t * );
+int  declpcmWork( hb_work_object_t *, hb_buffer_t **, hb_buffer_t ** );
+void declpcmClose( hb_work_object_t * );
+
+hb_work_object_t hb_declpcm =
+{   
+    WORK_DECLPCM,
+    "LPCM decoder",
+    declpcmInit,
+    declpcmWork,
+    declpcmClose
 };
 
-static int Work( hb_work_object_t * w, hb_buffer_t ** buf_in,
+int declpcmInit( hb_work_object_t * w, hb_job_t * job )
+{
+    return 0;
+}
+
+int declpcmWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
                  hb_buffer_t ** buf_out )
 {
     hb_buffer_t * in = *buf_in, * out;
@@ -51,22 +59,11 @@ static int Work( hb_work_object_t * w, hb_buffer_t ** buf_in,
             break;
     }
 
-    count      = ( in->size - 6 ) / 2;
-    out        = hb_buffer_init( count * sizeof( float ) );
-    duration   = count * 90000 / samplerate / 2;
-    if( w->pts_last > 0 &&
-        in->start < w->pts_last + duration / 6 &&
-        in->start > w->pts_last - duration / 6 )
-    {
-        /* Workaround for DVDs where dates aren't exact */
-        out->start = w->pts_last;
-    }
-    else
-    {
-        out->start = in->start;
-    }
+    count       = ( in->size - 6 ) / 2;
+    out         = hb_buffer_init( count * sizeof( float ) );
+    duration    = count * 90000 / samplerate / 2;
+    out->start  = in->start;
     out->stop   = out->start + duration;
-    w->pts_last = out->stop;
 
     samples_u8   = in->data + 6;
     samples_fl32 = (float *) out->data;
@@ -88,26 +85,6 @@ static int Work( hb_work_object_t * w, hb_buffer_t ** buf_in,
     return HB_WORK_OK;
 }
 
-static void Close( hb_work_object_t ** _w )
-{
-    hb_work_object_t * w = *_w;
-    free( w->name );
-    free( w );
-    *_w = NULL;
-}
-
-hb_work_object_t * hb_work_declpcm_init( hb_job_t * job, hb_audio_t * audio )
+void declpcmClose( hb_work_object_t * w )
 {
-    hb_work_object_t * w = calloc( sizeof( hb_work_object_t ), 1 );
-    w->name  = strdup( "LPCM decoder" );
-    w->work  = Work;
-    w->close = Close;
-
-    w->job   = job;
-    w->audio = audio;
-
-    w->pts_last = -1;
-
-    return w;
 }
-