Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
VideoSource_Net.hh
1 #ifndef __BIASVIDEOSOURCE_NET_HH__
2 #define __BIASVIDEOSOURCE_NET_HH__
3 
4 #include <bias_config.h>
5 #include <Base/Common/BIASpragmaStart.hh>
6 
7 #include <iostream>
8 #include <sstream>
9 #include <VideoSource/VideoSource_Base.hh>
10 
11 #include <NetworkComm/CScommClient.hh>
12 
13 
14 
15 #ifdef BIAS_HAVE_LIBJPEG
16 # include <Base/Image/CompressJpeg.hh>
17 #endif //BIAS_HAVE_LIBJPEG
18 
19 namespace BIAS
20 {
21  /**
22  \class VideoSource_Net
23  \ingroup g_videosource
24  \ingroup g_videotransmission
25  \ingroup network
26  \brief This class implements a video streaming client using TCP.
27  Use VideoServer to feed this beast.
28  \author grest, Nov. 2005
29  */
30  class BIASVideoSource_EXPORT VideoSource_Net : public VideoSource {
31 
32  public:
33  /** Standard Constructor
34  use threaded param for dis-/enabling threaded receiving!
35  If threaded receiving is disabled, keepAll-param will
36  be enabled for client_!
37  (you'll get every image that was sent)
38  */
39  VideoSource_Net(bool threaded = true);
40 
41  virtual ~VideoSource_Net() { delete pImgBuffer_; }
42 
43 
44  /** use given port and ip address to connect to videoserver*/
45  virtual int OpenDevice(const char* serverName);
46 
47  /** use given port and ip address to connect to videoserver*/
48  virtual int OpenDevice(const std::string &serverName,
49  int port=D_CS_DEFAULT_PORT);
50 
51  /** for UDP commm, listen on this port for data */
52  virtual int OpenDevice(int port=D_CS_DEFAULT_PORT);
53 
54  int PreGrab();
55  virtual int GrabSingle(BIAS::Camera <unsigned char> &image);
56  virtual int GrabSingle(BIAS::ImageBase &image);
57  int PostGrab();
58 
59  int CloseDevice();
60 
61  protected:
62  std::stringstream *pImgBuffer_; // pointer needed to free mem
63  int count_;
64  bool UseTCP_;
65 
66  int port_;
68 
69 
70 #ifdef BIAS_HAVE_LIBJPEG
73 #endif //BIAS_HAVE_LIBJPEG
74  };
75 
76 
77 } // namespace BIAS
78 
79 
80 #include <Base/Common/BIASpragmaEnd.hh>
81 
82 #endif
83 
Wrapper for fast libjpeg methods.
Definition: CompressJpeg.hh:50
Defines a common interface to different devices.
BIAS::Image< unsigned char > jpegImg_
class for sending/receiving data between clients and servers
Definition: CScommClient.hh:54
std::stringstream * pImgBuffer_
This class implements a video streaming client using TCP.
This is the base class for images in BIAS.
Definition: ImageBase.hh:102