/* Network-Integrated Multimedia Middleware (NMM)
 * http://www.motama.com/nmm.html
 *  
 * Copyright (C) 2006-2007
 * Motama GmbH, Saarbruecken, Germany
 * http://www.motama.com
 *  
 * This file is part of NMM. 
 * 
 * NMM 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; only version 2 of the License.      
 * 
 * NMM 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 NMM; if not, write to the Free Software Foundation,    
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */

#ifndef _NMM_VIDEOCROPNODE_HPP_
#define _NMM_VIDEOCROPNODE_HPP_ _NMM_VIDEOCROPNODE_HPP_

#include "nmm/nmm_prefix.hpp"

#include "nmm/multimedia/GenericProcessorNode.hpp"
#include "ICropImpl.hpp"

#include "visibility_VideoCropNode.hpp"

namespace NMM {
  class DLLEXPORT VideoCropNode :
    public GenericProcessorNode,
    public ICropImpl
  {  
  protected:
    virtual Message* processBuffer(Buffer* in_buffer);
    
    virtual Result doInit();
    virtual Result doInitOutput();

    // ICrop interface
    virtual void setCrop(const nmm_int32& xOffset, const nmm_int32& yOffset, const nmm_int32& xRange, const nmm_int32& yRange);
    
  public:
    VideoCropNode(const char *name = "VideoCropNode",
		  const StreamQueue::Mode queue_mode = StreamQueue::DEFAULT_MODE, 
		  const int queue_size = StreamQueue::DEFAULT_SIZE );
    ~VideoCropNode();
  private:
    int x_offset;
    int y_offset;
    int x_range;
    int y_range;
    int x_resolution;
    int y_resolution;

    bool send_format;
    int ratio_x;
    int ratio_y;
    string channelorder;
    string colorspace;
    string endian;
    string format;
    int bitperpixel;
    float framerate;

    Buffer* saved_buffer;
  }; 
}

#include "nmm/nmm_suffix.hpp"

#endif // _NMM_VIDEOCROPNODE_HPP_
