In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "what is the Qt Haikang sdk callback method". In the daily operation, I believe many people have doubts about what the Qt Haikang sdk callback method is. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "what is the Qt Haikang sdk callback method?" Next, please follow the editor to study!
I. Preface
Haikang sdk display real-time video stream in addition to the support handle, but also supports callback to get each picture to draw their own processing, of course, the callback in addition to getting video data, in fact, audio data also got a piece of, self-call audio equipment to play on the line, about Haikang sdk callback, it really took a while to complete, may not have reference to the demo provided and did not thoroughly search it Just looking at the sdk documents tossing and turning, unexpectedly did not fix it for a week, and then found the right way to find that it was almost lost, which reminds me of a lot of things, including things in life, isn't it all the same? When you are fully riveted, try all kinds of methods, and are about to give up, in fact, you are one step away from success, and it is also true to deal with many things in your life, so very often if you are going in the right direction, if you have persisted in your efforts, and if you are not able to do so, you will probably ok with one more effort.
It was right to call NET_DVR_RealPlay_V40 to set up the callback function, and it was also right to call PlayM4_SetDecCallBackMend to set up the decoding callback function (this place was also messed up for a while, but I didn't expect to deal with it in the form of playing MP4). Finally, it was found that the problem lies in the decoded data, and the data is also obtained by default. If you need to convert to image, you need to do a conversion, this conversion on the Internet to find a bunch of functions to test, all failed, and then found a yv12 to rgb888 format, finally, I can go.
Haikang sdk callback process:
Call the NET_DVR_RealPlay_V40 set callback handler.
Open, play, and decode are processed in turn in the callback handler RealDataCallBack.
Call PlayM4_GetPort to get the channel number that is not used by the playhouse.
Call PlayM4_OpenStream to open the video stream.
Call PlayM4_SetDecCallBackMend to set the decoding callback function, which is only decoded but not displayed.
Call PlayM4_Play to play the video stream.
Call PlayM4_InputData to loop to decode the data.
The audio and video data are processed respectively in the decoding callback function DecCallBack.
Call the self-encapsulated yv12ToRGB888 function to convert the data into QImage.
Please note the following about the callback function:
The callback function must be related to the key word CALLBACK.
The callback function itself must be a global or static function and cannot be defined as a member function of a particular class.
The callback function is not directly called and executed by the developer, but only uses the system interface API function as the starting point.
The callback function is usually passed as an argument to the system API, which is called by that API.
The callback function may be called once by the system API or multiple times in a loop.
II. Functional features
Support for playback of video streams and local MP4 files.
Both handle and callback modes are supported.
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 haikangwidget control to play.
H364/h365 video streaming is supported.
Playback can be paused and resumed.
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.
Can set screen stretch fill or proportional fill.
Programmable decoding is speed priority, quality priority and balanced processing.
You can take screenshots (original pictures) and screenshots (video forms) of the video.
The video file is stored as a MP4 file.
Support focal length control, head control.
Customizable function.
Third, effect picture
4. Core code / / yv12 to RGB888static bool yv12ToRGB888 (const unsigned char * yv12, unsigned char * rgb888, int width, int height) {if ((width)
< 1) || (height < 1) || (yv12 == NULL) || (rgb888 == NULL)) { return false; } int len = width * height; unsigned char const *yData = yv12; unsigned char const *vData = &yData[len]; unsigned char const *uData = &vData[len >> 2]; int rgb [3]; int yIdx, uIdx, vIdx, idx; for (int I = 0; I
< height; ++i) { for (int j = 0; j < width; ++j) { yIdx = i * width + j; vIdx = (i / 2) * (width / 2) + (j / 2); uIdx = vIdx; rgb[0] = static_cast(yData[yIdx] + 1.370705 * (vData[uIdx] - 128)); rgb[1] = static_cast(yData[yIdx] - 0.698001 * (uData[uIdx] - 128) - 0.703125 * (vData[vIdx] - 128)); rgb[2] = static_cast(yData[yIdx] + 1.732446 * (uData[vIdx] - 128)); for (int k = 0; k < 3; ++k) { idx = (i * width + j) * 3 + k; if ((rgb[k] >= 0) & & (rgb [k] nType; / / Video data is T_YV12 audio data is T_AUDIO16 if (frameType = = T_YV12) {/ / qDebug () 0 & & nPort! =-1) {BOOL inData = PlayM4_InputData (nPort, pBuffer, dwBufSize); while (! inData) {sleep (10) InData = PlayM4_InputData (nPort, pBuffer, dwBufSize);}} break;}} at this point, the study on "what is the Qt Haikang sdk callback method" is over, hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.