LeMaker Guitar:Video decoder engine

From BananaPro/Pi
Jump to: navigation, search

Other languages:
English • ‎中文(简体)‎


LeMaker Guitar VDE(Video Decoder Engine) is a decoder component based on OpenMAX. OpenMAX (Open Media Acceleration), often shortened as "OMX", is a non-proprietary and royalty-free cross-platform set of C-language programming interfaces that provides abstractions for routines especially useful for audio, video, and still images processing. It is intended for low power and embedded system devices (including smartphones, game consoles, digital media players, and set-top boxes) that need to efficiently process large amounts of multimedia data in predictable ways, such as video codecs, graphics libraries, and other functions for video, image, audio, voice and speech. OpenMAX provides three layers of interfaces: application layer (AL), integration layer (IL) and development layer (DL).

OMX_VDE has two ports: port1 acts as the video stream input port, port2 acts as the video stream output port. OMX_VDE supports many video formats, such as AVC(H264), H263, MJPEG, MPEG2, MPEG4, WMV3 etc…

OMX_VDE using

Component Init

Component Init.png

  1. Call OMX_GetHandle to initialize component;
  2. Call OMX_SetParameter to initialize component port and set format;
  3. Apply for buffer for port. The Buffer can be passed to port from the upper layer, also can call OM_AllocateBuffer to allocate buffer for port;
  4. Finish OMX_StateIdle state change.

Component Run

Component Run.png

  1. The process that the component's state is changed to OMX_StateIdle will start bufferMgmtThreadID thread which is responsible for handle the input and output of buffer.
  2. Pass buffer to EmptyThisBuffer (input port) and FillThisBuffer (output port), when component finish, EmptyBufferDone (input port) and FillBufferDone (output port) return buffer.
  3. If component is running an exception, EventHandler function will return the message to upper layer to handle.

Component Deinit

Component Deinit.png

  1. Change the component’s state to OMX_StateLoaded, bufferMgmtThreadID will end run.
  2. Call OMX_FreeHandle release component’s resourse.

OMX_VDE example

Step 1: Download and install omx lib

sudo wget http://mirror.lemaker.org/omx.tar.gz
sudo tar -zxvf omx.tar.gz
cd omx
sudo chown -R root:root .
sudo ./install.sh

omx head files will be installed in /usr/include/omx-include, omx video decoder libraries will be installed in /usr/lib, examples code will be installed in /home/owlplayer

Step 2: Compile examples

cd /home/owlplayer
sudo make

Step 3: Test examples

cd /home/owlplayer
./owlplayer [videoname]

Step 4: Test result
When executed “./owlplayer videoname”, you will find a file "NV12_wxxx_hxxx" in /home. The file "NV12_wxxx_hxxx" records 50 frames of the video "videoname". The "NV12" means the pix format is NV12. the "xxx" means width or height. You can play the file "NV12_wxxx_hxxx" by YUVPlayer.exe in Windows PC.