One, foreword
Preset functions, only to the ball with a preset a machine works, yuntai ball machine may not have a preset position, check carefully, don’t know can ask manufacturer or consult the manual, in this module, you can get a preset position, add preset, calls to a preset position, deleting preset, invoke the start bit, set the start bit, cruise, stop, cruise, etc.
After the preset bit is obtained, the preset bit set (usually 255 or more) will be displayed in the list. The prefix is token, followed by the alias name of the preset bit. The alias can be Chinese, and the Chinese name can be set when the preset bit is added. Before adding, calling, or deleting a preset bit, select a preset bit from the list of preset bits.
Automatic cruise strategy is applied at present through the back door of check the query of the preset information, check, and call a timer every once in a while a corresponding preset to implementation, will be in the list which is executing preset bit at a time, automatically select the preset late if have better processing method will automatically update to improve the code.
Two, functional characteristics
(1) Software module
- Video monitoring module, various docking small window sub-module, including device list, graphic warning, window information, panyt control, preset position, cruise setting, device control, floating map, web browsing, etc.
- Video playback module, including local playback, remote playback, device playback, picture playback, video upload, etc.
- Electronic map module, including picture map, online map, offline map, path planning, etc.
- Log query module, including local logs, device logs, etc.
- System setting module, including system Settings (basic Settings, video parameters, database Settings, map configuration, serial port configuration, etc.), VIDEO recorder management, camera management, polling configuration, user management, etc.
(2) Basic functions
- Support various video streams (RTSP, RTMP, HTTP, etc.), video files (MP4, RMVB, AVI, etc.), local USB camera playback.
- Support multi-screen switching, including 1, 4, 6, 8, 9, 13, 16, 25, 36, 64 screen switching.
- Supports full-screen switching, including the right mouse button, toolbar button, and shortcut keys (Alt + Enter full-screen, esc exit full-screen).
- Supports video polling, including 1, 4, 9, and 16 screen polling. You can set polling group (polling plan), polling interval, and bit stream type.
- Supports the OnVIF protocol, including device search, pte control, device control (picture parameters, check time, system restart, capture pictures, etc.).
- Different users can have different module permissions, such as deleting logs and shutting down the system.
- Support a variety of databases, including sqlite, mysql, sqlserver, postgresql, oracle, rendajincang and so on.
- You can set resolution and frame rate for a local USB camera.
- All docking modules automatically generate corresponding menus to control the display and hide, in the title bar right click can pop up.
- Display all modules, hide all modules, reset the common layout, and reset the full-screen layout.
- Double-click the device to pop up real-time preview video, supporting picture map, online map, offline map, etc.
- The camera node can be dragged to the corresponding window to play the video, and the local file can be dragged to play the video.
- You can delete a video by right-clicking the mouse button, closing the floating bar, or dragging it outside the video surveillance panel.
- The device button on the picture map can be dragged freely to automatically save the location information. You can click the mouse to obtain the longitude and latitude information on the Baidu map to update the location of the device.
- Any channel in the video surveillance panel form supports drag exchange, instant response.
- Encapsulated Baidu map, view switch, movement track, equipment point, mouse click to obtain latitude and longitude.
- Double-click the node, drag the node, drag the window to switch positions and other operations, will automatically update and save the last playing address, the next software open automatic application.
- Volume bar control in the lower right corner, automatically hide when losing focus, volume strip mute icon.
- You can specify a screenshot for a single channel or all channels. The screenshot button is also available on the bottom toolbar.
- The mouse pointer can be automatically hidden when timeout expires and the mouse pointer can be automatically displayed in full screen.
- Support onVIF PTZ control, can move PTZ camera up, down, left and right, including reset and focal length adjustment.
- Support any ONVIF camera, including but not limited to Hikang, Dahua, Yushi, Weiye, Huawei, etc.
- Can save video, can select the time storage or single file storage, optional storage interval time.
- Video stream communication mode can be set TCP + UDP, video decoding can be set speed first, quality first, balance, etc.
- You can set the software name, English name, and LOGO icon.
- You can export stored video files to specific directories or upload them to servers in batches.
(3) Features and functions
- The main interface adopts the mode of docked form, various components in the form of small modules, can be customized to join any module.
- Docking module can drag any position embedded and suspended, support maximum full screen, support multi-screen.
- Dual layout file storage mechanism, normal mode and full-screen mode are corresponding to different layout schemes, automatic switching and saving, for example, full-screen mode can highlight several modules transparent display in the specified position, more science fiction sense of modernization.
- Original onVIF protocol mechanism, using the underlying protocol resolution (UDP broadcast search + HTTP request execution command) more lightweight easy to understand learning expansion, does not rely on any third-party components such as GSOAP.
- Original data import and export mechanism, cross-platform independent of any components, instant data export.
- Built in multiple original components, the universe super value super awesome, Including data import and export components (export to XLS, PDF, printing), database components (database management thread, automatic data cleaning thread, universal paging, data request, etc.), map component, video monitoring component, file multithreading transceiver component, onVIF communication component, universal browser kernel component, etc.
- Customize information box + error box + query box + lower right prompt box (including various formats).
- Exquisite skin change, up to 17 sets of skin styles can be changed at will, all styles are unified, including menu, etc.
- Multiple buttons can be added to the video control hover bar, and buttons can also be added to the small toolbar at the bottom of the monitoring interface.
- Double click the camera node to automatically play the video, double click the node to automatically add the video, it will automatically jump to the next, double click the parent node to automatically add all the videos under the node. Primary stream and sub-stream are optional.
- You can add, delete, and modify the import and export printed information, and immediately apply the new device information to generate a tree list without restarting.
- Optional a variety of kernel free switch, FFMPEG, VLC, MPV, etc., can be set in pro. Ffmpeg is recommended. It is most cross-platform and provides libraries compiled on Linux and MAC platforms by default.
- Supports hard decoding and can be set to hard decoding type (QSV, DXVA2, d3D11VA, etc.).
- The default opengL rendering video, ultra-low CPU resource consumption, support YUYV and NV12 two formats to draw, very awesome.
- Highly customizable, users can easily derive their own functions on this basis, such as adding custom modules, adding operation mode, robot monitoring, uav monitoring, excavator monitoring, etc.
- Support XP, Win7, Win10, Linux, MAC, a variety of domestic systems (UOS, kyrin, Galaxy Kyrin, etc.), embedded Linux and other systems.
- Complete annotation, clear project structure, super detailed complete use of the development manual, accurate to the function description of each code file, continuous iteration version.
3. Experience address
- Experience address: pan.baidu.com/s/1d7TH_GEY… Extraction code: 01Jf File name: bin_video_system.zip
- Domestic site: gitee.com/feiyangqing…
- International site: github.com/feiyangqing…
- Profile: blog.csdn.net/feiyangqing…
- Zhihu homepage: www.zhihu.com/people/feiy…
- Online documentation: feiyangqingyun. Gitee. IO/qwidgetdemo…
Four, effect drawing
Five, core code
#include "frmipcpreset.h"
#include "ui_frmipcpreset.h"
#include "quihelper.h"
#include "deviceonvif.h"
frmIpcPreset::frmIpcPreset(QWidget *parent) : QWidget(parent), ui(new Ui::frmIpcPreset)
{
ui->setupUi(this);
this->initForm(a); } frmIpcPreset::~frmIpcPreset()
{
delete ui;
}
void frmIpcPreset::initForm(a)
{
// Timer simulates automatic cruise
presetIndex = 0;
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this.SLOT(navigate()));
timer->setInterval(3000);
}
void frmIpcPreset::on_btnGetPresets_clicked(a)
{
ui->listWidget->clear(a); QList<OnvifPresetInfo> presets = DeviceOnvif::getPresets(AppData::CurrentUrl);
foreach (OnvifPresetInfo preset, presets) {
QListWidgetItem *item = new QListWidgetItem;
QString text = QString("[% 1] % 2").arg(preset.token.toInt(), 3.10.QChar('0')).arg(preset.name);
item->setText(text);
item->setData(Qt::UserRole, QString(preset.token));
item->setCheckState(Qt::Unchecked);
ui->listWidget->addItem(item); }}void frmIpcPreset::on_btnGotoPreset_clicked(a)
{
int index = ui->listWidget->currentRow(a);if (index >= 0) {
QString presetToken = ui->listWidget->item(index)->data(Qt::UserRole).toString(a); DeviceOnvif::ptzPreset(0, AppData::CurrentUrl, presetToken); }}void frmIpcPreset::on_btnSetPreset_clicked(a)
{
int index = ui->listWidget->currentRow(a);if (index >= 0) {
QString presetToken = ui->listWidget->item(index)->data(Qt::UserRole).toString(a); QString presetName = ui->txtPresetName->text(a); DeviceOnvif::ptzPreset(1, AppData::CurrentUrl, presetToken, presetName); }}void frmIpcPreset::on_btnRemovePreset_clicked(a)
{
int index = ui->listWidget->currentRow(a);if (index >= 0) {
QString presetToken = ui->listWidget->item(index)->data(Qt::UserRole).toString(a); DeviceOnvif::ptzPreset(2, AppData::CurrentUrl, presetToken); }}void frmIpcPreset::on_btnGotoHomePosition_clicked(a)
{
DeviceOnvif::ptzPreset(3, AppData::CurrentUrl);
}
void frmIpcPreset::on_btnSetHomePosition_clicked(a)
{
DeviceOnvif::ptzPreset(4, AppData::CurrentUrl);
}
void frmIpcPreset::navigate(a)
{
// Stop if you reach the end
if (presetIndex == presetTokens.count()) {
on_btnStopNavigate_clicked(a);return;
}
// Perform call presets
QString presetToken = presetTokens.at(presetIndex);
DeviceOnvif::ptzPreset(0, AppData::CurrentUrl, presetToken);
// Select the preset bit currently executed in the corresponding list box
ui->listWidget->setCurrentRow(presetRows.at(presetIndex));
presetIndex++;
}
void frmIpcPreset::on_btnStartNavigate_clicked(a)
{
presetIndex = 0;
presetRows.clear(a); presetTokens.clear(a);// First fetch the selected preset bit
int count = ui->listWidget->count(a);for (int i = 0; i < count; ++i) {
QListWidgetItem *item = ui->listWidget->item(i);
if (item->checkState() == Qt::Checked) {
presetRows << i;
presetTokens << item->data(Qt::UserRole).toString();
}
}
if (presetTokens.count(a) >0) {
timer->start(a);navigate();
}
}
void frmIpcPreset::on_btnStopNavigate_clicked(a)
{
// Stop the timer and then stop the head
timer->stop(a); DeviceOnvif::ptzControl(0, AppData::CurrentUrl, 0.0.0);
}
void frmIpcPreset::on_listWidget_itemPressed(QListWidgetItem *item)
{
bool checked = (item->checkState() == Qt::Checked);
item->setCheckState(checked ? Qt::Unchecked : Qt::Checked);
}
Copy the code