Index: libs/libmythtv/livetvchain.h
===================================================================
--- libs/libmythtv/livetvchain.h	(revision 21402)
+++ libs/libmythtv/livetvchain.h	(working copy)
@@ -81,6 +81,9 @@
     bool IsHostSocket(const MythSocket *sock) const;
     uint HostSocketCount(void) const;
     void DelHostSocket(MythSocket *sock);
+    
+    void SetRecordingProfile(QString profile) { recordingProfile = profile; };
+    QString GetRecordingProfile() { return recordingProfile; };
  
   private:
     void BroadcastUpdate();
@@ -106,6 +109,8 @@
 
     mutable QMutex m_sockLock;
     QList<MythSocket*> m_inUseSocks;
+    
+    QString recordingProfile;
 };
 
 #endif
Index: libs/libmythtv/tv_rec.cpp
===================================================================
--- libs/libmythtv/tv_rec.cpp	(revision 21402)
+++ libs/libmythtv/tv_rec.cpp	(working copy)
@@ -3954,6 +3954,9 @@
     QString profileName = "Live TV";
     if (!tvchain && rec)
         profileName = rec->GetScheduledRecording()->getProfileName();
+    else if ((tvchain!=NULL) && (((LiveTVChain*)tvchain)->GetRecordingProfile()!=NULL)) {
+        profileName = ((LiveTVChain*)tvchain)->GetRecordingProfile();
+    }
 
     if (!profile.loadByType(profileName, cardtype))
     {
Index: programs/mythbackend/httplivetv.cpp
===================================================================
--- programs/mythbackend/httplivetv.cpp	(revision 0)
+++ programs/mythbackend/httplivetv.cpp	(revision 0)
@@ -0,0 +1,159 @@
+//////////////////////////////////////////////////////////////////////////////
+// Program Name: httplivetv.cpp
+//
+// Purpose - Html & XML status HttpExtension
+//
+// Created By  : Rene Buehlmann                 Created On : Aug. 23, 2009
+// Modified By :                                Modified On:
+//
+//////////////////////////////////////////////////////////////////////////////
+
+// POSIX headers
+#include <unistd.h>
+
+// ANSI C headers
+#include <cmath>
+#include <cstdio>
+#include <cstdlib>
+
+// Qt headers
+#include <QTextStream>
+#include <QRegExp>
+#include <QLocale>
+
+// MythTV headers
+#include "httplivetv.h"
+#include "backendutil.h"
+#include "mythxml.h"
+
+#include "mythcontext.h"
+#include "decodeencode.h"
+#include "mythdbcon.h"
+#include "compat.h"
+#include "mythconfig.h"
+
+#define STREAM_BLOCK_SIZE 10000 //in bytes
+
+/////////////////////////////////////////////////////////////////////////////
+//
+/////////////////////////////////////////////////////////////////////////////
+
+HttpLiveTV::HttpLiveTV( QMap<int, EncoderLink *> *tvList, Scheduler *sched, AutoExpire *expirer, bool bIsMaster )
+          : HttpServerExtension( "HttpLiveTV" , QString::null)
+{
+    m_pEncoders = tvList;
+    m_pSched    = sched;
+    m_pExpirer  = expirer;
+    m_bIsMaster = bIsMaster;
+
+    m_nPreRollSeconds = gContext->GetNumSetting("RecordPreRoll", 0);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+//
+/////////////////////////////////////////////////////////////////////////////
+
+HttpLiveTV::~HttpLiveTV()
+{
+}
+
+/////////////////////////////////////////////////////////////////////////////
+//
+/////////////////////////////////////////////////////////////////////////////
+
+bool HttpLiveTV::ProcessRequest( HttpWorkerThread * /* pThread */, HTTPRequest *pRequest )
+{
+    try
+    {
+        if (pRequest)
+        {
+            if (pRequest->m_sBaseUrl != "/livetv")
+                return( false );
+	    
+	    VERBOSE(VB_IMPORTANT, "HttpLiveTV: Requested channel:" + pRequest->m_sMethod);
+	    pRequest->m_eResponseType   = ResponseTypeNone;
+
+	    QString rHeader = QString( "HTTP/%1.%2 %3\r\n"
+                       "Date: %4\r\n"
+                       "Server: %5, UPnP/1.0, MythTV %6\r\n"
+                       "Content-type: video/mpeg\r\n\r\n" )
+                 .arg( pRequest->m_nMajor )
+                 .arg( pRequest->m_nMinor )
+                 .arg( QString("200 OK") )
+                 .arg( QDateTime::currentDateTime().toString( "d MMM yyyy hh:mm:ss" ) )
+                 .arg( HttpServer::g_sPlatform )
+                 .arg( MYTH_BINARY_VERSION );
+
+
+            QByteArray sHeader = rHeader.toUtf8();
+            pRequest->WriteBlockDirect( sHeader.constData(), sHeader.length() );
+
+	    QMap<int, EncoderLink *>::Iterator iter = m_pEncoders->find(1);
+	    if (iter == m_pEncoders->end())
+	    {
+                VERBOSE(VB_IMPORTANT, "HttpLiveTV: " + QString("Unknown encoder: %1").arg(1));
+		        return false;
+            }
+									
+	    
+	    EncoderLink *enc = *iter;
+	    LiveTVChain *chain =  new LiveTVChain();
+            chain->SetRecordingProfile(QString("Stream TV"));
+	    enc->SpawnLiveTV(chain, false, pRequest->m_sMethod);
+	    int i = 0;
+            bool finish=false;
+            
+            while (!finish) {
+                VERBOSE(VB_IMPORTANT, "HttpLiveTV: Getting recording...");
+                ProgramInfo *pi = enc->GetRecording();
+                while (pi==NULL && i < 10) {
+                    VERBOSE(VB_IMPORTANT, "HttpLiveTV: Waiting for recording...");
+                    sleep(1);
+                    pi = enc->GetRecording();
+                }
+		   
+                if (pi==NULL) {
+                    VERBOSE(VB_IMPORTANT, "HttpLiveTV: No recording");
+                    enc->StopLiveTV();
+                    return true;
+                }
+                VERBOSE(VB_IMPORTANT, "HttpLiveTV: Got recording: "+pi->GetPlaybackURL());
+                QByteArray   bytes  = pi->GetPlaybackURL().toAscii();
+
+                const char * file = bytes.data();
+                FILE *f = fopen(file,"r");
+                char buf[STREAM_BLOCK_SIZE];
+                int len=100;
+                int zerocount=0;
+                while (zerocount < 3 && !finish) {
+                if (len==0) {
+                    sleep(1);
+                    zerocount++;
+                }
+                else {
+                    zerocount=0;
+                }
+                len = fread((char *)&buf, 1, STREAM_BLOCK_SIZE, f);
+                int sent = pRequest->WriteBlockDirect(buf,len);
+                if (sent != len) {
+		   VERBOSE(VB_IMPORTANT, "HttpLiveTV: Probalby the client disconnected... Exiting...");
+		   finish=true;
+	        }
+	     }
+             VERBOSE(VB_IMPORTANT, "HttpLiveTV: End of Stream.");
+             fclose(f);
+          }
+          VERBOSE(VB_IMPORTANT, "HttpLiveTV: Exiting StreamTV.");
+	  enc->StopLiveTV();
+	  return true;
+        }
+    }
+    catch( ... )
+    {
+        cerr << "HttpLiveTV::ProcessRequest() - Unexpected Exception" << endl;
+    }
+
+    return( false );
+}
+
+// vim:set shiftwidth=4 tabstop=4 expandtab:
Index: programs/mythbackend/main.cpp
===================================================================
--- programs/mythbackend/main.cpp	(revision 21402)
+++ programs/mythbackend/main.cpp	(working copy)
@@ -49,6 +49,7 @@
 
 #include "mediaserver.h"
 #include "httpstatus.h"
+#include "httplivetv.h"
 
 #define LOC      QString("MythBackend: ")
 #define LOC_WARN QString("MythBackend, Warning: ")
@@ -1102,6 +1103,9 @@
 
         pHS->RegisterExtension( new HttpStatus( &tvList, sched,
                                                 expirer, ismaster ));
+        
+	pHS->RegisterExtension( new HttpLiveTV( &tvList, sched,
+                                                expirer, ismaster ));
     }
 
     VERBOSE(VB_IMPORTANT, QString("Enabled verbose msgs: %1").arg(verboseString));
Index: programs/mythbackend/mythbackend.pro
===================================================================
--- programs/mythbackend/mythbackend.pro	(revision 21402)
+++ programs/mythbackend/mythbackend.pro	(working copy)
@@ -18,12 +18,12 @@
 QMAKE_CLEAN += $(TARGET)
 
 # Input
-HEADERS += autoexpire.h encoderlink.h filetransfer.h httpstatus.h mainserver.h
+HEADERS += autoexpire.h encoderlink.h filetransfer.h httpstatus.h mainserver.h httplivetv.h
 HEADERS += playbacksock.h scheduler.h server.h housekeeper.h backendutil.h
 HEADERS += upnpcdstv.h upnpcdsmusic.h upnpcdsvideo.h mediaserver.h
 HEADERS += mythxml.h upnpmedia.h
 
-SOURCES += autoexpire.cpp encoderlink.cpp filetransfer.cpp httpstatus.cpp
+SOURCES += autoexpire.cpp encoderlink.cpp filetransfer.cpp httpstatus.cpp httplivetv.cpp
 SOURCES += main.cpp mainserver.cpp playbacksock.cpp scheduler.cpp server.cpp
 SOURCES += housekeeper.cpp backendutil.cpp
 SOURCES += upnpcdstv.cpp upnpcdsmusic.cpp upnpcdsvideo.cpp mediaserver.cpp
Index: programs/mythbackend/httplivetv.h
===================================================================
--- programs/mythbackend/httplivetv.h	(revision 0)
+++ programs/mythbackend/httplivetv.h	(revision 0)
@@ -0,0 +1,67 @@
+//////////////////////////////////////////////////////////////////////////////
+// Program Name: httplivetv.h
+//                                                                            
+// Purpose - Html & XML status HttpServerExtension 
+//                                                                            
+// Created By  : Rene Buehlmann                 Created On : Aug. 23, 2009
+// Modified By :                                Modified On:                  
+//                                                                            
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef HTTPLIVETV_H_
+#define HTTPLIVETV_H_
+
+#include <qdom.h>
+#include <qdatetime.h> 
+
+#include "httpserver.h"
+#include "mainserver.h"
+#include "autoexpire.h"
+#include "mythcontext.h"
+#include "jobqueue.h"
+#include "programinfo.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+//
+// 
+//
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+class HttpLiveTV : public HttpServerExtension
+{
+    private:
+
+        Scheduler                   *m_pSched;
+        QMap<int, EncoderLink *>    *m_pEncoders;
+        AutoExpire                  *m_pExpirer;
+        bool                         m_bIsMaster;
+        int                          m_nPreRollSeconds;
+        QMutex                       m_settingLock;
+
+    private:
+
+        //HttpLiveTVMethod GetMethod( const QString &sURI );
+
+        void    GetStatusXML      ( HTTPRequest *pRequest );
+        void    GetStatusHTML     ( HTTPRequest *pRequest );
+
+        void    FillStatusXML     ( QDomDocument *pDoc);
+    
+        void    PrintStatus       ( QTextStream &os, QDomDocument *pDoc );
+        int     PrintEncoderStatus( QTextStream &os, QDomElement encoders );
+        int     PrintScheduled    ( QTextStream &os, QDomElement scheduled );
+        int     PrintJobQueue     ( QTextStream &os, QDomElement jobs );
+        int     PrintMachineInfo  ( QTextStream &os, QDomElement info );
+        int     PrintMiscellaneousInfo ( QTextStream &os, QDomElement info );
+
+    public:
+                 HttpLiveTV( QMap<int, EncoderLink *> *tvList, Scheduler *sched, AutoExpire *expirer, bool bIsMaster );
+        virtual ~HttpLiveTV();
+
+        bool     ProcessRequest( HttpWorkerThread *pThread, HTTPRequest *pRequest );
+};
+
+#endif
