]> git.vomp.tv Git - vompclient-marten.git/commitdiff
A little convergence to NEW_DEMUXER
authorChris Tallon <chris@vomp.tv>
Fri, 19 May 2006 21:29:49 +0000 (21:29 +0000)
committerChris Tallon <chris@vomp.tv>
Fri, 19 May 2006 21:29:49 +0000 (21:29 +0000)
25 files changed:
Makefile
afeed.cc
afeed.h
afeedr.cc [deleted file]
afeedr.h [deleted file]
audio.h
audiomvp.cc
audiomvp.h
audiowin.cc
audiowin.h
demuxer.cc
demuxer.h
draintarget.cc
draintarget.h
main.cc
player.cc
stream.cc
stream.h
vfeed.cc
vfeed.h
video.h
videomvp.cc
videomvp.h
videowin.cc
videowin.h

index 2086636a9d3249e4cbae8aeb64c5805b05eafa65..9ee421cec92b6acefef74aa0c67ad0cd8051524b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ CROSSLIBS = ../jpeg-6b/libjpeg.a
 OBJECTS1 = main.o command.o log.o tcp.o dsock.o thread.o timers.o i18n.o               \
            message.o messagequeue.o                                                    \
            vdr.o recman.o recording.o channel.o rectimer.o event.o directory.o         \
-           player.o vfeed.o afeed.o afeedr.o                                           \
+           player.o vfeed.o afeed.o                                                    \
                                         demuxer.o demuxervdr.o stream.o draintarget.o                               \
            viewman.o box.o region.o colour.o view.o                                    \
            vinfo.o vwallpaper.o vvolume.o vrecordinglist.o vlivebanner.o vmute.o       \
index fc0b4ce26577a07e82c97ff6b6e3868a6283e0bd..7bc8fbf081398e244687ab79c0e5fe42df4fea5c 100644 (file)
--- a/afeed.cc
+++ b/afeed.cc
@@ -26,19 +26,10 @@ AFeed::AFeed(Callback* tcb)
   audioEnabled = 1;
 }
 
-#ifndef NEW_DEMUXER
-int AFeed::init(int tfd)
+int AFeed::init()
 {
-  fd = tfd;
   return 1;
 }
-#else
-int AFeed::init(DrainTarget* tdt)
-{
-  dt = tdt;
-  return 1;
-}
-#endif
 
 int AFeed::shutdown()
 {
@@ -77,11 +68,7 @@ void AFeed::threadMethod()
 
     if (audioEnabled)
     {
-#ifndef NEW_DEMUXER
-      alen = Demuxer::getInstance()->writeAudio(fd); // FIXME ?
-#else
-      alen = Demuxer::getInstance()->writeAudio(dt); // FIXME ?
-#endif
+      alen = Demuxer::getInstance()->writeAudio();
 
       if (alen)
       {
diff --git a/afeed.h b/afeed.h
index f67770b373e187775d471de5f41c72c5f9fe823b..76ec46635f5efcef8d324d193cab6546b9ffebe3 100644 (file)
--- a/afeed.h
+++ b/afeed.h
@@ -27,7 +27,6 @@
 #include "log.h"
 #include "demuxer.h"
 #include "callback.h"
-#include "draintarget.h"
 
 #ifdef WIN32
 #include "threadwin.h"
@@ -40,11 +39,8 @@ class AFeed : public Thread_TYPE
 {
   public:
     AFeed(Callback* tcb);
-#ifndef NEW_DEMUXER
-    int init(int fd);
-#else
-    int init(DrainTarget* tdt);
-#endif
+
+    int init();
     int shutdown();
 
     int start();
@@ -56,11 +52,6 @@ class AFeed : public Thread_TYPE
     void threadMethod();
     void threadPostStopCleanup() {};
     int audioEnabled;
-#ifndef NEW_DEMUXER
-    int fd;
-#else
-    DrainTarget* dt;
-#endif
     Callback& cb;
 };
 
diff --git a/afeedr.cc b/afeedr.cc
deleted file mode 100644 (file)
index f88c996..0000000
--- a/afeedr.cc
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
-    Copyright 2004-2005 Chris Tallon
-
-    This file is part of VOMP.
-
-    VOMP is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    VOMP is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-#include "afeedr.h"
-
-AFeedR::AFeedR(Callback* tcb, Stream* tstream)
-: cb(*tcb), stream(*tstream)
-{
-}
-
-#ifndef NEW_DEMUXER
-int AFeedR::init(int tfd)
-{
-  fd = tfd;
-  return 1;
-}
-#else
-int AFeedR::init(DrainTarget* tdt)
-{
-  dt = tdt;
-  return 1;
-}
-#endif
-
-
-int AFeedR::shutdown()
-{
-  // FIXME
-  return 1;
-}
-
-int AFeedR::start()
-{
-  return threadStart();
-}
-
-void AFeedR::stop()
-{
-  threadCancel();
-}
-
-void AFeedR::threadMethod()
-{
-  Log::getInstance()->log("AFeedR", Log::DEBUG, "Started");
-
-  int alen;
-
-  while(1)
-  {
-#ifndef NEW_DEMUXER
-    alen = stream.drain(fd);
-#else
-    alen = stream.drain(dt);
-    threadCheckExit();
-#endif
-
-    if (alen)
-    {
-      Log::getInstance()->log("AFeedR", Log::DEBUG, "Written %i", alen);
-      cb.call(this);
-    }
-    else
-    {
-      MILLISLEEP(100);
-    }
-  }
-}
-
diff --git a/afeedr.h b/afeedr.h
deleted file mode 100644 (file)
index 9967420..0000000
--- a/afeedr.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-    Copyright 2004-2005 Chris Tallon
-
-    This file is part of VOMP.
-
-    VOMP is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    VOMP is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-#ifndef AFEEDR_H
-#define AFEEDR_H
-
-#include <stdio.h>
-#include <time.h>
-
-#include "log.h"
-#include "callback.h"
-#include "stream.h"
-#include "draintarget.h"
-
-#ifdef WIN32
-#include "threadwin.h"
-#else
-#include "threadp.h"
-#endif
-
-class AFeedR : public Thread_TYPE
-{
-  public:
-    AFeedR(Callback* tcb, Stream* tstream);
-#ifndef NEW_DEMUXER
-    int init(int fd);
-#else
-    int init(DrainTarget* tdt);
-#endif
-    int shutdown();
-
-    int start();
-    void stop();
-
-  private:
-    void threadMethod();
-    void threadPostStopCleanup() {};
-#ifndef NEW_DEMUXER
-    int fd;
-#else
-    DrainTarget* dt;
-#endif
-    Callback& cb;
-    Stream& stream;
-};
-
-#endif
diff --git a/audio.h b/audio.h
index 23751d83119e0cfd5de38a290970e73d06ff7aa3..a240121bcc600f1705c2b18a7446bd4b34327ffc 100644 (file)
--- a/audio.h
+++ b/audio.h
@@ -57,8 +57,10 @@ class Audio : public DrainTarget
     virtual int setVolume(int volume)=0;
     virtual int mute()=0;
     virtual int unMute()=0;
-    virtual int write(char *buf, int len)=0;
-    virtual int getFD()=0;  // FIXME MVP specific
+
+#ifndef NEW_DEMUXER
+    virtual int write(UCHAR* buffer, ULONG length)=0;
+#endif
 
     int volumeUp();
     int volumeDown();
index f1bfe70f60694c877d56d601ef9c6b97b480f740..f7a4ab4c705b6b62cd9ec932bf2f007c2d089f28 100644 (file)
@@ -79,18 +79,6 @@ int AudioMVP::shutdown()
   return 1;
 }
 
-int AudioMVP::getFD()
-{
-  if (!initted) return 0;
-
-  return fdAudio;
-}
-
-int AudioMVP::write(char *buf, int len)
-{
-  return 0; //write(fdAudio, buf, len);
-}
-
 int AudioMVP::setStreamType(UCHAR type)
 {
   if (!initted) return 0;
@@ -241,7 +229,8 @@ int AudioMVP::test()
 #endif
 
 
-// unused
+#ifdef NEW_DEMUXER
+
 UINT AudioMVP::DeliverMediaSample(MediaPacket packet, UCHAR* buffer, UINT *samplepos)
 {
   return 0;
@@ -251,3 +240,11 @@ void AudioMVP::ResetTimeOffsets()
 {
 }
 
+#else
+
+int AudioMVP::write(UCHAR* buffer, ULONG length)
+{
+  return ::write(fdAudio, buffer, length);
+}
+
+#endif
index cf29478f1ee952e7432ab03ee6b1ae25aa60d101..0178514d065339e03911ad0fed744c9e76cb6278 100644 (file)
@@ -54,13 +54,15 @@ class AudioMVP : public Audio
     int setVolume(int volume);
     int mute();
     int unMute();
-    int write(char *buf, int len);
-    int getFD();
 
+#ifdef NEW_DEMUXER
     //Writing Data to Audiodevice -- unused in MVP code so far
     virtual UINT DeliverMediaSample(MediaPacket packet, UCHAR* buffer, UINT *samplepos);
     virtual long long SetStartOffset(long long curreftime, bool *rsync) { return 0; };
     virtual void ResetTimeOffsets();
+#else
+    int write(UCHAR* buffer, ULONG length);
+#endif
 
 #ifdef DEV
     int test();
index 40b51b62239976ab1208f172c2ec275439fb165b..d835bb6ee8f1233d8c716819b28a955238714199 100644 (file)
@@ -29,14 +29,14 @@ AudioWin::AudioWin()
 {
   initted = 0;
   firstsynched=false;
+
 
 
 }
 
 AudioWin::~AudioWin()
 {
-       
+
 
 }
 
@@ -54,11 +54,6 @@ int AudioWin::shutdown()
   return 1;
 }
 
-int AudioWin::getFD()
-{
-  return 0;
-}
-
 int AudioWin::write(char *buf, int len)
 {
   return 0; //write(fdAudio, buf, len);
@@ -216,17 +211,17 @@ UINT AudioWin::DeliverMediaSample(MediaPacket packet,
     if (packet.synched) {
       ms->SetSyncPoint(TRUE);
       ms->SetTime(&reftime1,&reftime2);
-        
+
       //ms->SetTime(NULL,NULL);
       ms->SetMediaTime(NULL, NULL);
-         if (reftime1<0) ms->SetPreroll(TRUE);
-         else ms->SetPreroll(FALSE);
+    if (reftime1<0) ms->SetPreroll(TRUE);
+    else ms->SetPreroll(FALSE);
     }else {
       ms->SetSyncPoint(FALSE);
       ms->SetTime(NULL,NULL);
       ms->SetMediaTime(NULL, NULL);
-         ms->SetPreroll(FALSE);
-          MessageBox(0,"here I'm","Hallo",0);
+    ms->SetPreroll(FALSE);
+     MessageBox(0,"here I'm","Hallo",0);
     //  ms->SetSyncPoint(TRUE);
     }
   }
index 2e6eb1adb532185c7d452a923c2ecf7593a26812..1727b52cf06c4551ddb5e5e9861eda412ac1480d 100644 (file)
@@ -47,12 +47,11 @@ class AudioWin : public Audio
     int mute();
     int unMute();
     int write(char *buf, int len);
-    int getFD();
 
     // Writing Data to Audiodevice
     virtual UINT DeliverMediaSample(MediaPacket packet, UCHAR* buffer, UINT *samplepos);
     virtual long long SetStartOffset(long long curreftime, bool *rsync);
-       virtual void ResetTimeOffsets();
+  virtual void ResetTimeOffsets();
 
 private:
   bool firstsynched;
index d8be631040bbd5b48a674457de9dff34dbe6826d..89c41e4b019fc65deb64aa696fade95cdf2e57ce 100644 (file)
@@ -61,21 +61,17 @@ Demuxer* Demuxer::getInstance()
   return instance;
 }
 
-int Demuxer::init(Callback* tcallback)
+int Demuxer::init(Callback* tcallback, DrainTarget* audio, DrainTarget* video)
 {
   if (!initted)
   {
-    if ( !videostream.init(demuxMemoryV) ||
-         !audiostream.init(demuxMemoryA))
+    if ( !videostream.init(video, demuxMemoryV) ||
+         !audiostream.init(audio, demuxMemoryA))
     {
       Log::getInstance()->log("Demuxer", Log::CRIT, "Failed to initialize demuxer");
       shutdown();
       return 0;
     }
-#ifdef NEW_DEMUXER
-    videostream.setDrainTarget(Video::getInstance());
-    audiostream.setDrainTarget(Audio::getInstance());
-#endif
   }
 
   reset();
@@ -143,27 +139,16 @@ void Demuxer::setAspectRatio(enum AspectRatio ar)
   else
     arcnt = 0;
 }
-#ifndef NEW_DEMUXER
-int Demuxer::writeAudio(int fd)
-{
-  return audiostream.drain(fd);
-}
 
-int Demuxer::writeVideo(int fd)
+int Demuxer::writeAudio()
 {
-  return videostream.drain(fd);
-}
-#else
-int Demuxer::writeAudio(DrainTarget* dt)
-{
-  return audiostream.drain(dt);
+  return audiostream.drain();
 }
 
-int Demuxer::writeVideo(DrainTarget* dt)
+int Demuxer::writeVideo()
 {
-  return videostream.drain(dt);
+  return videostream.drain();
 }
-#endif
 
 Demuxer::PESPacket::PESPacket()
 {
index b28f273c7b2f598c4f445cc1356286c41f84eee6..ba643243c6e5764ed772d5636153a7ee26d26c1f 100644 (file)
--- a/demuxer.h
+++ b/demuxer.h
@@ -38,9 +38,6 @@ however, no code was copied verbatim.
 #include "callback.h"
 #include "draintarget.h"
 
-#include "audio.h"
-#include "video.h"
-
 class Demuxer
 {
 public: //MS Visual C++ need this, private does not work for DemuxerVDR, Marten
@@ -69,20 +66,15 @@ public: //MS Visual C++ need this, private does not work for DemuxerVDR, Marten
     Demuxer();
     virtual ~Demuxer();
     static Demuxer* getInstance();
-    int init(Callback* callback);
+    int init(Callback* callback, DrainTarget* audio, DrainTarget* video);
     void reset();
     virtual void flush();
     void flushAudio();
     void seek();
     void setVideoStream(int id);
     void setAudioStream(int id);
-#ifndef NEW_DEMUXER
-    int writeAudio(int fd);
-    int writeVideo(int fd);
-#else
-    int writeAudio(DrainTarget* dt);
-    int writeVideo(DrainTarget* dt);
-#endif
+    int writeAudio();
+    int writeVideo();
 
     virtual int scan(UCHAR* buf, int len) = 0;
     virtual int findVideoPTS(UCHAR* buf, int len, ULLONG* dest) = 0;
index 8dd74a4232441f55e44a0ca61a0284dc51596107..26c9d96a45f748732fb7796cdb7e9a7ff4d80b13 100644 (file)
     along with VOMP; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
-#include "draintarget.h"
-DrainTarget::DrainTarget(){
 
+#include "draintarget.h"
 
+DrainTarget::DrainTarget()
+{
 }
-DrainTarget::~DrainTarget(){
-
+DrainTarget::~DrainTarget()
+{
 }
index 7923b2ef96acd972c48b83f84234798ba7a69cb0..380979b83ebccefeb7bf1419d44ebec2cfbba634 100644 (file)
 #include <list>
 
 
+#ifdef NEW_DEMUXER
 
-
-struct MediaPacket{
+struct MediaPacket
+{
   ULLONG recording_byte_pos; //position in recording
   ULLONG pts;
   ULONG pos_buffer; //position in stream buffer
@@ -42,23 +43,32 @@ using namespace std;
 
 typedef list<MediaPacket> MediaPacketList;
 
+#endif
+
+class DrainTarget
+{
+  public:
+    DrainTarget();
+    virtual ~DrainTarget();
+
+#ifdef NEW_DEMUXER
 
-class DrainTarget {
-public:
-  DrainTarget();
-  virtual ~DrainTarget();
-  virtual UINT DeliverMediaSample(MediaPacket packet, UCHAR* buffer,
-        UINT *samplepos)=0;
+    virtual UINT DeliverMediaSample(MediaPacket packet, UCHAR* buffer, UINT *samplepos)=0;
 
-/* This function behaviour should be:
-Try to deliver the Data from packet.pos_buffer+samplepos to packet.pos_buffer+packet.length,
-with considering the bufferwraparound according to buffersize.
-Then increasing samplepos, so that on the next call delivering can proceed. So if writebytes are
-writen samplepos=samplepos+writebytes!
-If samplepos>=packet.length is returned, the next packet can be used for the next call.*/
+    /* This function behaviour should be:
+    Try to deliver the Data from packet.pos_buffer+samplepos to packet.pos_buffer+packet.length,
+    with considering the bufferwraparound according to buffersize.
+    Then increasing samplepos, so that on the next call delivering can proceed. So if writebytes are
+    writen samplepos=samplepos+writebytes!
+    If samplepos>=packet.length is returned, the next packet can be used for the next call.*/
+
+    virtual long long SetStartOffset(long long curreftime, bool *rsync)=0;
+    virtual void ResetTimeOffsets()=0;
+
+#else
+    virtual int write(UCHAR* buffer, ULONG length)=0;
+#endif
 
-  virtual long long SetStartOffset(long long curreftime, bool *rsync)=0;
-  virtual void ResetTimeOffsets()=0;
 };
 
 
diff --git a/main.cc b/main.cc
index 7c8e1473b6eb9d6f93b627ceab13292e3d4bd118..b5f56e8fb4d7d1e6064cc8c3d8463c815624d66a 100644 (file)
--- a/main.cc
+++ b/main.cc
 #include "viewman.h"
 #include "command.h"
 
-#ifdef WIN32
-  #include "mtdwin.h"
-  #include "remotewin.h"
-  #include "ledwin.h"
-  #include "osdwin.h"
-  #include "audiowin.h"
-  #include "videowin.h"
-#else
-  #include "mtdmvp.h"
-  #include "remotemvp.h"
-  #include "ledmvp.h"
-  #include "osdmvp.h"
-  #include "audiomvp.h"
-  #include "videomvp.h"
-#endif
+#include "mtdmvp.h"
+#include "remotemvp.h"
+#include "ledmvp.h"
+#include "osdmvp.h"
+#include "audiomvp.h"
+#include "videomvp.h"
 
 #ifndef WIN32
 void sighandler(int signalReceived);
index 997dcff8ed70215fb638cff84aceb75a05bfd315..731019be5e31c7adb0b59d4534ac1fa9bf87597e 100644 (file)
--- a/player.cc
+++ b/player.cc
@@ -79,19 +79,15 @@ int Player::init()
   demuxer = new DemuxerVDR();
   if (!demuxer) return 0;
 
-  if (!demuxer->init(this))
+  if (!demuxer->init(this, audio, video))
   {
     logger->log("Player", Log::ERR, "Demuxer failed to init");
     shutdown();
     return 0;
   }
-#ifndef NEW_DEMUXER
-  vfeed.init(video->getFD());
-  afeed.init(audio->getFD());
-#else
-  vfeed.init(video);
-  afeed.init(audio);
-#endif
+
+  vfeed.init();
+  afeed.init();
 
   video->stop();
   video->blank();
index f226d8fb52b3b8a1a341e4f834917be29ac73f41..fc8c696e1fa0da77f9495dc1543d69e9dce98331 100644 (file)
--- a/stream.cc
+++ b/stream.cc
@@ -23,9 +23,9 @@
 Stream::Stream()
 {
   initted = 0;
+  draintarget=NULL;
 #ifdef NEW_DEMUXER
   cur_packet_pos=0;
-  draintarget=NULL;
 #endif
 }
 
@@ -41,10 +41,11 @@ void Stream::shutdown()
 
 }
 
-int Stream::init(int bufsize)
+int Stream::init(DrainTarget* tdt, int bufsize)
 {
   outbuf = (UCHAR*) malloc(bufsize);
   if (!outbuf) return 0;
+  draintarget = tdt;
   bufferSize = bufsize;
   bufferHead = 0;
   bufferTail = 0;
@@ -172,7 +173,7 @@ int Stream::put(UCHAR* inbuf, int len,ULLONG curpos)
 
 #ifndef NEW_DEMUXER
 
-int Stream::drain(int fd)
+int Stream::drain()
 {
   int ret = 0;
   int head = bufferHead;
@@ -186,7 +187,7 @@ int Stream::drain(int fd)
   {
     // Drain up to the marker.
 #ifndef WIN32
-    written = write(fd, outbuf + tail, (mark - tail));
+    written = draintarget->write(outbuf + tail, (mark - tail));
 #else
     written=mark-tail;
     MILLISLEEP(1);
@@ -207,7 +208,7 @@ int Stream::drain(int fd)
 
   if (tail == head) return ret; // Empty
 #ifndef WIN32
-  written = write(fd, outbuf + tail, (head - tail));
+  written = draintarget->write(outbuf + tail, (head - tail));
 #else
   written=(head - tail);
   MILLISLEEP(1);
@@ -217,12 +218,14 @@ int Stream::drain(int fd)
   bufferTail = tail + written;
   return ret;
 }
+
 #else
-int Stream::drain(DrainTarget* dt)
+
+int Stream::drain()
 {
   int ret = 0;
   int written=1;
-  draintarget=dt;
+//  draintarget=dt; // this is now set in init, is this ok?
 
 
 
index c3abce6d0b9280bee7ef8fefcad397d305f4a646..33d97c0d8cb2fc789e6978093b43d7fee1af40cf 100644 (file)
--- a/stream.h
+++ b/stream.h
@@ -36,29 +36,24 @@ class Stream
   public:
     Stream();
     ~Stream();
-    int init(int bufsize);
+    int init(DrainTarget* tdt, int bufsize);
     void shutdown();
     void flush();
 #ifndef NEW_DEMUXER
     int put(UCHAR* inbuf, int len);
 #else
-  int put(UCHAR* inbuf, int len,ULLONG curpos);
+    int put(UCHAR* inbuf, int len,ULLONG curpos);
 #endif
 
-#ifndef NEW_DEMUXER
-    int drain(int fd);
-#else
-    int drain(DrainTarget* fd);
-    void setDrainTarget(DrainTarget *dt) {if (dt) draintarget=dt;};
-#endif
+    int drain();
 
   private:
 #ifdef NEW_DEMUXER
     MediaPacketList mediapackets;
     UINT cur_packet_pos;
-    DrainTarget* draintarget;
 #endif
 
+    DrainTarget* draintarget;
     int initted;
     UCHAR* outbuf;
     int bufferSize;
index 7b649048df0d01fbe7fae5bad246b05331d32bc3..4fd465709a5c89fe461981a1551a5e0acad0fb75 100644 (file)
--- a/vfeed.cc
+++ b/vfeed.cc
@@ -25,19 +25,10 @@ VFeed::VFeed(Callback* tcb)
 {
 }
 
-#ifndef NEW_DEMUXER
-int VFeed::init(int tfd)
+int VFeed::init()
 {
-  fd = tfd;
   return 1;
 }
-#else
-int VFeed::init(DrainTarget* tdt)
-{
-  dt = tdt;
-  return 1;
-}
-#endif
 
 int VFeed::shutdown()
 {
@@ -68,12 +59,9 @@ void VFeed::threadMethod()
 
   while(1)
   {
-#ifndef NEW_DEMUXER
-    vlen = Demuxer::getInstance()->writeVideo(fd); // FIXME
-#else
     threadCheckExit();
-    vlen = Demuxer::getInstance()->writeVideo(dt); // FIXME
-#endif
+    vlen = Demuxer::getInstance()->writeVideo();
+
     if (vlen)
     {
  //     Log::getInstance()->log("VFeed", Log::DEBUG, "Written %i", vlen);
diff --git a/vfeed.h b/vfeed.h
index b1cb2040096e915cd6facaa4679bfee9ca012074..54975ef0fbda56371eea69a63d3a9bb02661c904 100644 (file)
--- a/vfeed.h
+++ b/vfeed.h
@@ -27,7 +27,6 @@
 #include "log.h"
 #include "demuxer.h"
 #include "callback.h"
-#include "draintarget.h"
 
 #ifdef WIN32
 #include "threadwin.h"
@@ -39,11 +38,7 @@ class VFeed : public Thread_TYPE
 {
   public:
     VFeed(Callback* tcb);
-#ifndef NEW_DEMUXER
-    int init(int fd);
-#else
-    int init(DrainTarget *tdt);
-#endif
+    int init();
 
     int shutdown();
 
@@ -54,12 +49,6 @@ class VFeed : public Thread_TYPE
   private:
     void threadMethod();
     void threadPostStopCleanup() {};
-#ifndef NEW_DEMUXER
-    int fd;
-#else
-    DrainTarget *dt;
-#endif
-
     Callback& cb;
 };
 
diff --git a/video.h b/video.h
index 69de304acc088011520111f99a9a08cd816334bf..dbb20d52a51fd6dd3ffab3ab337b5129d3ecb11c 100644 (file)
--- a/video.h
+++ b/video.h
@@ -55,9 +55,12 @@ class Video: public DrainTarget
     virtual int signalOff()=0;
     virtual int attachFrameBuffer()=0; // What does this do?
     virtual ULONG timecodeToFrameNumber(ULLONG timecode)=0;
-    virtual int getFD()=0;
     virtual ULLONG getCurrentTimestamp()=0;
 
+#ifndef NEW_DEMUXER
+    virtual int write(UCHAR* buffer, ULONG length)=0;
+#endif
+
     virtual void turnVideoOn(){};
     virtual void turnVideoOff(){};
     virtual ULLONG frameNumberToTimecode(ULONG timecode) { return 0; };
index 6e7c61bb3c5c6c5fb092ba00892c7af1343de8a4..43e84a72846993123dc5325239ccb82316ac69e2 100644 (file)
@@ -323,13 +323,6 @@ int VideoMVP::blank(void)
   return 1;
 }
 
-int VideoMVP::getFD()
-{
-  if (!initted) return 0;
-
-  return fdVideo;
-}
-
 ULLONG VideoMVP::getCurrentTimestamp()
 {
   sync_data_t timestamps;
@@ -373,7 +366,10 @@ int VideoMVP::test2()
 }
 #endif
 
-// unused
+
+
+#ifdef NEW_DEMUXER
+
 UINT VideoMVP::DeliverMediaSample(MediaPacket packet, UCHAR* buffer, UINT *samplepos)
 {
   return 0;
@@ -382,3 +378,13 @@ UINT VideoMVP::DeliverMediaSample(MediaPacket packet, UCHAR* buffer, UINT *sampl
 void VideoMVP::ResetTimeOffsets()
 {
 }
+
+#else
+
+int VideoMVP::write(UCHAR* buffer, ULONG length)
+{
+  return ::write(fdVideo, buffer, length);
+}
+
+#endif
+
index f2a2aaf8bc6c2235da7fa02e40b184b2c8c1b10c..3f626d20579ee4afeb3cfa53f74aa64a12573189 100644 (file)
@@ -66,13 +66,16 @@ class VideoMVP : public Video
     int signalOff();
     int attachFrameBuffer(); // What does this do?
     ULONG timecodeToFrameNumber(ULLONG timecode);
-    int getFD();
     ULLONG getCurrentTimestamp();
 
+#ifdef NEW_DEMUXER
     //Writing Data to Videodevice
     virtual UINT DeliverMediaSample(MediaPacket packet, UCHAR* buffer, UINT *samplepos);
     virtual long long SetStartOffset(long long curreftime, bool *rsync) { return 0; };
     virtual void ResetTimeOffsets();
+#else
+    int write(UCHAR* buffer, ULONG length);
+#endif
 
 #ifdef DEV
     int test();
index c1e3356319ca4a236d2d3c07a535a90bf9f05e39..3462f6c3378cb9b821cf933c0f1286312a9a7434 100644 (file)
@@ -55,7 +55,7 @@ VideoWin::VideoWin()
   pseudotvsize=0;
   videoposx=0;
   videoposy=0;
+
 
 
 }
@@ -64,7 +64,7 @@ VideoWin::~VideoWin()
 {
   CleanupDS();
   CloseHandle(filtermutex);
+
 
 
   instance = NULL;
@@ -175,8 +175,8 @@ int VideoWin::setPosition(int x, int y)
 {
   if (!initted) return 0;
   if (mode==QUARTER || mode==EIGHTH) {
-       videoposx=x;
-       videoposy=y;
+  videoposx=x;
+  videoposy=y;
   }
   return 1;
 }
@@ -200,7 +200,7 @@ int VideoWin::play()
 
   //Build filter graph
   HRESULT hres;
+
   if (hres=CoCreateInstance(CLSID_FilterGraph,NULL,CLSCTX_INPROC_SERVER,
     IID_IGraphBuilder,(void**)&dsgraphbuilder)!=S_OK) {
       return 0;
@@ -216,14 +216,14 @@ int VideoWin::play()
    sourcefilter=new DsSourceFilter(); //Creating our Source filter for pushing Data
    // to DirectShow
    if (hres=dsgraphbuilder->AddFilter(sourcefilter,L"Vomp Win Source Filter")!=S_OK) {
-        Log::getInstance()->log("VideoWin", Log::WARN , "Failed adding Vomp Source Filter!");
+   Log::getInstance()->log("VideoWin", Log::WARN , "Failed adding Vomp Source Filter!");
      CleanupDS();
      ReleaseMutex(filtermutex);
      return 0;
    }
    //if (audioon) {
      if (hres=dsgraphbuilder->Render(sourcefilter->GetPin(0)/*audio*/)!=S_OK) {
-          Log::getInstance()->log("VideoWin", Log::WARN , "Failed rendering audio!");
+     Log::getInstance()->log("VideoWin", Log::WARN , "Failed rendering audio!");
        CleanupDS();
        ReleaseMutex(filtermutex);
        return 0;
@@ -231,64 +231,64 @@ int VideoWin::play()
    //}
 #ifdef DO_VIDEO
     if (videoon) {
-               //We alloc the vmr9 as next step
-               if (hres=CoCreateInstance(CLSID_VideoMixingRenderer9,0,
-                       CLSCTX_INPROC_SERVER,IID_IBaseFilter,(void**) &dsvmrrenderer)!=S_OK) {
-                       Log::getInstance()->log("VideoWin", Log::WARN ,"Failed creating VMR9 renderer!");
-                       CleanupDS();
-                       ReleaseMutex(filtermutex);
-               }
-                       /*VMR 9 stuff**/
-               if (hres=dsgraphbuilder->AddFilter(dsvmrrenderer,L"VMR9")!=S_OK) {
-                       CleanupDS();
-                       Log::getInstance()->log("VideoWin", Log::WARN ,"Failed adding VMR9 renderer!");
-                       ReleaseMutex(filtermutex);
-                       return 0;
-               }
-               IVMRFilterConfig9* vmrfilconfig;
-               if (dsvmrrenderer->QueryInterface(IID_IVMRFilterConfig9,(void**)&vmrfilconfig)!=S_OK) {
-                       CleanupDS();
-                       Log::getInstance()->log("VideoWin", Log::WARN ,"Failed getting VMR9 Filterconfig interface!");
-                       ReleaseMutex(filtermutex);
-                       return 0;
-               }
-               vmrfilconfig->SetRenderingMode(VMR9Mode_Renderless);
-               vmrfilconfig->Release();
-               
-               if (dsvmrrenderer->QueryInterface(IID_IVMRSurfaceAllocatorNotify9,(void**)& dsvmrsurfnotify)!=S_OK) {
-                       CleanupDS();
-                       Log::getInstance()->log("VideoWin", Log::WARN ,"Failed getting VMR9 Surface Allocator interface!");
-                       ReleaseMutex(filtermutex);
-                       return 0;
-               }
-               allocatorvmr=new DsAllocator();
-               dsvmrsurfnotify->AdviseSurfaceAllocator(NULL,allocatorvmr);
-               allocatorvmr->AdviseNotify(dsvmrsurfnotify);
-
-
-
-               /*VMR 9 stuff end */
-               IFilterGraph2*fg2=NULL;
-               if (dsgraphbuilder->QueryInterface(IID_IFilterGraph2,(void**)&fg2)!=S_OK) {
-                       Log::getInstance()->log("VideoWin", Log::WARN , "Failed querying for FilterGraph2 Interface!");
-                       CleanupDS();
-                       ReleaseMutex(filtermutex);
-                       return 0;
-               }
-               if (hres=fg2->RenderEx(sourcefilter->GetPin(1)/*video*/,
-                               AM_RENDEREX_RENDERTOEXISTINGRENDERERS,NULL)!=S_OK) {
-                       Log::getInstance()->log("VideoWin", Log::WARN , "Failed rendering Video!");
-                       CleanupDS();
-                       ReleaseMutex(filtermutex);
-                       return 0;
-               }
+    //We alloc the vmr9 as next step
+    if (hres=CoCreateInstance(CLSID_VideoMixingRenderer9,0,
+      CLSCTX_INPROC_SERVER,IID_IBaseFilter,(void**) &dsvmrrenderer)!=S_OK) {
+      Log::getInstance()->log("VideoWin", Log::WARN ,"Failed creating VMR9 renderer!");
+      CleanupDS();
+      ReleaseMutex(filtermutex);
+    }
+      /*VMR 9 stuff**/
+    if (hres=dsgraphbuilder->AddFilter(dsvmrrenderer,L"VMR9")!=S_OK) {
+      CleanupDS();
+      Log::getInstance()->log("VideoWin", Log::WARN ,"Failed adding VMR9 renderer!");
+      ReleaseMutex(filtermutex);
+      return 0;
+    }
+    IVMRFilterConfig9* vmrfilconfig;
+    if (dsvmrrenderer->QueryInterface(IID_IVMRFilterConfig9,(void**)&vmrfilconfig)!=S_OK) {
+      CleanupDS();
+      Log::getInstance()->log("VideoWin", Log::WARN ,"Failed getting VMR9 Filterconfig interface!");
+      ReleaseMutex(filtermutex);
+      return 0;
+    }
+    vmrfilconfig->SetRenderingMode(VMR9Mode_Renderless);
+    vmrfilconfig->Release();
+
+    if (dsvmrrenderer->QueryInterface(IID_IVMRSurfaceAllocatorNotify9,(void**)& dsvmrsurfnotify)!=S_OK) {
+      CleanupDS();
+      Log::getInstance()->log("VideoWin", Log::WARN ,"Failed getting VMR9 Surface Allocator interface!");
+      ReleaseMutex(filtermutex);
+      return 0;
+    }
+    allocatorvmr=new DsAllocator();
+    dsvmrsurfnotify->AdviseSurfaceAllocator(NULL,allocatorvmr);
+    allocatorvmr->AdviseNotify(dsvmrsurfnotify);
+
+
+
+    /*VMR 9 stuff end */
+    IFilterGraph2*fg2=NULL;
+    if (dsgraphbuilder->QueryInterface(IID_IFilterGraph2,(void**)&fg2)!=S_OK) {
+      Log::getInstance()->log("VideoWin", Log::WARN , "Failed querying for FilterGraph2 Interface!");
+      CleanupDS();
+      ReleaseMutex(filtermutex);
+      return 0;
+    }
+    if (hres=fg2->RenderEx(sourcefilter->GetPin(1)/*video*/,
+        AM_RENDEREX_RENDERTOEXISTINGRENDERERS,NULL)!=S_OK) {
+      Log::getInstance()->log("VideoWin", Log::WARN , "Failed rendering Video!");
+      CleanupDS();
+      ReleaseMutex(filtermutex);
+      return 0;
+    }
    }
 #endif
    if (hres=CoCreateInstance(CLSID_SystemClock,NULL,CLSCTX_INPROC_SERVER,
     IID_IReferenceClock,(void**)&dsrefclock)!=S_OK) {
       return 0;
    }
-   
+
    dsgraphbuilder->QueryInterface(IID_IMediaFilter,(void **) &dsmediafilter);
    dsmediafilter->SetSyncSource(dsrefclock);
 
@@ -355,27 +355,20 @@ int VideoWin::blank(void)
   return 1;
 }
 
-int VideoWin::getFD()
+ULLONG VideoWin::getCurrentTimestamp()
 {
-  if (!initted) return 0;
+  REFERENCE_TIME cr_time,startoffset;
 
-  return fdVideo;
-}
+  if (!dsrefclock || !sourcefilter) return 0;
 
-ULLONG VideoWin::getCurrentTimestamp()
-{
-       REFERENCE_TIME cr_time,startoffset;
-       
-       if (!dsrefclock || !sourcefilter) return 0;
-       
-       dsrefclock->GetTime(&cr_time);
-       startoffset=sourcefilter->getStartOffset();
-       cr_time-=startoffset;
-       cr_time-=lastreftimeRT;
-       ULLONG result=frameNumberToTimecode(
-               VDR::getInstance()->frameNumberFromPosition(lastreftimeBYTE));
-       result+=(ULLONG)(cr_time/10000LL*90LL);
-       return result;
+  dsrefclock->GetTime(&cr_time);
+  startoffset=sourcefilter->getStartOffset();
+  cr_time-=startoffset;
+  cr_time-=lastreftimeRT;
+  ULLONG result=frameNumberToTimecode(
+    VDR::getInstance()->frameNumberFromPosition(lastreftimeBYTE));
+  result+=(ULLONG)(cr_time/10000LL*90LL);
+  return result;
 
 }
 
@@ -403,26 +396,26 @@ void VideoWin::CleanupDS()
     cur_video_media_sample=NULL;
   }
   if (dsvmrsurfnotify) {
-         dsvmrsurfnotify->Release();
-         dsvmrsurfnotify=NULL;
+    dsvmrsurfnotify->Release();
+    dsvmrsurfnotify=NULL;
   }
   if (dsvmrrenderer) {
-         dsvmrrenderer->Release();
-         dsvmrrenderer=NULL;
+    dsvmrrenderer->Release();
+    dsvmrrenderer=NULL;
   }
+
   if (allocatorvmr) {
-         allocatorvmr->Release();
-         allocatorvmr=NULL;
+    allocatorvmr->Release();
+    allocatorvmr=NULL;
   }
+
   if (dsrefclock) {
-         dsrefclock->Release();
-         dsrefclock=NULL;
+    dsrefclock->Release();
+    dsrefclock=NULL;
   }
   if (dsmediafilter) {
-         dsmediafilter->Release();
-         dsmediafilter=NULL;
+    dsmediafilter->Release();
+    dsmediafilter=NULL;
   }
 
   if (dsmediacontrol) {
@@ -522,18 +515,18 @@ UINT VideoWin::DeliverMediaSample(MediaPacket packet,
       ms->SetTime(&reftime1,&reftime2);
       //ms->SetTime(NULL,NULL);
       ms->SetMediaTime(NULL, NULL);
-         if (reftime1<0) ms->SetPreroll(TRUE);
-         else ms->SetPreroll(FALSE);
-         /*Timecode handling*/
-         lastreftimeRT=reftime1;
-         lastreftimeBYTE=packet.recording_byte_pos;
+    if (reftime1<0) ms->SetPreroll(TRUE);
+    else ms->SetPreroll(FALSE);
+    /*Timecode handling*/
+    lastreftimeRT=reftime1;
+    lastreftimeBYTE=packet.recording_byte_pos;
 
     }else {
       ms->SetSyncPoint(FALSE);
       ms->SetTime(NULL,NULL);
       ms->SetMediaTime(NULL, NULL);
-         ms->SetPreroll(FALSE);
-        
+    ms->SetPreroll(FALSE);
+
     //  ms->SetSyncPoint(TRUE);
     }
   }
@@ -620,8 +613,8 @@ long long VideoWin::SetStartOffset(long long curreftime, bool *rsync)
     startoffset=curreftime;//offset is set for audio
     offsetnotset=false;
     offsetvideonotset=false;
-       
-       
+
+
   } else {
     if (offsetvideonotset) {
       offsetvideonotset=false;
@@ -680,7 +673,7 @@ void VideoWin::ResetTimeOffsets() {
   lastreftimeBYTE=0;
   lastreftimeRT=0;
 
-  
+
 }
 
 
index 9897112910c994463ad4c797606689411c642435..5e01c3df5d5f266d55f1b4a75b483e870d1e5e7f 100644 (file)
@@ -48,10 +48,10 @@ class VideoWin : public Video
     int setFormat(UCHAR format);
     int setConnection(UCHAR connection);
     int setAspectRatio(UCHAR aspectRatio);   // This one does the pin 8 scart widescreen switching
-       UCHAR getAspectRatio(){return aspectRatio;};
-       UCHAR getMode(){return mode;};
-       UCHAR getPseudoTVsize() {return pseudotvsize;};
-       int setMode(UCHAR mode);
+  UCHAR getAspectRatio(){return aspectRatio;};
+  UCHAR getMode(){return mode;};
+  UCHAR getPseudoTVsize() {return pseudotvsize;};
+  int setMode(UCHAR mode);
     int setTVsize(UCHAR size);               // Is the TV a widescreen?
     int setDefaultAspect();
     int setSource();
@@ -69,8 +69,7 @@ class VideoWin : public Video
     int signalOff();
     int attachFrameBuffer(); // What does this do?
     ULONG timecodeToFrameNumber(ULLONG timecode);
-       ULLONG frameNumberToTimecode(ULONG framenumber);
-    int getFD();
+  ULLONG frameNumberToTimecode(ULONG framenumber);
     ULLONG getCurrentTimestamp();
 
     //Writing Data to Videodevice
@@ -84,15 +83,15 @@ class VideoWin : public Video
 
     virtual long long SetStartOffset(long long curreftime, bool *rsync);
     long long SetStartAudioOffset(long long curreftime, bool *rsync);
-       virtual void ResetTimeOffsets();
+  virtual void ResetTimeOffsets();
 
     void SetAudioState(bool state){audioon=state;};
 
     void turnVideoOn(){videoon=true;};
     void turnVideoOff(){videoon=false;};
 
-       unsigned int getPosx() {return videoposx;};
-       unsigned int getPosy() {return videoposy;};
+  unsigned int getPosx() {return videoposx;};
+  unsigned int getPosy() {return videoposy;};
 
 #ifdef DEV
     int test();