]> git.vomp.tv Git - vompserver.git/commitdiff
*** empty log message ***
authorChris Tallon <chris@vomp.tv>
Wed, 26 Oct 2005 16:34:57 +0000 (16:34 +0000)
committerChris Tallon <chris@vomp.tv>
Wed, 26 Oct 2005 16:34:57 +0000 (16:34 +0000)
mvpreceiver.c
remux/ts2ps.c
remux/ts2ps.h
remux/tsremux.c
remux/tsremux.h

index 56337c0681e02a9c0d7c1a1eb0603c19d55028b0..6614304b7f317659ad69b606a1db822b32bd60ca 100755 (executable)
@@ -40,16 +40,16 @@ MVPReceiver::MVPReceiver(cChannel* channel, cDevice* device)
   // Get the remuxer for audio or video
 
 #if VDRVERSNUM < 10300
-  if ((channel->Vpid() == 0) || (channel->Vpid() == 1) || (channel->Vpid() == 0x1FFF))
-  {
-    remuxer = new cTS2ESRemux(channel->Apid1());
-    logger->log("MVPReceiver", Log::DEBUG, "Created new < 1.3 TS->ES");
-  }
-  else
-  {
+//  if ((channel->Vpid() == 0) || (channel->Vpid() == 1) || (channel->Vpid() == 0x1FFF))
+//  {
+//    remuxer = new cTS2ESRemux(channel->Apid1());
+//    logger->log("MVPReceiver", Log::DEBUG, "Created new < 1.3 TS->ES");
+//  }
+//  else
+//  {
     remuxer = new cTS2PSRemux(channel->Vpid(), channel->Apid1(), 0, 0, 0, 0);
     logger->log("MVPReceiver", Log::DEBUG, "Created new < 1.3 TS->PS");
-  }
+//  }
 #else
   if ((channel->Vpid() == 0) || (channel->Vpid() == 1) || (channel->Vpid() == 0x1FFF))
   {
@@ -145,7 +145,7 @@ void MVPReceiver::threadMethod()
         processed.put(remuxedData, outputSize);
         pthread_mutex_unlock(&processedRingLock);
 
-//        printf("Got from unprocessed: %i, Got from remux: %p %i, consumed: %i\n",
+//        logger->log("MVPReceiver", Log::DEBUG, "Got from unprocessed: %i, Got from remux: %p %i, consumed: %i",
 //               amountGot, remuxedData, outputSize, remuxTook);
       }
       else
index e23fdcac17f5c09ee9d0d12944ae317f9ad3b7e5..f7f0f9971d4a1038eeaaa5ee17cf76196dc56e8d 100644 (file)
@@ -73,13 +73,18 @@ void cTS2PS::PutTSPacket(const uint8_t *Buffer) {
 }
 
 cTS2PSRemux::cTS2PSRemux(int VPid, int APid1, int APid2, int DPid1,
-                int DPid2, bool PS) {
-        m_VPid  = VPid;
-        m_APid1 = APid1;
-        m_APid2 = APid2;
-        m_DPid1 = DPid1;
-        m_DPid2 = DPid2;
-  m_VRemux  =         new cTS2PS(m_ResultBuffer, &m_ResultCount, 0x00, PS);
+                int DPid2, bool PS)
+{
+  m_VPid  = VPid;
+  m_APid1 = APid1;
+  m_APid2 = APid2;
+  m_DPid1 = DPid1;
+  m_DPid2 = DPid2;
+
+  if (!m_VPid) m_Sync = 0; // CJT
+
+  m_VRemux  = VPid  ? new cTS2PS(m_ResultBuffer, &m_ResultCount, 0x00, PS)
+                          : NULL;  // CJT edit to allow 0 APid
   m_ARemux1 =         new cTS2PS(m_ResultBuffer, &m_ResultCount, 0xC0, PS);
   m_ARemux2 = APid2 ? new cTS2PS(m_ResultBuffer, &m_ResultCount, 0xC1, PS)
                           : NULL;
@@ -93,14 +98,15 @@ cTS2PSRemux::cTS2PSRemux(int VPid, int APid1, int APid2, int DPid1,
 cTS2PSRemux::~cTS2PSRemux() {
         if (m_DRemux2) delete m_DRemux2;
         if (m_DRemux1) delete m_DRemux1;
+        if (m_VRemux) delete m_VRemux; // CJT
         if (m_ARemux2) delete m_ARemux2;
         delete m_ARemux1;
-        delete m_VRemux;
+//        delete m_VRemux;
 }
 
 void cTS2PSRemux::PutTSPacket(int Pid, const uint8_t *Data) {
-        if      (Pid == m_VPid)               m_VRemux->PutTSPacket(Data);
-        else if (Pid == m_APid1)              m_ARemux1->PutTSPacket(Data);
+        if      (Pid == m_VPid && m_VRemux /* CJT */ ) m_VRemux->PutTSPacket(Data);
+        else if (Pid == m_APid1) m_ARemux1->PutTSPacket(Data);
         else if (Pid == m_APid2 && m_ARemux2) m_ARemux2->PutTSPacket(Data);
         else if (Pid == m_DPid1 && m_DRemux1) m_DRemux1->PutTSPacket(Data);
         else if (Pid == m_DPid2 && m_DRemux2) m_DRemux2->PutTSPacket(Data);
index 5760f0943df04dccddc8ae553f071189cecfb35e..add96aaca1cd1dcfaa158f9aa959b13d64c8bf7f 100644 (file)
@@ -3,6 +3,8 @@
 
 #include "tsremux.h"
 
+#include "../log.h"
+
 class cTS2PS;
 
 class cTS2PSRemux: public cTSRemux {
index 895a435cacc7f44a322f465d19376231372118a0..490c2506d80f1338fcca2141c7619eaf4ff71519 100644 (file)
@@ -17,38 +17,43 @@ cTSRemux::cTSRemux(bool Sync) {
 cTSRemux::~cTSRemux(void) {
 }
 
-uchar *cTSRemux::Process(const uchar *Data, int &Count, int &Result) {
+uchar *cTSRemux::Process(const uchar *Data, int &Count, int &Result)
+{
   // Remove any previously delivered data from the result buffer:
-  if (m_ResultDelivered) {
+  if (m_ResultDelivered)
+  {
     if (m_ResultDelivered < m_ResultCount)
-      memmove(m_ResultBuffer, m_ResultBuffer + m_ResultDelivered, m_ResultCount
-                                        - m_ResultDelivered);
+      memmove(m_ResultBuffer, m_ResultBuffer + m_ResultDelivered, m_ResultCount - m_ResultDelivered);
+
     m_ResultCount -= m_ResultDelivered;
     m_ResultDelivered = 0;
-        }
+  }
 
   int used = 0;
 
         // Make sure we are looking at a TS packet:
-  while (Count > TS_SIZE) {
-                if (Data[0] == 0x47 && Data[TS_SIZE] == 0x47)
-                        break;
+  while (Count > TS_SIZE)
+  {
+    if (Data[0] == 0x47 && Data[TS_SIZE] == 0x47) break;
     Data++;
     Count--;
     used++;
   }
-  if (used)
-    esyslog("ERROR: skipped %d byte to sync on TS packet", used);
 
-        // Convert incoming TS data
-  for (int i = 0; i < Count; i += TS_SIZE) {
-    if (Count - i < TS_SIZE)
-      break;
-    if (Data[i] != 0x47)
-      break;
+  if (used) esyslog("ERROR: skipped %d byte to sync on TS packet", used);
+
+  // Convert incoming TS data
+  for (int i = 0; i < Count; i += TS_SIZE)
+  {
+    if (Count - i < TS_SIZE) break;
+    if (Data[i] != 0x47) break;
+
     int pid = get_pid((uint8_t*)(Data + i + 1));
-    if (Data[i + 3] & 0x10) // got payload
-                        PutTSPacket(pid, Data + i);
+    if (Data[i + 3] & 0x10)
+    {
+      // got payload
+      PutTSPacket(pid, Data + i);
+    }
     /*if      (pid == m_VPid)               m_VRemux->ConvertTSPacket(Data + i);
          else if (pid == m_APid1)              m_ARemux1->ConvertTSPacket(Data + i);
          else if (pid == m_APid2 && m_ARemux2) m_ARemux2->ConvertTSPacket(Data + i);
@@ -79,13 +84,14 @@ uchar *cTSRemux::Process(const uchar *Data, int &Count, int &Result) {
   }
   Count = used;
 
-        // When we don't need to sync, we don't need to sync :-)
-  if (!m_Sync) {
+  // When we don't need to sync, we don't need to sync :-)
+  if (!m_Sync)
+  {
     Result = m_ResultDelivered = m_ResultCount;
     return Result ? m_ResultBuffer : NULL;
   }
 
-        // Check if we're getting anywhere here:
+  // Check if we're getting anywhere here:
 
   if (!m_Synced && m_Skipped >= 0) {
      if (m_Skipped > MAXNONUSEFULDATA) {
index 2a28a359d5d72640c17d50eedf9c8cf6214901f7..a4255f290589792dd151426261576b7fb9e2acad 100644 (file)
@@ -4,6 +4,8 @@
 #include "transform.h"
 #include <vdr/remux.h>
 
+#include "../log.h"
+
 #define IPACKS 2048
 
 #define PROTECTIONSIZE 32768
@@ -23,7 +25,6 @@ protected:
         int m_ResultDelivered;
         int m_Synced;
         int m_Skipped;
-        int m_Sync;
 
   int GetPacketLength(const uchar *Data, int Count, int Offset);
   int ScanVideoPacket(const uchar *Data, int Count, int Offset, uchar &PictureType);
@@ -31,9 +32,11 @@ protected:
         virtual void PutTSPacket(int Pid, const uint8_t *Data) = 0;
 
 public:
+        int m_Sync;// CJT moved from protected
+
         cTSRemux(bool Sync = true);
         virtual ~cTSRemux();
-        
+
         virtual uchar *Process(const uchar *Data, int &Count, int &Result);
 
         static void SetBrokenLink(uchar *Data, int Length);