Android VLC player two times the development of 1 -- the program structure analy

  Recently because of a new project requires a multimedia player, so we need to do a video, audio, pictures of the player. Also consulted a lot of information in this regard, if you want to start a player so much work, but also great difficulty. So I finally chose VLC as the foundation, carries on two times of developments. Select VLC for two reasons, first: VLC is mature in other platform support, the decoder is perfect. Second: VLC has a complete implementation of the video and audio playback. Development speed can be much faster.

  Here are two screenshots, mainly in order to facilitate the later on the program structure, can control the pictures. Interface and the original VLC almost, I just ActionBar and the video list made some adjustments.


(PS: The new QQ group, who are interested can join together: Android group: 322599434)

1, Background

  The start was to modify the Android comes with the Gallery3D program, because this program comes with video playback capabilities, but the decoding is not ideal, many format is not supported. Decoding library helpless can only use third party, thus finally chose VLC as the two development foundation. Select the above reasons it has been said, here don't repeat.

  VLC player is not much, believe that do the audio and video friends all know, and it basically support the common platform. Two development and the objective is to VLC the original interface and some play control to modify, adapt to the tablet computer used above, another is to want to master the VLC codec library how to use. The first objective, modify the interface is not great, because the whole interface logic structure, I don't need a big change, just do some adjustment. So the main purpose is to understand the VLC implementation of the whole process.

  The analysis of the VLC is to achieve java layer, decoding library that still don't have the energy to analysis, and that a more complex. Some time back, in considering the analysis of decoding library. At present mainly analyze Java part of the code and how to use the decoding library. Reading the best open source project can learn a lot of things, Launcher let me improve a lot, but also learned a lot of Android development knowledge, for example: between ViewGroup and view touch event process. Through the analysis of Android Launcher is deeply understand touch mechanism. Believe that modify the VLC player through the analysis and, can also learn a lot of new knowledge.

  Additionally, the VLC source code is open source (including decoding library code), GIT can be used to obtain, to compile, I have written an article to obtain detailed VLC source code and compiled articles, if you don't know how to get the source code and how to compile a friend, you can view the links at the end. The article provides a VLC project, can be directly imported into Eclipse inside.

2, Program structure

The VLC player module can be divided into the following several important modules:

  The whole process can be divided into the main module above, corresponding to above the source SRC package directory can be seen, for each module specific code, here not say, I haven't completely analysis. Only master the program structure and each class or function. Specific behind my analysis, will continue to write articles.

  Direct mainly talking about the program interface logic, can be seen from the above screenshot given me, just start the default program is to enter the video list. The VLC interface is mainly composed of SlidingMenu and ActionBar, which embeds several Fragment. Switch SlidingMenu is responsible for the function module (video, audio, video or specific directory), enter the audio, this is the switching of Fragment, that is to say the specific functions are realized by Fragment. SLidingMenu provides the switching function, ActionBar provides a number of commonly used function buttons, search, refresh, video input, sorting, settings and other functions. Most of the interface are ActionBar, in addition to audio and video playback interface.

3, The main module of the program

  Entrance class programOrg.videolan.vlc.gui.MainActivity, also is the top directory inside the GUI Activity, this Activity is mainly detected VLC decoding library and class object creation and initialization function interface, there is the response of SlidingMenu and ActionBar operation. Analysis of the specific code, the next article, today to explain about the logic.

  Video moduleThe entrance is the video list, as mentioned above, the VLC interface are realized based on Fragment, the video list is also based on Fragment, the player interface is another Activity— — VideoPlayerActivity, video package is mainly the two class implements video playback function, one is the list interface, a a video player interface. The other is some adapter and auxiliary class, then the video in detail, and explain the relevant class.

  The audio is the main type is the entrance, the audio player module which was divided into several pages, implement the sliding switch functions similar to ViewPaper, this is Android Music layout almost and elements. These specific analysis of the audio module in on time.

  Widget control module: The two is the realization of some VLC own controls as well as the desktop Widget, VLC made a desktop Widget is used to play audio, with native Android Music similar to the Widget.

4, Summary

  Today is mainly to introduce the VLC code structure and main function modules of the analysis, the next article will introduce VLC module. And my personal changes of record, to the development of this area in need of a friend reference. In fact VLC the Java part of the code is very much, but also the logic structure to distinguish carefully. If you have some amount of code more open source project, the analysis of the VLC is not difficult, but if you read the code is not much, this for you is probably one of the more difficult.

  The whole project is used a lot of technology, such as SlidingMenu, ActionBar, Fragment, AIDL, Widget, View custom and so on, if you are not familiar with either of these, I suggest you first look at, especially SlidingMenu and Fragment, these two basically construct the whole VLC player interface.

  In addition, I intend to use the method of VLC decoding library to make it clear, because I am going to transplant the VLC decoding core, made an easy to use third party libraries. Is mainly transplanted into my personal development of a network of amateur radio used above. The other is independent, convenient use of transplantation.

Related articles

Linux compiled Android-VLC open-source player Xiangjie (with source code download)

Edited by mythou

The original Bowen, reprint please indicate the source

Posted by Ogden at November 21, 2013 - 11:43 AM