]> git.vomp.tv Git - vompserver.git/commitdiff
VDR 1.3 support
authorChris Tallon <chris@vomp.tv>
Sun, 17 Jul 2005 16:54:58 +0000 (16:54 +0000)
committerChris Tallon <chris@vomp.tv>
Sun, 17 Jul 2005 16:54:58 +0000 (16:54 +0000)
mvpclient.c
transceiver.c
transceiver.h

index 18a9dd13c5d537cc17ed0e0f5a471dc83bf83b74..95ef07b6f84532095b44e3e798e752b2eb626dbf 100644 (file)
@@ -97,8 +97,11 @@ cChannel* MVPClient::channelFromNumber(unsigned long channelNumber)
       if (channel->Number() == (int)channelNumber)
       {
         int vpid = channel->Vpid();
+#if VDRVERSNUM < 10300
         int apid1 = channel->Apid1();
-
+#else
+        int apid1 = channel->Apid(0);
+#endif
         printf("Found channel number %lu, vpid = %i, apid1 = %i\n", channelNumber, vpid, apid1);
         return channel;
       }
@@ -315,7 +318,7 @@ void MVPClient::processGetSummary(unsigned char* data, int length)
   cRecordings Recordings;
   Recordings.Load(); // probably have to do this
 
-  cRecordingrecording = Recordings.GetByName((char*)data);
+  cRecording *recording = Recordings.GetByName((char*)data);
 
   printf("recording pointer %p\n", recording);
 
@@ -325,8 +328,11 @@ void MVPClient::processGetSummary(unsigned char* data, int length)
     int count = 4; // leave space for the packet length
 
     char* point;
-
+#if VDRVERSNUM < 10300
     point = (char*)recording->Summary();
+#else
+    point = (char*)recording->Info()->ShortText();
+#endif
     strcpy((char*)&sendBuffer[count], point);
     count += strlen(point) + 1;
     *(unsigned long*)&sendBuffer[0] = htonl(count - 4); // -4 :  take off the size field
@@ -503,9 +509,13 @@ void MVPClient::processGetChannelSchedule(unsigned char* data, int length)
     return;
   }
 
+#if VDRVERSNUM < 10300
   cMutexLock MutexLock;
-  const cSchedules* Schedules = cSIProcessor::Schedules(MutexLock);
-//  const cSchedules* Schedules = cSchedules::Schedules(MutexLock);
+  const cSchedules *Schedules = cSIProcessor::Schedules(MutexLock);
+#else
+  cSchedulesLock MutexLock;
+  const cSchedules *Schedules = cSchedules::Schedules(MutexLock);
+#endif
   if (!Schedules)
   {
     unsigned char sendBuffer[8];
@@ -529,9 +539,13 @@ void MVPClient::testChannelSchedule(unsigned char* data, int length)
 {
   FILE* f = fopen("/tmp/s.txt", "w");
 
+#if VDRVERSNUM < 10300
   cMutexLock MutexLock;
-  const cSchedules* Schedules = cSIProcessor::Schedules(MutexLock);
-//  const cSchedules* Schedules = cSchedules::Schedules(MutexLock);
+  const cSchedules *Schedules = cSIProcessor::Schedules(MutexLock);
+#else
+  cSchedulesLock MutexLock;
+  const cSchedules *Schedules = cSchedules::Schedules(MutexLock);
+#endif
   if (!Schedules)
   {
     fprintf(f, "Schedules = NULL\n");
@@ -549,8 +563,12 @@ void MVPClient::testChannelSchedule(unsigned char* data, int length)
   tChannelID tchid;
   cChannel *thisChannel;
 
-  const cEventInfo* event;
+#if VDRVERSNUM < 10300
+  const cEventInfo *event;
   int eventNumber = 0;
+#else
+  const cEvent *event;
+#endif
 
 //    Schedule = Schedules->GetSchedule(channel->GetChannelID());
 //    Schedule = Schedules->GetSchedule();
@@ -567,9 +585,17 @@ void MVPClient::testChannelSchedule(unsigned char* data, int length)
     fprintf(f, "Schedule #%i\n", scheduleNumber);
     fprintf(f, "-------------\n\n");
 
+#if VDRVERSNUM < 10300
     tchid = Schedule->GetChannelID();
+#else
+    tchid = Schedule->ChannelID();
+#endif
+#if VDRVERSNUM < 10300
     fprintf(f, "ChannelID.ToString() = %s\n", tchid.ToString());
     fprintf(f, "NumEvents() = %i\n", Schedule->NumEvents());
+#else
+//     put the count at the end.
+#endif
     thisChannel = Channels.GetByChannelID(tchid, true);
     if (thisChannel)
     {
@@ -580,6 +606,7 @@ void MVPClient::testChannelSchedule(unsigned char* data, int length)
       fprintf(f, "thisChannel = NULL for tchid\n");
     }
 
+#if VDRVERSNUM < 10300
     for (eventNumber = 0; eventNumber < Schedule->NumEvents(); eventNumber++)
     {
       event = Schedule->GetEventNumber(eventNumber);
@@ -592,7 +619,13 @@ void MVPClient::testChannelSchedule(unsigned char* data, int length)
       event->Dump(f);
       fprintf(f, "\n\n");
     }
-
+#else
+//     This whole section needs rewriting to walk the list.
+    event = Schedule->Events()->First();
+    while (event) {
+      event = Schedule->Events()->Next(event);
+    }
+#endif
 
 
     fprintf(f, "\nDump from object:\n");
index 8a87fd06b36d498568c80b5401d73962f5e875ab..13bf8861919ab448e7f0c9427ea8c3b7fc34a1b4 100644 (file)
 #define BUFOVERTIME  5000
 #define BUFOVERCOUNT 100
 
+#if VDRVERSNUM < 10300
 cMediamvpTransceiver::cMediamvpTransceiver(const cChannel *Channel, int Priority, int Socket, cDevice *Device) :
                 cReceiver(Channel->Ca(), Priority, 7, Channel->Vpid(), Channel->Ppid(),
                                 Channel->Apid1(), Channel->Apid2(), Channel->Dpid1(), Channel->Dpid2(),
                                 Channel->Tpid()) {
-        m_Active = false;
+#else
+cMediamvpTransceiver::cMediamvpTransceiver(const cChannel *Channel, int Priority, int Socket, cDevice *Device) :
+                cReceiver(Channel->Ca(), Priority, Channel->Vpid(),
+                                Channel->Apids(), Channel->Dpids(), Channel->Spids()) {
+#endif        
+       m_Active = false;
         m_Socket = Socket;
         m_Remux = NULL;
         m_Device = Device;
@@ -51,11 +57,19 @@ cMediamvpTransceiver::cMediamvpTransceiver(const cChannel *Channel, int Priority
 //        m_RingBuffer = new cRingBufferLinear(VIDEOBUFSIZE, TS_SIZE * 20, true);
 
     /* Select the correct Muxing depending on whether it's video or not */
+#if VDRVERSNUM < 10300
     if ( Channel->Vpid() == 0 || Channel->Vpid() == 1 || Channel->Vpid() == 0x1FFF ) {
         m_Remux = new cTS2ESRemux(Channel->Apid1());
     } else {
                 m_Remux = new cTS2PSRemux(Channel->Vpid(), Channel->Apid1(), 0, 0, 0, 0);
     }
+#else
+    if ( Channel->Vpid() == 0 || Channel->Vpid() == 1 || Channel->Vpid() == 0x1FFF ) {
+        m_Remux = new cTS2ESRemux(Channel->Apid(0));
+    } else {
+                m_Remux = new cTS2PSRemux(Channel->Vpid(), Channel->Apid(0), 0, 0, 0, 0);
+    }
+#endif
     printf("Created transceiver at %p, remux @%p ringbuffer %p\n",this,m_Remux,m_RingBuffer);
 
     /* Suggested by Peter Wagner to assist single DVB card systems */
@@ -113,7 +127,8 @@ void cMediamvpTransceiver::Receive(uchar *Data, int Length)
                 int p = m_RingBuffer->Put(Data, Length);
                 if (p != Length) {
                         ++errcnt;
-                        if (showerr) {
+#if VDRVERSNUM < 10300
+                       if (showerr) {
                                 if (firsterr == 0)
                                         firsterr = time_ms();
                                 else if (firsterr + BUFOVERTIME > time_ms() && errcnt > BUFOVERCOUNT) {
@@ -131,6 +146,27 @@ void cMediamvpTransceiver::Receive(uchar *Data, int Length)
                                 esyslog("ERROR: ring buffer overflow (%d bytes dropped)", Length - p);
                         else
                                 firsterr = time_ms();
+#else
+                       if (showerr) {
+                                if (firsterr == 0) {
+                                        firsterr = 1;
+                                       lastTime.Set();
+                               }
+                                else if (lastTime.Elapsed() > BUFOVERTIME && errcnt > BUFOVERCOUNT) {
+                                        esyslog("ERROR: too many buffer overflows, logging stopped");
+                                        showerr = false;
+                                }
+                        } else if (lastTime.Elapsed() < BUFOVERTIME) {
+                                showerr = true;
+                                firsterr = 0;
+                                errcnt = 0;
+                        }
+
+                        if (showerr)
+                                esyslog("ERROR: ring buffer overflow (%d bytes dropped)", Length - p);
+                        else
+                                firsterr = 1;
+#endif
                 }
         }
 }
index e9b854c2f66c17d82430a89811a412e6ec4caa51..cbfe50a2655beaae8395da1df188eb899a9a66cc 100644 (file)
@@ -42,7 +42,9 @@ private:
     int       m_Socket;
 
         bool m_Active;
-
+#if VDRVERSNUM >= 10300
+       cTimeMs lastTime;
+#endif
         // CJT
         Ringbuffer rb;
         pthread_mutex_t ringLock;