Making MobileMate Main Program

Technical Overview

  • Program language. Because the real work of MobileMate is processed by the all kinds of open source tools, such as MPlayer, FFmpeg(Libav), Zenity, Grep, Sed, etc., so use Bash as a glue language to make them work together.
  • As the main program of MobileMate is a total resolution for video/audio converting, it's a bit complicated, borrow the idea of encapsulation from OOP, put the related data members and functions into a shell script file like a “class” with the special naming rules of data members and functions.
  • Using Zenity as the program UI, so it is simple and is only wizard way.
  • For easy to customize the program behavior, it is mainly worked on config files.

Source Structure

  • /opt/mobilemate/bin: the executable shell scripts, start from “/opt/mobilemate/bin/mobilemate”.
  • /opt/mobilemate/share: the “class” shell scripts which include functions can be called by the script in the “../bin” or by the function of the another “class”.
  • /opt/mobilemate/conf: all the config files are put here.

Coding Style and Rules

Apply the Google Shell Style Guide Revision 1.25 for our coding style except some particular cases below:

  • Separate libraries with ::. I need use united style for the variable and function in a library(under /opt/mobilemate/share, or “class”), but the variable name can not include “::”.

Except for these style guide, there are some rules in MobileMate main program must be used listed below:

  • The name of function and public variable in a library(or “class”, under /opt/mobilemate/share) must be prefixed with “filename_”. For example, a “class” /opt/mobilemate/share/taskmanager.sh, a public variable must be “taskmanager_task” and a function must be “taskmanager_thread()”.
  • If you need add new functions into program, if there is no any error in the old code file, don't modify the old code file, create a new code file to implement your functions except no other choice.

Other Considerations

  • The MobileMate project founder, me, littlebat, isn't a skilled programmer, so the design or implementation is maybe improper or even wrong, please don't hesitate to contact us or post bugs. Of course, it's very welcome you to post patches. Thanks a lot ahead.
  • Why choose Libav instead of FFmpeg in the current version? When I start to write this program, I don't know the difference between FFmpeg and Libav very clearly, and I need compile the MPlayer(Mencoder) to link FFmpeg libraries dynamically(for keep small size of the MobileMate), but I always got compiling error then, so I borrowed the source and compiling options of FFmpeg and MPlayer from Debian Sid repository. As we know, Debian official repository has no FFmpeg, it's Libav. In the future version, basically, we will use FFmpeg instead of Libav if we can resolve the question of MPlayer linking to FFmpeg libraries dynamically. Because I find it seems FFmpeg has more new features and the developing is more active. What's your consideration? Or, a more common question: When to use FFmpeg and when to use Libav? Which is more suitable for our project?
  • Why use Mencoder plus Libav and pure Libav these two converting methods? When I start to write this program, I heard Mencoder can decode more video types than FFmpeg(Libav) on the internet, but it seems can not encoder some formats(e.g., mpeg4 plus amrnb →3GP format) properly, So I use named pipe to pass the temporary work of Mencoder to Libav to get the last result. Later, I heard Mencoder has not been maintaining for years, and FFmpeg can replace Mencoder almost totally. So, I added the pure Libav converting method. The default method is pure Libav, if you meet a file maybe can't decoded by Libav properly, you can try edit /opt/mobilemate/conf/common.conf, replace “DECODED_BY=“LIBAV”” with “DECODED_BY=“MENCODER””, then it will use Mencoder plus Libav method to work. But, in the future version, if we validate FFmpeg can replace Mencoder totally, maybe we should remove Mencoder.
mobilemate.txt · Last modified: 2014/07/30 11:01 by littlebat
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0

蜀ICP备2021012931号-1 川公网安备51092202000377号