patch to limit DVB streams

Andrew de Quincey <[email protected]>
Newsgroups gmane.comp.video.videolan.vls.devel
Message-ID <[email protected]>
This patch will limit the types of streams streamed for DVB to just
audio/video. Currently the stream types are hardcoded, hoping to make it
dynamic in the future.
vls.streamtype.patch (text/x-patch, 2.5 KB)
diff -Naur vls.ORIGINALPATCHED/src/mpeg/tsmux.cpp vls/src/mpeg/tsmux.cpp
--- vls.ORIGINALPATCHED/src/mpeg/tsmux.cpp	2002-12-22 15:43:17.000000000 +0000
+++ vls/src/mpeg/tsmux.cpp	2002-12-22 15:42:31.000000000 +0000
@@ -104,8 +104,10 @@
     dvbpsi_pmt_es_t* pEs = pLLPmt->p_first_es;
     while(pEs)
     {
-      m_pMux->m_pDemux->UnselectPid(m_pMux, pEs->i_pid);
-      printf("--- %x\n", pEs->i_pid);
+      if (ValidStreamType(pEs->i_type)) {
+	m_pMux->m_pDemux->UnselectPid(m_pMux, pEs->i_pid);
+	printf("--- %x\n", pEs->i_pid);
+      }
       pEs = pEs->p_next;
     }
   }
@@ -139,9 +141,11 @@
       dvbpsi_pmt_es_t* pEs = pLLPmt->p_first_es;
       while(pEs)
       {
-        m_pMux->m_pDemux->UnselectPid(m_pMux, pEs->i_pid);
-        printf("--- %x\n", pEs->i_pid);
-        pEs = pEs->p_next;
+	if (ValidStreamType(pEs->i_type)) {
+	  m_pMux->m_pDemux->UnselectPid(m_pMux, pEs->i_pid);
+	  printf("--- %x\n", pEs->i_pid);
+	}
+	pEs = pEs->p_next;
       }
     }
 
@@ -149,8 +153,10 @@
     dvbpsi_pmt_es_t* pEs = pLLPmt->p_first_es;
     while(pEs)
     {
-      m_pMux->m_pDemux->SelectPid(m_pMux, pEs->i_pid, pEs->i_type);
-      printf("+++ %x\n", pEs->i_pid);
+      if (ValidStreamType(pEs->i_type)) {
+	m_pMux->m_pDemux->SelectPid(m_pMux, pEs->i_pid, pEs->i_type);
+	printf("+++ %x\n", pEs->i_pid);
+      }
       pEs = pEs->p_next;
     }
     m_pMux->m_pDemux->SelectPid(m_pMux, pLLPmt->i_pcr_pid, TS_TYPE_NULL);
@@ -158,6 +164,21 @@
   }
 }
 
+//------------------------------------------------------------------------------
+// Check if videolan should stream a certain type of stream
+//------------------------------------------------------------------------------
+bool C_TsMuxPmtDecoder::ValidStreamType(int iStreamType) {
+  switch(iStreamType) {
+  case 1: // ISO/IEC 11172 Video
+  case 2: // ITU-T Rec. H.262 | ISO/IEC 13818-2 Video or ISO/IEC 11172-2 constrained parameter video stream
+  case 3: // ISO/IEC 11172 Audio
+  case 4: // ISO/IEC 13818-3 Audio
+    return true;
+  }
+
+  // not a valid stream for videolan streaming
+  return false;
+}
 
 //******************************************************************************
 // C_TsMux class
diff -Naur vls.ORIGINALPATCHED/src/mpeg/tsmux.h vls/src/mpeg/tsmux.h
--- vls.ORIGINALPATCHED/src/mpeg/tsmux.h	2002-12-22 15:43:17.000000000 +0000
+++ vls/src/mpeg/tsmux.h	2002-12-22 15:39:34.000000000 +0000
@@ -60,6 +60,7 @@
 
 protected:
   virtual void OnDvbPsiPmtEvent(int iEvent);
+  virtual bool ValidStreamType(int iStreamType);
 
 private:
   // Internal data
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.