📜 ⬆️ ⬇️

VLC based video player. Part 1

Entry, or how it all began ...


When I came to get a job, they showed me a layout of what I would have to do. It was a video player with a pretty nice interface. It was supposed that my player would use the VLC player (or rather its LibVLC library) as a video engine. The fact is that the player that everyone is used to seeing on their desktop is VLC, in fact, only an interface for the LibVLC library, which allows you to download and decode video files from a local disk, a multicast stream.

The language of development was determined immediately - C ++. As for the development environment, I, like the authorities, had their own proposals (Visual Studio IDE) - in the end, they agreed on Qt IDE, since The SDK has many classes that allow you to speed up the development of an application with a user interface.

The essence of the problem


It was necessary to draw a translucent interface on top of the video image. Hmm ... I thought, and thought hard. The task was quite interesting. After consulting with Google, I found several options:

Solution 1

Since the player itself consists of many plug-ins, made by both developers and amateurs of ill-wishers , the idea was to make your own plugin by type overlay. However, having studied the sources of such plug-ins, I came to the conclusion that it would be problematic to embed a similar system with animation and tracking of mouse clicks, keys and other things.
')
Solution 2

The solution was to keep a transculent interface window on top of the video stream. The second window, of course, must be synchronized with the coordinates and state of the first window. But it was good only in theory and unfortunately it remained so - I could not realize it, because I did not understand how to link the absolutely transparent window with the translucent elements. And therefore ...

Solution 3

Very often on the Internet, when describing from VLC-based engines, I stumbled upon the description of the VMem plugin. So I decided that this was my last exit - and I was right.

Eureka! Or VMem enters the scene ...


So, VMem module, why is it so good, what functions does it perform?
The module is designed to display images in the memory instead of direct display on the screen. Moreover, the memory must be created by the calling application. And most importantly, a picture in memory will be formed only after all filters and plugins are applied to it, for processing video images (for example, an interlacing filter, displaying subtitles, etc.).

LibVLC API


A few words about the API: although the library is written in PureC, there are ports to other languages ​​(Python, Java, .NET, Pascal, Objective C) there are even wrappers for C ++, Qt ... in general, unless BrainFuck is not included in the above list. The official website has a couple of lessons on how to assemble a video player based on LibVLC on your knee.

Conclusion


That ended the first part of the article. In it, I described the main difficulties that I had to face when I first started developing the player. In the next part of the article I would like to talk about how to organize the output of the image on the screen and which graphic API (GAPI) is better to use for this.

List for reading and visiting:

  1. Official site of developers
  2. Doc on API
  3. Developer Forum

Source: https://habr.com/ru/post/111200/


All Articles