void ClientTrickPlayState::updateStateFromNPT(double npt) {
  fNPT = (float)npt;
  // Map "fNPT" to the corresponding Transport Stream and Index record numbers:
  unsigned long tsRecordNum, ixRecordNum;
  fIndexFile->lookupTSPacketNumFromNPT(fNPT, tsRecordNum, ixRecordNum);

  updateTSRecordNum();
  if (tsRecordNum != fTSRecordNum) {
    fTSRecordNum = tsRecordNum;
    fIxRecordNum = ixRecordNum;

    // Seek the source to the new record number:
    reseekOriginalTransportStreamSource();
    // Note: We assume that we're asked to seek only in normal
    // (i.e., non trick play) mode, so we don't seek within the trick
    // play source (if any).

    fFramer->clearPIDStatusTable();
  }
}
void ClientTrickPlayState::updateStateFromNPT(double npt, double streamDuration)
{
    fNPT = (float)npt;
    // Map "fNPT" to the corresponding Transport Stream and Index record numbers:
    unsigned long tsRecordNum, ixRecordNum;
    fIndexFile->lookupTSPacketNumFromNPT(fNPT, tsRecordNum, ixRecordNum);

    updateTSRecordNum();
    if (tsRecordNum != fTSRecordNum)
    {
        fTSRecordNum = tsRecordNum;
        fIxRecordNum = ixRecordNum;

        // Seek the source to the new record number:
        reseekOriginalTransportStreamSource();
        // Note: We assume that we're asked to seek only in normal
        // (i.e., non trick play) mode, so we don't seek within the trick
        // play source (if any).

        fFramer->clearPIDStatusTable();
    }

    unsigned long numTSRecordsToStream = 0;
    if (streamDuration > 0.0)
    {
        // Use the index file to figure out how many Transport Packets we get to stream:
        unsigned long toTSRecordNum, toIxRecordNum;
        float toNPT = (float)(fNPT + streamDuration);
        fIndexFile->lookupTSPacketNumFromNPT(toNPT, toTSRecordNum, toIxRecordNum);
        if (toTSRecordNum > tsRecordNum)   // sanity check
        {
            numTSRecordsToStream = toTSRecordNum - tsRecordNum;
        }
    }
    fFramer->setNumTSPacketsToStream(numTSRecordsToStream);
}