I. Introduction
VLCThe full name is video LAN client, which is an open-source, cross-platform video player. VLC supports a large number of audio and video transmission, encapsulation, and encoding formats. For a complete list of features, see http://www.videolan.org/vlc/features.html. The following provides a concise example:
Operating Systems: Windows, WinCE, Linux, MacOSX, BEOs, and BSD
Access format: file, DVD/VCD/CD, HTTP, FTP, MMS, TCP, UDP, RTP, IP multicast, IPv6, RTSP
Encoding formats: MPEG *, DivX, WMV, mov, 3GP, FLV, H.263, H.264, and FLAC
Video Subtitles: DVD, DVB, text, vobsub
Video output: DirectX, X11, xvideo, SDL, framebuffer, and ASCII
Control Interface: wxWidgets, qt4, web, telnet, command line
Browser plug-ins: ActiveX and Mozilla (Firefox)
In fact, to be clearer, we can also tell which common VLC does not support. The first is realvideo (Real's audio is partially supported), because the real video captor has copyright issues. In fact, VLC 0.9.0 already supports realvideo, but requires an additional Decoder (similar to mplayer ). In addition, VLC does not support 3GP audio format Amr.
VLC was originally a project by a few French college students. Later, they made VLC an open-source project, attracting many excellent programmers from all over the world to write and maintain VLC together, it gradually becomes the current way.
Why is it VideoLAN client? Because there was still a VideoLAN server project (VLS for short) in the past. Currently, the VLS function has been integrated into VLC, so VLC is not just a video player, it can also be used as a small video server. It can also play and transcode while sending video streams to the network. The most prominent feature of VLC is the playing function of network streams. For example, playback and forwarding of MPEG2 UDP ts streams are almost irreplaceable.
For common users, another benefit of VLC is that it does not affect the decoder in windows. VLC generally does not affect or depend on the built-in Decoder (except for the realvideo and QuickTime types) in the system. It is very green and environmentally friendly, and does not need to worry about spoligans such as software and AD plug-ins.
From the perspective of program structure, VLC has excellent scalability. Most VLC is written with efficient C code (a small number of C ++ and assembly), but it implements completely dynamic modularization. All functions, including the program framework itself, are modules, it can be loaded at runtime, which makes VLC easy to expand and maintain. Its architecture is similar to DirectShow technology.
VLC also focuses on copyright issues. You can use it freely without worrying about copyright issues-VLC only includes free and free libraries. VLC is based on GPL, so it can also be used in commercial applications. You only need to retain GPL and open source code, if you have modified VLC.
The following are links related to VLC:
Official website of VLC: http://www.videolan.org/
VLC download page: http://www.videolan.org/vlc/
VLC download directory (source code and installation package): http://download.videolan.org/pub/videolan/vlc/
VLC nightly builds: http://nightlies.videolan.org/
VLCDevelopmentWiki: http://wiki.videolan.org/Developers_Corner
VLC Win32 third-party library pre-compiled package download Directory: http://download.videolan.org/pub/testing/win32/
VLC official forum: http://forum.videolan.org/
VLC email list: http://www.videolan.org/developers/lists.html
Ii. Windows platform Compilation
Step 1: Create an environment for compiling VLC. In Windows, VLC can be compiled using msys + mingw or cygwin. The two are similar. Here we mainly introduce cygwin.
Cygwin is something that simulates the Linux environment under windows. It provides many libraries and applications so that you can use Windows like on Linux. You need to download a cygwininstaller, setup.exe, In the http://www.cygwin.com. Then select a cygwin source to download the required library, domestic words to ftp://ftp.sjtu.edu.cn/cygwin/and http://www.cygwin.cn/pub will be relatively faster. For the first installation, in addition to the default library, we also need to add some libraries to support VLC compilation, including
Archive (directory)
Unzip
Zip
Devel
Autoconf
Automake
Binutils
CVS
Expat
Gcc
Gcc-core
Gcc-G ++
Gcc-mingw
Gcc-mingw-core
Gcc-mingw-G ++
GDB (if you need debugging)
Gettext
Gettext-devel
Git (not required)
Libiconv
Libtool
Make
Mingw-runtime
NASM
Patchutils
PKG-config
Subversion
Editor
Vim (with its convenience)
Libs
Libgcrypt
The Web // can be ignored. If you do not want to compile a third-party library
Curl (Optional: for building extras/contrib)
Wget (Optional: for building extras/contrib)
Then download the source code of the desired version of VLC. For the release version, you can download: Release. Now VLC is switched to git, and the command: git clone git: // git.videolan.org/vlc.git
VLC also requires a lot of third-party libraries. You can obtain the source code for compilation. For details, refer to the VLC Compilation Article on Linux. On Windows, VLC makes a compiled Win32 third-party library package, which can be downloaded from the http://download.videolan.org/pub/testing/win32. Package needs to be decompressed to the root directory '/', in fact these libraries are located in '/usr/win32-branch.
In cygwin, enter the main directory of VLC and run Bootstrap, './Bootstrap '. Before it ends, let's take a look at how to configure VLC compilation. Run './configure-h> pai_opt.txt' to output the configuration options to pai_opt.txt. Most of the information is about enabling, disabling some features and functional modules, or configuring the library paths required by some modules. To facilitate writing a simple script to do this, of course, this is not necessary.
Path =/usr/win32-branch/bin: $ path \
Pkg_config_path =/usr/win32-branch/lib/pkgconfig \
Cppflags = "-I/usr/win32-branch/include-I/usr/win32-branch/include/ebml "\
Ldflags =-L/usr/win32-branch/Lib \
Cc = "gcc-MnO-cygwin" cxx = "g ++-MnO-cygwin "\
./Configure \
-Host = i686-pc-mingw32 \
-Disable-GTK \
-Enable-NLS-enable-SDL-with-SDL-config-Path =/usr/win32-branch/bin \
-Enable-FFMPEG-with-ffmpeg-mp3lame-with-FFMPEG-faac \
-With-FFMPEG-zlib-enable-faad-enable-FLAC-enable-theora \
-With-WX-config-Path =/usr/win32-branch/bin \
-With-FreeType-config-Path =/usr/win32-branch/bin \
-With-fribidi-config-Path =/usr/win32-branch/bin \
Enable-live555 -With-live555-tree =/usr/win32-branch/live.com \
-Enable-caca-with-caca-config-Path =/usr/win32-branch/bin \
-With-xml2-config-path =/usr/win32-branch/bin \
-With-dvdna V-config-Path =/usr/win32-branch/bin \
-Disable-cddax-Disable-vcdx-enable-goom \
-Enable-twolame-enable-dvdread \
-Enable-release-enable-DCA \
-Enable-MKV \
-Enable-QuickTime-enable-Mozilla \
-With-mozilla-SDK-Path =/usr/win32-branch/gecko-SDK \
-Enable-mostly-builtin \
& Make
For example, save this file as 'mybuilt'. After bootstrp is run, we only need to run mybuild to start configuration and compilation. This usually takes a long time. If you are lucky, make runs successfully after a long wait,VLCIt will be compiled. The vlc.exe on the right side of the Direct Double Master Directory should be ready to run.
For convenience, You can package it, the simplest is 'make package-win32-base ', it will create a sub directory to store all the things required for running, this directory is a green version of VLC.
Of course, if you are not so lucky, you may encounter various errors, such as errors in boottrap or configure, usually because a library or library version is not installed properly; you may also encounter a compilation error and try to google it.
This article references http://wiki.videolan.org/Win32CompileCygwinNew
Iii. compiling on Linux
Download the source code first, decompress the source code, and run Bootstrap first to see if there are any available tools, such as GCC, make, libtool, automake, and AutoConfig. If not, upgrade or install it as you like.
The following is the most troublesome step. VLC does not provide pre-compiled packages for third-party libraries similar to those on windows in Linux. You must obtain and compile these libraries on your own. The number of these databases depends on your configuration options. VLC provides an automated solution. Let's take a look at the main directory \ extras \ contrib. There are some tools in it to help you automatically download, patch, and compile all third-party libraries that may be used. Run the Bootstrap in that directory first ***. mak can be found in the VLC code library. It is a system-related file, and then a simple make statement is enough. If you are familiar with these libraries, you 'd better manually filter them first. Some may not be what you need, but it may take a long time to download them.
After a long wait, if everything goes well (I almost don't believe it), this step will be done. Possible problems: Download is too slow. You can use other download tools to package the library code and put it in \ extras \ contrib \ SRC. If half of the download is interrupted, you can delete the incomplete file and run make again.
This step is almost the same as compiling on Windows. Write a configuration script and run it. For example, a configuration script:
./Configure \
-Enable-release \
Disable-skins2 \
-Disable-wxWidgets \
-Enable-Mozilla \
-With-mozilla-SDK-Path =./gecko-SDK \
-Disable-sout \
-Disable-HTTPd \
Enable-live555 \
-Disable-dvdna V \
-Disable-libcdio \
-Disable-libcddb \
-Disable-cdda \
-Disable-VCD \
-Disable-dvdread \
-Disable-SMB \
-Disable-cmml \
-Disable-ALSA \
-Disable-OpenGL \
-Disable-PNG \
-Disable-screen \
-Disable-MKV \
-Disable-mod \
-Disable-MPC \
-Disable-libtar \
-Disable-speex \
-Disable-Visual \
-Disable-DAAP \
-Disable-Bonjour \
-Disable-gnutls \
-Enable-faad \
-Enable-mostly-builtin
Run make after configuration.
Reference: http://wiki.videolan.org/UnixCompile
Iv. Use
VLCIt is not only a video player, but also a small video server. It can also play and transcode while sending video streams to the network.
The simplest way is to open a file and play it back from the interface. You can also use it on the command line, such as c: \ Program Files \ VideoLAN \ VLC> vlc.exe test. Ts.
The help for obtaining the internal settings will be written to vlc-help.txt: C: \ Program Files \ VideoLAN \ VLC> vlc.exe-H
For more information, see c: \ Program Files \ VideoLAN \ VLC> vlc.exe-H.
Online Help
Http://www.videolan.org/doc/play-howto/en/play-howto-en.html
Http://www.videolan.org/doc/streaming-howto/en/streaming-howto-en.html
Search for and display the list of available modules: C: \ Program Files \ VideoLAN \ VLC> vlc.exe-l
In Windows, by default, the configuration file of VLC is % appdata % \ VLC \ vlcrc, and % appdata % is usually c: \ Documents ents and Settings \ User Name \ Application Data under XP.
In Linux
VLC options can be set by modifying vlcrc. The interface is just a little more convenient.
Reset all options to the default status: C: \ Program Files \ VideoLAN \ VLC> vlc.exe-reset-config
VLC recursively searches for plugin from the Plugin-path specified in vlcrc and the modules and plugins directories in the current directory. Most VLC functions are implemented through plugin. VLC has a large number of dynamic plug-ins by default. To speed up startup, VLC caches the plugin list in % appdata % \ VLC \ cache. The plugins-Cache option is set to 0 to disable caching plugin.
Open a UDP multicast stream. For multicast group 239.20.1.1, port 4567, default port 1234. For RTP protocol, VLC will automatically identify it. It is okay to write UDP or RTP.
C: \ Program Files \ VideoLAN \ VLC> vlc.exe UDP: // @ 239.20.1.1: 4567
When receiving a stream on the local UDP port 888, "@" indicates binding an address instead of connecting to the address.
C: \ Program Files \ VideoLAN \ VLC> vlc.exe UDP: // @ 888
Streaming output means that when playing a video, you can transfer the video to the outside in some way. It is easier to set it in streaming/save on the open interface.
For example, test. Ts is cyclically played and transmitted to port 1234 on port 224.1.1.1 in RTP mode. The video is displayed at the same time.
Vlc.exe test. Ts-loop: sout = # duplicate {DST = STD {access = RTP, MUX = ts, DST = 224.1.1.1: 1234}, DST = display}
For example, if you receive UDP port 888, all the data is saved to c: \ dump. Ts.
Vlc.exe UDP: // @ 888: Demux = dump: demuxdump-file = "C: \ dump. Ts"
About the video output module in Windows
Direct3d: the effect is worse than DirectX, but it is convenient. You can also implement Alpha on the image.
DirectX: The best effect. Display acceleration using DirectX
OpenGL: performance is not the same on different hardware.
Wingdi: the slowest type, requiring no video card Acceleration
Caca: displays data with colored assic characters.
Temporarily enable the output of a video as follows: C: \ Program Files \ VideoLAN \ VLC-0.8.6e> VLC test. Ts-vout = caca
ActiveX Control
The officially released VLC comes with the ActiveX control axvlc. dll. After registration, you can easily use VLC in applications and web pages. The registration method is
C: \ Program Files \ VideoLAN \ VLC-0.8.6e> regsvr32 axvlc. dll
The usage of ActiveX vlccan refer to readme.txtand test.html of activexdirectory in the source code. The interfaces of ActiveX control include the first and second editions. The first editions are simple and have fewer functions. We recommend that you use the second version instead of maintenance.
Mozilla plugin
You can also use VLC in Firefox for Windows and Linux. In Windows, you can select Mozilla plugin when installing VLC. In fact, it adds a VLC sub-key under the hklm_software_policillaplugin key. In Linux, you can put libvlcplugin. So (or npvlc. So) and the plug-in Directory into the Firefox plugins directory to make it take effect.
This applies to xulrunner-based applications. In fact, XUL applications such as Miro and songbird use this plug-in. Similar to ActiveX, VLC's Mozilla in also has two sets of interfaces. We recommend that you use the new version 2.
Registry
In Windows, VLC only uses a small amount of registry information. The most important one is the installdir item under the hklm_software_vlc key, the Mozilla in and ActiveX Controls of VLC use this item to locate the directory of their plug-ins. For VLC, telnet and HTTP control interfaces are interface modules. You can use various control modules. In Windows, the wxWidgets graphical interface is used by default. You can also remotely control the VLC using interfaces such as HTTP and telnet. If you use VLC to perform video stream forwarding on the server, this remote interface can be of great help.
Video Filter
The 0.8 series contains up to 13 video filters to add effects and special processing to videos.
Skin2 Interface
A nice, skin-changing interface.
Other
Play a DVD or VCD, open the DirectShow device, and play the current screen...
Some Problems
CurrentVLCReal videos, such as RM and rmvb, cannot be played. In fact, VLC of version 0.9 can be played by other decoder. However, the current test shows that sequential playback is normal, but the drag effect is poor. There is a problem with RTSP playback and dragging, and there is a defect in obtaining the playback position. For example, cooperation with Darwin server.
V. Basic principles of Video Playback
Almost all video players, such as VLC, mplayer, and xine, have similar principles and architecture in Playing videos, understanding this will get twice the result of understanding the source code of VLC.
Generally speaking, playing a video involves four steps:
1. Access acess, or read, obtain, or obtain
2. Demux demultiplexing means to separate audio and video (subtitles are also possible) that are normally combined)
3. Decode decoding, including audio and video decoding
4. Output output, also divided into audio and video output (aout and Vout)
Let's take a UDP multicast mpeg ts stream for example. The access part is responsible for receiving multicast streams from the network and placing them in the VLC memory buffer. The access module focuses on the IP protocol, for example, whether IPv6, multicast address, multicast protocol, port, and other information are detected. If the RTP protocol is detected (the RTP protocol simply adds a fixed 12-byte information to the UDP header ), the RTP Header information is also analyzed. For this part, see VLC source code/modules/access/udp. C. You can also see a large number of access modules in the same directory, such as file, HTTP, DVD, FTP, SMB, TCP, dshow, MMS, v4l... And so on.
The Demux part first needs to parse the TS stream information. The ts format is part of the MPEG2 protocol. In summary, ts is usually a 188-byte packet. a ts stream can contain multiple program programs ), A program can contain multiple elasticsearch streams of video, audio, and text information. Each elasticsearch stream has a different PID. To analyze these es streams, TS has some fixed PID tables used to send program and ES stream information at intervals: Pat and PMT tables. For more information about ts format, go to Google. VLC implements an independent library libdvbpsi to parse and encode ts streams. For the code that calls it, see VLC source code/modules/Demux/ts. C.
In fact, Demux is required because audio and video are actually independently encoded during production and separate data is obtained. To facilitate transmission, you must combine them in a certain way, in this case, Demux is available for various encapsulation formats. The audio and video streams decomposed by Demux are sent to the audio decoder and Video Decoder respectively. Because the original audio and video occupy a large amount of space, and the data with high redundancy is usually compressed during production. This is a well-known audio and video encoding format, including mpeg1 (VCD), MPEG2 (DVD), MPEG4, H.264, and rmvb. The audio/video decoder is used to restore the compressed data to the original audio/video data. VLC decoding MPEG2 uses an independent library libmp eg2. The source file called is/modules/codec/libmp eg2.c. VLC codec modules are all placed under the/modules/codec directory, including the famous hugeFFmpeg.
Decoder. For example, a video decoder outputs an image similar to a bitmap format, but a video output module is required to be visible on the screen. Of course, the image can be directly painted to the window DC like a Win32 window program -- wingdi, an output module of VLC, does this, but it is usually too slow and consumes a lot of CPU. In Windows, it is better to use the DirectX interface to automatically call the acceleration function of the video card.
Such functional decomposition makes modularization easier. Each module needs to focus on its own business. In general, the functions are powerful and flexible.
But things are always not that simple. For access, media access is hierarchical. For example, RTSP involves IPv4, TCP, UDP, RTCP, RTSP, and other protocols. Some video formats include transmission, encapsulation, and editing code format, such as the mpeg series. Some encapsulation formats are independent containers, but many people will misunderstand that they are codec formats, such as MKV and Avi.
Audio and video are independent after Demux, but a mechanism is required to synchronize them. At the same time, we need a set of mechanisms to control speed, pause, stop, and jump to obtain various media information. These are very complicated and important.
In addition, you may need to insert some modifications somewhere to achieve some effect. For example, audio EQ and video brightness adjustment, VLC specially designs access_filter, audio_filter, and video_filter modules to do this.
The unique feature of VLC is the integration of the original VLS functions, which relies on stream_output modules in VLC. They can re-transcode and send the video being played in some way, such as HTTP, UDP, and files.
The structure of mplayer is similar. For example, the/stream directory corresponds to the access function, the Demux function corresponding to/mpdemux, And the/libmp codecs decoder, /libvo and/libao2 are video and audio outputs respectively.
DirectShow is similar, but classification is more complex. The modules in DirectShow are called "filter", and filters are connected by "pin. The access module corresponds to the sourcefilter in DirectShow. This type of filter only outputs the pin and does not input the pin. The Demux module corresponds to the splitter filter, which has one input pin and multiple output pins. The decoding module is a kind of transform filter with an input pin and an output pin. The output module corresponds to readering filter and has an input pin without an output pin. Of course, the transform filter is not necessarily a decoder, or it may be some other processing.
Also give a vlc api document, see: http://rogerfd.cn/doc/vlcapi.htm
Vi. Streamlining
VLCBy default, a large number of functions are provided, with more than 2 hundred plug-ins. In Windows, the installation package size is close to 10 MB, and more than 35 MB after installation. Sometimes, if we only need some functions, how should we streamline them?
The first step to streamline VLC is to reconfigure the compilation options and remove unnecessary features. A simplified configuration script is as follows:
Path =/usr/win32-branch/bin: $ path \
Pkg_config_path =/usr/win32-branch/lib/pkgconfig \
Cppflags = "-I/usr/win32-branch/include-I/usr/win32-branch/include/ebml "\
Ldflags =-L/usr/win32-branch/Lib \
Cc = "gcc-MnO-cygwin" cxx = "g ++-MnO-cygwin "\
./Configure \
-With-FreeType-config-Path =/usr/win32-branch/bin \
-With-fribidi-config-Path =/usr/win32-branch/bin \
-Disable-FFMPEG \
Disable-live555 \
-Disable-cddax \
-Disable-vcdx \
Disable-skins2 \
-Disable-wxWidgets \
-Disable-Mozilla \
-Disable-HTTPd \
-Disable-dvdna V \
-Disable-libcdio \
-Disable-libcddb \
-Disable-cdda \
-Disable-SDL \
-Disable-SDL-image \
-Disable-VCD \
-Disable-dvdread \
-Disable-SMB \
-Disable-cmml \
-Disable-ALSA \
-Disable-OpenGL \
-Disable-PNG \
-Disable-screen \
-Disable-MKV \
-Disable-mod \
-Disable-MPC \
-Disable-libtar \
-Disable-speex \
-Disable-Visual \
-Disable-DAAP \
-Disable-Bonjour \
-Disable-gnutls \
-Disable-Vorbis \
-Disable-Real \
-Disable-XML \
Disable-x264 \
-Enable-sout \
-Enable-ActiveX \
-Enable-release
This script mainly disables a large number of features. Run./configure-h to display the meaning of each configuration item. If you are not clear about it, you can search for the location of the library corresponding to the option.FFmpegIt is a huge codec library, but MPEG2 decoding can use another library libmp eg2, so it is not needed here.
Note that you should use the make package-win32-base to compress the package after making, and the strip tool will be used to compress each executable file during packaging.
But this is not over yet. The configuration items are not comprehensive, and there may be some minor problems, such as disabling XML... Therefore, you also need to manually clean up the plug-ins in the Plugins directory and pick out the plug-ins that are useless.VLCModule familiarity. Alternatively, you can try it one by one using Roger's stupid method and remove it if it has no effect on the function. The plugin used by simpletv0.4 is shown below:
Liba52sys_plugin.dll liba52 is used for Audio Decoding in AC3 format.
Liba52tofloat32_plugin.dll
Liba52tospdif_plugin.dll
Liba52_plugin.dll
Libaccess_file_plugin.dll file access, the playback file needs
Libaccess_http_plugin.dll HTTP access module
Libaccess_output_file_plugin.dll file module for recording
Libaccess_udp_plugin.dll UDP access module
Libaout_directx_plugin.dll DirectX sound output, default sound output module
Libdeinterlace_plugin.dll's Vout-filter module
Libdirect3d_plugin.dll direct3d video output module, which can be translucent...
Libfixed32tofloat32_plugin.dll data conversion module
Libfixed32tos16_plugin.dll
Libfloat32tos16_plugin.dll
Libfloat32tos8_plugin.dll
Libfloat32tou16_plugin.dll
Libfloat32tou8_plugin.dll
Libfloat32_mixer_plugin.dll
Libglwin32_plugin.dll OpenGL video output module
Libi420_ymga_plugin.dll
Libi422_yuy2_plugin.dll
Libipv4_plugin.dll IPv4 network module
Libipv6_plugin.dll IPv6 Network Module
Liblibmp eg2_plugin.dll libmp eg2, which is used for decoding.
Liblogger_plugin.dll Log Module, required for debugging
Libmemcpy_plugin.dll seems to use various CPU commands to accelerate memory copying.
Libmp eg_audio_plugin.dll MPEG audio decoding module
Libmp gatofixed32_plugin.dll
Libmp ga_plugin.dll
Libmux_dummy_plugin.dll
Libpacketizer_mpegvideo_plugin.dll
Libs16tofixed32_plugin.dll
Libs16tofloat32swab_plugin.dll
Libs16tofloat32_plugin.dll
Libs8tofloat32_plugin.dll
Libsimple_channel_mixer_plugin.dll
Libstream_out_display_plugin.dll sout module...
Libstream_out_duplicate_plugin.dll
Libstream_out_standard_plugin.dll
Libtrivial_channel_mixer_plugin.dll
Libtrivial_mixer_plugin.dll
Libtrivial_resampler_plugin.dll
Libts_plugin.dll TS Stream de-multiplexing Module
Libu8tofixed32_plugin.dll
Libu8tofloat32_plugin.dll
Libugly_resampler_plugin.dll
Libvout_directx_plugin.dll DirectX video output module
Libwingdi_plugin.dll GDI video output module
As the ActiveX control VLC, only these modules and axvlc. dll are enough. Of course, if libvlc. dll is used, it must be included.
VLC 0.9.2 officially released & VLC playing RM rmvb plug-in
The new VLC is added with the Demux and CODEC modules of realvideo. You can play real videos in RM and rmvb formats, but you need to download the following two attachments:
Copy pncrt. DLL to c: \ Program Files \ VideoLAN \ VLC \
Copy drv43260.dll to c: \ Program Files \ VideoLAN \ VLC \ plugins \
These two files can also be copied from Win32 codec of mplayer. From the test, there is no problem with sequential playback, but the jump speed is slow and the image is not stable.
Here is an introduction to the new features of VLC http://wiki.videolan.org/What_is_cool_in_0.9
Release Note: http://www.videolan.org/developers/vlc/NEWS
Download Directory: http://download.videolan.org/pub/vlc/0.9.2/win32/
Download link (exe): http://download.videolan.org/pub/vlc/0.9.2/win32/vlc-0.9.2-win32.exe
7. Change
VLCEmbed your own applications
In general, there are four ways to embed VLC into your own applications:
• Directly call the VLC Process
• VLC plugin for Mozilla
• ActiveX plug-in of VLC
• Call libvlc
Of course, in theory, the source code of VLC can be directly deducted to your own program. However, this method is too difficult and doesn't make much sense.
First, let alone the first method. This is a very useful solution. Especially for transcoding, stream forwarding, and other applications, you can call VLC directly. VLC has an HTTP and telnet interface module (that is, the interface for interacting with users), which is also convenient for remote interaction. Cross-platform applications are also very convenient. You only need to install VLC on different platforms. Directly calling VLC is the most important parameter. You can obtain detailed command line parameters from vlc.exe-H. For transcoding and forwarding, the command line parameters are complicated. You can use the GUI to first try and then copy the generated stream output string on the interface.
In addition to Firefox Web pages, VLC Mozilla plugin can also be used for any XUL-base applications, which are usually started using xulrunner. XUL is a language that uses XML to write interfaces. It is a bit like HTML and compatible with most HTML tags. Firefox uses XUL to write interfaces. VLC Mozilla plug-ins are usually controlled using JavaScript, detailed interface documentation can refer to here: http://www.videolan.org/doc/play-howto/en/ch04.html#id310965 this interface has a relatively old first version and a relatively new second version, it is recommended to use a new, more features. VLC has many Mozilla plug-ins, such as Miro and songbird. This advantage is obvious: cross-platform, highly controllable, and easy to use. restrictions are also obvious: it is designed for Mozilla and has a narrow application scope.
The ActiveX plug-in of VLC can only be used on Windows platforms. Of course, this is because ActiveX is only something of Microsoft. But I have to say this is still very useful. Both C ++, C #, VB, and web pages can be used easily. About this VLC official documentation here http://wiki.videolan.org/ActiveX_Controls development, before using do not forget to first register ActiveX control, the way is to run regsvr32 axvlc. dll. Previously, Roger wrote simpletv to call the ActiveX Control of VLC, so this can also be used as an example code. You can mainly look at how to call this control for stream code:
// Create option for the plugin
Bool bipv6 = false;
If (strstr (szmrl, ":")
{
Bipv6 = true;
}
Tagvariant opt, VAR, ip6;
Cstring sout, IPv6 = "IPv6 = 1 ″;
Safearray * PSA;
Long index;
Safearraybound bound [1] = {0 };
Bound [0]. celements = bipv6? 2: 1;
If (m_cfg.bdisplaywhenrecording)
{
Sout. Format ("sout = # duplicate {DST = display, DST = STD {access = file, MUX = ts, DST = \" % s \"}}",
Strname );
}
Else
{
Sout. Format ("sout = # duplicate {DST = STD {access = file, MUX = ts, DST = \" % s \ "}", strname );
}
Var. Vt = vt_bstr;
Var. bstrval = sout. allocsysstring ();
PSA = safearraycreate (vt_variant, 1, bound );
Index = 0;
Safearrayputelement (PSA, & Index, & var );
If (bipv6)
{
Ip6.vt = vt_bstr;
Ip6.bstrval = pai6.allocsysstring ();
Index = 1;
Safearrayputelement (PSA, & Index, & ip6 );
}
Opt. Vt = vt_array | vt_bstr;
Opt. parray = psa;
Tagvariant NUL;
Nul. Vt = vt_null;
M_vlc.getplaylist (). Add (szmrl, NUL, OPT );
M_vlc.getplaylist (). Next ();
M_vlc.getplaylist (). Play ();
Many people call the ActiveX Control of VLC. The question is that the playback has no response. Most of the reasons are caused by plugins problems. When VLC is run as EXE, it recursively searches the modules and plugins directories in the current directory to find plugin. However, when running with ActiveX controls, it only checks the hklm_software_videolan_vlc_installdir of the Registry by default, add plugins as the module search path. If this path is not set or set incorrectly, VLC will not find most modules, leading to the absence of most functions and failure to run. To modify this feature, you can modify the vlcplugin: getvlc function in \ ActiveX \ plugin. cpp (0.8.6i.
In simpletv, a piece modified by Roger is
Char p_pluginpath [max_path + 1];
Int itmp = 0;
/* Get the full path to simpletv.exe */
DWORD dwlen = getmodulefilenamea (null, p_pluginpath, max_path );
For (itmp = strlen (p_pluginpath)-1; itmp> = 0;-itmp)
{
If (p_pluginpath [itmp] = '\\')
{
P_pluginpath [itmp] = 0;
Break;
}
}
/* Set the module path to player \ modules under simpletv */
Strcat (p_pluginpath, "\ player \ modules");
Ppsz_argv [ppsz_argc ++] = "-plugin-path ";
Ppsz_argv [ppsz_argc ++] = p_pluginpath;
Another point is the vlcrc path of the configuration file. If you need to modify the path, you can modify src/MISC/configuration. the getdir function in C returns % appdata % by default in this directory in windows. If you do the preceding two steps, you can actually create a green VLC of portable.
Compared with other ActiveX players, such as WMP, QuickTime, and RealPlayer, VLC has obvious advantages: built-in decoder, open source, and powerful functions.
Of course, ActiveX and Mozilla plug-ins also have limitations. Such methods are not powerful enough, for example, there is no screenshot interface... If you need more complete functions, you can directly call the libvlc interface,
VLC provides official documents and examples: http://wiki.videolan.org/libvlc. Here is an example http://jeremiah.blog.51cto.com/539865/116981 that calls libvlc with C #
In Windows, libvlc may not be compiled by default (0.8.6i). You can enable this option-enable-shared-libvlc in configure.
The complete VLC volume is not small. If you only need some of the VLC functions, You can streamline it at last.