This README is a guideline about How to build Quadra omx decoder/encoder plugin.


brief description:
The Quadra omx decoder/encoder is based on Android MediaCodec mechanism, it can be considered as omx component in Android MediaCodec.
The Quadra omx decoder/encoder contain H264/H265 decoder components and H264/H265 encoder components, and they will be called by Android MediaCodec when needed. 


Environment requirement:
1.AOSP (Android Open Source Project) is necessary to build Quadra omx decoder/encoder plugin.
2.NETINT release package include libxcoder/OpenMax/FFMPEG.


How to build Quadra omx decoder/encoder:
1. prepare libxcoder build, please refer to "APPS608 Android Docker setup Application Note"
   Quadra omx decoder/encoder plugin is based on libxcoder, so the build of libxcoder is necessary.

2. build Quadra omx decoder/encoder
   copy Quadra H264/H265 decoder/encoder omx componet to AOSP, it's like the following command:
     cp FFmpegXcoder/OpenMAX/source/omx/SoftOMXPlugin.cpp aosp/frameworks/av/media/libstagefright/omx/
     cp FFmpegXcoder/OpenMAX/source/component/NiQuadraOMXAvcDec/ aosp/frameworks/av/media/libstagefright/codecs/ -rL
     cp FFmpegXcoder/OpenMAX/source/component/NiQuadraOMXHevcDec/ aosp/frameworks/av/media/libstagefright/codecs/ -rL
     cp FFmpegXcoder/OpenMAX/source/component/NiQuadraOMXAvcEnc/ aosp/frameworks/av/media/libstagefright/codecs/ -rL
     cp FFmpegXcoder/OpenMAX/source/component/NiQuadraOMXHevcEnc/ aosp/frameworks/av/media/libstagefright/codecs/ -rL

   build quadra omx decoder/encoder based on AOSP, run the following command in the AOSP directory:
     source build/envsetup.sh
     lunch aosp_x86_64-eng                                    //aosp_x86_64-eng is one example here, you can choose the corresponding option according to your needs
     mmm frameworks/av/media/libstagefright/omx/
     mmm frameworks/av/media/libstagefright/codecs/NiQuadraOMXAvcDec/    //build Quadra h264 decoder
     mmm frameworks/av/media/libstagefright/codecs/NiQuadraOMXHevcDec/   //build Quadra h265 decoder
     mmm frameworks/av/media/libstagefright/codecs/NiQuadraOMXAvcEnc/    //build Quadra h264 encoder
     mmm frameworks/av/media/libstagefright/codecs/NiQuadraOMXHevcEnc/   //build Quadra h265 encoder

3. copy the build to the Android container
   push the above building to Android run environment, run the following command in the AOSP directory:
     docker cp out/target/product/generic_x86_64/vendor/lib/libstagefright_softomx_plugin.so android11:/vendor/lib/
     docker cp out/target/product/generic_x86_64/vendor/lib/libstagefright_soft_niavcdec.so android11:/vendor/lib/
     docker cp out/target/product/generic_x86_64/vendor/lib/libstagefright_soft_nihevcdec.so android11:/vendor/lib/
     docker cp out/target/product/generic_x86_64/vendor/lib/libstagefright_soft_niavcenc.so android11:/vendor/lib/
     docker cp out/target/product/generic_x86_64/vendor/lib/libstagefright_soft_nihevcenc.so android11:/vendor/lib/
     docker cp ~/FFmpegXcoder/OpenMAX/etc/media_codecs.xml android11:/vendor/etc/    //media_codecs.xml is important for using hardware decoder to accelerate video decoding.

   Here android11 is just example as Docker container name.

4. test
   After copying the build to the Android container, restart the Android container:
     docker restart android11

   Then exec the following command for initialization:
     /vendor/bin/hw/android.hardware.nidec@1.0-service &
     ni_rsrc_mon


  Finally, you can install the app or use our demo to test.

