Index: libs/libmythtv/mpeg/mpegstreamdata.cpp
===================================================================
--- libs/libmythtv/mpeg/mpegstreamdata.cpp	(révision 17092)
+++ libs/libmythtv/mpeg/mpegstreamdata.cpp	(copie de travail)
@@ -79,7 +79,8 @@
       _pmt_single_program_num_video(1),
       _pmt_single_program_num_audio(0),
       _pat_single_program(NULL), _pmt_single_program(NULL),
-      _invalid_pat_seen(false), _invalid_pat_warning(false)
+      _invalid_pat_seen(false), _invalid_pat_warning(false),
+      _filter_audio_pid(-1)
 {
     _local_utc_offset = calc_utc_offset();
 
@@ -560,8 +561,12 @@
 
         if (is_audio)
         {
-            audio_cnt++;
-            audioPIDs.push_back(pid);
+			if (_filter_audio_pid==-1 || _filter_audio_pid==pid)
+			{
+			    audio_cnt++;
+				audioPIDs.push_back(pid);
+			}
+			else continue;
         }
 
 #ifdef DEBUG_MPEG_RADIO
Index: libs/libmythtv/mpeg/mpegstreamdata.h
===================================================================
--- libs/libmythtv/mpeg/mpegstreamdata.h	(révision 17092)
+++ libs/libmythtv/mpeg/mpegstreamdata.h	(copie de travail)
@@ -178,6 +178,11 @@
             return -1;
         return *it;
     }
+    
+    void SetFilterAudioPid(int filter_audio_pid)
+    {
+    	_filter_audio_pid = filter_audio_pid;
+    }
 
     // Sections seen
     void SetPATSectionSeen(uint tsid, uint section);
@@ -374,6 +379,8 @@
     bool                      _invalid_pat_seen;
     bool                      _invalid_pat_warning;
     MythTimer                 _invalid_pat_timer;
+    
+    int			           _filter_audio_pid;
 
   protected:
     static const unsigned char bit_sel[8];
Index: libs/libmythtv/iptvrecorder.cpp
===================================================================
--- libs/libmythtv/iptvrecorder.cpp	(révision 17092)
+++ libs/libmythtv/iptvrecorder.cpp	(copie de travail)
@@ -75,8 +75,12 @@
         Open();
 
     if (_stream_data)
-        _stream_data->Reset(_stream_data->DesiredProgram());
-
+    {
+    	IPTVChannelInfo chaninfo = _channel->GetCurrentChanInfo();
+    	_stream_data->SetFilterAudioPid(chaninfo.audioStartPid());
+    	_stream_data->Reset(_stream_data->DesiredProgram());
+    }
+   
     DTVRecorder::Unpause();
 
     VERBOSE(VB_RECORD, LOC + "Unpause() -- end");
Index: libs/libmythtv/iptv/iptvchannelfetcher.cpp
===================================================================
--- libs/libmythtv/iptv/iptvchannelfetcher.cpp	(révision 17092)
+++ libs/libmythtv/iptv/iptvchannelfetcher.cpp	(copie de travail)
@@ -271,7 +273,14 @@
         QString msg = tr("Encountered malformed channel");
         if (!channum.isEmpty())
         {
-            chanmap[channum] = info;
+	    if (chanmap.contains(channum))
+	    {
+               chanmap["f_" + info.m_freqid] = info;
+	    }
+	    else
+	    {
+               chanmap[channum] = info;
+	    }
 
             msg = tr("Parsing Channel #%1 : %2 : %3")
                 .arg(channum).arg(info.m_name).arg(info.m_url);
@@ -303,6 +312,7 @@
 
     QString name;
     QString xmltvid;
+    int audiostartpid = -1;
     while (true)
     {
         QString line = rawdata.section("\n", lineNum, lineNum);
@@ -324,6 +334,14 @@
                     xmltvid = data.mid(data.find('=')+1);
                 }
             }
+            else if (line.startsWith("#EXTVLCOPT:"))
+            {
+            	QString cmd = line.mid(line.find(':')+1);
+            	if (cmd.startsWith("audio-track-id"))
+            	{
+            		audiostartpid = line.mid(line.find('=')+1).toInt();
+            	}
+            }
             else
             {
                 // Just ignore other comments
@@ -334,7 +352,10 @@
             if (name.isEmpty())
                 return false;
             QString url = line;
-            info = IPTVChannelInfo(name, url, xmltvid);
+	    
+			int p1 = url.find("?id=");
+	    	QString freqId = url.mid(p1+4);
+            info = IPTVChannelInfo(name, url, xmltvid, freqId, audiostartpid);
             return true;
         }
     }
Index: libs/libmythtv/iptv/iptvchannelinfo.h
===================================================================
--- libs/libmythtv/iptv/iptvchannelinfo.h	(révision 17092)
+++ libs/libmythtv/iptv/iptvchannelinfo.h	(copie de travail)
@@ -15,22 +15,34 @@
     IPTVChannelInfo() :
         m_name(QString::null),
         m_url(QString::null),
-        m_xmltvid(QString::null) {}
-
+        m_xmltvid(QString::null),
+	     m_freqid(QString::null),
+	     m_audiostartpid(0) {}
+	
+	
     IPTVChannelInfo(const QString &name,
                     const QString &url,
-                    const QString &xmltvid) :
-                    m_name(name), m_url(url), m_xmltvid(xmltvid) {}
+                    const QString &xmltvid,
+		    const QString &freqid,
+		    int audiostartpid) :
+        m_name(name), m_url(url), m_xmltvid(xmltvid), m_freqid(freqid), m_audiostartpid(audiostartpid) {}
 
     bool isValid(void) const
     {
         return !m_name.isEmpty() && !m_url.isEmpty();
     }
+    
+    int audioStartPid() const
+    {
+    	return m_audiostartpid;
+    }
 
   public:
     QString m_name;
     QString m_url;
     QString m_xmltvid;
+    QString m_freqid;
+    int m_audiostartpid;
 };
 
 typedef QMap<QString,IPTVChannelInfo> fbox_chan_map_t;
