In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "what is the Qt vlc callback processing method". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
I. Preface
It is convenient to use a handle to display video, but there is a disadvantage that you can't get the data of every picture of a real-time video. This is quite annoying. Most applications in the surveillance industry, in addition to screenshots, probably need to get pictures to do some processing on their own, and if you get pictures to draw by yourself, this flexibility will be greatly enhanced, such as drawing all kinds of OSD tags and drawing whatever you want. If you want to draw there, you have to draw there. If you want to draw there, you have to make a label without a parent to automatically follow the movement. It is very annoying that there are several tags in one channel, and there are almost hundreds of tags in 32 channels. The efficiency is quite low, and the processing method looks silly. Every time you move this channel, you have to automatically calculate the location for the tag and move the past.
Therefore, callback is very necessary. One advantage is that the data of the image itself can be used for additional processing, such as artificial intelligence analysis, face analysis, and so on. Another advantage is that things such as OSD tags can be drawn freely, and the data format of the callback in vlc can be specified on its own. For example, the Format_RGB32,RGBA in RV32 corresponds to the Format_RGB32,RGBA in Qt and the Format_RGBA8888,YUYV in Qt can be displayed directly in QOpenGlWidget. It is still very good to display through GPU, greatly reducing the occupation of CPU.
II. Functional features
Multithreading plays video streams and local videos in real time.
Support windows+linux+mac, support vlc2 and vlc3.
Multi-thread display image, do not card the main interface.
Automatically reconnect the webcam.
The border size can be set, that is, the offset and the border color.
You can set whether to draw OSD tags, that is, label text or pictures and label locations.
There are two OSD locations and styles that can be set.
You can set whether to save to a file and the file name.
You can drag the file directly to the vlcwidget control to play.
Supports h365 video streams + rtmp and other common video streams.
Playback can be paused and resumed.
Callback mode and handle mode are supported.
Support thread reading progress and other information and event callback two processing modes.
Automatically signal whether the current playback position and volume are muted or not.
Provides the interface to set the playback position and volume and set mute.
Support for storing individual video files and storing video files at regular intervals.
Customize the top suspension bar and send click signal notification, which can be set whether it is enabled or not.
Third, effect picture
4. Core code if (callback) {callbackData = new CallbackData; callbackData- > thread = this; callbackData- > pixels = new uchar [bufferWidth * bufferHeight * 4]; memset (callbackData- > pixels, 0, bufferWidth * bufferHeight * 4); int width = callbackData- > thread- > getBufferWidth (); int height = callbackData- > thread- > getBufferHeight (); / / set callback to get each frame data libvlc_video_set_callbacks (vlcPlayer, lock, unlock, display, callbackData) / / set the format of RV32-Format_RGB32 RGBA-Format_RGBA8888 YUYV I420 libvlc_video_set_format (vlcPlayer, "RV32", width, height, width * 4);} / / # get a data callback typedef struct CallbackData {QMutex mutex; VlcThread * thread; uchar * pixels;} CallbackData;static void * lock (void * op, void * * plane) {CallbackData * callbackData = (CallbackData *) op; callbackData- > mutex.lock () * plane = callbackData- > pixels; return NULL;} static void unlock (void * op, void * pic, void * const * plane) {CallbackData * callbackData = (CallbackData *) op; uchar * data = (uchar *) * plane; int width = callbackData- > thread- > getBufferWidth (); int height = callbackData- > thread- > getBufferHeight (); QImage image (data, width, height, QImage::Format_RGB32); callbackData- > thread- > setImage (image); callbackData- > mutex.unlock () } static void display (void * op, void * pic) {(void) op;} / / # "what is the Qt vlc callback handling method"? thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.