Added support for secure OMX component.

(cherry picked from commit 27adb100b825a1dd6d871106c9549e2e39ac23fb)

Change-Id: Ib79cce145b7800dc0417e2cb6125b0615c3b6d58
vidc: support for ION secure heap allocations.

Added support for video decoder secure heap
allocations.

(cherry picked from commit 546a5972050384b88429ffd03ee45480bd4b940d)

Change-Id: I9d64c5263f0a409cb6d55dd528c6d87603fa788f
vdec: Return error if OMX_FreeBuffer is called in incorrect state

- Return a proper error code (OMX_ErrorIncorrectStateOperation) if OMX_FreeBuffer
  is called in an incorrect state.

(cherry picked from commit 249b72c1aa0174fc34a37d4b2583aa5538c62e21)

Change-Id: I0778f78b047f2125fdec29426fb2bbd264575b1c
CRs-Fixed: 329874
vidc: Fix for ANR due to continuous bit stream errors.

For consecutive ETBs with bit stream errors, FBDs are
not being generated for a long time, resulting in ANR.
Fixed this by checking the number of consecutive
input frames with bit stream error and then generating
OMX event error.

CRs-fixed: 328793
(cherry picked from commit d1113167642c3fc8597e7e569753c59a599b8978)

Change-Id: Iff46f680ebfd04e0be5f5ca4174257147de7a150
vidc: Fix crash in encoder for meta mode

Check for NULL pointer in meta handle

CRs-Fixed: 331736
(cherry picked from commit 412262bb48e45805149bbd98d6c501a20fb0d9e5)

Change-Id: I91e41dd664fbe4b7c66036a6cbe5e44148dab678
vidc: Fix for crash in camcoder while MPEG-4 ASP recoding

Observing camcoder application crash, while recoding
MPEG-4 video with ASP profile. The number of B frames
value is not initialised, while setting intra period.
Fixed this by initialising it to 0.

CRs-Fixed: 331891
(cherry picked from commit 06eb548bc88b989991b74bd96b9a33274e9f2e2b)

Change-Id: Ied8eabe9ebc89642fc2d8b54a8ac689e6ae30fa5
vidc: Generate FBD if genlock lock operation fails

- Add missing call to generate FBD message if genlock_lock fails.
- Without this call, this particular buffer is never returned back
  to OMX IL client.

(cherry picked from commit cc417ab9aadcc24070d9658c67bad968135bb835)

Change-Id: I080902f893cc5cfbc1d33cfacc42cc1fe9884128
CRs-Fixed: 332651
vidc: Fix for slow video playback of an AVI clip

A particular avi clip contains xvid video, playing slowly
as compare to audio. The variations in the timestamp values
are ignored in the adjust timestamp function resulting in
setting wrong FPS value. Fixed the same by changing the
timestamp comparison logic.

CRs-fixed: 330010
(cherry picked from commit 209cba0fef493e27b622a2cbf3144dfbf5722652)

Change-Id: I3c58729990e584c6ae2ff393e19f2942883b4be9
vidc: Fix for crash in frame parser

Frame parser is crashing while decoding HRD parameters
from the corrupted input bitstream. Added a range check
on the maximum value of the CPB count to avoid the crash.

CRs-Fixed: 331496
(cherry picked from commit 2affd210070dcb28eee4c976dbadd0066cf34453)

Change-Id: Id505cfd02a0db54658eb89e76987437e5b70ea27
Merge "vidc: Fix for crash in frame parser" into ics_chocolate
vidc: vdec: Enable/Disable Time stamp prints on setprop adb command

Added flag to monitor the setprop bit for vidc.dec.debug.ts
Based on this flag timestamp will be printed in the log.
By default these prints will not appear in the log.

CRs-Fixed: 334409
(cherry picked from commit 946739a092307dfb9ed439fed2bd0b496f9fbeff)

Change-Id: I86e28617a5497da0864c9723a86ee8e3bce035d2
vidc: Fix for specific ISDB-T stream playback through test app

A specific ISDB-T stream is not playing through test app.
Fixed it by changing the input bitstream error condition
check in component. In case of arbitrary mode input bit
stream error is detected in frame parser.

CRs-Fixed: 335614
(cherry picked from commit cd79433c30f0ee372a34432d134257f5b8fe5a86)

Change-Id: I520c133c82aaf5271f625b7d29fff9793fc9eb45
vidc: Fix for secure mode crash.

In secure mode memory is never mmaped in userspace
accordingly memory should never be unmaped.
added checks as not to unmap the memory when in
secure mode.

CRs-fixed: 336365
(cherry picked from commit 1aa31132403ca9a803d9175b785b9846d5f0c828)

Change-Id: I43cd93156f087168fbcc504aace598202bcee2df
venc: Support OMX_COLOR_FormatAndroidOpaque color format

- The OMX IL Client can set color format to OMX_COLOR_FormatAndroidOpaque
  if the client is unaware of the input color format. (e.g. live effects)
- If OMX_COLOR_FormatAndroidOpaque is set, we internally map it to
  one of the supported input formats (e.g. OMX_COLOR_FormatYUV420SemiPlanar)

(cherry picked from commit 79535a226ec321df2f02d924494738091632369e)

Change-Id: Ice3ca88edc1131255fa0ee371f66206252d32482
vidc: vdec: Allocate separate fds for buffers

Made changes in allocate_output_buffer() to separate the
fds for decoder output buffers.

Change-Id: I8afb6a67b2df3387522309d0ff02f8d1fa41b794
(cherry picked from commit 77d7af1ba978c51be68e63b92575e676431c8f91)

Conflicts:

	vidc/vdec/src/omx_vdec.cpp
venc: Support OMX_COLOR_FormatAndroidOpaque color format

- The OMX IL Client can set color format to OMX_COLOR_FormatAndroidOpaque
  if the client is unaware of the input color format. (e.g. live effects)
- If OMX_COLOR_FormatAndroidOpaque is set, we internally map it to
  one of the supported input formats (e.g. OMX_COLOR_FormatYUV420SemiPlanar)

Change-Id: I611f98bb032e1791e40da9a5b84b17db0768e39b
(cherry picked from commit 79535a226ec321df2f02d924494738091632369e)
Merge "venc: Support OMX_COLOR_FormatAndroidOpaque color format" into ics_chocolate
mm-video: Create Decrypt handle internally

Decoder will create decrypt handle internally, when needed.

(cherry picked from commit 31c0e9a0f705625f88e24d976c89bdcab176b932)

Change-Id: I782e8b4c8451f74920925deae47b2f6295233029
vidc: Increase the MAX_INPUT_ERROR value

The OMX_Component errors out if the error count from video driver
exceeds MAX_INPUT_ERROR. The OMX component queues each SPS and PPS
separately and the video core returns a non-frame data recoverable
error after processing each SPS\PPS. With this change, the OMX
component can queue the max number of SPS and PPS, without
erroring out.

CRs-fixed: 337499
(cherry picked from commit 26fd32d632615f2b6ebfaf44f5db30b36a86706f)

Change-Id: Idd81a7a43b99bc8f106b892f32a3d7786e265b4b
vidc: Add slice info extradata feature for encoder

Single frame can have multiple slices/NAL units.
video driver can give slice information to
video encoder component at the end of output
bitstream if slice information extrdata enabled.

Slice info extradata can be enabled as below,
OMX_Client can call OMX_SetParameter with
index "OMX_QcomIndexParamIndexExtraDataType"
by appropriately sending third argument of
type QOMX_INDEXEXTRADATATYPE with
nPortIndex as output port number and
nIndex as "OMX_ExtraDataVideoEncoderSliceInfo".

The slice information in output buffer can be
parsed for any errors in component using
setprop command via adb shell window as below,
adb shell setprop vidc.venc.debug.sliceinfo 1

The extradata set parameter has to be called
before "OMX_IndexParamPortDefinition" else
currently driver is failing to allocate the
buffers due to buffer size mismatch.

CRs-fixed: 342914
(cherry picked from commit aedb982c4b74de69a42e49f02cf45c2f14deb936)

Change-Id: Iafb38c2ca9588ac6c9d47ae94ee2ff0c0916fe97