#ifndef n_nudpImageSink_H
#define n_nudpImageSink_H

/*
 *
 * nucleo/image/sink/nudpImageSink.H --
 *
 * Copyright (C) Nicolas Roussel
 *
 * See the file LICENSE for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 */

#include <nucleo/image/sink/ImageSink.H>
#include <nucleo/network/udp/UdpSender.H>

namespace nucleo {

  // ------------------------------------------------------------------

  class nudpImageSink : public ImageSink {

  private:

    Image::Encoding _encoding ;
    unsigned int _quality ;

    UdpSender *_udp ;
    bool _active ;

  public:

    nudpImageSink(const URL &url) ;

    nudpImageSink(const char *hostOrGroup, int port,
			   Image::Encoding encoding, unsigned int quality,
			   unsigned int ttl) ;

    ~nudpImageSink(void) ;

    bool start(void) ;
    bool stop(void) ;
    bool isActive(void) ;

    // warning: only the *data* part of the image is to be transmitted
    // (not the width, height and encoding information)
    bool handle(Image *img) ;
    
  } ;

  // ------------------------------------------------------------------

}

#endif
