Merge "Split FrontendSettings and move to frontend package"

This commit is contained in:
TreeHugger Robot
2020-01-08 02:25:44 +00:00
committed by Android (Google) Code Review
16 changed files with 503 additions and 284 deletions

View File

@@ -19,8 +19,6 @@ package android.media.tv.tuner;
import android.annotation.SystemApi;
import android.media.tv.tuner.TunerConstants.FrontendSettingsType;
import java.util.List;
/**
* Frontend settings for tune and scan operations.
* @hide
@@ -29,7 +27,8 @@ import java.util.List;
public abstract class FrontendSettings {
private final int mFrequency;
FrontendSettings(int frequency) {
/** @hide */
public FrontendSettings(int frequency) {
mFrequency = frequency;
}
@@ -48,282 +47,4 @@ public abstract class FrontendSettings {
return mFrequency;
}
// TODO: use hal constants for enum fields
// TODO: javaDoc
// TODO: add builders and getters for other settings type
/**
* Frontend settings for analog.
* @hide
*/
public static class FrontendAnalogSettings extends FrontendSettings {
private int mAnalogType;
private int mSifStandard;
@Override
public int getType() {
return TunerConstants.FRONTEND_TYPE_ANALOG;
}
public int getAnalogType() {
return mAnalogType;
}
public int getSifStandard() {
return mSifStandard;
}
/**
* Creates a new builder object.
*/
public static Builder newBuilder() {
return new Builder();
}
private FrontendAnalogSettings(int frequency, int analogType, int sifStandard) {
super(frequency);
mAnalogType = analogType;
mSifStandard = sifStandard;
}
/**
* Builder for FrontendAnalogSettings.
*/
public static class Builder {
private int mFrequency;
private int mAnalogType;
private int mSifStandard;
private Builder() {}
/**
* Sets frequency.
*/
public Builder setFrequency(int frequency) {
mFrequency = frequency;
return this;
}
/**
* Sets analog type.
*/
public Builder setAnalogType(int analogType) {
mAnalogType = analogType;
return this;
}
/**
* Sets sif standard.
*/
public Builder setSifStandard(int sifStandard) {
mSifStandard = sifStandard;
return this;
}
/**
* Builds a FrontendAnalogSettings instance.
*/
public FrontendAnalogSettings build() {
return new FrontendAnalogSettings(mFrequency, mAnalogType, mSifStandard);
}
}
}
/**
* Frontend settings for ATSC.
* @hide
*/
public static class FrontendAtscSettings extends FrontendSettings {
public int modulation;
FrontendAtscSettings(int frequency) {
super(frequency);
}
@Override
public int getType() {
return TunerConstants.FRONTEND_TYPE_ATSC;
}
}
/**
* Frontend settings for ATSC-3.
* @hide
*/
public static class FrontendAtsc3Settings extends FrontendSettings {
public int bandwidth;
public byte demodOutputFormat;
public List<FrontendAtsc3PlpSettings> plpSettings;
FrontendAtsc3Settings(int frequency) {
super(frequency);
}
@Override
public int getType() {
return TunerConstants.FRONTEND_TYPE_ATSC3;
}
}
/**
* Frontend settings for DVBS.
* @hide
*/
public static class FrontendDvbsSettings extends FrontendSettings {
public int modulation;
public FrontendDvbsCodeRate coderate;
public int symbolRate;
public int rolloff;
public int pilot;
public int inputStreamId;
public byte standard;
FrontendDvbsSettings(int frequency) {
super(frequency);
}
@Override
public int getType() {
return TunerConstants.FRONTEND_TYPE_DVBS;
}
}
/**
* Frontend settings for DVBC.
* @hide
*/
public static class FrontendDvbcSettings extends FrontendSettings {
public int modulation;
public long fec;
public int symbolRate;
public int outerFec;
public byte annex;
public int spectralInversion;
FrontendDvbcSettings(int frequency) {
super(frequency);
}
@Override
public int getType() {
return TunerConstants.FRONTEND_TYPE_DVBC;
}
}
/**
* Frontend settings for DVBT.
* @hide
*/
public static class FrontendDvbtSettings extends FrontendSettings {
public int transmissionMode;
public int bandwidth;
public int constellation;
public int hierarchy;
public int hpCoderate;
public int lpCoderate;
public int guardInterval;
public boolean isHighPriority;
public byte standard;
public boolean isMiso;
public int plpMode;
public byte plpId;
public byte plpGroupId;
FrontendDvbtSettings(int frequency) {
super(frequency);
}
@Override
public int getType() {
return TunerConstants.FRONTEND_TYPE_DVBT;
}
}
/**
* Frontend settings for ISDBS.
* @hide
*/
public static class FrontendIsdbsSettings extends FrontendSettings {
public int streamId;
public int streamIdType;
public int modulation;
public int coderate;
public int symbolRate;
public int rolloff;
FrontendIsdbsSettings(int frequency) {
super(frequency);
}
@Override
public int getType() {
return TunerConstants.FRONTEND_TYPE_ISDBS;
}
}
/**
* Frontend settings for ISDBS-3.
* @hide
*/
public static class FrontendIsdbs3Settings extends FrontendSettings {
public int streamId;
public int streamIdType;
public int modulation;
public int coderate;
public int symbolRate;
public int rolloff;
FrontendIsdbs3Settings(int frequency) {
super(frequency);
}
@Override
public int getType() {
return TunerConstants.FRONTEND_TYPE_ISDBS3;
}
}
/**
* Frontend settings for ISDBT.
* @hide
*/
public static class FrontendIsdbtSettings extends FrontendSettings {
public int modulation;
public int bandwidth;
public int coderate;
public int guardInterval;
public int serviceAreaId;
FrontendIsdbtSettings(int frequency) {
super(frequency);
}
@Override
public int getType() {
return TunerConstants.FRONTEND_TYPE_ISDBT;
}
}
/**
* PLP settings for ATSC-3.
* @hide
*/
public static class FrontendAtsc3PlpSettings {
public byte plpId;
public int modulation;
public int interleaveMode;
public int codeRate;
public int fec;
}
/**
* Code rate for DVBS.
* @hide
*/
public static class FrontendDvbsCodeRate {
public long fec;
public boolean isLinear;
public boolean isShortFrames;
public int bitsPer1000Symbol;
}
}

View File

@@ -33,6 +33,8 @@ import android.media.tv.tuner.TunerConstants.LnbVoltage;
import android.media.tv.tuner.TunerConstants.Result;
import android.media.tv.tuner.filter.FilterEvent;
import android.media.tv.tuner.frontend.FrontendCallback;
import android.media.tv.tuner.frontend.FrontendInfo;
import android.media.tv.tuner.frontend.FrontendStatus;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;

View File

@@ -22,7 +22,7 @@ import android.os.NativeHandle;
* Media event.
* @hide
*/
public class MediaEvent {
public class MediaEvent extends FilterEvent {
private int mStreamId;
private boolean mIsPtsPresent;
private long mPts;

View File

@@ -0,0 +1,97 @@
/*
* Copyright 2019 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.media.tv.tuner.frontend;
import android.media.tv.tuner.FrontendSettings;
import android.media.tv.tuner.TunerConstants;
/**
* Frontend settings for analog.
* @hide
*/
public class AnalogFrontendSettings extends FrontendSettings {
private int mAnalogType;
private int mSifStandard;
@Override
public int getType() {
return TunerConstants.FRONTEND_TYPE_ANALOG;
}
public int getAnalogType() {
return mAnalogType;
}
public int getSifStandard() {
return mSifStandard;
}
/**
* Creates a new builder object.
*/
public static Builder newBuilder() {
return new Builder();
}
private AnalogFrontendSettings(int frequency, int analogType, int sifStandard) {
super(frequency);
mAnalogType = analogType;
mSifStandard = sifStandard;
}
/**
* Builder for FrontendAnalogSettings.
*/
public static class Builder {
private int mFrequency;
private int mAnalogType;
private int mSifStandard;
private Builder() {}
/**
* Sets frequency.
*/
public Builder setFrequency(int frequency) {
mFrequency = frequency;
return this;
}
/**
* Sets analog type.
*/
public Builder setAnalogType(int analogType) {
mAnalogType = analogType;
return this;
}
/**
* Sets sif standard.
*/
public Builder setSifStandard(int sifStandard) {
mSifStandard = sifStandard;
return this;
}
/**
* Builds a FrontendAnalogSettings instance.
*/
public AnalogFrontendSettings build() {
return new AnalogFrontendSettings(mFrequency, mAnalogType, mSifStandard);
}
}
}

View File

@@ -0,0 +1,42 @@
/*
* Copyright 2019 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.media.tv.tuner.frontend;
import android.media.tv.tuner.FrontendSettings;
import android.media.tv.tuner.TunerConstants;
import java.util.List;
/**
* Frontend settings for ATSC-3.
* @hide
*/
public class Atsc3FrontendSettings extends FrontendSettings {
public int bandwidth;
public byte demodOutputFormat;
public List<Atsc3PlpSettings> plpSettings;
Atsc3FrontendSettings(int frequency) {
super(frequency);
}
@Override
public int getType() {
return TunerConstants.FRONTEND_TYPE_ATSC3;
}
}

View File

@@ -0,0 +1,29 @@
/*
* Copyright 2019 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.media.tv.tuner.frontend;
/**
* PLP settings for ATSC-3.
* @hide
*/
public class Atsc3PlpSettings {
public byte plpId;
public int modulation;
public int interleaveMode;
public int codeRate;
public int fec;
}

View File

@@ -0,0 +1,37 @@
/*
* Copyright 2019 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.media.tv.tuner.frontend;
import android.media.tv.tuner.FrontendSettings;
import android.media.tv.tuner.TunerConstants;
/**
* Frontend settings for ATSC.
* @hide
*/
public class AtscFrontendSettings extends FrontendSettings {
public int modulation;
AtscFrontendSettings(int frequency) {
super(frequency);
}
@Override
public int getType() {
return TunerConstants.FRONTEND_TYPE_ATSC;
}
}

View File

@@ -0,0 +1,42 @@
/*
* Copyright 2019 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.media.tv.tuner.frontend;
import android.media.tv.tuner.FrontendSettings;
import android.media.tv.tuner.TunerConstants;
/**
* Frontend settings for DVBC.
* @hide
*/
public class DvbcFrontendSettings extends FrontendSettings {
public int modulation;
public long fec;
public int symbolRate;
public int outerFec;
public byte annex;
public int spectralInversion;
DvbcFrontendSettings(int frequency) {
super(frequency);
}
@Override
public int getType() {
return TunerConstants.FRONTEND_TYPE_DVBC;
}
}

View File

@@ -0,0 +1,28 @@
/*
* Copyright 2019 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.media.tv.tuner.frontend;
/**
* Code rate for DVBS.
* @hide
*/
public class DvbsCodeRate {
public long fec;
public boolean isLinear;
public boolean isShortFrames;
public int bitsPer1000Symbol;
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright 2019 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.media.tv.tuner.frontend;
import android.media.tv.tuner.FrontendSettings;
import android.media.tv.tuner.TunerConstants;
/**
* Frontend settings for DVBS.
* @hide
*/
public class DvbsFrontendSettings extends FrontendSettings {
public int modulation;
public DvbsCodeRate coderate;
public int symbolRate;
public int rolloff;
public int pilot;
public int inputStreamId;
public byte standard;
DvbsFrontendSettings(int frequency) {
super(frequency);
}
@Override
public int getType() {
return TunerConstants.FRONTEND_TYPE_DVBS;
}
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright 2019 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.media.tv.tuner.frontend;
import android.media.tv.tuner.FrontendSettings;
import android.media.tv.tuner.TunerConstants;
/**
* Frontend settings for DVBT.
* @hide
*/
public class DvbtFrontendSettings extends FrontendSettings {
public int transmissionMode;
public int bandwidth;
public int constellation;
public int hierarchy;
public int hpCoderate;
public int lpCoderate;
public int guardInterval;
public boolean isHighPriority;
public byte standard;
public boolean isMiso;
public int plpMode;
public byte plpId;
public byte plpGroupId;
DvbtFrontendSettings(int frequency) {
super(frequency);
}
@Override
public int getType() {
return TunerConstants.FRONTEND_TYPE_DVBT;
}
}

View File

@@ -14,8 +14,9 @@
* limitations under the License.
*/
package android.media.tv.tuner;
package android.media.tv.tuner.frontend;
import android.media.tv.tuner.FrontendCapabilities;
import android.media.tv.tuner.TunerConstants.FrontendType;
/**

View File

@@ -14,8 +14,9 @@
* limitations under the License.
*/
package android.media.tv.tuner;
package android.media.tv.tuner.frontend;
import android.media.tv.tuner.TunerConstants;
import android.media.tv.tuner.TunerConstants.FrontendDvbcSpectralInversion;
import android.media.tv.tuner.TunerConstants.FrontendDvbtHierarchy;
import android.media.tv.tuner.TunerConstants.FrontendInnerFec;

View File

@@ -0,0 +1,42 @@
/*
* Copyright 2019 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.media.tv.tuner.frontend;
import android.media.tv.tuner.FrontendSettings;
import android.media.tv.tuner.TunerConstants;
/**
* Frontend settings for ISDBS-3.
* @hide
*/
public class Isdbs3FrontendSettings extends FrontendSettings {
public int streamId;
public int streamIdType;
public int modulation;
public int coderate;
public int symbolRate;
public int rolloff;
Isdbs3FrontendSettings(int frequency) {
super(frequency);
}
@Override
public int getType() {
return TunerConstants.FRONTEND_TYPE_ISDBS3;
}
}

View File

@@ -0,0 +1,42 @@
/*
* Copyright 2019 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.media.tv.tuner.frontend;
import android.media.tv.tuner.FrontendSettings;
import android.media.tv.tuner.TunerConstants;
/**
* Frontend settings for ISDBS.
* @hide
*/
public class IsdbsFrontendSettings extends FrontendSettings {
public int streamId;
public int streamIdType;
public int modulation;
public int coderate;
public int symbolRate;
public int rolloff;
IsdbsFrontendSettings(int frequency) {
super(frequency);
}
@Override
public int getType() {
return TunerConstants.FRONTEND_TYPE_ISDBS;
}
}

View File

@@ -0,0 +1,42 @@
/*
* Copyright 2019 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.media.tv.tuner.frontend;
import android.media.tv.tuner.FrontendSettings;
import android.media.tv.tuner.TunerConstants;
/**
* Frontend settings for ISDBT.
* @hide
*/
public class IsdbtFrontendSettings extends FrontendSettings {
public int modulation;
public int bandwidth;
public int coderate;
public int guardInterval;
public int serviceAreaId;
IsdbtFrontendSettings(int frequency) {
super(frequency);
}
@Override
public int getType() {
return TunerConstants.FRONTEND_TYPE_ISDBT;
}
}