+ pv->samplerate = hdr2samplerate[ ( in->data[4] >> 4 ) & 0x3 ];
+ pv->nchannels = ( in->data[4] & 7 ) + 1;
+ pv->sample_size = hdr2samplesize[in->data[4] >> 6];
+
+ /*
+ * PCM frames have a constant duration (150 90KHz ticks).
+ * We need to convert that to the amount of data expected. It's the
+ * duration divided by the sample rate (to get #samples) times the number
+ * of channels times the bits per sample divided by 8 to get bytes.
+ * (we have to compute in bits because 20 bit samples are not an integral
+ * number of bytes). We do all the multiplies first then the divides to
+ * avoid truncation errors.
+ */
+ pv->duration = in->data[0] * 150;
+ pv->count = ( pv->duration * pv->nchannels * pv->samplerate ) / 90000;
+ pv->size = ( pv->count * pv->sample_size ) / 8;
+
+ pv->next_pts = in->start;
+}
+
+static int declpcmInit( hb_work_object_t * w, hb_job_t * job )
+{
+ hb_work_private_t * pv = calloc( 1, sizeof( hb_work_private_t ) );
+ w->private_data = pv;
+ pv->job = job;
+ return 0;
+}
+
+/*
+ * Convert DVD encapsulated LPCM to floating point PCM audio buffers.
+ * The amount of audio in a PCM frame is always <= the amount that will fit
+ * in a DVD block (2048 bytes) but the standard doesn't require that the audio
+ * frames line up with the DVD frames. Since audio frame boundaries are unrelated
+ * to DVD PES boundaries, this routine has to reconstruct then extract the audio
+ * frames. Because of the arbitrary alignment, it can output zero, one or two buf's.
+ */
+static int declpcmWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
+ hb_buffer_t ** buf_out )
+{
+ hb_work_private_t * pv = w->private_data;
+ hb_buffer_t *in = *buf_in;
+ hb_buffer_t *buf = NULL;