Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Qt vlc event subscription

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to use Qt vlc event subscription". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to use Qt vlc event subscription.

I. Preface

Event subscription can get information such as file length, playback progress, playback state change and so on. Vlc's event subscription mechanism is relatively friendly. You only need to create an event manager first, and then subscribe to the events you are interested in one by one. If you are not interested, you can not subscribe. Only subscribed events can be obtained in the event callback, so if you find that some events have not been obtained in the event callback First of all, to check whether you have subscribed or not, the enumeration of all events can be found in the libvlc_ events.h header file, which is described in easy-to-understand all-English words that developers with basic English skills can understand.

When the libvlc_event_attach subscription event is called, the third parameter specifies the event callback function, and the fourth parameter is passed in the user data, which is generally used to pass in the class pointer, so that when the event is called back, it can be directly obtained and converted into the class pointer, and then using the methods in the class, it is found that the signal in the Qt5 is public in the process of compatibility with Qt4-Qt5, so you can send the signal directly in the callback function emit. The signal in Qt4 is protected, so it is impossible to emit directly, so we need to do a general transfer function to redistribute the signal, control the type through the parameter type, and pass in the parameter set by QVariantList.

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. The core code / / event callback static void handleEvents (const libvlc_event_t * event, void * userData) {VlcThread * thread = (VlcThread *) userData; switch (event- > type) {case libvlc_MediaPlayerLengthChanged: {quint64 length = event- > u.media playercallback changes. New callback; if (length > 0) {thread- > doEvent (1, QVariantList ())

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report