]> git.vomp.tv Git - vompclient-marten.git/commitdiff
Send MAC in login packet, volume read from hw at startup
authorChris Tallon <chris@vomp.tv>
Wed, 7 Dec 2005 17:44:01 +0000 (17:44 +0000)
committerChris Tallon <chris@vomp.tv>
Wed, 7 Dec 2005 17:44:01 +0000 (17:44 +0000)
Makefile
audio.cc
command.cc
player.h
playervideo.cc
playervideo.h
tcp.cc
tcp.h
vdr.cc
vvideolive.cc

index 5757f5a9dd311722de6ddbce331b9168ddbebc76..67e569bc3989a1a3f22cec9fbfacbe8db0baadb6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -13,22 +13,19 @@ CROSSLIBS = ../jpeg-6b/libjpeg.a
 
 OBJECTS = main.o command.o log.o remote.o led.o mtd.o video.o audio.o tcp.o directory.o thread.o event.o \
           player.o demuxer.o stream.o vfeed.o afeed.o afeedr.o osd.o surface.o viewman.o vdr.o dsock.o box.o \
-          recording.o channel.o message.o playervideo.o playerradio.o messagequeue.o \
+          recording.o channel.o message.o playervideo.o messagequeue.o \
           view.o vinfo.o vwallpaper.o vvolume.o vrecordinglist.o vlivebanner.o vmute.o \
-          vrecordingmenu.o vquestion.o vchannellist.o vwelcome.o vvideolive.o vvideorec.o vradiolive.o \
+          vrecordingmenu.o vquestion.o vchannellist.o vwelcome.o vvideolive.o vvideorec.o \
           vchannelselect.o vserverselect.o colour.o vconnect.o voptions.o vepg.o region.o \
           widget.o wselectlist.o wjpeg.o wsymbol.o wbutton.o woptionbox.o wtextbox.o i18n.o timers.o \
           fonts/helvB24.o fonts/helvB18.o
+# playerradio.o vradiolive.o
 
 .PHONY: clean fresh all install strip
 
 default: dev
 fresh:   clean default
 
-temp:
-       $(CC) -E $(CXXFLAGS_DEV) -c i18n.cc
-
-
 vompclient: $(OBJECTS)
        $(CC) $(LDFLAGS) $(LIBPATHS) $(RELEASE) -o vompclient $(OBJECTS) $(CROSSLIBS) $(LIBS)
 
index 01e53e112b7bfb64eababdcb523408c48579b311..013357f5878cb1199903c12f0565b1180bc6efd2 100644 (file)
--- a/audio.cc
+++ b/audio.cc
@@ -63,6 +63,15 @@ int Audio::init(UCHAR tstreamType)
 
   unMute();
 
+  // Set the volume variable to what the hardware is set at now
+  int hwvol = -1;
+  int hwvolFail = ioctl(fdAudio, AV_GET_AUD_VOLUME, &hwvol);
+  if (!hwvolFail)
+  {
+    volume = 20 - ((hwvol >> 16) & 0xFF);
+    if ((volume < 0) || (volume > 20)) volume = 20;
+  }
+
   return 1;
 }
 
index 16f98ec5e37b3eb32dbc4f6eed74646248f71571..b44106db79d131030bdec6ab5cb110ba8df8e801 100644 (file)
@@ -334,6 +334,8 @@ void Command::doJustConnected(VConnect* vconnect)
   {
     firstBoot = 0;
 
+    logger->log("Command", Log::DEBUG, "Load power after boot");
+
     config = vdr->configLoad("General", "Power After Boot");
 
     if (config)
index e0ac06c3e89563fbc83f0338241a6e41b0e6531f..0b4f990954010e2ac6518b95e2df21e8db9545e4 100644 (file)
--- a/player.h
+++ b/player.h
@@ -44,6 +44,7 @@ class Player : public Thread, public Callback
     virtual void skipBackward(int seconds)=0;
     virtual void setPosition(ULLONG position)=0;
     virtual void setLength(ULLONG length)=0;
+    virtual void resyncAudio()=0;
 #ifdef DEV
     virtual void test1()=0;
     virtual void test2()=0;
index 0a326e8cbee7cda6ad1435850c33c91f7bded09b..5ef741ed1c63bbca3301ac3752dbafb01e034774 100644 (file)
@@ -104,6 +104,17 @@ int PlayerVideo::shutdown()
   return 1;
 }
 
+void PlayerVideo::resyncAudio()
+{
+  // Temp hopefully
+
+  if (!initted) return;
+
+  audio->pause();
+      usleep(500000); // SYNC
+  audio->unPause();
+}
+
 int PlayerVideo::play()
 {
   if (!initted) return 0;
index ce8bff71a6fa9cc71fefbf6e6dcd635bd487eb59..e9aa4b970b5fdfe48bac464763c425ddb5fb603e 100644 (file)
@@ -56,6 +56,7 @@ class PlayerVideo : public Player
     void call(void*); // for callback interface
     void setPosition(ULLONG position);
     void setLength(ULLONG length);
+    void resyncAudio();
 #ifdef DEV
     void test1();
     void test2();
diff --git a/tcp.cc b/tcp.cc
index a9939e9f64217ce6dc34dae0109ec04fc737bfbc..fd5444fbda38b92d013b9e015c79dcc4c1f2d12c 100644 (file)
--- a/tcp.cc
+++ b/tcp.cc
@@ -42,6 +42,14 @@ void TCP::disableTimeout()
   timeoutEnabled = 0;
 }
 
+void TCP::getMAC(char* dest)
+{
+  struct ifreq ifr;
+  strcpy(ifr.ifr_name, "eth0");
+  ioctl(sock, SIOCGIFHWADDR, &ifr);
+  memcpy(dest, ifr.ifr_hwaddr.sa_data, 6);
+}
+
 int TCP::connectTo(char* host, unsigned short port)
 {
   sock = socket(PF_INET, SOCK_STREAM, 0);
diff --git a/tcp.h b/tcp.h
index 5eeed6b2254fe05e29bef9df455d416f313001cc..4a024c71065dba0cf877044e275a32c4d339b45a 100644 (file)
--- a/tcp.h
+++ b/tcp.h
@@ -33,6 +33,8 @@
 #include <arpa/inet.h>
 #include <fcntl.h>
 #include <ctype.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
 
 #include "defines.h"
 #include "log.h"
@@ -57,6 +59,8 @@ class TCP
 
     static void dump(unsigned char* data, ULONG size);
 
+    void getMAC(char* dest); // copies 6 MAC bytes to dest
+
   private:
     int sock;
     int connected;
diff --git a/vdr.cc b/vdr.cc
index 6eb863a47314043fdb6f908412b2cb68375bf5bb..b5d1fac7a10adf71049a6393ff3e1555898042b5 100644 (file)
--- a/vdr.cc
+++ b/vdr.cc
@@ -206,14 +206,17 @@ int VDR::doLogin()
 {
   if (!connected) return 0;
 
-  UCHAR buffer[8];
+  UCHAR buffer[14];
 
-  *(unsigned long*)&buffer[0] = htonl(4);
+  *(unsigned long*)&buffer[0] = htonl(10);
   *(unsigned long*)&buffer[4] = htonl(VDR_LOGIN);
 
+  tcp->getMAC((char*)&buffer[8]);
+
+
   pthread_mutex_lock(&mutex);
-  int a = tcp->sendPacket(buffer, 8);
-  if (a != 8)
+  int a = tcp->sendPacket(buffer, 14);
+  if (a != 14)
   {
     pthread_mutex_unlock(&mutex);
     return 0;
index 5bc2cdba7ca6b35eb6e83032696a310e3cd23611..1b87978571ac84fd07499fd68d59659f1a6077e6 100644 (file)
@@ -72,6 +72,11 @@ int VVideoLive::handleCommand(int command)
       if (!unavailable) player->play(); // do resync
       return 2;
     }
+    case Remote::PAUSE:
+    {
+      if (!unavailable) player->resyncAudio(); // do resync2
+      return 2;
+    }
 
     case Remote::STOP:
     case Remote::BACK: