[Ekiga-list] [PATCH] Fix building pwlib HEAD VideoInputDevice class

Damien Sandras dsandras at seconix.com
Fri Apr 27 17:10:07 UTC 2007


Hi!

Le vendredi 27 avril 2007 à 18:44 +0200, Luc Saillard a écrit :
> Nearly all video plugins was break by this patch:
> http://openh323.cvs.sourceforge.net/openh323/pwlib/include/ptlib/videoio.h?r1=1.50&r2=1.51&pathrev=MAIN
> 
>   * Revision 1.24  2007/04/14 07:08:55  rjongbloed
>   * Major update of video subsystem:
>   *   Abstracted video frame info (width, height etc) into separate class.
>   *   Changed devices, converter and video file to use above.
>   *   Enhanced video file hint detection for frame rate and more
>   *     flexible formats.
>   *   Fixed issue if need to convert both colour format and size, had to do
>   *     colour format first or it didn't convert size.
>   *   Win32 video output device can be selected by "MSWIN" alone.
> 
> Only the v4l plugin was fixed, the fix can be found at:
> http://openh323.cvs.sourceforge.net/openh323/pwlib/plugins/vidinput_v4l/vidinput_v4l.h?r1=1.5&r2=1.6&pathrev=MAIN
> http://openh323.cvs.sourceforge.net/openh323/pwlib/plugins/vidinput_v4l/vidinput_v4l.cxx?r1=1.23&r2=1.24&pathrev=MAIN
> 
> I've made patch to fix the remaining driver in pwlib (V4L2, DC, AVC, BSD)
> 

can you attach it to the email please ?

(inline patch results in a broken apply).

Thank you,

> Luc
> 
> diff -r f44ab44b54b6 plugins/vidinput_avc/vidinput_avc.cxx
> --- a/plugins/vidinput_avc/vidinput_avc.cxx	Fri Apr 27 18:19:31 2007 +0200
> +++ b/plugins/vidinput_avc/vidinput_avc.cxx	Fri Apr 27 18:29:12 2007 +0200
> @@ -465,19 +465,7 @@ BOOL PVideoInputDevice_1394AVC::GetFrame
>  
>  BOOL PVideoInputDevice_1394AVC::GetFrameData(BYTE * buffer, PINDEX * bytesReturned)
>  {
> -  int capturing_duration = 10000; // FIXME: what is it for?
> -  // notice: funny things happen when it is set too low!
> -  
> -  if(frameRate>0) {
> -    if(msBetweenFrames > capturing_duration)
> -      PThread::Current()->Sleep(msBetweenFrames - capturing_duration);
> -    PTime start;
> -    if(!GetFrameDataNoDelay(buffer, bytesReturned))
> -      return FALSE;
> -    PTime end;
> -    capturing_duration = (int)((end-start).GetMilliSeconds());
> -    return TRUE;
> -  }
> +  m_pacing.Delay(1000/GetFrameRate());
>    return GetFrameDataNoDelay(buffer, bytesReturned);
>  }
>  
> diff -r f44ab44b54b6 plugins/vidinput_avc/vidinput_avc.h
> --- a/plugins/vidinput_avc/vidinput_avc.h	Fri Apr 27 18:19:31 2007 +0200
> +++ b/plugins/vidinput_avc/vidinput_avc.h	Fri Apr 27 18:29:57 2007 +0200
> @@ -96,6 +96,7 @@
>  #if !P_USE_INLINES
>  #include <ptlib/contain.inl>
>  #endif
> +#include <ptclib/delaychan.h>
>  
> 
>  /** This class defines a video input device that
> @@ -263,6 +264,7 @@ class PVideoInputDevice_1394AVC : public
>      dv_decoder_t * dv_decoder;
>      PINDEX frameBytes;
>      int port;
> +    PAdaptiveDelay m_pacing;
>  
>      BOOL SetupHandle();
>  };
> diff -r f44ab44b54b6 plugins/vidinput_bsd/vidinput_bsd.cxx
> --- a/plugins/vidinput_bsd/vidinput_bsd.cxx	Fri Apr 27 18:19:31 2007 +0200
> +++ b/plugins/vidinput_bsd/vidinput_bsd.cxx	Fri Apr 27 18:20:46 2007 +0200
> @@ -369,20 +369,7 @@ PINDEX PVideoInputDevice_BSDCAPTURE::Get
>  
>  BOOL PVideoInputDevice_BSDCAPTURE::GetFrameData(BYTE * buffer, PINDEX * bytesReturned)
>  {
> -  if(frameRate>0) {
> -    frameTimeError += msBetweenFrames;
> -
> -    do {
> -      if ( !GetFrameDataNoDelay(buffer, bytesReturned))
> -        return FALSE;
> -      PTime now;
> -      PTimeInterval delay = now - previousFrameTime;
> -      frameTimeError -= (int)delay.GetMilliSeconds();
> -      previousFrameTime = now;
> -    }  while(frameTimeError > 0) ;
> -
> -    return TRUE;
> -  }
> +  m_pacing.Delay(1000/GetFrameRate());
>    return GetFrameDataNoDelay(buffer,bytesReturned);
>  }
>  
> diff -r f44ab44b54b6 plugins/vidinput_bsd/vidinput_bsd.h
> --- a/plugins/vidinput_bsd/vidinput_bsd.h	Fri Apr 27 18:19:31 2007 +0200
> +++ b/plugins/vidinput_bsd/vidinput_bsd.h	Fri Apr 27 18:26:01 2007 +0200
> @@ -11,6 +11,7 @@
>  #include <ptlib.h>
>  #include <ptlib/videoio.h>
>  #include <ptlib/vconvert.h>
> +#include <ptclib/delaychan.h>
>  
>  #if defined(P_FREEBSD)
>  #include <sys/param.h>
> @@ -126,6 +127,7 @@ public:
>    BYTE * videoBuffer;
>    PINDEX frameBytes;
>    int    mmap_size;
> +  PAdaptiveDelay m_pacing;
>   
>  };
>  
> diff -r f44ab44b54b6 plugins/vidinput_dc/video4dc1394.cxx
> --- a/plugins/vidinput_dc/video4dc1394.cxx	Fri Apr 27 18:19:31 2007 +0200
> +++ b/plugins/vidinput_dc/video4dc1394.cxx	Fri Apr 27 18:24:56 2007 +0200
> @@ -257,7 +257,6 @@ static int num_captured;
>  
>  PVideoInputDevice_1394DC::PVideoInputDevice_1394DC()
>  {
> -  msBetweenFrames = 1000 / frameRate;
>    handle = NULL;
>    is_capturing = FALSE;
>    capturing_duration = 10000; // arbitrary large value suffices
> @@ -681,8 +680,6 @@ BOOL PVideoInputDevice_1394DC::SetFrameR
>    if (!PVideoDevice::SetFrameRate(rate))
>      return FALSE;
>  
> -  msBetweenFrames = 1000/rate;
> -
>    return TRUE;
>  }
>  
> @@ -742,16 +739,7 @@ BOOL PVideoInputDevice_1394DC::GetFrameD
>  
>  BOOL PVideoInputDevice_1394DC::GetFrameData(BYTE * buffer, PINDEX * bytesReturned)
>  {
> -  if (frameRate > 0) {
> -    if (msBetweenFrames > capturing_duration)
> -      PThread::Current()->Sleep(msBetweenFrames - capturing_duration);
> -    PTime start;
> -    if ( !GetFrameDataNoDelay(buffer, bytesReturned))
> -      return FALSE;
> -    PTime end;
> -    capturing_duration = (int)((end-start).GetMilliSeconds());
> -    return TRUE;
> -  }
> +  m_pacing.Delay(1000/GetFrameRate());
>    return GetFrameDataNoDelay(buffer,bytesReturned);
>  }
>  
> diff -r f44ab44b54b6 plugins/vidinput_dc/videoio1394dc.h
> --- a/plugins/vidinput_dc/videoio1394dc.h	Fri Apr 27 18:19:31 2007 +0200
> +++ b/plugins/vidinput_dc/videoio1394dc.h	Fri Apr 27 18:25:20 2007 +0200
> @@ -79,6 +79,7 @@
>  
>  #include <libraw1394/raw1394.h>
>  #include <libdc1394/dc1394_control.h>
> +#include <ptclib/delaychan.h>
>  
>  /** This class defines a video input device that
>      generates fictitous image data.
> @@ -246,7 +247,7 @@ class PVideoInputDevice_1394DC : public 
>      dc1394_cameracapture camera;
>      int capturing_duration;
>      int supportedFormat;
> -    int msBetweenFrames;
> +    PAdaptiveDelay m_pacing;
>  #define DC1394_FORMAT_160x120	1
>  #define DC1394_FORMAT_320x240	2
>  };
> diff -r f44ab44b54b6 plugins/vidinput_v4l2/vidinput_v4l2.cxx
> --- a/plugins/vidinput_v4l2/vidinput_v4l2.cxx	Fri Apr 27 18:19:31 2007 +0200
> +++ b/plugins/vidinput_v4l2/vidinput_v4l2.cxx	Fri Apr 27 18:22:36 2007 +0200
> @@ -729,21 +729,7 @@ BOOL PVideoInputDevice_V4L2::GetFrameDat
>  {
>    PTRACE(1,"PVidInDev\tGetFrameData()");
>  
> -  if (frameRate>0) {
> -    PTimeInterval delay;
> -
> -    do {
> -      if (!GetFrameDataNoDelay(buffer, bytesReturned))
> -        return FALSE;
> -
> -      delay = PTime() - previousFrameTime;
> -    } while (delay.GetMilliSeconds() < msBetweenFrames);
> -
> -    previousFrameTime = PTime();
> -
> -    return TRUE;
> -  }
> -
> +  m_pacing.Delay(1000/GetFrameRate());
>    return GetFrameDataNoDelay(buffer, bytesReturned);
>  }
>  
> diff -r f44ab44b54b6 plugins/vidinput_v4l2/vidinput_v4l2.h
> --- a/plugins/vidinput_v4l2/vidinput_v4l2.h	Fri Apr 27 18:19:31 2007 +0200
> +++ b/plugins/vidinput_v4l2/vidinput_v4l2.h	Fri Apr 27 18:25:26 2007 +0200
> @@ -75,6 +75,7 @@
>  #include <ptlib.h>
>  #include <ptlib/videoio.h>
>  #include <ptlib/vconvert.h>
> +#include <ptclib/delaychan.h>
>  
>  #ifdef SOLARIS
>  #include <sys/videodev2.h>
> @@ -172,6 +173,7 @@ public:
>    int    videoFd;
>    int    frameBytes;
>    BOOL   started;
> +  PAdaptiveDelay m_pacing;
>  };
>  
>  #endif
> _______________________________________________
> ekiga-list mailing list
> ekiga-list at gnome.org
> http://mail.gnome.org/mailman/listinfo/ekiga-list
-- 
 _     Damien Sandras
(o-      
//\    Ekiga Softphone : http://www.ekiga.org/
v_/_   NOVACOM         : http://www.novacom.be/
       FOSDEM          : http://www.fosdem.org/
       SIP Phone       : sip:dsandras at ekiga.net
                       




More information about the ekiga-list mailing list