diff -r -u /root/Desktop/mythtv/cvs/20041216.1/mythtv-0.16.20041216.1/libs/libmythtv/NuppelVideoPlayer.cpp /root/Desktop/mythtv/cvs/20041216.4/mythtv-0.16.20041216.4/libs/libmythtv/NuppelVideoPlayer.cpp
--- /root/Desktop/mythtv/cvs/20041216.1/mythtv-0.16.20041216.1/libs/libmythtv/NuppelVideoPlayer.cpp	2004-12-15 19:42:54.000000000 +0100
+++ /root/Desktop/mythtv/cvs/20041216.4/mythtv-0.16.20041216.4/libs/libmythtv/NuppelVideoPlayer.cpp	2004-12-24 02:14:06.000000000 +0100
@@ -582,17 +582,25 @@
         delete decoder;
 
     if (NuppelDecoder::CanHandle(testbuf))
+    {
         decoder = new NuppelDecoder(this, m_db, m_playbackinfo);
+	cerr << "set decoder to Nuppel\n";
+    }
+    
 #ifdef USING_IVTV
     else if (!disablevideo && IvtvDecoder::CanHandle(testbuf,
                                                      ringBuffer->GetFilename()))
     {
         decoder = new IvtvDecoder(this, m_db, m_playbackinfo);
         disableaudio = true; // no audio with ivtv.
+	cerr << "set decoder to Ivtv\n";
     }
 #endif
     else if (AvFormatDecoder::CanHandle(testbuf, ringBuffer->GetFilename()))
+    {
         decoder = new AvFormatDecoder(this, m_db, m_playbackinfo);
+	cerr << "set decoder to AvFormat\n";
+    }
 
     if (!decoder)
     {
@@ -684,6 +692,7 @@
 
 VideoFrame *NuppelVideoPlayer::GetNextVideoFrame(void)
 {
+    assert(videoOutput);
     return videoOutput->GetNextFreeFrame();
 }
 
@@ -1533,6 +1542,9 @@
     }
 
     vidExitLock.lock();
+    // Wait that the player has exited before destroing videoOutput
+    while(!killvideo)
+    	usleep(500);
     delete videoOutput;
     videoOutput = NULL;
     vidExitLock.unlock();
@@ -1734,7 +1746,8 @@
 
     if (bookmarkseek > 30)
     {
-        GetFrame(audioOutput == NULL || !normal_speed);
+        // Don't show frame before to be in the right postion
+        //GetFrame(audioOutput == NULL || !normal_speed);
 
         bool seeks = exactseeks;
 
@@ -1885,13 +1898,6 @@
             continue;
         }
 
-        GetFrame(audioOutput == NULL || !normal_speed);
-
-        if (disablevideo || forceVideoOutput == kVideoOutput_IVTV)
-            decoder->UpdateFramesPlayed();
-        else
-            framesPlayed = videoOutput->GetFramesPlayed();
-
         if (ffrew_skip != 1)
             continue;
 
@@ -1906,13 +1912,25 @@
                 eof = 1;
             else
             {
+		// Don't show empty buffer
+		videoOutput->BlancFrame();
                 PauseVideo();
                 JumpToFrame(deleteIter.key());
                 UnpauseVideo();
                 while (GetVideoPause())
                     usleep(50);
+		videoOutput->UnBlancFrame();
             }
         }
+        
+	// Now we're in postition to show the right frame
+        GetFrame(audioOutput == NULL || !normal_speed);
+
+        if (disablevideo || forceVideoOutput == kVideoOutput_IVTV)
+            decoder->UpdateFramesPlayed();
+        else
+            framesPlayed = videoOutput->GetFramesPlayed();
+    
     }
 
     killvideo = true;
@@ -2200,7 +2218,8 @@
 
     if (normal_speed)
     {
-        audioOutput->SetStretchFactor(play_speed);
+        if(audioOutput)
+            audioOutput->SetStretchFactor(play_speed);
 #ifdef USING_DIRECTX
         if (audioOutput)
             audioOutput->Reset();
@@ -3555,7 +3574,7 @@
 
                 int flagFPS;
                 float elapsed = flagTime.elapsed() / 1000.0;
-
+//            VERBOSE(VB_IMPORTANT, "myFramesPlayed: %1, elapsed: %2, totalFrames:%3").arg(myFramesPlayed).arg(elapsed).arg(totalFrames);
                 if (elapsed)
                     flagFPS = (int)(myFramesPlayed / elapsed);
                 else
diff -r -u /root/Desktop/mythtv/cvs/20041216.1/mythtv-0.16.20041216.1/libs/libmythtv/avformatdecoder.cpp /root/Desktop/mythtv/cvs/20041216.4/mythtv-0.16.20041216.4/libs/libmythtv/avformatdecoder.cpp
--- /root/Desktop/mythtv/cvs/20041216.1/mythtv-0.16.20041216.1/libs/libmythtv/avformatdecoder.cpp	2004-12-08 05:23:16.000000000 +0100
+++ /root/Desktop/mythtv/cvs/20041216.4/mythtv-0.16.20041216.4/libs/libmythtv/avformatdecoder.cpp	2004-12-24 12:00:14.000000000 +0100
@@ -809,6 +809,8 @@
 
     if (!hasFullPositionMap)
     {
+        VERBOSE(VB_IMPORTANT, "!hasFullPositionMap"); 
+    
         long long last_frame = 0;
         if (!m_positionMap.empty())
             last_frame = m_positionMap[m_positionMap.size() - 1].index;
diff -r -u /root/Desktop/mythtv/cvs/20041216.1/mythtv-0.16.20041216.1/libs/libmythtv/decoderbase.cpp /root/Desktop/mythtv/cvs/20041216.4/mythtv-0.16.20041216.4/libs/libmythtv/decoderbase.cpp
--- /root/Desktop/mythtv/cvs/20041216.1/mythtv-0.16.20041216.1/libs/libmythtv/decoderbase.cpp	2004-11-30 03:32:22.000000000 +0100
+++ /root/Desktop/mythtv/cvs/20041216.4/mythtv-0.16.20041216.4/libs/libmythtv/decoderbase.cpp	2004-12-23 02:07:12.000000000 +0100
@@ -90,12 +90,13 @@
             if (!posMap.empty())
             {
                 positionMapType = MARK_GOP_START;
-                if (keyframedist == -1)
+                // Let the decoder handle it
+                /* if (keyframedist == -1)
                 {
                     keyframedist = 15;
                     if (fps < 26 && fps > 24)
                         keyframedist = 12;
-                }
+                }*/
             }
             else
             {
diff -r -u /root/Desktop/mythtv/cvs/20041216.1/mythtv-0.16.20041216.1/libs/libmythtv/programinfo.cpp /root/Desktop/mythtv/cvs/20041216.4/mythtv-0.16.20041216.4/libs/libmythtv/programinfo.cpp
--- /root/Desktop/mythtv/cvs/20041216.1/mythtv-0.16.20041216.1/libs/libmythtv/programinfo.cpp	2004-12-14 04:31:46.000000000 +0100
+++ /root/Desktop/mythtv/cvs/20041216.4/mythtv-0.16.20041216.4/libs/libmythtv/programinfo.cpp	2004-12-23 02:07:11.000000000 +0100
@@ -525,7 +525,7 @@
                        "channel.outputfilters,seriesid,programid,filesize, "
                        "lastmodified,stars,previouslyshown,originalairdate, "
                        "category_type, hostname "
-                       "FROM recorded "
+                       "FROM mythconverg.recorded "
                        "LEFT JOIN channel "
                        "ON recorded.chanid = channel.chanid "
                        "WHERE recorded.chanid = %1 "
diff -r -u /root/Desktop/mythtv/cvs/20041216.1/mythtv-0.16.20041216.1/libs/libmythtv/videoout_xv.cpp /root/Desktop/mythtv/cvs/20041216.4/mythtv-0.16.20041216.4/libs/libmythtv/videoout_xv.cpp
--- /root/Desktop/mythtv/cvs/20041216.1/mythtv-0.16.20041216.1/libs/libmythtv/videoout_xv.cpp	2004-11-30 03:32:22.000000000 +0100
+++ /root/Desktop/mythtv/cvs/20041216.4/mythtv-0.16.20041216.4/libs/libmythtv/videoout_xv.cpp	2004-12-23 02:07:12.000000000 +0100
@@ -529,9 +529,26 @@
         XFree(attributes);
     }
 
+    // Try to set the color key to black to avoid the blue falsh at start
+    xv_atom = XInternAtom(data->XJ_disp, "XV_COLORKEY", False);
+    if (xv_atom != None)
+    {
+	data->colorkey = 0x010000;
+	if(ret = XvSetPortAttribute(data->XJ_disp, xv_port, xv_atom, data->colorkey))
+	{
+            
+            if (ret != Success)
+            {
+		VERBOSE(VB_PLAYBACK, QString("Failed to set the color key to black"));
+	    }
+	    else
+		VERBOSE(VB_PLAYBACK, QString("set the colorkey to black"));
+	    
+        }
+    }
+
     if (data->needdrawcolor)
     {
-        xv_atom = XInternAtom(data->XJ_disp, "XV_COLORKEY", False);
         if (xv_atom != None)
         {
             ret = XvGetPortAttribute(data->XJ_disp, xv_port, xv_atom, 
@@ -545,6 +562,8 @@
         }
     }
 
+    VERBOSE(VB_PLAYBACK, QString("colorkey = %1").arg(data->colorkey));
+
     MoveResize();
 
     if (gContext->GetNumSetting("UseOutputPictureControls", 0))
diff -r -u /root/Desktop/mythtv/cvs/20041216.1/mythtv-0.16.20041216.1/libs/libmythtv/videooutbase.cpp /root/Desktop/mythtv/cvs/20041216.4/mythtv-0.16.20041216.4/libs/libmythtv/videooutbase.cpp
--- /root/Desktop/mythtv/cvs/20041216.1/mythtv-0.16.20041216.1/libs/libmythtv/videooutbase.cpp	2004-12-02 07:29:11.000000000 +0100
+++ /root/Desktop/mythtv/cvs/20041216.4/mythtv-0.16.20041216.4/libs/libmythtv/videooutbase.cpp	2004-12-23 02:07:12.000000000 +0100
@@ -1374,3 +1374,23 @@
 */
 }
 
+void VideoOutput::BlancFrame(void)
+{
+    imgw = 0;
+    imgh = 0;
+
+    blancked = true;
+    
+}
+void VideoOutput::UnBlancFrame(void)
+{
+    imgw = XJ_width;
+    imgh = XJ_height;
+
+    blancked = false;
+}
+
+bool VideoOutput::GetBlancked(void)
+{
+    return blancked;
+}
diff -r -u /root/Desktop/mythtv/cvs/20041216.1/mythtv-0.16.20041216.1/libs/libmythtv/videooutbase.h /root/Desktop/mythtv/cvs/20041216.4/mythtv-0.16.20041216.4/libs/libmythtv/videooutbase.h
--- /root/Desktop/mythtv/cvs/20041216.1/mythtv-0.16.20041216.1/libs/libmythtv/videooutbase.h	2004-12-02 07:29:11.000000000 +0100
+++ /root/Desktop/mythtv/cvs/20041216.4/mythtv-0.16.20041216.4/libs/libmythtv/videooutbase.h	2004-12-23 02:07:12.000000000 +0100
@@ -165,6 +165,10 @@
     int GetCurrentColour(void) { return colour; }
     int GetCurrentHue(void) { return hue; }
 
+    void BlancFrame(void);
+    void UnBlancFrame(void);
+    bool GetBlancked(void);
+    
     bool AllowPreviewEPG(void) { return allowpreviewepg; }
 
     virtual bool hasIDCTAcceleration() const { return false; }
@@ -206,6 +210,8 @@
     int w_mm;
     int h_mm;
 
+    bool blancked;
+ 
     int myth_dsw;
     int myth_dsh;
 
diff -r -u /root/Desktop/mythtv/cvs/20041216.1/mythtv-0.16.20041216.1/programs/mythtranscode/transcode.cpp /root/Desktop/mythtv/cvs/20041216.4/mythtv-0.16.20041216.4/programs/mythtranscode/transcode.cpp
--- /root/Desktop/mythtv/cvs/20041216.1/mythtv-0.16.20041216.1/programs/mythtranscode/transcode.cpp	2004-11-11 08:36:45.000000000 +0100
+++ /root/Desktop/mythtv/cvs/20041216.4/mythtv-0.16.20041216.4/programs/mythtranscode/transcode.cpp	2004-12-23 17:34:32.000000000 +0100
@@ -476,7 +476,14 @@
     bool first_loop = true;
     while (nvp->TranscodeGetNextFrame(dm_iter, &did_ff, &is_key, honorCutList))
     {
-        if (first_loop)
+    	// see if the decoder has determined the number of frame
+    	if(!total_frame_count)
+	{
+            total_frame_count = nvp->GetTotalFrameCount();
+	    cerr << "\ntotal_frame_count: "<< total_frame_count;
+	}
+        
+	if (first_loop)
         {
             copyaudio = nvp->GetRawAudioState();
             first_loop = false;
@@ -656,10 +663,18 @@
                     unlink(outputname);
                     return REENCODE_STOPPED;
                 }
-                int percentage = curFrameNum * 100 / total_frame_count;
-                JobQueue::ChangeJobComment(m_db, jobID,
-                                           QString("%1% ").arg(percentage) + 
-                                           QObject::tr("Completed"));
+		
+		if(total_frame_count)
+		{
+                    int percentage = curFrameNum * 100 / total_frame_count;
+                    JobQueue::ChangeJobComment(m_db, jobID,
+                                               QString("%1% ").arg(percentage) + 
+                                               QObject::tr("Completed"));
+		}
+		else
+		{
+                    JobQueue::ChangeJobComment(m_db, jobID, QObject::tr("Working"));
+		}
             }
             curtime = QDateTime::currentDateTime();
             curtime = curtime.addSecs(60);
