samsung: add support for tvout and yamahaplayer services

Change-Id: I653f9876b7fb83734abf3a0b9b9b5af1920b8112

libmedia: renamed cflag for samsungs isSeparatedStream()

also needed on non-yamaha sound phones
BOARD_USE_YAMAHAPLAYER -> BOARD_USE_SAMSUNG_SEPARATEDSTREAM

Change-Id: I5326f4e561102df4d47152b560fe0185fa848ff5

libmedia: build with AudioParameter if needed

Usage:
BOARD_USES_LIBMEDIA_WITH_AUDIOPARAMETER := true

Change-Id: I4d33afcf2af200f70120ee9b9ee03c8830712686
Add customized parameters for qcom camera features.

Squashed commit of the following submissions to CAF:

camera: add custom camera parameters to hardware java file.

Change-Id: Ic2b363df6d25a0c3a49aed30e717d10874f533ae

Camera: Add support for wavelet denoise

Change-Id: I97be72615fe5909987ac430034bbdc16f2d20509

Camera : Add support for histogram in frameworks

Change-Id: Ibf751c3b2d488f4be0afaaa3e994372bafeffbe7

Camera: Add ZSL support in framework.

Change-Id: I4e863020d7d407d9c3936beb83dc7abf385c4654

Camera: Add touch AF/AEC support in ICS framework

In, ICS the old touch AF/AEC functions getTouchIndexAf(),
setTouchIndexAf() etc  are no longer valid. Added new functions  to get
the center of touched area.

Change-Id: I37d00040f895cd8a4de2e2a438971aa2d9c1a045

Camera: Add support for Red eye reduction

Change-Id: Iada280ac33aee8b1114dc40d8d79e0e47ad5c2fd

Conflicts:

	api/current.txt

Camera: Enable streaming texture and YV12 feature

Change-Id: I814c92b469e0f25baef0ce80338761d1e6443085

Camera: Add frameworks support for high frame rate

Change-Id: I9722e9b7e61433651ab5f76f76208853eb1fd849

Camera: Simplify ASD menu and best mode menu.

Change-Id: Ia7a1eca9268eec021a6e2c3f7ce2a932e8819d50

Camera : Macro definition change. PIXEL_FORMAT_YV12 to "yuv420p"

Why: CTS testcase is expecting "yuv420p" as the format string for YV12 mode.

CRs-Fixed: 328252
(cherry picked from commit 0a263f67b75497e4b95b9de8c370ed9496ab59ef)

Change-Id: I66f418a52775a969d81bcb332bbe500370e3ab7c

Camera: Changes for face detection

Change-Id: I7b2172e8690d6e23762e42f5888fecbfda15ba61

Camera: Add support for burst count

Change-Id: I4488a5eac1eebb0b5c8e2cc7cbbe7be0c7301be7

Camera: enable HDR feature

(cherry picked from commit e40770bbdadd925fc1e07a08249a15981b961570)

Change-Id: Ie9ca3066e8e53710bf292d047a3724aefc029854

Camera : Add API to find fullsize liveshot support

Change-Id: I3c2fc3578decbe5cf87fded5362f317df0b40b5e
(cherry picked from commit 65d80f04892776eec1c19c844eacb8c454b4bd1a)

Camera: Set default camera area string

The default invalid value for KEY_FOCUS_AREA and
KEY_METERING_AREA is changed to "(0,0,0,0,0)"
CRs-fixed: 334934

Change-Id: I354802c8611ee5c00a591b96b1a1ca04926969cb

Camera: Change the scenemode names in framework

To comply with ICS API Specification,
SCENE_MODE_AUTO changed to SCENE_MODE_ASD
SCENE_MODE_OFF changed to SCENE_MODE_AUTO

Change-Id: I8e744f10c728f469923b09f69d6d64bc5c7c6850

Camera : Framework changes for camcorder UI menu

Change-Id: Iff9e9021da44b67f81a24c828b960113ee249248

Camera : Remove unwanted video resolution in Framework

- FWVGA, WQVGA resolution UI options are removed for camcorder.

Change-Id: If621140966b01dbc8c30a4d161e6771528b8adda

Camera : Enable FWVGA and WQVGA resolutions in camcorder media profiles

Change-Id: Iad9cc33f7b6d8eb7de21df372c016edeef0b99ba

Unlock camera AWB lock only when white-balance is changed.

bug:5633546
Change-Id: I90bb4b5b445daedf38a64e2f8fb980fc0f0aaa81

Change-Id: Ie3cc15132489502e64321776d49d96846b5705d6
libstagefright: Video playback bringup

Change-Id: I2d3420a391a085045607bd618772e34d6360da2d
libstagefright: Initial commit for camcorder bringup

TBD
- Remove check in drainInputBuffers
- Remove check in getFrameSize

Change-Id: I29f4df547b3482e9e62501b7f3311af74d2efea0
libstagefright: Fix crash during 3D Video playback

The crash was observed while handling extra data in FTB.
This was due to improper assignment of buffer handle to
pBuffer. This assignement is corrected in OMX component
and hence CHECK_EQ for buffer handle in OMX nodeInstance
is removed.

Change-Id: Ib1eb206a201f2e23aec2137b64b93bcb0fc2d221
CRs-Fixed: 328535
stagefright: Allow compatibility with ICS EGL for OMX

QCOM uses the OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka
format for video buffers, which in ICS was "translated" into a different
gralloc format (0x108, HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED)

JB uses the same value for both the buffer format and the pixel format,
which the ICS Adreno libraries don't recognize. If using such libraries,
enable the conversion with the QCOM_ICS_COMPAT CFLAG

Change-Id: I85b50f193c25c88f4517677dd4a328a0c83f941c
Fix building on qcoms with incomplete configs

Change-Id: Ib5224c993ed1f03d3bd09c0f4a05d2cb7d5d1c2c
Add support for ICS audio blobs

Enable with the ICS_AUDIO_BLOB CFLAG

Change-Id: Ie174d5997202b8931c1f11db62b6ec2e377f096a
audio: Add compatibility bits to use legacy libaudio implementations

Enable with BOARD_USES_AUDIO_LEGACY, requires the use of the generic
legacy audio shim

Change-Id: I60407b48c2a8f3c9736805f31dcdef280c9aa485
libmedia: Add ICS constructor for getOutput

Used by the Tegra ICS OMX libraries

Change-Id: I2f6e7f10f11b53853626d1be86e7b2be870720f4
Add Samsung OMX and Color Format support (2/2)

Change-Id: I76ca4c2bcd61ee27156d6104f212b8ec0b491fbd
camera: Add parameters for some Samsung cameras

 * Enable with SAMSUNG_CAMERA_HARDWARE
 * Adds anti-shake, metering, and wdr modes.

Change-Id: I080c90e11fcb8fa48900c01a454868f173f61eb0
Suppress error about the missing vendor libwvm.so

Change-Id: I3a1acf74ae3d66927c3f5760fcae03aad619d139
Stagefright: Add H263 and common components of AVI/WMV container

Note: ifdef removed from omapzoom, its just constants,
      to change if required later...

Change-Id: I1ed50f1fc0467ed9ca9556df5f1d59ea088a591a
StageFright: enable mp3 audio for mp4 container

based on http://review.omapzoom.org/24931 and 24935

Change-Id: I1f998e773af6a5b3c29411879a2cc8570fb9f2f7
samsung: reenable BOARD_USE_SECTVOUT for tvout service

Change-Id: Id394849908d73277013f686eb8a730f2d348626f
audio: Temporary workaround for missing QCOM LPA

 * Temporary workaround to fix ABI

Change-Id: I7e7f44048b982ddbc843b3818861727fb473ae11
ACodec: Video bringup for NuPlayer and other fixes

- Add tile color format
- Handle Flush command in intermediate states

Change-Id: Id60e6a47d7dba39ea6febbfa55f64b6480ac54fa

Process EBD and FBD messages in ERROR state

- OMXCodec::on_message() function drops all OMX messages if
  OMXCodec is in ERROR state
- This can cause EBD/FBD messages containing valid buffers to be
  dropped
- Avoid dropping EBD/FBD messages so that buffer book-keeping is still
  possible

Change-Id: Idc1174b3fa946b26458d49394b87fba1738b228e
Signed-off-by: Iliyan Malchev <malchev@google.com>

nuplayer: Fixes in nuplayer Renderer

- Fix to allow EOS to be queued & handled even before
  a single frame is rendered. This can occur for suspend
  resume scenarios, where seek fails after resume.
- Reset the mSyncQueues flag when an EOS is queued immediately
  after seek
- Fix in AV sync calculation for video only stream's pause
  scenario

Change-Id: I881b9d0584dddde5f20da54f0501258649c9c600

NuPlayer: Fixes in NuPlayer

- Do not scan for sources during pause
- Do not create Video Decoder if Surface is not set
- Do not create Audio Decoder if Audio Sink is not set
- Enable fetchFile & BW estimate logs in LiveSession
- Enable format changed, and EOS logs in NuPlayer

Change-Id: Ia829dd6bb11fd4d1305caaa1dbac7434ea33e02f

ACodec: Support for dynamic port reconfig

- On port settings changed first flush output port
- Move ACodec to new state called FlushingOutputState
- Flush all output buffers, wait till all decoded buffers
  are rendered
- Then disable output port, and allocate output buffers
  with new resolution, and reset native window

Change-Id: Iafa266371ed2a87b909fbcb4eeae6b64208df617

NuPlayer-HLS: Support for handling seek from NuPlayer

- Seek was handled by the source by queuing discontinuity events
  individually for each stream.With this approach renderer will
  continue till discontinuity events are handled for each stream
- With the new approach Seek will be handled by NuPlayer directly
  Flush & reset decoders & renderer, then scan for sources
- Update meta data in ATSParser & AnotherPacketSource after seek
- Add a new discontinity type for HLS seek, and set it for seek

Change-Id: Iaff05b33f9a8d244cddbc53ae55219fb8568e614

libstagefright: Thumbnail mode initial commit

- DIVX and WMV are commented out for now
- Fix thumbnails for videos with non multiple of 4 width
- Fix source start assertion failure on MPEG4Source

Change-Id: I0e8974e088fdcc468e27764861c128cfe291499f
CRs-Fixed: 346285, 331371, 326063, 325461, 323538

libvideoeditor: Initial commit for VideoEditor bringup

- Add the color conversion routines of TILE4x2 to Planar and Planar
  to Semi-Planar to libI420colorconvert.so
- Set the native window buffer count to 3 for image preview
- All Features are supported, Resolutions upto 1080P are supported
  (constrained by available memory) as we need to support two codec
  instances at a time
- High and main profile clips cannot be imported
- Export is in H264 always (Coming from the app)

- NativeWindowRenderer: Fixed the green tint issue when applying
  negative effect
- M4xVSS_API: Do not go through the M4MCS path if there is an
  effect in the clip(avoid double encoding)
- M4MCS_API: Remove the limitBitRate function as we set the bitrate
  in Encoder
- VideoEditorVideoEncoder: Add a function to calculate proper bitrate
  for different quality and resolutions

- Remove the check for effects present in the project to get original
  functionality. This check would encode all clips in the project if
  an effects existed via the _EDIT path. But it fails for HP clips.
  Hence reverting it.
- Only encode in M4MCS for input profile > output profile

- When parsing a clip, add support for level 6 for simple profile
  MPEG4 clips
- However map it to level 5, since OpenMax does not have support for
  level 6

- When creating transitions, the bitrate is copied from the input file,
  if this bitrate is > 20Mbps, it results in an error.Limit this bitrate
  to max of 20Mbps

- During preview, after calling start on mVideoSource if the component
  runs into an out of memory error, then first stop the mVideoSource
  before clearing it.
  Once the source is NULL(cleared), add a check to handle that case
  and propogate it upwards to the app.

- If there is clip with begin cut time and MPEG4, then let it encode
  via the M4MCS path first. Null encoding leads to corruption - because
  in null encoding, if we have a begin cut time then it will decode
  upto that time, encode the frame at the cut time and just copy the
  rest from the reader and write to the intermediate file, resulting
  in corruption. Instead now this change will make it encode from the
  cut time all the way to the end of clip.

- For H263/MPEG4 encoding, bitrate is not reconfigured.We break out
 from the case to avoid getting into the default case.

Change-Id: I850edc1fcaad167250089644a4435bc549f1e31d

CRs-Fixed: 327213, 329321, 328501, 329324, 332373, 332959, 375291

libstagefright: Add support for mm-color-convertor

- Define structure and enums to be used by stagefright
  to interact with mm-color-convertor library
- Adds support of NV12 Tile to RGB565 color conversion
  using the qcom color convertor library.
- Use proper mangled name for color convertor API

Change-Id: Ifd87d0e56c5fe4c9f605321abdd39574415733f5
CRs-Fixed: 329591

libstagefright: Enable frame by frame mode

- Enable frame by frame for all formats - local playback & http
  streaming.
- Arbitrary mode is enabled only for specific formats by setting
  a new key (kKeyUseArbitraryMode) in extractor, for following
  formats :
  - H264 Interlaced clips
  - VC1 Advance profile clips
  - MPEG4 in AVI container
- If the arbitrary mode key is not set by the extractor, it will
  default to frame by frame mode for all video clips except
  interlaced clips.
- Adds SPS parsing functionality.

Change-Id: If8c47d0499720eead86b4c4fbe74696aba4423fb
CRs-Fixed: 322872

libstagefright: Fix to use correct HAL pixel format

Use correct HAL pixel format to update buffer geometry
using native window API for 7x27A/8x25.

Change-Id: I3602cf3e21d259a79f36db3103ab5f18ec2a1010

Conflicts:

	media/libstagefright/OMXCodec.cpp

libvideoeditor: remove header file added during bringup

This header file was added to this directory while merging
changes to JB.The header file exist in a different location.
Source code which need the header file is updated to include
correct path.

Change-Id: I95a8cb7dcc13ddb925d4e4f55fbeabbf54f9ca61

libstagefright: Ignore bad size error when parsing d263 atom.

Change-Id: Id71c6d55181d46671aba3e14bfbc4933687b180f
CRs-Fixed: 288020

libstagefright: Handle error on allocate buffer failure

Set state to error on allocate buffer failure at start(init)
of decoding.

Change-Id: Id16cb68aad95bf60aa520d1cc7378cfe0f88b65a
CRs-Fixed: 332373
Signed-off-by: Shalaj Jain <shalajj@codeaurora.org>

libstagefright: Add definitions for sync margins

- Added definitions for late and early margins in AwesomePlayer which
  are used to decide if frames should be delayed or dropped

CRs-Fixed: 276424, 297660

SampleTable: Add shortcut in getMaxSampleSize() to avoid ANR in corrupted clips

-for very large/corrupt values of mNumSampleSizes, getMaxSampleSize will
 run a very long forloop that will cause an ANR
-for cases where mDefaultSampleSize is zero, this ANR issue will not
 occur becase a check is in place for checking mNumSampleSizes corruption
-for cases where mDefaultSampleSize is non-zero, getMaxSampleSize will proceed
 to process each sample for finding max size.  But each run of
 SampleIterator::getSampleSizeDirect will return mDefaultSampleSize as the size
-a check for mDefaultSampleSize being non-zero is placed before the for loop,
 and will return mDefaultSampleSize if it is the case, skipping the entire for loop
 and avoids ANR

Change-Id: Ib2af5f18a2d15fb8efa6e1edaa2e5b46f6746fe8
CRs-Fixed: 316017

libstagefright - Squashed commits from CodeAurora

libstagefright - increase avcc atom size allowed

 - increases buffer allowed for parsing avcc atom to 1024

Change-Id: I2bd91be7f578978a6d00280f05beccfda19eea0b
CRs-Fixed: 344358, 331837

libstagefright: Release output buffer when file limit is reached in recording

There is a memory leak in video recording when the
file size or duration limits are reached. The output
buffer copy is not released before exiting the track
thread in the mpeg4 writer.

To avoid the memory leak, the buffer copy is released
when a limit condition is detected in the mpeg4 writer.

Change-Id: Idfde2083fdd9997b3025c7c12e00f3ae4665b8da
CRs-Fixed: 315255
Signed-off-by: Shalaj Jain <shalajj@codeaurora.org>

libstagefright: Remove warnings

- Treat warnings as errors
- Clean up existing warnings

Change-Id: I162e6f0586f27502c404dfcea87052a930c543ee

Check for status of OMX_UseBuffer before updating port buffer vector

- For output buffers, check if the call to OMX_UseBuffer
  was successful before updating the port buffer queue.

Change-Id: I0cdef2200349ff6be4620d4f9fe4ae96e0c263cf

StagefrightRecorder: Set intra-period to 2 seconds for video recording

Sets the video encoder intra period value to 2 seconds in
StagefrightRecorder.

Change-Id: Ic9fa16e75baa9aa8e90876f0558b3f2bdcfaa2b3

libstagefright: Fix AV sync issues

- Add edit list support for video playback.

Change-Id: If50ecebc46d97b6da4164834c5aece0345b2aeea
CRs-Fixed: 362885

frameworks/base: Add rendering statistics to Stagefright

- this adds extra fps statistics

CRs-Fixed: 345331, 338656, 334379, 325195
Change-Id: I2637e1912169e44fc136377d385c95d836813b0c

AudioFlinger: Compile AudioParameter as shared library

Change-Id: I5115ef6ba370c251b1a28e3453a154a43ae3470b

libstagefright: Ignore port settings changed event in certain cases

Ignore port settings changed event if the client has already
requested the component to move to Idle state (or any other state)
from Executing state. This scenario happens when Stop is called
immediately after Stop on OMXCodec. Since, Stop is called
so we request the component to move into Idle state and set
the state variable accordingly. In this case we might receive
port settings changed event after we have requested the
component to move into Idle state.

Change-Id: I35cb15bb582381c86f327cd874999ac05c771ee2

libstagefright: enable extended extractor

- Enable extended extractor to support proprietary Audio\Video
  format.

Change-Id: Ia586a3048420ddf1515261f20035589447263b7b

libmediaplayerservices: Enable DASH on Nuplayer framework

Change-Id: Ie9b107881867686d5ee04f19bc043c926ba7427e

Conflicts:

	media/libmediaplayerservice/nuplayer/NuPlayer.cpp

libstagefright - Fix timestamp overflow

 - change time related variables to 64 bit to avoid overflow
 - composition time calculations were having overflow in
   SampleIterator and it propagates to the rest of the time
   related information for the frames

Change-Id: I8ba25cc2ef8ceeadc63d3aa123ed7716f8d1e209
Crs-Fixed: 350349, 360150

ligstagefright: New flag GRALLOC_USAGE_PRIVATE_CP_BUFFER used for securing buffers

GRALLOC_USAGE_PROTECTED is being used by Surface flinger for protecting screen
shot. For WV L3 secure buffers are not being used, so we need a different flag
to set use or not use secure buffers.

Change-Id: I17224a978a13a344786f81df555efbe68f71918a
CRs-fixed: 348454

Conflicts:

	include/media/stagefright/OMXCodec.h
	media/libstagefright/OMXCodec.cpp

libstagefright : Fix to support additional file types in MPEG4Extractor

-Add Support for AVC1, MSNV, mmp4, FACE, wmf and ftyp's k3g1, skm3, mp41
 file types in SniffMPEG4 function.
-Function returns true if the header contains one of these
 filetypes.

Change-Id: I569c9ab783b013401f095edf3959748b1e47d370
CRs-Fixed: 253907, 257978, 263296

libstagefright: Do not populate sync sample index if none present

- While an A/V clip in playback, seek fails to desired location
  and starts playback from zero position.
- The stss atom has zero entry count and sync sample index for Audio
  track. Due to this seek fails and starts playback from zero position.
- Do not return sync sample index as zero when no sample is present. Just
  return the original value back.

Change-Id: I1bd222006a9b61d58c3157773c540c7ab5327016
CRs-Fixed: 271385

libstagefright: Enable timestamp reordering for mpeg4 and vc1 clips

Enables timestamp reordering when decoding:
- All VC1 bitstreams
- Mpeg4 bitstreams contained in AVI file format

Timestamp reordering is enabled only for qcom codecs.

Change-Id: I8da7e7a6c0ccced1965cc5c2204879288b57cbe0
CRs-Fixed: 339035

libstagefright: Fix for CTS MediaRecorder test cases

The static keyword in a declaration of a local variable in an
mpeg4 writer function is causing the variable to be initialized
only the first time the function is called.

Because of this, the variable is not being re-initialized properly
when the function is called again on subsequent record attempts,
leading to a recording error.

This change removes the static keyword from the variable
declaration.

Change-Id: Ifb1348eb38377c844e2e024bface8c735271045c
CRs-Fixed: 346553

libstagefright : Fix to prevent CHECK failures for YAMATO format

-Fix to prevent CHECK failures for YAMATO format.
-Removes unused code related to YAMATO format.

Change-Id: Iadf972b1234dd3ea0caebc9678ec32d875db18a6

Conflicts:

	media/libstagefright/OMXCodec.cpp
frameworks/base: enable meta mode for 7x27a video encoder

msm7627a family of chipsets supports only one input frame at
one time. camera expects the input frame to be released before
sending another frame. so send one input buffer and available
output bufefrs to video encoder component. release the input
buffer to camera (to get another frame) after receiving input
frame done callback from video encoder component.

Change-Id: I8fbc911f046ff7e2a3047dd65d8c09ac2d8608e1
stagefright: Fix encoder startup failure on 7x27

Framerate value on output port can't be zero, that value causes the
encoder init to abort entirely.
Higher values must be used, and on 7x27 VidEnc it apparently must match
the input bitrate, since the value is used for rate control. Lower values
result in:

E/VENC_ENC( 2565): VENC_ERROR venci_do_rate_control_camcorder::5077 time delta is less than 1
E/VENC_ENC( 2565): VENC_ERROR venci_arm_encode::5586 time delta is less than 1

Change-Id: I7070514040e5bdedae7f360fa4df502bca158439