libstagefright: Extended media support via FFMPEG

 * Original work by Michael Chen - https://github.com/omxcodec
 * Kitkat port from Android X86 project

libstagefright: add null checking to addPlugin

libstagefright: fix error handling of dlsym()

According 'man dlsym', a NULL return from dlsym() doesn't indicate an error.
The correct way to test for an error is to call dlerror() to clear any old
error conditions, then call dlsym(), and then call dlerror() again to check
whether its return value is not NULL.

libstagefright: add more media mimetypes

This is the first step to add the ffmpeg plugins.

libstagefright: add ExtractorPlugin

The patch allows to load an ExtractorPlugin to extend the functions of
DataSource::sniff and MediaExtractor. A plugin has to implement a C
function getExtractorPlugin to fill the MediaExtractor::Plugin struct.

The filename of the plugin could be specified by the
media.stagefright.extractor-plugin property.

Change-Id: I995a37a4f1ab4bba6ca3c24c7001a27a1e3ccb90

FLACExtractor: Add more sample rates support

In FLACExtractor.cpp, it has function to check file's sample rate.
If the input sample rate is not in its list, it will return "unsupported
sample rate" issue. Modify code to make other sample rates (100,1k,42k,46k)
pass the check

Issue: AXIA-1441
Change-Id: I48f91119275560ec6d00feb0dedc70d10aa55262
Signed-off-by: Xiaobing Feng <xiaobing.feng@windriver.com>
Signed-off-by: Matt Gumbel <matthew.k.gumbel@intel.com>

libstagefright: add ffmpeg components

libstagefright: add more decoders

Add support for wma, wmv, ra, ape, dts decoders.

Change-Id: Iaf48a806aa0cef7d9bcb848383fc3d778c8bd248

libstagefright: allow to use the extended extractor in priority

If the meta contains the string "extended-extractor-use",
use the extended extractor first.

add support for rv20, rv30

add ffmpeg heuristic decoder

Change-Id: I5eed11b563ca7f15d44bacfb795d6f3da08ab883

add HEVC(H.265) decoder and cleanup

Squashed the following commits of branch cm_maguro-10.1 from
https://github.com/omxcodec/android_frameworks_av.git
by Michael Chen <omxcodec@gmail.com>

defb904 remove MEDIA_MIMETYPE_AUDIO_MP2
8036958 add fetchUriFromFd func to get file name
91bc7d5 fix videoCompressionFormatString and audioCodingTypeString funcs
f03069f reset FRAME_DROP_FREQ to 0
718b99a add HEVC(H.265) decoder
84f8bf6 cleanup
f026c93 cleanup
440614a add debug info

Change-Id: Ie75db0778f633357e2280aef6d47a0fa3beb823e

AwesomePlayer: use AwesomeLocalRenderer for OMX.ffmpeg.* components

stagefright: Remove duplicate types from QC media defs

Change-Id: I50ecafe79a2985d0868a1ac82464d6ca448aa2c5
libstagefright: Re-introduce a QCOM_HARDWARE ifdef after the FFMPEG commit

Fixes a build error on non QCOM hardware.

Change-Id: I4a4268b351d0d8bf748dd03ccea0fbab20ed4314
DataSource: Remove global variables in DataSource related to sniff

Removed global variables related to sniff, and added Sniffer class
to implement the sniff functionality with non-static members.

Change-Id: I6fbd0ba5b686e09fda11d78cdd687a69c81a6bdf
CRs-Fixed: 567753
libstagefright: Add MPEG2 Codec support

Enables playback support for MPEG2 Codec to play specific ts content

CRs-Fixed: 631693
Change-Id: I96e44b1f1f26ea138802d8d75f1784a06dd8dc6b
libstagefright: Fix crash while setting buffer size

The format returned from MakeAVCCodecSpecificData may be
NULL and will crash on trying to set buffer size.

Added NULL check to avoid crash

Change-Id: I45485f820a6aa657e63aeeb6dd43061a2e3575e3
CRs-Fixed: 644331
libeffect: Fix enabled effect count calculation error

When switching from tunnel to arm effects, effect chain will be moved
from offload thread to mixer thread. During this procedure effect instance
is not destroyed, instead it's preserved and mounted onto new chain.

The migrant sequence is 1) disable instance -> 2) move to new effect
chain -> 3) enable instance again. However, the accumulated effect
enabled count is not decreased when effect instance is disabled.

As a result, LvmBundle_process() is only called once when Effect_process()
called twice, which causes input buffer get processed alternately and
glitch sound appears.

Change-Id: Idd3b8753a73694cc36617ed55b40fda93155abed
CRs-Fixed: 636353
libmedia: Add timelapse profiles for 4k sizes

 The encoder profiles need to be extended to
 support 4k resolutions during timelapse as well.

Change-Id: If67ef1cca45bc61ce1d08bcd5b33adcf22ed8751
CRs-Fixed: 642013
stagefright: Fix playback for mkv files with lacing

Most mkv files having 'lacing' in their audio section to save space.
Android did not handle this properly, sending all frames in the block
with the same time code, which causes stuttery playback.

Change-Id: I4dc76e7c2a53126c7fbdd3628fe7d339d2e3364e
DataSource: Split off ffmpeg sniffer to a second pass, and only if necessary

ffmpeg's sniffer is intended as a grab-all-that-doesn't-work-elsewhere
extractor. Unfortunately, this causes two issues:

- As written, it requires ffmpeg to whitelist any extractors supported
by stagefright, or else it will blindly override them. This has codebase
sync issues, as shown by the VP9 and WAV accidental overrides
- It imposes an in-depth analysis of _all_ media, even that which we
want to be processed quickly by shipping stagefright plugins (hardware
or not). This is mostly noticeable in network streams and thumbnail
generation.

This patch moves FFmpegExtractor to an independent sniffer queue, and
it only invokes it when the regular MediaExtractor hits 1 of 3 conditions:

1 - The confidence in the identified container type is low
2 - No container is identified at all
3 - A video container was found by other extractors, but only 1 stream
(audio or video) was identified.

Change-Id: Ib96ff4f6bc06223fe0e819a57560d3c872a79ddd