#ifndef CLOCKED_VIDEO_INPUT_HPP_
#define CLOCKED_VIDEO_INPUT_HPP_

#include "Vipcore.hpp"

class Clocked_Video_Input : public Vipcore{
  public:
    
    static const int fifo_usedw_addressoffset = 2;
    static const int f0_sample_count_addressoffset = 3;
    static const int f0_line_count_addressoffset = 4;
    static const int f1_sample_count_addressoffset = 5;
    static const int f1_line_count_addressoffset = 6;
    
    Clocked_Video_Input(long base_address) : Vipcore(base_address)
    {}
    
    /* DIAGNOSTIC/STATUS METHODS */
    bool is_f0_sample_count_valid()
    {
        return (bool)(do_read(STATUS) & 4);
    }
    
    bool is_f0_line_count_valid()
    {
        return (bool)(do_read(STATUS) & 8);
    }
    
    bool is_f1_sample_count_valid()
    {
        return (bool)(do_read(STATUS) & 16);
    }
    
    bool is_f1_line_count_valid()
    {
        return (bool)(do_read(STATUS) & 32);
    }
    
    bool is_input_interlaced()
    {
        return (bool)(do_read(STATUS) & 64);
    }
    
    bool is_input_stable()
    {
        return (bool)(do_read(STATUS) & 128);
    }
    
    bool is_fifo_overflowed()
    {
        return (bool)(do_read(STATUS) & 256);
    }
    
    int get_input_fifo_usedw()
    {
        return do_read(fifo_usedw_addressoffset);
    }
    
    int get_f0_sample_count()
    {
        return do_read(f0_sample_count_addressoffset);
    }
    
    int get_f0_line_count()
    {
        return do_read(f0_line_count_addressoffset);
    }
    
    int get_f1_sample_count()
    {
        return do_read(f1_sample_count_addressoffset);
    }
    
    int get_f1_line_count()
    {
        return do_read(f1_line_count_addressoffset);
    }
    
    /* END DIAGNOSTIC/STATUS METHODS */
};

#endif /*CLOCKED_VIDEO_INPUT_HPP_*/
