Index: libs/libmythtv/nuppeldecoder.cpp
===================================================================
--- libs/libmythtv/nuppeldecoder.cpp	(revision 9716)
+++ libs/libmythtv/nuppeldecoder.cpp	(working copy)
@@ -36,7 +36,7 @@
       audio_bits_per_sample(0),
 #endif
       ffmpeg_extradatasize(0), ffmpeg_extradata(0), usingextradata(false),
-      disablevideo(false), totalLength(0), totalFrames(0), effdsp(0), 
+      disablevideo(false), totalFrames(0), effdsp(0), 
       directframe(NULL),            decoded_video_frame(NULL),
       mpa_codec(0), mpa_ctx(0), directrendering(false),
       lastct('1'), strm(0), buf(0), buf2(0), 
@@ -352,10 +352,8 @@
                     m_positionMap.push_back(e);
                 }
                 hasFullPositionMap = true;
-                totalLength = (int)((ste.keyframe_number * keyframedist * 1.0) /
-                                     video_frame_rate);
                 totalFrames = (long long)ste.keyframe_number * keyframedist;
-                GetNVP()->SetFileLength(totalLength, totalFrames);
+                GetNVP()->SetFrameCount(totalFrames);
 
                 delete [] seekbuf;
             }
@@ -417,9 +415,8 @@
                 }
                 hasKeyFrameAdjustTable = true;
 
-                totalLength -= (int)(adjust / video_frame_rate);
                 totalFrames -= adjust;
-                GetNVP()->SetFileLength(totalLength, totalFrames);
+                GetNVP()->SetFrameCount(totalFrames);
 
                 adjust = 0;
                 for (unsigned int i=0; i < m_positionMap.size(); i++) 
Index: libs/libmythtv/NuppelVideoPlayer.cpp
===================================================================
--- libs/libmythtv/NuppelVideoPlayer.cpp	(revision 9716)
+++ libs/libmythtv/NuppelVideoPlayer.cpp	(working copy)
@@ -151,7 +151,7 @@
       seekamount(30),               exactseeks(false),
       // Playback misc.
       videobuf_retries(0),          framesPlayed(0),
-      totalFrames(0),               totalLength(0),
+      totalFrames(0),
       rewindtime(0),                m_recusage(inUseID),
       // Input Video Attributes
       video_width(0), video_height(0), video_size(0),
@@ -837,12 +837,6 @@
     m_scan_tracker = (m_scan == kScan_Interlaced) ? 2 : 0;
 }
 
-void NuppelVideoPlayer::SetFileLength(int total, int frames)
-{
-    totalLength = total;
-    totalFrames = frames;
-}
-
 int NuppelVideoPlayer::OpenFile(bool skipDsp, uint retries,
                                 bool allow_libmpeg2)
 {
@@ -5101,7 +5095,7 @@
         return;
     }
 
-    int playbackLen = totalLength;
+    int playbackLen = (int)((float)totalFrames / video_frame_rate);
     
     if (livetv && livetvchain)
     {
@@ -5116,6 +5110,7 @@
     float secsplayed;
     if (ringBuffer->isDVD())
     {
+        playbackLen = ringBuffer->DVD()->GetTotalTimeOfTitle();
         if (!ringBuffer->DVD()->IsInMenu())
             secsplayed = ringBuffer->DVD()->GetCurrentTime();
     }
Index: libs/libmythtv/avformatdecoder.cpp
===================================================================
--- libs/libmythtv/avformatdecoder.cpp	(revision 9716)
+++ libs/libmythtv/avformatdecoder.cpp	(working copy)
@@ -844,14 +844,14 @@
 
         if (dur > 0)
         {
-            GetNVP()->SetFileLength((int)(dur), (int)(dur * fps));
+            GetNVP()->SetFrameCount((long long)(dur * fps));
         }
         else
         {
             // the pvr-250 seems to overreport the bitrate by * 2
             float bytespersec = (float)bitrate / 8 / 2;
             float secs = ringBuffer->GetRealFileSize() * 1.0 / bytespersec;
-            GetNVP()->SetFileLength((int)(secs), (int)(secs * fps));
+            GetNVP()->SetFrameCount((long long)(secs * fps));
         }
 
         // we will not see a position map from db or remote encoder,
@@ -1723,8 +1723,7 @@
             {
                 long long index       = m_positionMap.back().index;
                 long long totframes   = index * keyframedist;
-                uint length = (uint)((totframes * 1.0f) / fps);
-                GetNVP()->SetFileLength(length, totframes);
+                GetNVP()->SetFrameCount(totframes);
             }
 #endif
         }
@@ -1766,7 +1765,7 @@
             bitrate = (int)((pkt->pos * 8 * fps) / (framesRead - 1));
             float bytespersec = (float)bitrate / 8;
             float secs = ringBuffer->GetRealFileSize() * 1.0 / bytespersec;
-            GetNVP()->SetFileLength((int)(secs), (int)(secs * fps));
+            GetNVP()->SetFrameCount((long long)(secs * fps));
         }
 #endif
     }
Index: libs/libmythtv/nuppeldecoder.h
===================================================================
--- libs/libmythtv/nuppeldecoder.h	(revision 9716)
+++ libs/libmythtv/nuppeldecoder.h	(working copy)
@@ -97,7 +97,6 @@
 
     bool disablevideo;
 
-    int totalLength;
     long long totalFrames;
 
     int effdsp;
Index: libs/libmythtv/NuppelVideoPlayer.h
===================================================================
--- libs/libmythtv/NuppelVideoPlayer.h	(revision 9716)
+++ libs/libmythtv/NuppelVideoPlayer.h	(working copy)
@@ -128,7 +128,7 @@
     void SetLiveTVChain(LiveTVChain *tvchain) { livetvchain = tvchain; }
     void SetAudioSampleRate(int rate)         { audio_samplerate = rate; }
     void SetAudioStretchFactor(float factor)  { audio_stretchfactor = factor; }
-    void SetLength(int len)                   { totalLength = len; }
+    void SetFrameCount(long long len)         { totalFrames = len; }
     void SetAudioOutput (AudioOutput *ao)     { audioOutput = ao; }
     void SetVideoFilters(QString &filters)    { videoFilterList = filters; }
     void SetFramesPlayed(long long played)    { framesPlayed = played; }
@@ -146,7 +146,6 @@
                         float a = 1.33333, FrameScanType scan = kScan_Ignore);
     void SetAudioParams(int bits, int channels, int samplerate, bool passthru);
     void SetEffDsp(int dsprate);
-    void SetFileLength(int total, int frames);
     void Zoom(int direction);
     void ClearBookmark(void);
     void SetForcedAspectRatio(int mpeg2_aspect_value, int letterbox_permission);
@@ -174,7 +173,7 @@
     int     GetFFRewSkip(void) const          { return ffrew_skip; }
     float   GetAudioStretchFactor(void) const { return audio_stretchfactor; }
     float   GetNextPlaySpeed(void) const      { return next_play_speed; }
-    int     GetLength(void) const             { return totalLength; }
+    int     GetLength(void) const             { return (int)((float)totalFrames / video_frame_rate); }
     long long GetTotalFrameCount(void) const  { return totalFrames; }
     long long GetFramesPlayed(void) const     { return framesPlayed; }
     long long GetBookmark(void) const;
@@ -549,7 +548,6 @@
     int       videobuf_retries;
     long long framesPlayed;
     long long totalFrames;
-    long long totalLength;
     long long rewindtime;
     QString m_recusage;
 
Index: libs/libmythtv/tv_play.cpp
===================================================================
--- libs/libmythtv/tv_play.cpp	(revision 9716)
+++ libs/libmythtv/tv_play.cpp	(working copy)
@@ -1272,7 +1272,6 @@
     nvp->SetRecorder(recorder);
     nvp->SetAudioSampleRate(gContext->GetNumSetting("AudioSampleRate", 44100));
     nvp->SetAudioDevice(gContext->GetSetting("AudioOutputDevice"));
-    nvp->SetLength(playbackLen);
     nvp->SetExactSeeks(gContext->GetNumSetting("ExactSeeking", 0));
     nvp->SetAutoCommercialSkip(autoCommercialSkip);
     nvp->SetLiveTVChain(tvchain);
@@ -1345,8 +1344,6 @@
     pipnvp->SetAudioDevice(gContext->GetSetting("AudioOutputDevice"));
     pipnvp->SetExactSeeks(gContext->GetNumSetting("ExactSeeking", 0));
     pipnvp->SetLiveTVChain(piptvchain);
-
-    pipnvp->SetLength(playbackLen);
 }
 
 void TV::TeardownPlayer(void)
@@ -5172,12 +5169,12 @@
                 message = message.simplifyWhiteSpace();
                 QStringList tokens = QStringList::split(" ", message);
                 int cardnum = tokens[1].toInt();
-                int filelen = tokens[2].toInt();
+                long long filelen = tokens[2].toLongLong();
 
                 if (recorder && cardnum == recorder->GetRecorderNumber())
                 {
                     nvp->SetWatchingRecording(false);
-                    nvp->SetLength(filelen);
+                    nvp->SetFrameCount(filelen);
                     ChangeState(kState_WatchingPreRecorded);
                 }
             }
@@ -5186,13 +5183,13 @@
                 message = message.simplifyWhiteSpace();
                 QStringList tokens = QStringList::split(" ", message);
                 int cardnum = tokens[1].toInt();
-                int filelen = tokens[2].toInt();
+                long long filelen = tokens[2].toLongLong();
 
                 if (recorder && cardnum == recorder->GetRecorderNumber() &&
                     tvchain && tvchain->HasNext())
                 {
                     nvp->SetWatchingRecording(false);
-                    nvp->SetLength(filelen);
+                    nvp->SetFrameCount(filelen);
                 }
             }
         }
Index: libs/libmythtv/decoderbase.cpp
===================================================================
--- libs/libmythtv/decoderbase.cpp	(revision 9716)
+++ libs/libmythtv/decoderbase.cpp	(working copy)
@@ -328,23 +328,21 @@
         if (ringBuffer->isDVD())
         { 
             totframes = m_positionMap[m_positionMap.size() - 1].index;
-            length = ringBuffer->DVD()->GetTotalTimeOfTitle();
         }
         else
         { 
             totframes = 
                      m_positionMap[m_positionMap.size()-1].index * keyframedist;
-            length = (int)((totframes * 1.0) / fps);
         }
 
-        GetNVP()->SetFileLength(length, totframes);
+        GetNVP()->SetFrameCount(totframes);
         GetNVP()->SetKeyframeDistance(keyframedist);
         posmapStarted = true;
 
         VERBOSE(VB_PLAYBACK,
-                QString("SyncPositionMap, new totframes: %1, new length: %2, "
-                        "posMap size: %3")
-                        .arg((long)totframes).arg(length)
+                QString("SyncPositionMap, new totframes: %1, "
+                        "posMap size: %2")
+                        .arg((long)totframes)
                         .arg(m_positionMap.size()));
     }
     recordingHasPositionMap |= !m_positionMap.empty();
Index: libs/libmythtv/ivtvdecoder.cpp
===================================================================
--- libs/libmythtv/ivtvdecoder.cpp	(revision 9716)
+++ libs/libmythtv/ivtvdecoder.cpp	(working copy)
@@ -295,7 +295,7 @@
         float bytespersec = (float)bitrate / 8 / 2;
         float secs = ringBuffer->GetRealFileSize() * 1.0 / bytespersec;
 
-        GetNVP()->SetFileLength((int)(secs), (int)(secs * fps));
+        GetNVP()->SetFrameCount((long long)(secs * fps));
     }
 
     if (hasFullPositionMap)
@@ -397,8 +397,7 @@
                             float bytespersec = (float)bitrate / 8;
                             float secs = ringBuffer->GetRealFileSize() * 1.0 /
                                              bytespersec;
-                            GetNVP()->SetFileLength((int)(secs),
-                                                    (int)(secs * fps));
+                            GetNVP()->SetFrameCount((long long)(secs * fps));
                         }
 
                     }
Index: libs/libmythtv/tv_rec.cpp
===================================================================
--- libs/libmythtv/tv_rec.cpp	(revision 9716)
+++ libs/libmythtv/tv_rec.cpp	(working copy)
@@ -926,12 +926,8 @@
 
     if (recorder && HasFlags(kFlagRecorderRunning))
     {
-        // This is a bad way to calculate this, the framerate
-        // may not be constant if using a DTV based recorder.
-        filelen = (int)((float)GetFramesWritten() / GetFramerate());
-
         QString message = QString("DONE_RECORDING %1 %2")
-            .arg(cardid).arg(filelen);
+            .arg(cardid).arg(GetFramesWritten());
         MythEvent me(message);
         gContext->dispatch(me);
 
