#ifndef n_nudppImageSink_H
#define n_nudppImageSink_H

/*
 *
 * nucleo/image/sink/nudppImageSink.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 <netinet/in.h>

namespace nucleo {

  class nudppImageSink : public ImageSink {
  
  private:

    int _socket ;
    struct sockaddr_in _peer ;

    Image::Encoding _encoding ;
    unsigned int _quality ;

    bool _active ;

  public:

    struct FragmentInfo {
	 uint16_t inum, fnum ;
	 uint32_t encoding ;
	 uint16_t width, height ;
	 uint32_t totalsize ;
    } ;

    static unsigned int MaxFragmentSize ;

    nudppImageSink(const URL &url) ;
    ~nudppImageSink() ;

    bool start(void) ;
    bool isActive(void) { return _active ; }
    bool handle(Image *img) ;
    bool stop(void) ;
  
  } ;

}

#endif
