#ifndef __USE_Video_H__
#define __USE_Video_H__
#include "com_video.h"
#include "api/mlocalrecord.h"

class Use_Video :public Com_Video
{
public:
	Q_OBJECT
public:
	 Use_Video(QWidget *parent = 0);
	~Use_Video();
public:
	void onAttach(rtc::IRoom* room);
	void onDetach();
protected:
	void updateLocalCameras();
	void updateRemotePublishedCameras();
	void fillResolutions();

protected: // c or cpp api imp
	bool   isAttach() const { return NULL != module_; }
	bool   api_engineSetOption(rtc::EngineOption option, void* value);
    bool   api_isSelfDevice(const rtc::DeviceId& dId) const;
    Result api_attachRender(const rtc::DeviceId& dId, IVideoView* view);
    Result api_detachRender(const rtc::DeviceId& dId);
    Result api_detachRender_1(IVideoView* render);
    Result api_subscribe(const rtc::DeviceId& dId);
    Result api_unsubscribe(const rtc::DeviceId& dId);
    Result api_muteLocalCamera(const rtc::DeviceId& dId);
    Result api_unmuteLocalCamera(const rtc::DeviceId& dId);
    Result api_publishLocalCamera( rtc::Camera& cam);
	Result api_unpublishLocalCamera();
    Result api_previewLocalCamera(const rtc::DeviceId& dId);
	Result api_unpreviewLocalCamera();
    Result api_setVideoBitrate(const rtc::DeviceId& dId, int min, int max);
	const rtc::MediaStats& getMediaStats();
    rtc::Camera api_getCamera(const rtc::DeviceId& dId);
	virtual void   api_switchIndexvideo(int index);
    virtual Result api_changeCapability(const rtc::DeviceId& dId, const rtc::CameraCapability& cap);
private:
	rtc::IMVideo* module_;
	rtc::IMixRecorder* record_;
	float vlayout_x_;
};

#endif //__USE_Video_H__
