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

Commit 73b18ac9 authored by Kensuke Miyagi's avatar Kensuke Miyagi
Browse files

Enable support for main type cap aware demux management

Adding 3 ITuner.aidl APIs:
 - int[] getDemuxIds();
 - IDemux openDemuxById(in int demuxId);
 - DemuxInfo getDemuxInfo(in int demuxId);

And adding DemuxInfo.aidl.

Bug: 239211919
Bug: 239227510
Test: atest VtsHalTvTunerTargetTest

Change-Id: Icd34cc974a6f6fa167d90b69b3ff0a119bf50ae8
parent bab42594
Loading
Loading
Loading
Loading
+39 −0
Original line number Diff line number Diff line
/*
 * Copyright 2021 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.
 */
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
///////////////////////////////////////////////////////////////////////////////

// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
//     the interface (from the latest frozen version), the build system will
//     prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.

package android.hardware.tv.tuner;
/* @hide */
@VintfStability
parcelable DemuxInfo {
  int filterTypes = 0;
}
+3 −0
Original line number Diff line number Diff line
@@ -48,4 +48,7 @@ interface ITuner {
  void setMaxNumberOfFrontends(in android.hardware.tv.tuner.FrontendType frontendType, in int maxNumber);
  int getMaxNumberOfFrontends(in android.hardware.tv.tuner.FrontendType frontendType);
  boolean isLnaSupported();
  int[] getDemuxIds();
  android.hardware.tv.tuner.IDemux openDemuxById(in int demuxId);
  android.hardware.tv.tuner.DemuxInfo getDemuxInfo(in int demuxId);
}
+31 −0
Original line number Diff line number Diff line
/*
 * Copyright 2021 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.
 */

package android.hardware.tv.tuner;

import android.hardware.tv.tuner.DemuxFilterMainType;

/**
 * Information for the Demux.
 * @hide
 */
@VintfStability
parcelable DemuxInfo {
    /**
     * Bitwise OR of DemuxFilterMainTypes
     */
    int filterTypes = DemuxFilterMainType.UNDEFINED;
}
+30 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.hardware.tv.tuner;

import android.hardware.tv.tuner.DemuxCapabilities;
import android.hardware.tv.tuner.DemuxInfo;
import android.hardware.tv.tuner.FrontendInfo;
import android.hardware.tv.tuner.FrontendType;
import android.hardware.tv.tuner.IDemux;
@@ -65,7 +66,7 @@ interface ITuner {
    IDemux openDemux(out int[] demuxId);

    /**
     * Retrieve the Demux's Capabilities.
     * Retrieve the system wide Demux's Capabilities
     *
     * @return the Demux's Capabilities.
     */
@@ -158,4 +159,32 @@ interface ITuner {
     * @return true if supported, otherwise false
     */
    boolean isLnaSupported();

    /**
     * Get Demux IDs
     *
     * It is used by the client to get all available demuxes' IDs.
     *
     * @return an array of IDs for the available Demuxes.
     */
    int[] getDemuxIds();

    /**
     * Create a new instance of Demux given a demuxId.
     *
     * It is used by the client to create a demux instance.
     *
     * @param demuxId the id of the demux to be opened.
     *
     * @return the newly created demux interface.
     */
    IDemux openDemuxById(in int demuxId);

    /**
     * Retrieve the DemuxInfo of the specified Demux.
     *
     * @param demuxId the demux ID to query the DemuxInfo for.
     * @return the DemuxInfo of the specified Demux by demuxId.
     */
    DemuxInfo getDemuxInfo(in int demuxId);
}
+21 −1
Original line number Diff line number Diff line
@@ -31,8 +31,12 @@ namespace tuner {

#define WAIT_TIMEOUT 3000000000

Demux::Demux(int32_t demuxId, std::shared_ptr<Tuner> tuner) {
Demux::Demux(int32_t demuxId, uint32_t filterTypes) {
    mDemuxId = demuxId;
    mFilterTypes = filterTypes;
}

void Demux::setTunerService(std::shared_ptr<Tuner> tuner) {
    mTuner = tuner;
}

@@ -346,6 +350,22 @@ uint16_t Demux::getFilterTpid(int64_t filterId) {
    return mFilters[filterId]->getTpid();
}

int32_t Demux::getDemuxId() {
    return mDemuxId;
}

bool Demux::isInUse() {
    return mInUse;
}

void Demux::setInUse(bool inUse) {
    mInUse = inUse;
}

void Demux::getDemuxInfo(DemuxInfo* demuxInfo) {
    *demuxInfo = {.filterTypes = mFilterTypes};
}

void Demux::startFrontendInputLoop() {
    ALOGD("[Demux] start frontend on demux");
    // Stop current Frontend thread loop first, in case the user starts a new
Loading