• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.media.tv.tuner.frontend;
18 
19 import android.annotation.IntDef;
20 import android.annotation.IntRange;
21 import android.annotation.NonNull;
22 import android.annotation.SuppressLint;
23 import android.annotation.SystemApi;
24 import android.hardware.tv.tuner.FrontendIsdbtBandwidth;
25 import android.hardware.tv.tuner.FrontendIsdbtMode;
26 import android.hardware.tv.tuner.FrontendIsdbtModulation;
27 import android.hardware.tv.tuner.FrontendIsdbtPartialReceptionFlag;
28 import android.hardware.tv.tuner.FrontendIsdbtTimeInterleaveMode;
29 import android.media.tv.tuner.TunerVersionChecker;
30 import android.media.tv.tuner.frontend.DvbtFrontendSettings.CodeRate;
31 import android.util.Log;
32 import java.lang.annotation.Retention;
33 import java.lang.annotation.RetentionPolicy;
34 
35 /**
36  * Frontend settings for ISDBT.
37  *
38  * @hide
39  */
40 @SystemApi
41 public class IsdbtFrontendSettings extends FrontendSettings {
42     /** @hide */
43     @IntDef(prefix = "MODULATION_",
44             value = {MODULATION_UNDEFINED, MODULATION_AUTO, MODULATION_MOD_DQPSK,
45                     MODULATION_MOD_QPSK, MODULATION_MOD_16QAM, MODULATION_MOD_64QAM})
46     @Retention(RetentionPolicy.SOURCE)
47     public @interface Modulation {}
48 
49     /**
50      * Modulation undefined.
51      */
52     public static final int MODULATION_UNDEFINED = FrontendIsdbtModulation.UNDEFINED;
53     /**
54      * Hardware is able to detect and set modulation automatically
55      */
56     public static final int MODULATION_AUTO = FrontendIsdbtModulation.AUTO;
57     /**
58      * DQPSK Modulation.
59      */
60     public static final int MODULATION_MOD_DQPSK = FrontendIsdbtModulation.MOD_DQPSK;
61     /**
62      * QPSK Modulation.
63      */
64     public static final int MODULATION_MOD_QPSK = FrontendIsdbtModulation.MOD_QPSK;
65     /**
66      * 16QAM Modulation.
67      */
68     public static final int MODULATION_MOD_16QAM = FrontendIsdbtModulation.MOD_16QAM;
69     /**
70      * 64QAM Modulation.
71      */
72     public static final int MODULATION_MOD_64QAM = FrontendIsdbtModulation.MOD_64QAM;
73 
74 
75     /** @hide */
76     @IntDef(prefix = "MODE_",
77             value = {MODE_UNDEFINED, MODE_AUTO, MODE_1, MODE_2, MODE_3})
78     @Retention(RetentionPolicy.SOURCE)
79     public @interface Mode {}
80 
81     /**
82      * Mode undefined.
83      */
84     public static final int MODE_UNDEFINED = FrontendIsdbtMode.UNDEFINED;
85     /**
86      * Hardware is able to detect and set Mode automatically.
87      */
88     public static final int MODE_AUTO = FrontendIsdbtMode.AUTO;
89     /**
90      * Mode 1
91      */
92     public static final int MODE_1 = FrontendIsdbtMode.MODE_1;
93     /**
94      * Mode 2
95      */
96     public static final int MODE_2 = FrontendIsdbtMode.MODE_2;
97     /**
98      * Mode 3
99      */
100     public static final int MODE_3 = FrontendIsdbtMode.MODE_3;
101 
102 
103     /** @hide */
104     @IntDef(prefix = "BANDWIDTH_",
105             value = {BANDWIDTH_UNDEFINED, BANDWIDTH_AUTO, BANDWIDTH_8MHZ, BANDWIDTH_7MHZ,
106                     BANDWIDTH_6MHZ})
107     @Retention(RetentionPolicy.SOURCE)
108     public @interface Bandwidth {}
109 
110     /**
111      * Bandwidth undefined.
112      */
113     public static final int BANDWIDTH_UNDEFINED = FrontendIsdbtBandwidth.UNDEFINED;
114     /**
115      * Hardware is able to detect and set Bandwidth automatically.
116      */
117     public static final int BANDWIDTH_AUTO = FrontendIsdbtBandwidth.AUTO;
118     /**
119      * 8 MHz bandwidth.
120      */
121     public static final int BANDWIDTH_8MHZ = FrontendIsdbtBandwidth.BANDWIDTH_8MHZ;
122     /**
123      * 7 MHz bandwidth.
124      */
125     public static final int BANDWIDTH_7MHZ = FrontendIsdbtBandwidth.BANDWIDTH_7MHZ;
126     /**
127      * 6 MHz bandwidth.
128      */
129     public static final int BANDWIDTH_6MHZ = FrontendIsdbtBandwidth.BANDWIDTH_6MHZ;
130 
131     /** @hide */
132     @IntDef(prefix = "PARTIAL_RECEPTION_FLAG_",
133             value = {PARTIAL_RECEPTION_FLAG_UNDEFINED, PARTIAL_RECEPTION_FLAG_FALSE,
134                     PARTIAL_RECEPTION_FLAG_TRUE})
135     @Retention(RetentionPolicy.SOURCE)
136     public @interface PartialReceptionFlag {}
137 
138     /**
139      * Partial Reception Flag undefined.
140      */
141     public static final int PARTIAL_RECEPTION_FLAG_UNDEFINED =
142             FrontendIsdbtPartialReceptionFlag.UNDEFINED;
143     /**
144      * Partial Reception Flag false.
145      */
146     public static final int PARTIAL_RECEPTION_FLAG_FALSE = FrontendIsdbtPartialReceptionFlag.FALSE;
147     /**
148      * Partial Reception Flag true.
149      */
150     public static final int PARTIAL_RECEPTION_FLAG_TRUE = FrontendIsdbtPartialReceptionFlag.TRUE;
151 
152     /** @hide */
153     @IntDef(prefix = "TIME_INTERLEAVE_MODE_",
154             value = {TIME_INTERLEAVE_MODE_UNDEFINED, TIME_INTERLEAVE_MODE_AUTO,
155                     TIME_INTERLEAVE_MODE_1_0, TIME_INTERLEAVE_MODE_1_4, TIME_INTERLEAVE_MODE_1_8,
156                     TIME_INTERLEAVE_MODE_1_16, TIME_INTERLEAVE_MODE_2_0, TIME_INTERLEAVE_MODE_2_2,
157                     TIME_INTERLEAVE_MODE_2_4, TIME_INTERLEAVE_MODE_2_8, TIME_INTERLEAVE_MODE_3_0,
158                     TIME_INTERLEAVE_MODE_3_1, TIME_INTERLEAVE_MODE_3_2, TIME_INTERLEAVE_MODE_3_4})
159     @Retention(RetentionPolicy.SOURCE)
160     public @interface TimeInterleaveMode {}
161 
162     /**
163      * Time Interleave Mode undefined.
164      */
165     public static final int TIME_INTERLEAVE_MODE_UNDEFINED =
166             FrontendIsdbtTimeInterleaveMode.UNDEFINED;
167     /**
168      * Hardware is able to detect and set time interleave mode automatically
169      */
170     public static final int TIME_INTERLEAVE_MODE_AUTO = FrontendIsdbtTimeInterleaveMode.AUTO;
171     /**
172      * Time Interleave Mode 1: 0.
173      */
174     public static final int TIME_INTERLEAVE_MODE_1_0 =
175             FrontendIsdbtTimeInterleaveMode.INTERLEAVE_1_0;
176     /**
177      * Time Interleave Mode 1: 4.
178      */
179     public static final int TIME_INTERLEAVE_MODE_1_4 =
180             FrontendIsdbtTimeInterleaveMode.INTERLEAVE_1_4;
181     /**
182      * Time Interleave Mode 1: 8.
183      */
184     public static final int TIME_INTERLEAVE_MODE_1_8 =
185             FrontendIsdbtTimeInterleaveMode.INTERLEAVE_1_8;
186     /**
187      * Time Interleave Mode 1: 16.
188      */
189     public static final int TIME_INTERLEAVE_MODE_1_16 =
190             FrontendIsdbtTimeInterleaveMode.INTERLEAVE_1_16;
191     /**
192      * Time Interleave Mode 2: 0.
193      */
194     public static final int TIME_INTERLEAVE_MODE_2_0 =
195             FrontendIsdbtTimeInterleaveMode.INTERLEAVE_2_0;
196     /**
197      * Time Interleave Mode 2: 2.
198      */
199     public static final int TIME_INTERLEAVE_MODE_2_2 =
200             FrontendIsdbtTimeInterleaveMode.INTERLEAVE_2_2;
201     /**
202      * Time Interleave Mode 2: 4.
203      */
204     public static final int TIME_INTERLEAVE_MODE_2_4 =
205             FrontendIsdbtTimeInterleaveMode.INTERLEAVE_2_4;
206     /**
207      * Time Interleave Mode 2: 8.
208      */
209     public static final int TIME_INTERLEAVE_MODE_2_8 =
210             FrontendIsdbtTimeInterleaveMode.INTERLEAVE_2_8;
211     /**
212      * Time Interleave Mode 3: 0.
213      */
214     public static final int TIME_INTERLEAVE_MODE_3_0 =
215             FrontendIsdbtTimeInterleaveMode.INTERLEAVE_3_0;
216     /**
217      * Time Interleave Mode 3: 1.
218      */
219     public static final int TIME_INTERLEAVE_MODE_3_1 =
220             FrontendIsdbtTimeInterleaveMode.INTERLEAVE_3_1;
221     /**
222      * Time Interleave Mode 3: 2.
223      */
224     public static final int TIME_INTERLEAVE_MODE_3_2 =
225             FrontendIsdbtTimeInterleaveMode.INTERLEAVE_3_2;
226     /**
227      * Time Interleave Mode 3: 4.
228      */
229     public static final int TIME_INTERLEAVE_MODE_3_4 =
230             FrontendIsdbtTimeInterleaveMode.INTERLEAVE_3_4;
231 
232     private final int mBandwidth;
233     private final int mMode;
234     private final int mGuardInterval;
235     private final int mServiceAreaId;
236     private final IsdbtLayerSettings[] mLayerSettings;
237     private final int mPartialReceptionFlag;
238     private static final String TAG = "IsdbtFrontendSettings";
239 
IsdbtFrontendSettings(long frequency, int bandwidth, int mode, int guardInterval, int serviceAreaId, IsdbtLayerSettings[] layerSettings, int partialReceptionFlag)240     private IsdbtFrontendSettings(long frequency, int bandwidth, int mode, int guardInterval,
241             int serviceAreaId, IsdbtLayerSettings[] layerSettings, int partialReceptionFlag) {
242         super(frequency);
243         mBandwidth = bandwidth;
244         mMode = mode;
245         mGuardInterval = guardInterval;
246         mServiceAreaId = serviceAreaId;
247         mLayerSettings = new IsdbtLayerSettings[layerSettings.length];
248         for (int i = 0; i < layerSettings.length; i++) {
249             mLayerSettings[i] = layerSettings[i];
250         }
251         mPartialReceptionFlag = partialReceptionFlag;
252     }
253 
254     /**
255      * Gets Modulation.
256      *
257      * <p>This query is only supported in Tuner 1.1 or lowner version. Unsupported version will
258      * return {@link MODULATION_UNDEFINED}.
259      * Use {@link TunerVersionChecker#getTunerVersion()} to get the version information.
260      * @deprecated Use {@link #getLayerSettings()} and {@link IsdbtLayerSettings#getModulation()}
261      * instead.
262      */
263     @Deprecated
264     @Modulation
getModulation()265     public int getModulation() {
266         if (TunerVersionChecker.isHigherOrEqualVersionTo(TunerVersionChecker.TUNER_VERSION_2_0)) {
267             return MODULATION_UNDEFINED;
268         }
269         return mLayerSettings.length > 0 ? mLayerSettings[0].getModulation() : MODULATION_UNDEFINED;
270     }
271     /**
272      * Gets Bandwidth.
273      */
274     @Bandwidth
getBandwidth()275     public int getBandwidth() {
276         return mBandwidth;
277     }
278     /**
279      * Gets ISDBT mode.
280      */
281     @Mode
getMode()282     public int getMode() {
283         return mMode;
284     }
285     /**
286      * Gets Code rate.
287      *
288      * <p>This query is only supported in Tuner 1.1 or lowner version. Unsupported version will
289      * return {@link DvbtFrontendSettings#CODERATE_UNDEFINED}.
290      * Use {@link TunerVersionChecker#getTunerVersion()} to get the version information.
291      * @deprecated Use {@link #getLayerSettings()} and {@link IsdbtLayerSettings#getCodeRate()}
292      * instead.
293      */
294     @Deprecated
295     @CodeRate
getCodeRate()296     public int getCodeRate() {
297         if (TunerVersionChecker.isHigherOrEqualVersionTo(TunerVersionChecker.TUNER_VERSION_2_0)) {
298             return DvbtFrontendSettings.CODERATE_UNDEFINED;
299         }
300         return mLayerSettings.length > 0 ? mLayerSettings[0].getCodeRate()
301                                          : DvbtFrontendSettings.CODERATE_UNDEFINED;
302     }
303     /**
304      * Gets Guard Interval.
305      */
306     @DvbtFrontendSettings.GuardInterval
getGuardInterval()307     public int getGuardInterval() {
308         return mGuardInterval;
309     }
310     /**
311      * Gets Service Area ID.
312      */
getServiceAreaId()313     public int getServiceAreaId() {
314         return mServiceAreaId;
315     }
316     /**
317      * Gets ISDB-T Layer Settings.
318      *
319      * <p>This query is only supported in Tuner 2.0 or higher version. Unsupported version will
320      * return an empty array.
321      * Use {@link TunerVersionChecker#getTunerVersion()} to get the version information.
322      */
323     @SuppressLint("ArrayReturn")
324     @NonNull
getLayerSettings()325     public IsdbtLayerSettings[] getLayerSettings() {
326         return mLayerSettings;
327     }
328     /**
329      * Gets ISDB-T Partial Reception Flag.
330      *
331      * <p>This query is only supported in Tuner 2.0 or higher version. Unsupported version will
332      * return {@link PARTIALRECEPTIONFLAG_UNDEFINED}.
333      * Use {@link TunerVersionChecker#getTunerVersion()} to get the version information.
334      */
335     @PartialReceptionFlag
getPartialReceptionFlag()336     public int getPartialReceptionFlag() {
337         return mPartialReceptionFlag;
338     }
339 
340     /**
341      * Creates a builder for {@link IsdbtFrontendSettings}.
342      */
343     @NonNull
builder()344     public static Builder builder() {
345         return new Builder();
346     }
347 
348     /**
349      * Builder for {@link IsdbtFrontendSettings}.
350      */
351     public static class Builder {
352         private long mFrequency = 0;
353         private int mBandwidth = BANDWIDTH_UNDEFINED;
354         private int mMode = MODE_UNDEFINED;
355         private int mGuardInterval = DvbtFrontendSettings.GUARD_INTERVAL_UNDEFINED;
356         private int mServiceAreaId = 0;
357         private IsdbtLayerSettings[] mLayerSettings = {};
358         private int mPartialReceptionFlag = PARTIAL_RECEPTION_FLAG_UNDEFINED;
359 
Builder()360         private Builder() {
361         }
362 
363         /**
364          * Sets frequency in Hz.
365          *
366          * <p>Default value is 0.
367          * @deprecated Use {@link #setFrequencyLong(long)}
368          */
369         @NonNull
370         @IntRange(from = 1)
371         @Deprecated
setFrequency(int frequency)372         public Builder setFrequency(int frequency) {
373             return setFrequencyLong((long) frequency);
374         }
375 
376         /**
377          * Sets frequency in Hz.
378          *
379          * <p>Default value is 0.
380          */
381         @NonNull
382         @IntRange(from = 1)
setFrequencyLong(long frequency)383         public Builder setFrequencyLong(long frequency) {
384             mFrequency = frequency;
385             return this;
386         }
387 
388         /**
389          * Sets Modulation.
390          *
391          * <p>This configuration is only supported in Tuner 1.1 or lowner version. Unsupported
392          * version will cause no-op. Use {@link TunerVersionChecker#getTunerVersion()} to get the
393          * version information.
394          *
395          * <p>Default value is {@link #MODULATION_UNDEFINED}.
396          */
397         @Deprecated
398         @NonNull
setModulation(@odulation int modulation)399         public Builder setModulation(@Modulation int modulation) {
400             if (TunerVersionChecker.checkHigherOrEqualVersionTo(
401                         TunerVersionChecker.TUNER_VERSION_2_0, "setModulation")) {
402                 Log.d(TAG, "Use IsdbtLayerSettings on HAL 2.0 or higher");
403             } else {
404                 IsdbtLayerSettings.Builder layerBuilder = IsdbtLayerSettings.builder();
405                 layerBuilder.setModulation(modulation);
406                 if (mLayerSettings.length == 0) {
407                     mLayerSettings = new IsdbtLayerSettings[1];
408                 } else {
409                     layerBuilder.setCodeRate(mLayerSettings[0].getCodeRate());
410                 }
411                 mLayerSettings[0] = layerBuilder.build();
412             }
413             return this;
414         }
415         /**
416          * Sets Bandwidth.
417          *
418          * <p>Default value is {@link #BANDWIDTH_UNDEFINED}.
419          */
420         @NonNull
setBandwidth(@andwidth int bandwidth)421         public Builder setBandwidth(@Bandwidth int bandwidth) {
422             mBandwidth = bandwidth;
423             return this;
424         }
425         /**
426          * Sets ISDBT mode.
427          *
428          * <p>Default value is {@link #MODE_UNDEFINED}.
429          */
430         @NonNull
setMode(@ode int mode)431         public Builder setMode(@Mode int mode) {
432             mMode = mode;
433             return this;
434         }
435         /**
436          * Sets Code rate.
437          *
438          * <p>This configuration is only supported in Tuner 1.1 or lowner version. Unsupported
439          * version will cause no-op. Use {@link TunerVersionChecker#getTunerVersion()} to get the
440          * version information.
441          *
442          * <p>Default value is {@link DvbtFrontendSettings#CODERATE_UNDEFINED}.
443          */
444         @Deprecated
445         @NonNull
setCodeRate(@vbtFrontendSettings.CodeRate int codeRate)446         public Builder setCodeRate(@DvbtFrontendSettings.CodeRate int codeRate) {
447             if (TunerVersionChecker.checkHigherOrEqualVersionTo(
448                         TunerVersionChecker.TUNER_VERSION_2_0, "setModulation")) {
449                 Log.d(TAG, "Use IsdbtLayerSettings on HAL 2.0 or higher");
450             } else {
451                 IsdbtLayerSettings.Builder layerBuilder = IsdbtLayerSettings.builder();
452                 layerBuilder.setCodeRate(codeRate);
453                 if (mLayerSettings.length == 0) {
454                     mLayerSettings = new IsdbtLayerSettings[1];
455                 } else {
456                     layerBuilder.setModulation(mLayerSettings[0].getModulation());
457                 }
458                 mLayerSettings[0] = layerBuilder.build();
459             }
460             return this;
461         }
462         /**
463          * Sets Guard Interval.
464          *
465          * <p>Default value is {@link DvbtFrontendSettings#GUARD_INTERVAL_UNDEFINED}.
466          */
467         @NonNull
setGuardInterval(@vbtFrontendSettings.GuardInterval int guardInterval)468         public Builder setGuardInterval(@DvbtFrontendSettings.GuardInterval int guardInterval) {
469             mGuardInterval = guardInterval;
470             return this;
471         }
472         /**
473          * Sets Service Area ID.
474          *
475          * <p>Default value is 0.
476          */
477         @NonNull
setServiceAreaId(int serviceAreaId)478         public Builder setServiceAreaId(int serviceAreaId) {
479             mServiceAreaId = serviceAreaId;
480             return this;
481         }
482         /**
483          * Sets ISDB-T Layer Settings.
484          *
485          * <p>This configuration is only supported in Tuner 2.0 or higher version. Unsupported
486          * version will cause no-op. Use {@link TunerVersionChecker#getTunerVersion()} to get the
487          * version information.
488          *
489          * <p>Default value is an empty array.
490          */
491         @NonNull
setLayerSettings( @uppressLint"ArrayReturn") @onNull IsdbtLayerSettings[] layerSettings)492         public Builder setLayerSettings(
493                 @SuppressLint("ArrayReturn") @NonNull IsdbtLayerSettings[] layerSettings) {
494             if (TunerVersionChecker.checkHigherOrEqualVersionTo(
495                         TunerVersionChecker.TUNER_VERSION_2_0, "setLayerSettings")) {
496                 mLayerSettings = new IsdbtLayerSettings[layerSettings.length];
497                 for (int i = 0; i < layerSettings.length; i++) {
498                     mLayerSettings[i] = layerSettings[i];
499                 }
500             }
501             return this;
502         }
503         /**
504          * Sets ISDB-T Partial Reception Flag.
505          *
506          * <p>This configuration is only supported in Tuner 2.0 or higher version. Unsupported
507          * version will cause no-op. Use {@link TunerVersionChecker#getTunerVersion()} to get the
508          * version information.
509          *
510          * <p>Default value is {@link PARTIALRECEPTIONFLAG_UNDEFINED}.
511          */
512         @NonNull
setPartialReceptionFlag(@artialReceptionFlag int flag)513         public Builder setPartialReceptionFlag(@PartialReceptionFlag int flag) {
514             if (TunerVersionChecker.checkHigherOrEqualVersionTo(
515                         TunerVersionChecker.TUNER_VERSION_2_0, "setPartialReceptionFlag")) {
516                 mPartialReceptionFlag = flag;
517             }
518             return this;
519         }
520 
521         /**
522          * Builds a {@link IsdbtFrontendSettings} object.
523          */
524         @NonNull
build()525         public IsdbtFrontendSettings build() {
526             return new IsdbtFrontendSettings(mFrequency, mBandwidth, mMode, mGuardInterval,
527                     mServiceAreaId, mLayerSettings, mPartialReceptionFlag);
528         }
529     }
530 
531     @Override
getType()532     public int getType() {
533         return FrontendSettings.TYPE_ISDBT;
534     }
535 
536     /**
537      * Layer Settings for ISDB-T Frontend.
538      *
539      * <p>Layer Settings is only supported in Tuner 2.0 or higher version. Use
540      * {@link TunerVersionChecker#getTunerVersion()} to get the version information.
541      */
542     public static final class IsdbtLayerSettings {
543         private final int mModulation;
544         private final int mTimeInterleaveMode;
545         private final int mCodeRate;
546         private final int mNumOfSegments;
547 
IsdbtLayerSettings( int modulation, int timeInterleaveMode, int codeRate, int numOfSegments)548         private IsdbtLayerSettings(
549                 int modulation, int timeInterleaveMode, int codeRate, int numOfSegments) {
550             mModulation = modulation;
551             mTimeInterleaveMode = timeInterleaveMode;
552             mCodeRate = codeRate;
553             mNumOfSegments = numOfSegments;
554         }
555 
556         /**
557          * Gets Modulation.
558          */
559         @Modulation
getModulation()560         public int getModulation() {
561             return mModulation;
562         }
563         /**
564          * Gets Time Interleave Mode.
565          */
566         @TimeInterleaveMode
getTimeInterleaveMode()567         public int getTimeInterleaveMode() {
568             return mTimeInterleaveMode;
569         }
570         /**
571          * Gets Code rate.
572          */
573         @CodeRate
getCodeRate()574         public int getCodeRate() {
575             return mCodeRate;
576         }
577         /**
578          * Gets Number of Segments.
579          */
580         @IntRange(from = 0, to = 0xff)
getNumberOfSegments()581         public int getNumberOfSegments() {
582             return mNumOfSegments;
583         }
584 
585         /**
586          * Creates a builder for {@link IsdbtLayerSettings}.
587          */
588         @NonNull
builder()589         public static Builder builder() {
590             return new Builder();
591         }
592 
593         /**
594          * Builder for {@link IsdbtLayerSettings}.
595          */
596         public static final class Builder {
597             private int mModulation = MODULATION_UNDEFINED;
598             private int mTimeInterleaveMode = TIME_INTERLEAVE_MODE_UNDEFINED;
599             private int mCodeRate = DvbtFrontendSettings.CODERATE_UNDEFINED;
600             private int mNumOfSegments = 0;
601 
Builder()602             private Builder() {}
603 
604             /**
605              * Sets modulation.
606              *
607              * <p>Default value is {@link #MODULATION_UNDEFINED}.
608              */
609             @NonNull
setModulation(@odulation int modulation)610             public Builder setModulation(@Modulation int modulation) {
611                 mModulation = modulation;
612                 return this;
613             }
614             /**
615              * Sets time interleave mode.
616              *
617              * <p>Default value is {@link #TIME_INTERLEAVE_MODE_UNDEFINED}.
618              */
619             @NonNull
setTimeInterleaveMode(@imeInterleaveMode int mode)620             public Builder setTimeInterleaveMode(@TimeInterleaveMode int mode) {
621                 mTimeInterleaveMode = mode;
622                 return this;
623             }
624             /**
625              * Sets code rate.
626              */
627             @NonNull
setCodeRate(@vbtFrontendSettings.CodeRate int codeRate)628             public Builder setCodeRate(@DvbtFrontendSettings.CodeRate int codeRate) {
629                 mCodeRate = codeRate;
630                 return this;
631             }
632             /**
633              * Sets number of segments.
634              *
635              * <p>Default value is 0.
636              */
637             @NonNull
638             @IntRange(from = 0, to = 0xff)
setNumberOfSegments(int numOfSegments)639             public Builder setNumberOfSegments(int numOfSegments) {
640                 mNumOfSegments = numOfSegments;
641                 return this;
642             }
643 
644             /**
645              * Builds a {@link IsdbtLayerSettings} object.
646              */
647             @NonNull
build()648             public IsdbtLayerSettings build() {
649                 return new IsdbtLayerSettings(
650                         mModulation, mTimeInterleaveMode, mCodeRate, mNumOfSegments);
651             }
652         }
653     }
654 }
655