Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2c460781 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

release-request-fda658d8-eecf-4c78-a2e9-e5093ca10451-for-git_oc-mr1-release-41...

release-request-fda658d8-eecf-4c78-a2e9-e5093ca10451-for-git_oc-mr1-release-4165363 snap-temp-L49300000080728237

Change-Id: Ic044409c5fb111320432d03d8032ca25abf6c5e8
parents 64905ef0 6f6840a9
Loading
Loading
Loading
Loading
+0 −238
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2017 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://schemas.android.com/audio/audio_effects_conf/v2_0"
           xmlns:aec="http://schemas.android.com/audio/audio_effects_conf/v2_0"
           elementFormDefault="qualified">

  <!-- Simple types -->
  <xs:simpleType name="versionType">
    <xs:restriction base="xs:decimal">
      <xs:enumeration value="2.0"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="uuidType">
    <xs:restriction base="xs:string">
      <xs:pattern value="[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="streamInputType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="mic"/>
      <xs:enumeration value="voice_uplink"/>
      <xs:enumeration value="voice_downlink"/>
      <xs:enumeration value="voice_call"/>
      <xs:enumeration value="camcorder"/>
      <xs:enumeration value="voice_recognition"/>
      <xs:enumeration value="voice_communication"/>
      <xs:enumeration value="unprocessed"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="streamOutputType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="default"/>
      <xs:enumeration value="voice_call"/>
      <xs:enumeration value="system"/>
      <xs:enumeration value="ring"/>
      <xs:enumeration value="music"/>
      <xs:enumeration value="alarm"/>
      <xs:enumeration value="notification"/>
      <xs:enumeration value="bluetooth_sco"/>
      <xs:enumeration value="enforced_audible"/>
      <xs:enumeration value="dtmf"/>
      <xs:enumeration value="tts"/>
    </xs:restriction>
  </xs:simpleType>

  <!-- Complex types -->
  <xs:complexType name="libraryType">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        List of effect libraries to load. Each library element must have "name" and
        "path" attributes. The latter is giving the full path of the library .so file.

        Example:

        <library name="name" path="/vendor/lib/soundfx/lib.so"/>

      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="library" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="name" type="xs:string" use="required"/>
          <xs:attribute name="path" type="xs:string" use="required"/>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="effectImplType">
    <xs:attribute name="library" type="xs:string" use="required"/>
    <xs:attribute name="uuid" type="aec:uuidType" use="required"/>
  </xs:complexType>
  <xs:complexType name="effectProxyType">
    <xs:complexContent>
      <xs:extension base="aec:effectImplType">
        <xs:sequence>
          <xs:element name="libsw" type="aec:effectImplType" minOccurs="0" maxOccurs="1"/>
          <xs:element name="libhw" type="aec:effectImplType" minOccurs="0" maxOccurs="1"/>
        </xs:sequence>
        <xs:attribute name="name" type="xs:string" use="required"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="effectType">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        List of effects to load. Each effect element must contain "name",
        "library", and "uuid" attrs. The value of the "library" attr must
        correspond to the name of a "library" element. The name of the effect
        element is indicative, only the value of the "uuid" element designates
        the effect for the audio framework.  The uuid is the implementation
        specific UUID as specified by the effect vendor. This is not the generic
        effect type UUID.

        For effect proxy implementations, SW and HW implemetations of the effect
        can be specified.

        Example:

        <effect name="name" library="lib" uuid="uuuu"/>
        <effect name="proxied" library="proxy" uuid="xxxx">
            <libsw library="sw_bundle" uuid="yyyy"/>
            <libhw library="offload_bundle" uuid="zzzz"/>
        </effect>

      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="effect" type="aec:effectProxyType" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="streamProcessingType">
    <xs:sequence>
      <xs:element name="apply" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="effect" type="xs:string" use="required"/>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="streamPreprocessType">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Audio preprocessing configuration. The processing configuration consists
        of a list of elements each describing processing settings for a given
        input stream. Valid input stream types are listed in "streamInputType".

        Each stream element contains a list of "apply" elements. The value of the
        "effect" attr must correspond to the name of an "effect" element.

        Example:

        <stream type="voice_communication">
            <apply effect="effect1"/>
            <apply effect="effect2"/>
        </stream>

      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="aec:streamProcessingType">
        <xs:attribute name="type" type="aec:streamInputType" use="required"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="streamPostprocessType">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Audio postprocessing configuration. The processing configuration consists
        of a list of elements each describing processing settings for a given
        output stream. Valid output stream types are listed in "streamOutputType".

        Each stream element contains a list of "apply" elements. The value of the
        "effect" attr must correspond to the name of an "effect" element.

        Example:

        <stream type="music">
            <apply effect="effect1"/>
        </stream>

      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="aec:streamProcessingType">
        <xs:attribute name="type" type="aec:streamOutputType" use="required"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!-- Root element -->
  <xs:element name="audio_effects_conf">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="libraries" type="aec:libraryType"/>
        <xs:element name="effects" type="aec:effectType"/>
        <xs:element name="postprocess" minOccurs="0" maxOccurs="1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="stream" type="aec:streamPostprocessType" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="preprocess" minOccurs="0" maxOccurs="1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="stream" type="aec:streamPreprocessType" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="version" type="aec:versionType" use="required"/>
    </xs:complexType>

    <!-- Keys and references -->
    <xs:key name="libraryName">
      <xs:selector xpath="aec:libraries/aec:library"/>
      <xs:field xpath="@name"/>
    </xs:key>
    <xs:keyref name="libraryNameRef1" refer="aec:libraryName">
      <xs:selector xpath="aec:effects/aec:effect"/>
      <xs:field xpath="@library"/>
    </xs:keyref>
    <xs:keyref name="libraryNameRef2" refer="aec:libraryName">
      <xs:selector xpath="aec:effects/aec:effect/aec:libsw"/>
      <xs:field xpath="@library"/>
    </xs:keyref>
    <xs:keyref name="libraryNameRef3" refer="aec:libraryName">
      <xs:selector xpath="aec:effects/aec:effect/aec:libhw"/>
      <xs:field xpath="@library"/>
    </xs:keyref>
    <xs:key name="effectName">
      <xs:selector xpath="aec:effects/aec:effect"/>
      <xs:field xpath="@name"/>
    </xs:key>
    <xs:keyref name="effectNamePreRef" refer="aec:effectName">
      <xs:selector xpath="aec:preprocess/aec:stream/aec:apply"/>
      <xs:field xpath="@effect"/>
    </xs:keyref>
    <xs:keyref name="effectNamePostRef" refer="aec:effectName">
      <xs:selector xpath="aec:postprocess/aec:stream/aec:apply"/>
      <xs:field xpath="@effect"/>
    </xs:keyref>
  </xs:element>
</xs:schema>
+0 −41
Original line number Diff line number Diff line
@@ -46,47 +46,6 @@ using ::android::sp;
#include <media_hidl_test_common.h>
#include <memory>

Return<android::hardware::media::omx::V1_0::Status> setAudioPortFormat(
    sp<IOmxNode> omxNode, OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE eEncoding) {
    OMX_U32 index = 0;
    OMX_AUDIO_PARAM_PORTFORMATTYPE portFormat;
    std::vector<OMX_AUDIO_CODINGTYPE> arrEncoding;
    android::hardware::media::omx::V1_0::Status status;

    while (1) {
        portFormat.nIndex = index;
        status = getPortParam(omxNode, OMX_IndexParamAudioPortFormat, portIndex,
                              &portFormat);
        if (status != ::android::hardware::media::omx::V1_0::Status::OK) break;
        arrEncoding.push_back(portFormat.eEncoding);
        index++;
        if (index == 512) {
            // enumerated way too many formats, highly unusual for this to
            // happen.
            EXPECT_LE(index, 512U)
                << "Expecting OMX_ErrorNoMore but not received";
            break;
        }
    }
    if (!index) return status;
    for (index = 0; index < arrEncoding.size(); index++) {
        if (arrEncoding[index] == eEncoding) {
            portFormat.eEncoding = arrEncoding[index];
            break;
        }
    }
    if (index == arrEncoding.size()) {
        ALOGE("setting default Port format %x", (int)arrEncoding[0]);
        portFormat.eEncoding = arrEncoding[0];
    }
    // In setParam call nIndex shall be ignored as per omx-il specification.
    // see how this holds up by corrupting nIndex
    portFormat.nIndex = RANDOM_INDEX;
    status = setPortParam(omxNode, OMX_IndexParamAudioPortFormat, portIndex,
                          &portFormat);
    return status;
}

void enumerateProfile(sp<IOmxNode> omxNode, OMX_U32 portIndex,
                      std::vector<int32_t>* arrProfile) {
    android::hardware::media::omx::V1_0::Status status;
+0 −8
Original line number Diff line number Diff line
@@ -19,17 +19,9 @@

#include <media_hidl_test_common.h>

/*
 * Random Index used for monkey testing while get/set parameters
 */
#define RANDOM_INDEX 1729

/*
 * Common audio utils
 */
Return<android::hardware::media::omx::V1_0::Status> setAudioPortFormat(
    sp<IOmxNode> omxNode, OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE eEncoding);

void enumerateProfile(sp<IOmxNode> omxNode, OMX_U32 portIndex,
                      std::vector<int32_t>* arrProfile);

+107 −0
Original line number Diff line number Diff line
@@ -60,6 +60,113 @@ Return<android::hardware::media::omx::V1_0::Status> setRole(
    return setParam(omxNode, OMX_IndexParamStandardComponentRole, &params);
}

// get/set video component port format
Return<android::hardware::media::omx::V1_0::Status> setVideoPortFormat(
    sp<IOmxNode> omxNode, OMX_U32 portIndex,
    OMX_VIDEO_CODINGTYPE eCompressionFormat, OMX_COLOR_FORMATTYPE eColorFormat,
    OMX_U32 xFramerate) {
    OMX_U32 index = 0;
    OMX_VIDEO_PARAM_PORTFORMATTYPE portFormat;
    std::vector<OMX_COLOR_FORMATTYPE> arrColorFormat;
    std::vector<OMX_VIDEO_CODINGTYPE> arrCompressionFormat;
    android::hardware::media::omx::V1_0::Status status;

    while (1) {
        portFormat.nIndex = index;
        status = getPortParam(omxNode, OMX_IndexParamVideoPortFormat, portIndex,
                              &portFormat);
        if (status != ::android::hardware::media::omx::V1_0::Status::OK) break;
        if (eCompressionFormat == OMX_VIDEO_CodingUnused)
            arrColorFormat.push_back(portFormat.eColorFormat);
        else
            arrCompressionFormat.push_back(portFormat.eCompressionFormat);
        index++;
        if (index == 512) {
            // enumerated way too many formats, highly unusual for this to
            // happen.
            EXPECT_LE(index, 512U)
                << "Expecting OMX_ErrorNoMore but not received";
            break;
        }
    }
    if (!index) return status;
    if (eCompressionFormat == OMX_VIDEO_CodingUnused) {
        for (index = 0; index < arrColorFormat.size(); index++) {
            if (arrColorFormat[index] == eColorFormat) {
                portFormat.eColorFormat = arrColorFormat[index];
                break;
            }
        }
        if (index == arrColorFormat.size()) {
            ALOGE("setting default color format %x", (int)arrColorFormat[0]);
            portFormat.eColorFormat = arrColorFormat[0];
        }
        portFormat.eCompressionFormat = OMX_VIDEO_CodingUnused;
    } else {
        for (index = 0; index < arrCompressionFormat.size(); index++) {
            if (arrCompressionFormat[index] == eCompressionFormat) {
                portFormat.eCompressionFormat = arrCompressionFormat[index];
                break;
            }
        }
        if (index == arrCompressionFormat.size()) {
            ALOGE("setting default compression format %x",
                  (int)arrCompressionFormat[0]);
            portFormat.eCompressionFormat = arrCompressionFormat[0];
        }
        portFormat.eColorFormat = OMX_COLOR_FormatUnused;
    }
    // In setParam call nIndex shall be ignored as per omx-il specification.
    // see how this holds up by corrupting nIndex
    portFormat.nIndex = RANDOM_INDEX;
    portFormat.xFramerate = xFramerate;
    status = setPortParam(omxNode, OMX_IndexParamVideoPortFormat, portIndex,
                          &portFormat);
    return status;
}

// get/set audio component port format
Return<android::hardware::media::omx::V1_0::Status> setAudioPortFormat(
    sp<IOmxNode> omxNode, OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE eEncoding) {
    OMX_U32 index = 0;
    OMX_AUDIO_PARAM_PORTFORMATTYPE portFormat;
    std::vector<OMX_AUDIO_CODINGTYPE> arrEncoding;
    android::hardware::media::omx::V1_0::Status status;

    while (1) {
        portFormat.nIndex = index;
        status = getPortParam(omxNode, OMX_IndexParamAudioPortFormat, portIndex,
                              &portFormat);
        if (status != ::android::hardware::media::omx::V1_0::Status::OK) break;
        arrEncoding.push_back(portFormat.eEncoding);
        index++;
        if (index == 512) {
            // enumerated way too many formats, highly unusual for this to
            // happen.
            EXPECT_LE(index, 512U)
                << "Expecting OMX_ErrorNoMore but not received";
            break;
        }
    }
    if (!index) return status;
    for (index = 0; index < arrEncoding.size(); index++) {
        if (arrEncoding[index] == eEncoding) {
            portFormat.eEncoding = arrEncoding[index];
            break;
        }
    }
    if (index == arrEncoding.size()) {
        ALOGE("setting default Port format %x", (int)arrEncoding[0]);
        portFormat.eEncoding = arrEncoding[0];
    }
    // In setParam call nIndex shall be ignored as per omx-il specification.
    // see how this holds up by corrupting nIndex
    portFormat.nIndex = RANDOM_INDEX;
    status = setPortParam(omxNode, OMX_IndexParamAudioPortFormat, portIndex,
                          &portFormat);
    return status;
}

// allocate buffers needed on a component port
void allocatePortBuffers(sp<IOmxNode> omxNode,
                         android::Vector<BufferInfo>* buffArray,
+13 −0
Original line number Diff line number Diff line
@@ -36,6 +36,11 @@
#define DEFAULT_TIMEOUT 100000
#define TIMEOUT_COUNTER (10000000 / DEFAULT_TIMEOUT)

/*
 * Random Index used for monkey testing while get/set parameters
 */
#define RANDOM_INDEX 1729

enum bufferOwner {
    client,
    component,
@@ -259,6 +264,14 @@ Return<android::hardware::media::omx::V1_0::Status> setPortConfig(
Return<android::hardware::media::omx::V1_0::Status> setRole(
    sp<IOmxNode> omxNode, const char* role);

Return<android::hardware::media::omx::V1_0::Status> setVideoPortFormat(
    sp<IOmxNode> omxNode, OMX_U32 portIndex,
    OMX_VIDEO_CODINGTYPE eCompressionFormat, OMX_COLOR_FORMATTYPE eColorFormat,
    OMX_U32 xFramerate);

Return<android::hardware::media::omx::V1_0::Status> setAudioPortFormat(
    sp<IOmxNode> omxNode, OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE eEncoding);

void allocatePortBuffers(sp<IOmxNode> omxNode,
                         android::Vector<BufferInfo>* buffArray,
                         OMX_U32 portIndex,
Loading