📄 videomancontrol.h
字号:
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the VIDEOMAN_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// VIDEOMAN_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#ifdef VideoMan_EXPORTS
#define VIDEOMAN_API __declspec(dllexport)
#else
#define VIDEOMAN_API __declspec(dllimport)
#endif
#include <string>
#include <vector>
#include <list>
#include <assert.h>
#pragma once
#pragma warning(disable : 4251)// >> warning C4251: // >> needs to have dll-interface to be used by clients
#include "VideoManInputFormat.h"
class VideoManFactory;
class VideoManRenderer;
class VideoInput;
class VideoManInputController;
class VideoFileInput;
class CameraInput;
/** \brief the main class
*/
class VIDEOMAN_API VideoManControl
{
private:
VideoManControl(const VideoManControl &);
VideoManControl & operator=(const VideoManControl &);
public:
VideoManControl(void);
virtual ~VideoManControl(void);
//////////////RENDERER CONTROL
//! \name Renderer Control
//@{
/** \brief Activate all the video inputs. In the next render all the inputs will be shown
*/
void activateAllVideoInputs();
/** \brief Activate this video input. In the next render this input will be shown
\param input [in] the video input index
*/
void activateVideoInput( const size_t &input );
/** \brief Deactivate all the video inputs. In the next render anyone of the inputs will be shown
*/
void deactivateAllVideoInputs();
/** \brief Deactivate this video input. In the next render this input will not be shown
\param input [in] the video input index
*/
void deactivateVideoInput( const size_t &input );
/** \brief Check if this video input is activated or not
\param input [in] the video input index
*/
bool isActivated( const size_t &input );
/** \brief notify to the renderer the change of the screen
\param left [in] the x coordinate of the top left corner of the region where the renderer must draw
\param up [in] the y coordinate of the top left corner of the region where the renderer must draw
\param width [in] the width of the region where the renderer must draw
\param height [in] the height of the region where the renderer must draw
*/
void changeScreenSize( const int left, const int up, const int width, const int height );
void changeVisualizationMode( int vM );
void changeMainVisualizationInput( const size_t &input );
int getMainVisualizationInput();
void setVerticalFlip( const size_t &input, bool value );
bool getVerticalFlip( const size_t &input );
void setHorizontalFlip( const size_t &input, bool value );
bool getHorizontalFlip( const size_t &input );
/** \brief Render all the activated video inputs
*/
inline void renderFrames() const;
/** \brief Render this video input
\param input [in] the video input index
*/
inline void renderFrame( size_t input ) const;
/** \brief Update the texture to be rendered with the image
\param input [in] the video input index
\param image [in] the new image
*/
inline void updateTexture( size_t input, const char *image );
/** \brief Update the texture to be rendered with the last captured frame
\param input [in] the video input index
*/
inline void updateTexture( size_t input );
int screenToImageCoords( float &x, float &y );
bool imageToScreenCoords( const size_t &input, float &x, float &y );
bool getScreenCoords( const size_t &input, int &left, int &up, int &width, int &height );
/** \brief Get the coordinates of the input texture
\param input [in] the video input index
\param left,up,right,bottom [out] the texture coordinates
*/
void getTextureCoords( const size_t &input, float &left, float &bottom, float &right, float &up );
/** \brief Activate the renderer viewport of this video input
\param input [in] the video input index
*/
void activateViewport( const size_t &input );
/** \brief Activate the renderer texture of this video input
\param v [in] the video input index
*/
void activateTexture( const size_t &input );
//@}
//////////////CAMERA INPUT CONTROL
/** \brief Get the controller of this video input (only works with cameras)
With this controller you can directly work with the sdk of the camera
\param input [in] the video input index
\return the pointer to the controller
*/
VideoManInputController *getController( size_t input ) const;
/** \brief Show the property page of this video input (only works with cameras)
\param input [in] the video input index
*/
void showPropertyPage( size_t input) const;
//////////////GENERAL CONTROL
/** \brief Add a video input
\param identifier [in] The input Identification (see inputIdentification)
\param format [in/out] The preferred format of the video input, the resolution and fps will be taken from the video file
\return false if something fails
*/
int addVideoInput( inputIdentification &identifier, VideoManInputFormat *format );
/** \brief Delete the rquested video input
\param input [in] the video input index
*/
void deleteInput( size_t input );
/** \brief Get a new frame of this video input
\param input [in] the video input index
\param wait [in] if it must wait for next sample or not
\return the frame of the video
*/
inline char *getFrame( size_t input, bool wait=false );
void getFormat( size_t input, VideoManInputFormat &format );
void getAvailableDevices( std::vector<inputIdentification> &deviceList );
void getAvailableDevices( const std::string &identifier, std::vector<inputIdentification> &deviceList );
/** \brief Get the number of inputs
\return the number of initialized video inputs
*/
int getNumberOfInputs();
inline void releaseFrame( size_t input );
//////////////USER INPUT CONTROL
void setUserInputImage( size_t input, char* image );
//////////////VIDEO FILE INPUT CONTROL
/** \brief Go to this frame of this input (only for video files)
\param input [in] the video input index
\param frame [in] the frame position
*/
void goToFrame( size_t input, int frame );
/** \brief Go to this milisecond of this input (only for video files)
\param input [in] the video input index
\param milisecond [in] the position in miliseconds
*/
void goToMilisecond( size_t input, double milisecond );
double getLength( size_t input );
double getPosition( size_t input );
void pauseVideo( size_t input );
void playVideo( size_t input );
private:
std::vector < VideoInput * > videoList; //The list of video inputs
std::list<size_t> emptyIndexes; //The queue of the free inputs
VideoManRenderer *renderer; //The object that draws the image in the screen
VideoManFactory &factory; //The object that creates the video inputs
std::string path;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -