vidc: venc: add maximum allowed bitrate check parameter

Bitrate for video encoder cannot be set beyond
the maximum suported bitrate for the set profile
and level. This change will enable maximum allowed
bitrate check condition (via OMX_SetParameter with
index 'OMX_QcomIndexParamVideoMaxAllowedBitrateCheck')
and return error if bitrate is more than the set
profile & level maximum supported bitrate.

CRs-fixed: 345105
(cherry picked from commit 03c4b8693e18ede01c9eaa69fd11e3e2fabcafa9)

Change-Id: Ic6b418042c95c7072d7c825763a422918f81ea26
vidc: vdec: Fix possibility of NULL pointer access

Code changes were made to take care possibility of
NULL pointer access and also to take care the use
of uninitialized variable.

CRs-Fixed: 345440
(cherry picked from commit 05023abdba5e5fb5068ed95543ecba4e9edc7c22)

Change-Id: Ifa2c9937c57304d2efe6c4eec863bbabda6155f0
vidc: venc: Update encoder test app to support ION

Encoder test app is updated with ION allocation and
free for input and output buffers.

Change-Id: Ifa2c4fcb5d05e2ca6ee4d2672449a7af3b0db85d
CRs-Fixed: 334525
(cherry picked from commit e481706c66b39498c41195c1e3e14305010aabe7)
mm-video: vidc: Try to open secure video decoder again.

Try to open secure video decoder again if first
open fails.

Change-Id: I09c6f1db00ef62e023e2640cc17f0dc81f49911e
mm-video: vidc: Parse Seq start code and Entry point code for VC1

With out this change, the decoder test app parser was sending the
sequence start code and entry point start code at the end of the
current frame. Hence there was no reconfig message coming from
the video core. This change will prepend the seq start code and
entry point start code data at the start of the next frame, as
expected by the video core.

This change is required in the decoder test app parser to
support reconfig data in vc1 bitstream.

CRs-fixed: 342166
(cherry picked from commit 93dc6b4fbf5c4edf2c599a293a3b3ffcd4e63471)

Change-Id: I1657b94b5f6eeef270acef4a59f99408342eacfb
mm-video:vidc: Avoid dead lock & NULL pointer access

Added code to take care of possible dead-lock before exiting the
function. Also, added code to take care of NULL pointer access
in the code.

CRs-fixed: 346588
(cherry picked from commit d8fedf1ccef2e7c42632baa423bc77f37f758c9d)

Change-Id: Icb617fd60732ca13efaa400578150cec531afdb3
vidc: Fix issues raised by klockwork

Remove banned function scanf and replace it with fgets-sscanf

CRs-Fixed: 346588
(cherry picked from commit e053413efff8f8dccf98e9cfe6f90797f8218603)

Change-Id: Id598adcc56fac5d4fe75875d699d6ac5b695c2cc
mm-video: vidc: Fix incorrect parsing of vdec test app command line args

While executing decoder test app in single command line mode, there is
an incorrect extra read of nalSize for H264 arbitrary bytes modes. It
is breaking the test app functionality. This change fixes this problem
and updates nalSize only if NAL size option is selected for H264 decoder.

CRs-fixed: 352493
(cherry picked from commit 24bef2715a36a57153003ca487efe63fe3d2bb98)

Change-Id: I180bb52a1ef51ed3290fa92dea7e8043d7487370
Use O_SYNC for pmem device.

Necessary as usageflags are indicates an uncached
device. Without O_SYNC buffers become corrupt leading to
HW_ERRORS in vidc.

This commit will hopefully fix the video playback issue.

Change-Id: I2fe8d1ce6b8aa93c608c0fb41f94b6f0484a42c2
vidc: use O_SYNC instead of O_DSYNC

Change-Id: I1c540a425147b55ddf627ad3eb0de3e88511e5b6