diff -ru --new-file --exclude=.svn myth-org/mythtv/configure myth-patch/mythtv/configure
--- myth-org/mythtv/configure	2006-04-01 12:53:28.000000000 +0200
+++ myth-patch/mythtv/configure	2006-04-09 19:18:35.000000000 +0200
@@ -2,7 +2,7 @@
 #
 # ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
 #
-
+ 
 x86_mmx_cpus="pentium-mmx,pentium2,pentium3,pentium3m,pentium-m"
 x86_mmx_cpus="$x86_mmx_cpus,pentium4,pentium4m,prescott"
 x86_mmx_cpus="$x86_mmx_cpus,athlon,athlon-xp,athlon-tbird,athlon-4,athlon-mp,"
@@ -55,6 +55,7 @@
 lirc="yes"
 joystick_menu="yes"
 firewire_cable_box="yes"
+freebox_box="yes"
 dbox2_dvb_box="yes"
 x11_include_path="/usr/X11R6/include"
 x11="yes"
@@ -173,6 +174,7 @@
 echo "  --disable-lirc           disable lirc support (Infrared Remotes)"
 echo "  --disable-joystick-menu  disable joystick menu"
 echo "  --disable-firewire       disable support for FireWire cable boxes"
+echo "  --disable-freebox        disable support for Freebox"
 echo "  --disable-dbox2          disable support for Nokia DBOX2 DVB boxes (or compatibles)"
 echo "  --disable-v4l            disable Video4Linux support"
 echo "  --disable-ivtv           disable ivtv support (PVR-x50) req. v4l support"
@@ -809,6 +811,10 @@
   ;;
   --disable-dbox2) dbox2_dvb_box="no"
   ;;
+  --enable-freebox) freebox_box="yes"
+  ;;
+  --disable-freebox) freebox_box="no"
+  ;;
   --enable-dvb) dvb="yes"
   ;;
   --disable-dvb) dvb="no"
@@ -2100,6 +2106,15 @@
     fi
 fi
 
+if test x"$dvd" = x"yes" ; then
+    if has_library libdvdnav ; then
+        if has_header dvdnav/dvdnav.h ; then
+            dvd="yes"
+        fi
+    fi
+fi
+
+
 VENDOR_XVMC_LIBS=""
 if test x"$xvmc" = x"yes"; then
     xvmc="no"
@@ -2249,6 +2264,8 @@
   echo "FireWire support $firewire_cable_box"
   echo "DVB support      $dvb [$dvb_path]"
   echo "DBox2 support    $dbox2_dvb_box"
+  echo "freebox support    $freebox_box"
+
 fi
 
 if test x"$frontend" = x"yes" ; then
@@ -2891,6 +2908,12 @@
   CONFIG_DEFINES="$CONFIG_DEFINES USING_DBOX2"
 fi
 
+if test x"$freebox_box" = x"yes" ; then
+  CCONFIG="$CCONFIG using_freebox"
+  CONFIG_DEFINES="$CONFIG_DEFINES USING_FREEBOX"
+fi
+
+
 if test x"$lirc" = x"yes" ; then
   CCONFIG="$CCONFIG using_lirc"
   echo "CONFIG_LIRC_LIBS=-llirc_client" >> $MYTH_CONFIG_MAK
diff -ru --new-file --exclude=.svn myth-org/mythtv/libs/libmythtv/cardutil.cpp myth-patch/mythtv/libs/libmythtv/cardutil.cpp
--- myth-org/mythtv/libs/libmythtv/cardutil.cpp	2006-04-01 12:53:26.000000000 +0200
+++ myth-patch/mythtv/libs/libmythtv/cardutil.cpp	2006-04-09 19:19:26.000000000 +0200
@@ -515,7 +515,7 @@
 {
     QStringList ret;
 
-    if (("FIREWIRE" == cardtype) || ("DBOX2" == cardtype))
+    if (("FIREWIRE" == cardtype) || ("DBOX2" == cardtype) || ("FREEBOX" == cardtype))
         ret += "MPEG2TS";
     else if ("DVB" == cardtype)
         ret += probeDVBInputs(device, diseqctype);
@@ -705,6 +705,21 @@
                 .arg(query.value(1).toString())
                 .arg(query.value(2).toString());
     }
+    else if (cardtype == "FREEBOX")
+    {
+        MSqlQuery query(MSqlQuery::InitCon());
+        query.prepare(
+            "SELECT freebox_host "
+            "FROM capturecard "
+            "WHERE cardid = :CARDID");
+        query.bindValue(":CARDID", cardid);
+
+        if (!query.exec() || !query.isActive() || !query.size())
+            label = "[ DB ERROR ]";
+        else
+            label = QString("[ FREEBOX : HOST %1  ]")
+                .arg(query.value(0).toString());
+    }
     else
     {
         label = QString("[ %1 : %2 ]").arg(cardtype).arg(videodevice);
@@ -724,7 +739,7 @@
     int rcardid = (parentid) ? parentid : cardid;
     QStringList inputs;
 
-    if (("FIREWIRE" == cardtype) || ("DBOX2" == cardtype))
+    if (("FIREWIRE" == cardtype) || ("DBOX2" == cardtype) || ("FREEBOX" == cardtype))
         inputs += "MPEG2TS";
     else if ("DVB" != cardtype)
         inputs += probeV4LInputs(device);
diff -ru --new-file --exclude=.svn myth-org/mythtv/libs/libmythtv/dbcheck.cpp myth-patch/mythtv/libs/libmythtv/dbcheck.cpp
--- myth-org/mythtv/libs/libmythtv/dbcheck.cpp	2006-04-08 16:47:47.000000000 +0200
+++ myth-patch/mythtv/libs/libmythtv/dbcheck.cpp	2006-04-09 19:19:20.000000000 +0200
@@ -2010,6 +2010,7 @@
             return false;
     }
 
+
     if (dbver == "1123")
     {
         const QString updates[] = {
@@ -2184,6 +2185,19 @@
 //"ALTER TABLE capturecard DROP COLUMN dvb_hw_decoder;" in 0.21
 //"ALTER TABLE cardinput DROP COLUMN  preference;" in 0.22
 
+  if (dbver == "1134")
+    {
+        const QString updates[] = {
+"INSERT INTO profilegroups SET name = 'Freebox Input', cardtype = 'Freebox', is_default = 1;",
+"ALTER TABLE capturecard ADD COLUMN freebox_host varchar(64) DEFAULT 'mafreebox.freebox.fr';",
+""
+};
+
+        if (!performActualUpdate(updates, "1135", dbver))
+            return false;
+    }
+
+
     return true;
 }
 
@@ -2244,6 +2258,7 @@
 "  dbox2_port int(10) unsigned NOT NULL default '31338',"
 "  dbox2_httpport int(10) unsigned NOT NULL default '80',"
 "  dbox2_host varchar(32) default NULL,"
+"  freebox_host varchar(64) DEFAULT 'mafreebox.freebox.fr',"
 "  signal_timeout int(11) NOT NULL default '1000',"
 "  channel_timeout int(11) NOT NULL default '3000',"
 "  PRIMARY KEY  (cardid)"
@@ -2810,6 +2825,7 @@
 "INSERT INTO profilegroups VALUES (8,"
 " 'USB Mpeg-4 Encoder (Plextor ConvertX, etc)','GO7007',1,NULL);",
 "INSERT INTO profilegroups VALUES (9,'DBOX2 Input','DBOX2',1,NULL);",
+"INSERT INTO `profilegroups` VALUES (10,'Freebox Input','Freebox',1,NULL);",
 "INSERT INTO recordingprofiles VALUES (1,'Default',NULL,NULL,1);",
 "INSERT INTO recordingprofiles VALUES (2,'Live TV',NULL,NULL,1);",
 "INSERT INTO recordingprofiles VALUES (3,'High Quality',NULL,NULL,1);",
diff -ru --new-file --exclude=.svn myth-org/mythtv/libs/libmythtv/freeboxchannel.cpp myth-patch/mythtv/libs/libmythtv/freeboxchannel.cpp
--- myth-org/mythtv/libs/libmythtv/freeboxchannel.cpp	1970-01-01 01:00:00.000000000 +0100
+++ myth-patch/mythtv/libs/libmythtv/freeboxchannel.cpp	2006-04-09 19:19:48.000000000 +0200
@@ -0,0 +1,330 @@
+/**
+ *  FreeboxChannel
+ *  Copyright (c) 2005 by Levent Gündogdu
+ *  Distributed as part of MythTV under GPL v2 and later.
+ */
+
+
+
+#include <iostream>
+#include <qsqldatabase.h>
+#include "mythdbcon.h"
+#include "mythcontext.h"
+#include "freeboxchannel.h"
+
+
+FreeboxChannel::FreeboxChannel(TVRec *parent, FreeboxDBOptions *freebox_options, int cardid): 
+				QObject(NULL, "FreeboxChannel"), 
+				ChannelBase(parent),
+				http(new QHttp()),
+				m_freeboxoptions(freebox_options),
+				m_freeboxchannelcount(0),
+				m_channelListReady(false),
+				m_requestChannel(""),
+				m_lastChannel("1"),
+				m_cardid(cardid)
+
+{
+	connect(http, 	     SIGNAL(           done(bool)),
+            this,        SLOT(  HttpRequestDone(bool)));
+ 
+ 	LoadChannels();
+}
+
+bool FreeboxChannel::SwitchToInput(const QString &inputname, const QString &chan)
+{
+	int inputNum = GetInputByName(inputname);
+  	if (inputNum < 0)
+    	 return false;
+	        
+   return SetChannelByString(chan);
+}
+
+bool FreeboxChannel::SetChannelByString(const QString &newChan)
+{
+	 // Delay set channel when list has not yet been retrieved
+    if (!m_channelListReady)
+    {
+    	VERBOSE(VB_IMPORTANT,QString("Freebox # Channel list not received yet. Will switch to channel %1 later...").arg(newChan));
+		m_requestChannel = newChan;
+		return true;
+    }
+    
+    QString chan = newChan;
+    // If chan is empty, use DefautChannel
+    if (chan == "")
+    {
+    	VERBOSE(VB_IMPORTANT,QString("Freebox # Empty channel name has been provided. Getting default name."));
+		chan = GetDefaultChannel();
+    }
+    
+    // update current chanel
+    if (m_lastChannel != curchannelname)
+        m_lastChannel = curchannelname;
+
+    curchannelname = chan;
+    m_currenturl = GetChannelUrlFromNumber(curchannelname);
+	
+
+	// emit signal to recorder
+	emit ChannelChanged();
+
+    return true;
+}
+
+QString FreeboxChannel::GetCurrentChannelUrl()
+{
+	return m_currenturl;
+}
+
+bool FreeboxChannel::IsOpen(void) const
+{
+	return true;
+}
+
+bool FreeboxChannel::Open(void)
+{
+    if (!InitializeInputs())
+        return false;
+	
+	return true;
+}
+
+void FreeboxChannel::Close(void)
+{
+}
+
+
+// =====================================================================================
+//
+//	C H A N N E L     L O A D I N G
+// =====================================================================================
+
+
+void FreeboxChannel::LoadChannels()
+{
+    // Request Channel list via http. Signal will be emmitted when list is ready.
+    QHttpRequestHeader header("GET", "/freeboxtv/playlist.m3u");
+    header.setValue("Host", m_freeboxoptions->host);
+    http->setHost(m_freeboxoptions->host, 80);
+    http->request(header);
+}
+
+
+QString FreeboxChannel::normalize(QString channelName)
+{
+	// Normalize Channel name so we can try to automap channel return by freebox to channel coming from tv_grab_fr
+	QString res;
+	for (unsigned int i=0;i<channelName.length();i++)
+	{
+		QChar c = channelName[i];
+		if (c.isSpace()) continue;
+		c=c.lower();
+		if (c=='é' || c=='ê' || c=='ê') c='e';
+		if (c=='à') c='a';
+		if (c=='i' || c=='î') c=='i';
+		if (c=='ô') c=='o';
+		
+		res += c;
+	}
+	
+	return res;
+}
+
+// ==========================================================================================
+// HttpRequestDone : Receive response to channel list request
+// 
+// ==========================================================================================
+void FreeboxChannel::HttpRequestDone(bool error) 
+{
+    if (error) 
+    {
+    	VERBOSE(VB_IMPORTANT,QString("Freebox # Reading channel list failed!"));
+        return;
+    }
+
+    QString buffer=http->readAll();
+    m_freeboxchannelcount = 0;
+
+    int sepCount = 0;
+    
+    QString header = buffer.section("\n", sepCount, sepCount);
+    sepCount++;
+
+	// Verify header is ok
+	if (header != "#EXTM3U")
+	{
+		VERBOSE(VB_IMPORTANT,QString("Freebox # Invalid header while retrieve channel list.!"));
+		return;
+	}
+    
+    while (true)
+    {
+        QString line1 = buffer.section("\n", sepCount, sepCount);
+		if (line1 == "") 
+	    	break;
+	    
+	    sepCount++;
+
+        QString line2 = buffer.section("\n", sepCount, sepCount);
+		if (line2 == "") 
+	    	break;
+
+	    sepCount++;
+
+		// each line contains ://
+		// header:extension,channelNum - channelName rtsp://channelUrl
+		//#EXTINF:0,2 - France 2 rtsp://mafreebox.freebox.fr/freeboxtv/201
+
+		QString lineHead;
+		QString extension;
+		QString channelNum;
+		QString channelName;
+	
+		int pos = 0;
+		int oldPos = 0;
+		
+		pos = line1.find(":", oldPos);
+		if (pos<0)
+		{
+			VERBOSE(VB_IMPORTANT,QString("Freebox # Invalid header while retrieve channel list.!"));
+			return;
+		}
+		lineHead = line1.mid(0, pos);
+		
+		if (lineHead != "#EXTINF")
+		{
+			VERBOSE(VB_IMPORTANT,QString("Freebox # Invalid header while retrieve channel list.!"));
+			return;
+		}
+		
+		oldPos = pos + 1;
+		pos = line1.find(",", oldPos);
+		if (pos<0)
+		{
+			VERBOSE(VB_IMPORTANT,QString("Freebox # Invalid header while retrieve channel list.!"));
+			return;
+		}
+		extension = line1.mid(oldPos, pos - oldPos);
+		
+
+		oldPos = pos + 1;
+		pos = line1.find(" ", oldPos);
+		if (pos<0)
+		{
+			VERBOSE(VB_IMPORTANT,QString("Freebox # Invalid header while retrieve channel list.!"));
+			return;
+		}
+		channelNum = line1.mid(oldPos, pos - oldPos);
+		
+		
+		oldPos = pos + 1;
+		pos = line1.find("- ", oldPos);
+		if (pos<0)
+		{
+			VERBOSE(VB_IMPORTANT,QString("Freebox # Invalid header while retrieve channel list.!"));
+			return;
+		}
+		channelName = line1.mid(pos + 2, line1.length());
+		
+		
+
+		QString channelUrl = line2;
+		
+		
+		// save all this information in map for quick access
+		bool ok;
+		int channelNumI = channelNum.toInt( &ok, 10 );     
+    
+    	QString channelNameN = normalize(channelName);
+		
+		m_freeboxchannelIds[channelNumI] = m_freeboxchannelcount;
+		m_freeboxchannelUrl[m_freeboxchannelcount] = channelUrl;
+		m_freeboxchannelNames[m_freeboxchannelcount] = channelName;
+		m_freeboxchannelNamesN[m_freeboxchannelcount] = channelNameN;
+		
+		m_freeboxchannelcount++;
+    }
+    
+ 
+    // Channel list is ready.
+    m_channelListReady = true;
+    
+    // Change channel if delayed request is available
+    if (m_requestChannel != "")
+    {
+		SetChannelByString(m_requestChannel);
+		m_requestChannel = "";
+    }
+}
+
+
+// ==========================================================================================
+// GetChannelUrlFromNumber : Map a channel number to the corresponding rtsp URL
+// 
+// ==========================================================================================
+QString FreeboxChannel::GetChannelUrlFromNumber(const QString& channelnumber) 
+{
+    MSqlQuery query(MSqlQuery::InitCon());   
+    
+    query.prepare("SELECT name,freqid "
+		  "FROM channel,cardinput "
+                  "WHERE "
+		  "channel.sourceid = cardinput.sourceid AND "
+		  "cardinput.cardid = :CARDID AND "
+                  "channel.channum = :CHANNUM");
+                  
+    query.bindValue(":CARDID", m_cardid);
+    query.bindValue(":CHANNUM", channelnumber);
+
+    if (query.exec() && query.isActive() && query.size() > 0)
+    {
+        query.next();
+        QString chanName = query.value(0).toString();
+
+		// if we have a FreqID in the table, use this as the real freebox channel number
+        int mFreqId = query.value(1).toInt();
+        if (mFreqId!=0)
+        {
+        	int channelI = m_freeboxchannelIds[mFreqId];
+        	return m_freeboxchannelUrl[channelI];
+        }
+        
+        // if no freqID, try to map the chanName to an existing channel name
+        for (int i=0;i<m_freeboxchannelcount;i++)
+        {
+        	if (m_freeboxchannelNamesN[i] == chanName)
+        	{
+        		return m_freeboxchannelUrl[i];
+        	}
+        }
+
+		return "";        
+    } 
+    return "";
+}
+
+// ==========================================================================================
+// GetDefaultChannel : Search for default channel
+// 
+// ==========================================================================================
+
+QString FreeboxChannel::GetDefaultChannel()
+{
+    MSqlQuery query(MSqlQuery::InitCon());   
+    query.prepare("SELECT channum "
+		  "FROM channel,cardinput "
+                  "WHERE "
+		  "channel.sourceid = cardinput.sourceid AND "
+		  "cardinput.cardid = :CARDID "
+		  "ORDER BY channum limit 1");
+		  
+    query.bindValue(":CARDID", m_cardid);
+
+    if (query.exec() && query.isActive() && query.size() > 0)
+    {
+        query.next();
+        return query.value(0).toString();
+    } 
+    return "";
+}
\ Pas de fin de ligne Ã  la fin du fichier.
diff -ru --new-file --exclude=.svn myth-org/mythtv/libs/libmythtv/freeboxchannel.h myth-patch/mythtv/libs/libmythtv/freeboxchannel.h
--- myth-org/mythtv/libs/libmythtv/freeboxchannel.h	1970-01-01 01:00:00.000000000 +0100
+++ myth-patch/mythtv/libs/libmythtv/freeboxchannel.h	2006-04-09 19:19:34.000000000 +0200
@@ -0,0 +1,89 @@
+#ifndef FREEBOXCHANNEL_H
+#define FREEBOXCHANNEL_H
+
+#include <qstring.h>
+#include <qmap.h>
+#include <qhttp.h>
+#include <qobject.h>
+#include <qthread.h>
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
+#include "tv_rec.h"
+#include "channelbase.h"
+#include "sitypes.h"
+
+
+class FreeboxChannel : public QObject, public ChannelBase
+{
+    Q_OBJECT
+  	public:
+    	FreeboxChannel(TVRec *parent, FreeboxDBOptions *freebox_options, int cardid);
+    	~FreeboxChannel(void) 
+    	{  
+   		}
+
+
+    	bool Open();
+    	void Close();
+    	bool SwitchToInput(const QString &inputname, const QString &chan);
+    	bool SetChannelByString(const QString &chan);
+    	bool IsOpen(void) const;
+ 
+	 	
+	 	QString GetCurrentChannelUrl();
+	 	
+	 	
+	    bool SwitchToInput(int newcapchannel, bool setstarting)
+        { 
+        	(void)newcapchannel; 
+        	(void)setstarting; 
+        	return false; 
+        }
+        
+        QString GetChannelUrlFromNumber(const QString& channelnumber);
+		QString GetDefaultChannel();
+		
+  signals:
+    	void ChannelChanged();
+    
+  	public slots:
+    	void HttpRequestDone(bool error);
+    
+ 	private:
+        void LoadChannels();
+	 	QString normalize(QString channelName);
+
+	   	void Log(QString string);
+ 
+		QHttp            	*http;
+		FreeboxDBOptions   	*m_freeboxoptions;
+		
+
+		bool              	m_channelListReady;
+		QString          	m_requestChannel;
+		QString           	m_lastChannel;
+	    int               	m_cardid;
+	    
+	    // the rtsp url for the current channel
+	    QString           	m_currenturl;
+		
+		// number of channel support by freebox
+		int               	m_freeboxchannelcount;
+    	
+    	// map channelNum to channel index in table
+    	QMap<int,int> 		m_freeboxchannelIds;
+
+    	// map channel index to channel url
+    	QMap<int,QString> 	m_freeboxchannelUrl;
+
+    	// map channel index to channel name
+    	QMap<int,QString> 	m_freeboxchannelNames;
+
+    	// map channel index to channel normalize name
+    	QMap<int,QString> 	m_freeboxchannelNamesN;
+};
+
+#endif
diff -ru --new-file --exclude=.svn myth-org/mythtv/libs/libmythtv/freeboxrecorder.cpp myth-patch/mythtv/libs/libmythtv/freeboxrecorder.cpp
--- myth-org/mythtv/libs/libmythtv/freeboxrecorder.cpp	1970-01-01 01:00:00.000000000 +0100
+++ myth-patch/mythtv/libs/libmythtv/freeboxrecorder.cpp	2006-04-09 19:19:46.000000000 +0200
@@ -0,0 +1,457 @@
+/**
+ *  FreeboxRecorder
+ *  Copyright (c) 2005 by Levent G?u (mythtv@feature-it.com)
+ *  Distributed as part of MythTV under GPL v2 and later.
+ */
+
+#include <iostream>
+using namespace std;
+
+
+
+#include <pthread.h>
+#include "RingBuffer.h"
+#include "mythcontext.h"
+#include "freeboxrecorder.h"
+#include "freeboxchannel.h"
+#include <qhttp.h>
+#include <qobject.h>
+#include <sys/select.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <netinet/in.h>    // For sockaddr_in on OS X
+
+void subsessionAfterPlaying(void *clientData);
+void subsessionByeHandler(void *clientData);
+
+
+
+
+
+FreeboxRecorder::FreeboxRecorder(TVRec *rec, FreeboxChannel *channel):DTVRecorder(rec, "FreeboxRecorder"), 
+      // ptr to FreeboxChannel
+      m_channel(channel)
+ 					
+{
+	// the var will be use to abort current rtsp session
+	_abort_rtsp = new char();
+ 	
+	connect (m_channel, SIGNAL(ChannelChanged()),
+             		this,      SLOT(  ChannelChanged()));
+}
+
+
+bool FreeboxRecorder::Open()
+{
+	// Start a new RTSP flow with current channel
+	pthread_create(&start_thread, NULL, FreeboxRecorder::StartRtspS, this);
+	return true;
+}	
+
+
+void FreeboxRecorder::Close()
+{
+	// ask for RTSP shutdown setting abort_rstp=1, and wait effective shutdown on mutex
+	waitShutdown = new QWaitCondition();
+	*_abort_rtsp = 1;
+	_request_recording = false;
+	waitShutdown->wait();
+	
+  	if (session == NULL) return;
+
+	// Ensure RTSP cleanup, remove old RTSP session  	
+  	MediaSubsessionIterator iter(*session);
+  	MediaSubsession* subsession;
+  	while ((subsession = iter.next()) != NULL) 
+  	{
+	    Medium::close(subsession->sink);
+    	subsession->sink = NULL;
+  	}
+  
+	if (session == NULL) return;
+  
+  	rtspClient->teardownMediaSession(*session);
+  
+  	// Close all RTSP descriptor
+  	Medium::close(session);
+  	Medium::close(rtspClient);	
+}
+
+void FreeboxRecorder::ChannelChanged()
+{
+		// Channel change, we need to close current RTSP flow, and open a new one
+        Close();
+        Open();
+}
+
+
+
+void FreeboxRecorder::SetOptionsFromProfile(RecordingProfile *profile,
+											   const QString &videodev,
+											   const QString &audiodev,
+											   const QString &vbidev)
+{
+	(void)videodev;
+	(void)audiodev;
+	(void)vbidev;
+	(void)profile;
+}
+
+
+
+void FreeboxRecorder::StartRecording() 
+{
+	// Open RTSP flow for current channel
+	Open();
+
+    _request_recording = true;
+    _recording = true;
+    _request_abort = false;
+   
+	// wait until recorder abot
+    while(_request_recording) 
+    {
+        if (_request_abort) 
+  	    break;
+  	    
+  	    usleep(1000);
+    }
+}
+
+void FreeboxRecorder::StopRecording(void)
+{
+	// Close the current RTSP flow
+	Close();	
+}
+
+
+void *FreeboxRecorder::StartRtspS(void *param)
+{
+	FreeboxRecorder *recorder = (FreeboxRecorder*)param;
+	recorder->StartRtsp();
+	return NULL;
+}
+
+// ======================================================================
+// StartRtsp : start a new RTSP session for the current channel
+// ======================================================================
+void FreeboxRecorder::StartRtsp()
+{
+ 	// Retrieve the RTSP channel URL
+ 	QString url = m_channel->GetCurrentChannelUrl();
+ 	
+ 	
+ 	// Begin by setting up our usage environment:
+  	TaskScheduler* scheduler = BasicTaskScheduler::createNew();
+  	env = BasicUsageEnvironment::createNew(*scheduler);
+
+  
+  	// Create our client object:
+  	rtspClient = RTSPClient::createNew(*env, 0, "myRTSP", 0);
+  	if (rtspClient == NULL) 
+  	{
+  		VERBOSE(VB_IMPORTANT, QString("Freebox # Failed to create RTSP client: %1").arg(env->getResultMsg()));
+    	shutdown();
+  	}
+  	
+  	// Setup URL for the current session
+  	char* sdpDescription = rtspClient->describeURL(url);
+  	rtspClient->describeStatus();
+
+  	if (sdpDescription == NULL) 
+  	{
+  		VERBOSE(VB_IMPORTANT, QString("Freebox # Failed to get a SDP description from URL: %1 %2").arg(url).arg(env->getResultMsg()));
+    	shutdown();
+  	}
+  
+
+  	// Create a media session object from this SDP description:
+  	session = MediaSession::createNew(*env, sdpDescription);
+  	delete[] sdpDescription;
+  	if (session == NULL) 
+  	{
+  		VERBOSE(VB_IMPORTANT, QString("Freebox # Failed to create a MediaSession object from the SDP description: %1").arg(env->getResultMsg()));
+	    shutdown();
+  	} 
+  	else if (!session->hasSubsessions()) 
+  	{
+  		VERBOSE(VB_IMPORTANT, QString("Freebox # This session has no media subsessions"));
+    	shutdown();
+  	}
+  
+	// Then, setup the "RTPSource"s for the session:
+  	MediaSubsessionIterator iter(*session);
+  	MediaSubsession *subsession;
+  	Boolean madeProgress = False;
+  	while ((subsession = iter.next()) != NULL) 
+  	{
+      	if (!subsession->initiate(-1)) 
+      	{
+	  		VERBOSE(VB_IMPORTANT, QString("Freebox # Unable to create receiver for: %1 / %2 subsession: %3").arg(subsession->mediumName()).arg(subsession->codecName()).arg(env->getResultMsg()));
+    	} 
+      	else 
+      	{
+			madeProgress = True;
+
+			if (subsession->rtpSource() != NULL) 
+			{
+		  		unsigned const thresh = 1000000; // 1 second 
+		  		subsession->rtpSource()->setPacketReorderingThresholdTime(thresh);
+			}
+      	}
+  	}
+
+
+  	if (!madeProgress) shutdown();
+
+
+  	// Perform additional 'setup' on each subsession, before playing them:
+  	madeProgress = false;
+  	iter.reset();
+  	while ((subsession = iter.next()) != NULL) 
+  	{
+    	if (subsession->clientPortNum() == 0) continue; // port # was not set
+
+
+	    if (rtspClient->setupMediaSubsession(*subsession, False, false))
+    	{
+       		madeProgress = True;
+		}
+		else
+		{  	
+			VERBOSE(VB_IMPORTANT, QString("Freebox # Failed to setup: %1 %2 : %3").arg(subsession->mediumName()).arg(subsession->codecName()).arg(env->getResultMsg()));
+    	} 
+  	}
+  
+  
+  	if (!madeProgress) shutdown();
+  
+  
+ 	// Create and start "FileSink"s for each subsession:
+ 	// FileSink while receive Mpeg2 TS Data & will feed them to mythtv
+  	madeProgress = False;
+  	iter.reset();
+  	while ((subsession = iter.next()) != NULL) 
+  	{
+  		if (subsession->readSource() == NULL) continue; // was not initiated
+
+		FreeboxSink* FreeboxSink = FreeboxSink::createNew(*env, this);
+	    
+    	subsession->sink = FreeboxSink;
+   		if (subsession->sink == NULL) 
+   		{
+			VERBOSE(VB_IMPORTANT, QString("Freebox # Failed to create sink: %1").arg(env->getResultMsg()));
+ 		}
+	  	
+  	    subsession->sink->startPlaying(*(subsession->readSource()),	 subsessionAfterPlaying, new FreeboxData(this, subsession));
+  	    
+   	    if (subsession->rtcpInstance() != NULL) {
+	    		subsession->rtcpInstance()->setByeHandler(subsessionByeHandler, new FreeboxData(this, subsession));
+	  	}
+
+	    madeProgress = True;
+  	}
+
+  	if (!madeProgress) shutdown();
+
+	// Setup player
+  	if (!(rtspClient->playMediaSession(*session))) 
+  	{
+		VERBOSE(VB_IMPORTANT, QString("Freebox # Failed to start playing session: %1").arg(env->getResultMsg()));
+	 	shutdown();
+  	}
+
+
+	request_pause = false;
+	paused = false;
+  	_request_recording = true;
+  	_recording = true;
+  	*_abort_rtsp=0;
+
+	// Go into main RTSP loop, feeding data to mythtv  
+  	env->taskScheduler().doEventLoop(_abort_rtsp); // does not return
+
+	// Event loop exists, the recording finish
+  	FinishRecording();
+  	_recording = false;
+
+
+	// wakeUp everibody
+	waitShutdown->wakeAll();
+}
+
+
+// ===================================================
+// FindTSHeader : find a TS Header in flow
+// ===================================================
+int FreeboxRecorder::findTSHeader(unsigned char *data, unsigned dataSize)
+{
+    unsigned int pos = 0;
+    
+    while (pos < dataSize) 
+    {
+        if (data[pos] == 0x47)
+	    	return pos;
+		pos++;
+    }
+    return -1;
+}
+
+// ===================================================
+// addData : feed date from RTSP flow to mythtv
+// ===================================================
+void FreeboxRecorder::addData(unsigned char* data, unsigned dataSize, struct timeval )
+{  
+	unsigned int readIndex = 0;
+	
+	// data may be compose from more than one packet, loop to consume all data
+    while (readIndex < dataSize) 
+    {
+    	// If recorder is pause, stop there
+       	if (PauseAndWait())
+       	{
+           	return;
+    	}
+
+		
+    	// Find the next TS Header in data
+        int tsPos = findTSHeader(data + readIndex, dataSize);
+        
+        // if no TS, something bad happens
+    	if (tsPos == -1) 
+        {
+	    	VERBOSE(VB_IMPORTANT, QString("FREEBOX: No TS header."));
+	    	break;
+		}
+      
+      	// if TS Header not at start of data, we receive out of sync data
+		if (tsPos > 0)
+		{
+	    	VERBOSE(VB_IMPORTANT, QString("FREEBOX: TS header at %1, not in sync.").arg(tsPos));
+	    }
+
+		// Check if the next packet in buffer is complete : packet size is 188 bytes long
+		if ((dataSize - tsPos) < 188) 
+		{
+	    	VERBOSE(VB_IMPORTANT, QString("FREEBOX: TS header at %1 but packet not yet complete.").arg(tsPos));
+	  		break;
+	    }
+	
+		// Cast current found TS Packet to TSPacket structure
+	    const void     *newData     = data + tsPos + readIndex;
+	    const TSPacket *tspacket = reinterpret_cast<const TSPacket*>(newData);
+
+		// Feed current packet to myth
+		_buffer_packets = !FindKeyframes(tspacket);
+	  	BufferedWrite(*tspacket);
+	  	
+	  	// follow to next packet
+	  	readIndex += tsPos + TSPacket::SIZE;
+	  	
+	}
+} 
+
+
+void FreeboxRecorder::shutdown(int ) 
+{
+}
+
+
+void subsessionAfterPlaying(void *clientData)
+{
+	FreeboxData *myData = (FreeboxData*)clientData;
+	myData->freeboxRecorder->SubsessionAfterPlaying(myData->mediaSubSession);
+}
+
+void subsessionByeHandler(void *clientData)
+{
+	FreeboxData *myData = (FreeboxData*)clientData;
+	myData->freeboxRecorder->SubsessionByeHandler(myData->mediaSubSession);
+}
+
+void FreeboxRecorder::SubsessionAfterPlaying(MediaSubsession* subsession)
+{
+	Medium::close(subsession->sink);
+  	subsession->sink = NULL;
+
+  	MediaSession& session = subsession->parentSession();
+  	MediaSubsessionIterator iter(session);
+  	while ((subsession = iter.next()) != NULL) 
+  	{
+	    if (subsession->sink != NULL) return; 
+  	}
+
+  	shutdown(0);
+
+}
+
+
+void FreeboxRecorder::SubsessionByeHandler(MediaSubsession* subsession) 
+{
+  	subsessionAfterPlaying(subsession);
+}
+
+
+// ==================================================================================================
+// FreeboxSink : Helper class use to receive RTSP data from socket.
+// ==================================================================================================
+
+FreeboxSink::FreeboxSink(UsageEnvironment& pEnv, FreeboxRecorder *pRecorder) : MediaSink(pEnv) 
+{
+	recorder = pRecorder;
+	env = &pEnv;
+	
+	// Setup the data buffer
+	fBufferSize = 20000;
+	fBuffer = new unsigned char[fBufferSize]; 
+}
+
+FreeboxSink::~FreeboxSink() 
+{
+	// free the data buffer
+	delete[] fBuffer; 
+} 
+
+FreeboxSink* FreeboxSink::createNew(UsageEnvironment& env, FreeboxRecorder *pRecorder) 
+{
+  FreeboxSink* newSink = new FreeboxSink(env, pRecorder);
+  return newSink;
+} 
+
+Boolean FreeboxSink::continuePlaying() 
+{
+  if (fSource == NULL) return False;
+
+  fSource->getNextFrame(fBuffer, fBufferSize, afterGettingFrame, this, onSourceClosure, this);
+
+  return True;
+} 
+
+void FreeboxSink::afterGettingFrame(void* clientData, unsigned frameSize, unsigned /*numTruncatedBytes*/,struct timeval presentationTime, unsigned /*durationInMicroseconds*/) 
+{
+
+  FreeboxSink* sink = (FreeboxSink*)clientData;
+  sink->afterGettingFrame1(frameSize, presentationTime);
+}  
+
+void FreeboxSink::afterGettingFrame1(unsigned frameSize, struct timeval presentationTime) 
+{
+  	addData(fBuffer, frameSize, presentationTime);
+    continuePlaying();
+} 
+
+void FreeboxSink::addData(unsigned char* data, unsigned dataSize, struct timeval presentationTime)
+{  
+	recorder->addData(data, dataSize, presentationTime);
+} 
+
+
+
+
+
+
+
+
diff -ru --new-file --exclude=.svn myth-org/mythtv/libs/libmythtv/freeboxrecorder.h myth-patch/mythtv/libs/libmythtv/freeboxrecorder.h
--- myth-org/mythtv/libs/libmythtv/freeboxrecorder.h	1970-01-01 01:00:00.000000000 +0100
+++ myth-patch/mythtv/libs/libmythtv/freeboxrecorder.h	2006-04-09 19:19:35.000000000 +0200
@@ -0,0 +1,142 @@
+/**
+ *  DBOX2Recorder
+ *  Copyright (c) 2005 by Levent Gündogdu
+ *  Distributed as part of MythTV under GPL v2 and later.
+ */
+
+#ifndef FREEBOXRECORDER_H_
+#define FREEBOXRECORDER_H_
+
+#include "dtvrecorder.h"
+#include <time.h>
+#include "freeboxchannel.h"
+#include "sitypes.h"
+#include "qhttp.h"
+#include "mpeg/tspacket.h"
+
+
+#include "BasicUsageEnvironment.hh"
+#include "GroupsockHelper.hh"
+#include "liveMedia.hh"
+
+/**
+
+ *
+ *  Constructs a FreeboxRecorder
+ *
+ */
+
+#if defined(__WIN32__) || defined(_WIN32)
+#define snprintf _snprintf
+#else
+#include <signal.h>
+#define USE_SIGNALS 1
+#endif
+
+
+
+class FreeboxRecorder : public DTVRecorder
+{
+    Q_OBJECT
+    public:
+        FreeboxRecorder(TVRec *rec, FreeboxChannel *channel);
+        ~FreeboxRecorder() {  }
+
+
+		void StartRecording(void);
+		void StopRecording(void);
+		bool Open(void); 
+		void Close();
+	
+		void SetOptionsFromProfile(RecordingProfile *profile,
+				   const QString &videodev,
+				   const QString &audiodev,
+				   const QString &vbidev);
+
+	   	void SubsessionAfterPlaying(MediaSubsession* subsession);
+	   	void SubsessionByeHandler(MediaSubsession* subsession);
+
+		// Callback function to add MPEG2 TS data
+	   	void addData(unsigned char* data, unsigned dataSize, struct timeval presentationTime);
+	   	
+	   	// Look for TS Header in data
+	   	int findTSHeader(unsigned char *data, unsigned dataSize);
+
+    	
+    public slots:
+    	void ChannelChanged();
+		
+  
+	private:
+	   	UsageEnvironment* env;
+	   	RTSPClient* rtspClient;
+	   	MediaSession* session;
+
+		// var to check if we need to abort current rtsp session
+	   	char* _abort_rtsp;
+
+		// request abort for StartRecording Thread	   
+	   	bool _request_abort;
+	   	
+	   	// Call back function to start RTSP Flow
+	   	static void *StartRtspS(void *param);
+	   	void StartRtsp();
+
+	   	void shutdown(int exitCode = 1);
+
+		// Current channel	   
+	   	FreeboxChannel *m_channel;
+	   	
+	   	// Mutex : use to make sure that current RTSP thread as stop
+	   	QWaitCondition *waitShutdown;
+	  
+	  	// The current RTSP thread
+		pthread_t start_thread;
+};
+
+
+// ==================================================================================================
+// FreeboxData : Helper class use for static Callback handler
+// ==================================================================================================
+class FreeboxData
+{
+	public: 
+		FreeboxData(FreeboxRecorder *pFreeboxRecorder, MediaSubsession *pMediaSubSession)
+		{
+			freeboxRecorder = pFreeboxRecorder;
+			mediaSubSession = pMediaSubSession;
+		}
+	
+	FreeboxRecorder *freeboxRecorder;
+	MediaSubsession *mediaSubSession;
+};
+
+
+// ==================================================================================================
+// FreeboxSink : Helper class use to receive RTSP data from socket.
+// ==================================================================================================
+class FreeboxSink: public MediaSink {
+	public:
+	  	static FreeboxSink* createNew(UsageEnvironment& env, FreeboxRecorder *pRecorder);
+	
+		// Callback function when rtsp data are ready
+		void addData(unsigned char* data, unsigned dataSize, struct timeval presentationTime);
+	
+	protected:
+	  	FreeboxSink(UsageEnvironment& env, FreeboxRecorder *pRecorder);
+	  	virtual ~FreeboxSink();
+	
+	  	static void afterGettingFrame(void* clientData, unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds);
+	  	virtual void afterGettingFrame1(unsigned frameSize, struct timeval presentationTime);
+	
+	private: 
+	  	virtual Boolean continuePlaying();
+	  
+		  unsigned char* fBuffer;
+  		  unsigned fBufferSize; 
+  	  	UsageEnvironment *env;
+  	  	FreeboxRecorder *recorder;
+  	  	int bufferIndex;
+  	  
+}; 
+#endif
diff -ru --new-file --exclude=.svn myth-org/mythtv/libs/libmythtv/libmythtv.pro myth-patch/mythtv/libs/libmythtv/libmythtv.pro
--- myth-org/mythtv/libs/libmythtv/libmythtv.pro	2006-04-01 12:53:26.000000000 +0200
+++ myth-patch/mythtv/libs/libmythtv/libmythtv.pro	2006-04-09 19:19:50.000000000 +0200
@@ -332,6 +332,9 @@
     # Support for set top boxes (Nokia DBox2 etc.)
     using_dbox2:SOURCES += dbox2recorder.cpp dbox2channel.cpp dbox2epg.cpp
     using_dbox2:HEADERS += dbox2recorder.h dbox2channel.h dbox2epg.h
+    
+    using_freebox:SOURCES += freeboxrecorder.cpp freeboxchannel.cpp
+    using_freebox:HEADERS += freeboxrecorder.h freeboxchannel.h
 
     # Support for PVR-150/250/350/500, etc. on Linux
     using_ivtv:HEADERS += mpegrecorder.h
diff -ru --new-file --exclude=.svn myth-org/mythtv/libs/libmythtv/tv_rec.cpp myth-patch/mythtv/libs/libmythtv/tv_rec.cpp
--- myth-org/mythtv/libs/libmythtv/tv_rec.cpp	2006-04-08 16:47:47.000000000 +0200
+++ myth-patch/mythtv/libs/libmythtv/tv_rec.cpp	2006-04-09 19:19:54.000000000 +0200
@@ -73,6 +73,12 @@
 #include "dbox2channel.h"
 #endif
 
+#ifdef USING_FREEBOX
+#include "freeboxrecorder.h"
+#include "freeboxchannel.h"
+#endif
+
+
 #define DEBUG_CHANNEL_PREFIX 0 /**< set to 1 to channel prefixing */
 
 #define LOC QString("TVRec(%1): ").arg(cardid)
@@ -185,6 +191,17 @@
         init_run = true;
 #endif
     }
+else if (genOpt.cardtype == "FREEBOX")
+    {
+    	VERBOSE(VB_IMPORTANT,QString("trye to alloc chan"));
+#ifdef USING_FREEBOX
+        channel = new FreeboxChannel(this, &freeboxOpt, cardid);
+        channel->Open();
+        InitChannel(genOpt.defaultinput, startchannel);
+        init_run = true;
+    	VERBOSE(VB_IMPORTANT,QString("end trye to alloc chan"));
+#endif
+    }    
     else if (genOpt.cardtype == "MPEG" &&
              genOpt.videodev.lower().left(5) == "file:")
     {
@@ -232,7 +249,7 @@
 {
     QMutexLocker lock(&stateChangeLock);
 
-    if (!GetDevices(cardid, genOpt, dvbOpt, fwOpt, dboxOpt))
+    if (!GetDevices(cardid, genOpt, dvbOpt, fwOpt, dboxOpt, freeboxOpt))
         return false;
 
     QString startchannel = GetStartChannel(cardid, genOpt.defaultinput);
@@ -299,6 +316,11 @@
         GetDBox2Channel()->deleteLater();
     else
 #endif // USING_DBOX2
+#ifdef USING_FREEBOX
+	if (GetFreeboxChannel())
+        GetFreeboxChannel()->deleteLater();
+	else
+#endif // USING_FREEBOX
     if (channel)
         delete channel;
     channel = NULL;
@@ -861,6 +883,13 @@
         recorder->SetOption("httpport", dboxOpt.httpport);
 #endif // USING_DBOX2
     }
+    else if (genOpt.cardtype == "FREEBOX")
+    {
+#ifdef USING_FREEBOX
+        recorder = new FreeboxRecorder(this, GetFreeboxChannel());
+        recorder->SetOption("host",     freeboxOpt.host);
+#endif // USING_FREEBOX
+    }
     else if (genOpt.cardtype == "DVB")
     {
 #ifdef USING_DVB
@@ -1067,7 +1096,18 @@
     return NULL;
 #endif // USING_DBOX2
 }
+FreeboxChannel *TVRec::GetFreeboxChannel(void)
+{
+#ifdef USING_FREEBOX
+    return dynamic_cast<FreeboxChannel*>(channel);
+#else
+    return NULL;
+#endif // USING_FREEBOX
+}
+
 
+ 
+ 
 DVBChannel *TVRec::GetDVBChannel(void)
 {
 #ifdef USING_DVB
@@ -1404,7 +1444,8 @@
                        GeneralDBOptions  &gen_opts,
                        DVBDBOptions      &dvb_opts,
                        FireWireDBOptions &firewire_opts,
-                       DBox2DBOptions    &dbox2_opts)
+                       DBox2DBOptions    &dbox2_opts,
+                       FreeboxDBOptions  &freebox_opts)
 {
     int testnum = 0;
     QString test;
@@ -1421,7 +1462,8 @@
         "       firewire_port,    firewire_node,       firewire_speed,  "
         "       firewire_model,   firewire_connection,                  "
         ""
-        "       dbox2_port,       dbox2_host,          dbox2_httpport   "
+        "       dbox2_port,       dbox2_host,          dbox2_httpport,  "
+        "		freebox_host "
         ""
         "FROM capturecard "
         "WHERE cardid = :CARDID");
@@ -1499,6 +1541,13 @@
 
     dbox2_opts.httpport = query.value(dbox2off + 2).toUInt();
 
+    // Freebox options
+    uint freeboxoff = dbox2off + 3;
+    test = query.value(freeboxoff).toString();
+    if (test != QString::null)
+	   freebox_opts.host = QString::fromUtf8(test); 
+
+
     return true;
 }
 
@@ -3549,7 +3598,7 @@
         delete channel;
         channel = NULL;
 
-        GetDevices(newCardID, genOpt, dvbOpt, fwOpt, dboxOpt);
+        GetDevices(newCardID, genOpt, dvbOpt, fwOpt, dboxOpt, freeboxOpt);
         genOpt.defaultinput = inputname;
         CreateChannel(channum);
         if (!(request.flags & kFlagNoRec))
diff -ru --new-file --exclude=.svn myth-org/mythtv/libs/libmythtv/tv_rec.h myth-patch/mythtv/libs/libmythtv/tv_rec.h
--- myth-org/mythtv/libs/libmythtv/tv_rec.h	2006-04-08 16:47:47.000000000 +0200
+++ myth-patch/mythtv/libs/libmythtv/tv_rec.h	2006-04-09 19:19:49.000000000 +0200
@@ -38,6 +38,9 @@
 class DVBChannel;
 class Channel;
 
+class FreeboxChannel;
+
+
 class MPEGStreamData;
 class ProgramMapTable;
 
@@ -129,6 +132,17 @@
     QString host;
 };
 
+ 
+class FreeboxDBOptions
+{
+	public:
+	    FreeboxDBOptions() : host("mafreebox.freebox.fr") {;}
+
+    	QString host;
+};
+
+
+
 class TuningRequest
 {
   public:
@@ -271,7 +285,8 @@
                            GeneralDBOptions   &general_opts,
                            DVBDBOptions       &dvb_opts,
                            FireWireDBOptions  &firewire_opts,
-                           DBox2DBOptions     &dbox2_opts);
+                           DBox2DBOptions     &dbox2_opts,
+                           FreeboxDBOptions	  &free_opts);
 
 
     static QString GetStartChannel(int cardid, const QString &defaultinput);
@@ -284,8 +299,11 @@
     bool CreateChannel(const QString &startChanNum);
     void InitChannel(const QString &inputname, const QString &startchannel);
     void CloseChannel(void);
+    
+    
     DBox2Channel *GetDBox2Channel(void);
     DVBChannel   *GetDVBChannel(void);
+    FreeboxChannel *GetFreeboxChannel(void);
     Channel      *GetV4LChannel(void);
 
     void SetupSignalMonitor(bool enable_table_monitoring, bool notify);
@@ -368,6 +386,7 @@
     DVBDBOptions      dvbOpt;
     FireWireDBOptions fwOpt;
     DBox2DBOptions    dboxOpt;
+    FreeboxDBOptions  freeboxOpt;
 
     // State variables
     QMutex         stateChangeLock;
diff -ru --new-file --exclude=.svn myth-org/mythtv/libs/libmythtv/videosource.cpp myth-patch/mythtv/libs/libmythtv/videosource.cpp
--- myth-org/mythtv/libs/libmythtv/videosource.cpp	2006-04-08 16:47:47.000000000 +0200
+++ myth-patch/mythtv/libs/libmythtv/videosource.cpp	2006-04-09 19:19:25.000000000 +0200
@@ -928,6 +928,29 @@
  };
 
 
+class FreeboxHost : public LineEditSetting, public CCSetting {
+	public:
+	   FreeboxHost(const CaptureCard &parent):
+	   CCSetting(parent, "freebox_host") {
+	   		setValue("mafreebox.freebox.fr");
+		 	setLabel(QObject::tr("Freebox Host"));
+            setHelpText(QObject::tr("The freebox host."));
+        }
+};
+
+class FreeboxConfigurationGroup: public VerticalConfigurationGroup {
+public:
+   FreeboxConfigurationGroup(CaptureCard& a_parent):
+	   ConfigurationGroup(false, true, false, false),
+       VerticalConfigurationGroup(false, true, false, false),
+       parent(a_parent) {
+       setUseLabel(false);
+       addChild(new FreeboxHost(parent));
+   };
+  private:
+     CaptureCard& parent;
+ };
+	    	     
 
 
 class V4LConfigurationGroup: public VerticalConfigurationGroup
@@ -1025,6 +1048,7 @@
     addTarget("MPEG", new MPEGConfigurationGroup(parent));
     addTarget("FIREWIRE", new FirewireConfigurationGroup(parent));
     addTarget("DBOX2", new DBOX2ConfigurationGroup(parent));
+    addTarget("FREEBOX", new FreeboxConfigurationGroup(parent));
 }
 
 void CaptureCardGroup::triggerChanged(const QString& value) 
@@ -1059,7 +1083,7 @@
     QString qstr =
         "SELECT cardtype, videodevice, cardid, "
         "       firewire_port, firewire_node, "
-        "       dbox2_port, dbox2_host, dbox2_httpport "
+        "       dbox2_port, dbox2_host, dbox2_httpport, freebox_host "
         "FROM capturecard "
         "WHERE hostname = :HOSTNAME";
     if (no_children)
@@ -1089,7 +1113,14 @@
                     "Streaming-Port: " + query.value(5).toString() + ", " +
                     "Http-Port: " + query.value(7).toString() + 
                     "] ", query.value(2).toString());
-            }
+	}
+            else if (query.value(0).toString() == "FREEBOX")
+            {
+                setting->addSelection(
+                    "[ " + query.value(0).toString() + " " + 
+                    "HOST: " + query.value(8).toString() +  " " +
+                    "] ", query.value(2).toString());
+	  }
             else 
             {
                 setting->addSelection(
@@ -1135,6 +1166,8 @@
         "GO7007");
     setting->addSelection(
         QObject::tr("DBox2 TCP/IP cable box"), "DBOX2");
+    setting->addSelection(
+        QObject::tr("Freebox"), "FREEBOX");
 }
 
 class CardID: public SelectLabelSetting, public CISetting {
@@ -1943,6 +1976,7 @@
     // SelectSetting provided a facility to edit the labels, we
     // could use CaptureCard::fillSelections
 
+
     MSqlQuery query(MSqlQuery::InitCon());
     query.prepare(
         "SELECT cardid, videodevice, cardtype "
diff -ru --new-file --exclude=.svn myth-org/mythtv/programs/mythbackend/version.cpp myth-patch/mythtv/programs/mythbackend/version.cpp
--- myth-org/mythtv/programs/mythbackend/version.cpp	1970-01-01 01:00:00.000000000 +0100
+++ myth-patch/mythtv/programs/mythbackend/version.cpp	2006-04-09 19:18:42.000000000 +0200
@@ -0,0 +1 @@
+const char *myth_source_version = "9647M";
diff -ru --new-file --exclude=.svn myth-org/mythtv/programs/mythfrontend/version.cpp myth-patch/mythtv/programs/mythfrontend/version.cpp
--- myth-org/mythtv/programs/mythfrontend/version.cpp	1970-01-01 01:00:00.000000000 +0100
+++ myth-patch/mythtv/programs/mythfrontend/version.cpp	2006-04-09 19:18:48.000000000 +0200
@@ -0,0 +1 @@
+const char *myth_source_version = "9647M";
diff -ru --new-file --exclude=.svn myth-org/mythtv/settings.pro myth-patch/mythtv/settings.pro
--- myth-org/mythtv/settings.pro	2006-03-05 09:13:00.000000000 +0100
+++ myth-patch/mythtv/settings.pro	2006-04-09 19:18:54.000000000 +0200
@@ -20,6 +20,10 @@
 
 INCLUDEPATH += $${PREFIX}/include
 INCLUDEPATH += $$CONFIG_INCLUDEPATH
+INCLUDEPATH += /usr/lib/live/liveMedia/include 
+INCLUDEPATH += /usr/lib/live/UsageEnvironment/include 
+INCLUDEPATH += /usr/lib/live/BasicUsageEnvironment/include 
+INCLUDEPATH += /usr/lib/live/groupsock/include 
 
 # figure out compile flags based on qmake info
 
@@ -72,7 +76,7 @@
 }
 QMAKE_LIBDIR_OPENGL =
 
-EXTRA_LIBS = -lfreetype -lmp3lame
+EXTRA_LIBS = -lfreetype -lmp3lame -L /usr/lib/live/liveMedia -lliveMedia -L/usr/lib/live/UsageEnvironment -lUsageEnvironment -L/usr/lib/live/groupsock -lgroupsock -L/usr/lib/live/BasicUsageEnvironment -lBasicUsageEnvironment
 EXTRA_LIBS += $$CONFIG_AUDIO_OSS_LIBS
 EXTRA_LIBS += $$CONFIG_AUDIO_ALSA_LIBS
 EXTRA_LIBS += $$CONFIG_AUDIO_ARTS_LIBS
Les fichiers binaires myth-org/mythtv/xine-out.wav et myth-patch/mythtv/xine-out.wav sont diffÃ©rents.
