Merge "Clean up tuner constants and update according to ag/9977359"
This commit is contained in:
committed by
Android (Google) Code Review
commit
ca878a4c66
@@ -34,7 +34,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
*/
|
||||
public class Descrambler implements AutoCloseable {
|
||||
/** @hide */
|
||||
@IntDef(prefix = "PID_TYPE_", value = {PID_TYPE_T, PID_TYPE_MMPT})
|
||||
@IntDef(prefix = "PID_TYPE_", value = {PID_TYPE_T, PID_TYPE_MMTP})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface PidType {}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class Descrambler implements AutoCloseable {
|
||||
/**
|
||||
* Packet ID is used to specify packets in MMTP.
|
||||
*/
|
||||
public static final int PID_TYPE_MMPT = 2;
|
||||
public static final int PID_TYPE_MMTP = 2;
|
||||
|
||||
|
||||
private long mNativeContext;
|
||||
|
||||
@@ -40,7 +40,8 @@ import java.lang.annotation.RetentionPolicy;
|
||||
@SystemApi
|
||||
public class Lnb implements AutoCloseable {
|
||||
/** @hide */
|
||||
@IntDef({VOLTAGE_NONE, VOLTAGE_5V, VOLTAGE_11V, VOLTAGE_12V, VOLTAGE_13V, VOLTAGE_14V,
|
||||
@IntDef(prefix = "VOLTAGE_",
|
||||
value = {VOLTAGE_NONE, VOLTAGE_5V, VOLTAGE_11V, VOLTAGE_12V, VOLTAGE_13V, VOLTAGE_14V,
|
||||
VOLTAGE_15V, VOLTAGE_18V, VOLTAGE_19V})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Voltage {}
|
||||
@@ -83,7 +84,8 @@ public class Lnb implements AutoCloseable {
|
||||
public static final int VOLTAGE_19V = Constants.LnbVoltage.VOLTAGE_19V;
|
||||
|
||||
/** @hide */
|
||||
@IntDef({TONE_NONE, TONE_CONTINUOUS})
|
||||
@IntDef(prefix = "TONE_",
|
||||
value = {TONE_NONE, TONE_CONTINUOUS})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Tone {}
|
||||
|
||||
@@ -97,7 +99,8 @@ public class Lnb implements AutoCloseable {
|
||||
public static final int TONE_CONTINUOUS = Constants.LnbTone.CONTINUOUS;
|
||||
|
||||
/** @hide */
|
||||
@IntDef({POSITION_UNDEFINED, POSITION_A, POSITION_B})
|
||||
@IntDef(prefix = "POSITION_",
|
||||
value = {POSITION_UNDEFINED, POSITION_A, POSITION_B})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Position {}
|
||||
|
||||
@@ -114,6 +117,37 @@ public class Lnb implements AutoCloseable {
|
||||
*/
|
||||
public static final int POSITION_B = Constants.LnbPosition.POSITION_B;
|
||||
|
||||
/** @hide */
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef(prefix = "EVENT_TYPE_",
|
||||
value = {EVENT_TYPE_DISEQC_RX_OVERFLOW, EVENT_TYPE_DISEQC_RX_TIMEOUT,
|
||||
EVENT_TYPE_DISEQC_RX_PARITY_ERROR, EVENT_TYPE_LNB_OVERLOAD})
|
||||
public @interface EventType {}
|
||||
|
||||
/**
|
||||
* Outgoing Diseqc message overflow.
|
||||
* @hide
|
||||
*/
|
||||
public static final int EVENT_TYPE_DISEQC_RX_OVERFLOW =
|
||||
Constants.LnbEventType.DISEQC_RX_OVERFLOW;
|
||||
/**
|
||||
* Outgoing Diseqc message isn't delivered on time.
|
||||
* @hide
|
||||
*/
|
||||
public static final int EVENT_TYPE_DISEQC_RX_TIMEOUT =
|
||||
Constants.LnbEventType.DISEQC_RX_TIMEOUT;
|
||||
/**
|
||||
* Incoming Diseqc message has parity error.
|
||||
* @hide
|
||||
*/
|
||||
public static final int EVENT_TYPE_DISEQC_RX_PARITY_ERROR =
|
||||
Constants.LnbEventType.DISEQC_RX_PARITY_ERROR;
|
||||
/**
|
||||
* LNB is overload.
|
||||
* @hide
|
||||
*/
|
||||
public static final int EVENT_TYPE_LNB_OVERLOAD = Constants.LnbEventType.LNB_OVERLOAD;
|
||||
|
||||
int mId;
|
||||
LnbCallback mCallback;
|
||||
Context mContext;
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
package android.media.tv.tuner;
|
||||
|
||||
|
||||
import android.media.tv.tuner.Lnb.EventType;
|
||||
|
||||
/**
|
||||
* Callback interface for receiving information from LNBs.
|
||||
*
|
||||
@@ -26,7 +28,7 @@ public interface LnbCallback {
|
||||
/**
|
||||
* Invoked when there is a LNB event.
|
||||
*/
|
||||
void onEvent(int lnbEventType);
|
||||
void onEvent(@EventType int lnbEventType);
|
||||
|
||||
/**
|
||||
* Invoked when there is a new DiSEqC message.
|
||||
|
||||
@@ -24,13 +24,13 @@ import android.annotation.RequiresPermission;
|
||||
import android.annotation.SystemApi;
|
||||
import android.content.Context;
|
||||
import android.media.tv.tuner.TunerConstants.FilterStatus;
|
||||
import android.media.tv.tuner.TunerConstants.FilterSubtype;
|
||||
import android.media.tv.tuner.TunerConstants.FrontendScanType;
|
||||
import android.media.tv.tuner.TunerConstants.Result;
|
||||
import android.media.tv.tuner.dvr.Dvr;
|
||||
import android.media.tv.tuner.dvr.DvrCallback;
|
||||
import android.media.tv.tuner.dvr.DvrSettings;
|
||||
import android.media.tv.tuner.filter.FilterConfiguration.FilterType;
|
||||
import android.media.tv.tuner.filter.Filter.Subtype;
|
||||
import android.media.tv.tuner.filter.Filter.Type;
|
||||
import android.media.tv.tuner.filter.FilterEvent;
|
||||
import android.media.tv.tuner.filter.TimeFilter;
|
||||
import android.media.tv.tuner.frontend.FrontendCallback;
|
||||
@@ -102,7 +102,8 @@ public final class Tuner implements AutoCloseable {
|
||||
* TODO: replace the other constructor
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
|
||||
public Tuner(@NonNull Context context, @NonNull String tvInputSessionId, int useCase) {
|
||||
public Tuner(@NonNull Context context, @NonNull String tvInputSessionId, int useCase,
|
||||
@Nullable OnResourceLostListener listener) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@@ -113,7 +114,8 @@ public final class Tuner implements AutoCloseable {
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public void shareFrontend(@NonNull Tuner tuner) { }
|
||||
public void shareFrontendFromTuner(@NonNull Tuner tuner) {
|
||||
}
|
||||
|
||||
|
||||
private long mNativeContext; // used by native jMediaTuner
|
||||
@@ -513,18 +515,18 @@ public final class Tuner implements AutoCloseable {
|
||||
* @param subType the subtype of the filter.
|
||||
* @param bufferSize the buffer size of the filter to be opened in bytes. The buffer holds the
|
||||
* data output from the filter.
|
||||
* @param cb the callback to receive notifications from filter.
|
||||
* @param executor the executor on which callback will be invoked. The default event handler
|
||||
* executor is used if it's {@code null}.
|
||||
* @param cb the callback to receive notifications from filter.
|
||||
* @return the opened filter. {@code null} if the operation failed.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
|
||||
@Nullable
|
||||
public Filter openFilter(@FilterType int mainType, @FilterSubtype int subType,
|
||||
@BytesLong long bufferSize, @Nullable FilterCallback cb,
|
||||
@CallbackExecutor @Nullable Executor executor) {
|
||||
public Filter openFilter(@Type int mainType, @Subtype int subType,
|
||||
@BytesLong long bufferSize, @CallbackExecutor @Nullable Executor executor,
|
||||
@Nullable FilterCallback cb) {
|
||||
TunerUtils.checkTunerPermission(mContext);
|
||||
Filter filter = nativeOpenFilter(
|
||||
mainType, TunerUtils.getFilterSubtype(mainType, subType), bufferSize);
|
||||
@@ -540,16 +542,34 @@ public final class Tuner implements AutoCloseable {
|
||||
/**
|
||||
* Opens an LNB (low-noise block downconverter) object.
|
||||
*
|
||||
* @param cb the callback to receive notifications from LNB.
|
||||
* @param executor the executor on which callback will be invoked. The default event handler
|
||||
* executor is used if it's {@code null}.
|
||||
* @param cb the callback to receive notifications from LNB.
|
||||
* @return the opened LNB object. {@code null} if the operation failed.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
|
||||
@Nullable
|
||||
public Lnb openLnb(LnbCallback cb, @CallbackExecutor @Nullable Executor executor) {
|
||||
public Lnb openLnb(@CallbackExecutor @Nullable Executor executor, LnbCallback cb) {
|
||||
return openLnbByName(null, executor, cb);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens an LNB (low-noise block downconverter) object.
|
||||
*
|
||||
* @param name the LNB name.
|
||||
* @param executor the executor on which callback will be invoked. The default event handler
|
||||
* executor is used if it's {@code null}.
|
||||
* @param cb the callback to receive notifications from LNB.
|
||||
* @return the opened LNB object. {@code null} if the operation failed.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
|
||||
@Nullable
|
||||
public Lnb openLnbByName(@Nullable String name, @CallbackExecutor @Nullable Executor executor,
|
||||
LnbCallback cb) {
|
||||
TunerUtils.checkTunerPermission(mContext);
|
||||
// TODO: use resource manager to get LNB ID.
|
||||
return new Lnb(0);
|
||||
@@ -608,17 +628,17 @@ public final class Tuner implements AutoCloseable {
|
||||
* @param type the DVR type to be opened.
|
||||
* @param bufferSize the buffer size of the output in bytes. It's used to hold output data of
|
||||
* the attached filters.
|
||||
* @param cb the callback to receive notifications from DVR.
|
||||
* @param executor the executor on which callback will be invoked. The default event handler
|
||||
* executor is used if it's {@code null}.
|
||||
* @param cb the callback to receive notifications from DVR.
|
||||
* @return the opened DVR object. {@code null} if the operation failed.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
|
||||
@Nullable
|
||||
public Dvr openDvr(@DvrSettings.Type int type, @BytesLong long bufferSize, DvrCallback cb,
|
||||
@CallbackExecutor @Nullable Executor executor) {
|
||||
public Dvr openDvr(@DvrSettings.Type int type, @BytesLong long bufferSize,
|
||||
@CallbackExecutor @Nullable Executor executor, DvrCallback cb) {
|
||||
TunerUtils.checkTunerPermission(mContext);
|
||||
Dvr dvr = nativeOpenDvr(type, bufferSize);
|
||||
return dvr;
|
||||
|
||||
@@ -36,68 +36,41 @@ import java.lang.annotation.RetentionPolicy;
|
||||
*/
|
||||
@SystemApi
|
||||
public final class TunerConstants {
|
||||
/** @hide */
|
||||
/**
|
||||
* Invalid TS packet ID.
|
||||
* @hide
|
||||
*/
|
||||
public static final int INVALID_TS_PID = Constants.Constant.INVALID_TS_PID;
|
||||
/** @hide */
|
||||
/**
|
||||
* Invalid stream ID.
|
||||
* @hide
|
||||
*/
|
||||
public static final int INVALID_STREAM_ID = Constants.Constant.INVALID_STREAM_ID;
|
||||
|
||||
|
||||
/** @hide */
|
||||
@IntDef({FRONTEND_EVENT_TYPE_LOCKED, FRONTEND_EVENT_TYPE_NO_SIGNAL,
|
||||
FRONTEND_EVENT_TYPE_LOST_LOCK})
|
||||
@IntDef(prefix = "FRONTEND_EVENT_TYPE_",
|
||||
value = {FRONTEND_EVENT_TYPE_LOCKED, FRONTEND_EVENT_TYPE_NO_SIGNAL,
|
||||
FRONTEND_EVENT_TYPE_LOST_LOCK})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface FrontendEventType {}
|
||||
/** @hide */
|
||||
/**
|
||||
* Frontend locked.
|
||||
* @hide
|
||||
*/
|
||||
public static final int FRONTEND_EVENT_TYPE_LOCKED = Constants.FrontendEventType.LOCKED;
|
||||
/** @hide */
|
||||
/**
|
||||
* No signal detected.
|
||||
* @hide
|
||||
*/
|
||||
public static final int FRONTEND_EVENT_TYPE_NO_SIGNAL = Constants.FrontendEventType.NO_SIGNAL;
|
||||
/** @hide */
|
||||
/**
|
||||
* Frontend lock lost.
|
||||
* @hide
|
||||
*/
|
||||
public static final int FRONTEND_EVENT_TYPE_LOST_LOCK = Constants.FrontendEventType.LOST_LOCK;
|
||||
|
||||
|
||||
/** @hide */
|
||||
@IntDef({FILTER_SUBTYPE_UNDEFINED, FILTER_SUBTYPE_SECTION, FILTER_SUBTYPE_PES,
|
||||
FILTER_SUBTYPE_AUDIO, FILTER_SUBTYPE_VIDEO, FILTER_SUBTYPE_DOWNLOAD,
|
||||
FILTER_SUBTYPE_RECORD, FILTER_SUBTYPE_TS, FILTER_SUBTYPE_PCR, FILTER_SUBTYPE_TEMI,
|
||||
FILTER_SUBTYPE_MMPT, FILTER_SUBTYPE_NTP, FILTER_SUBTYPE_IP_PAYLOAD, FILTER_SUBTYPE_IP,
|
||||
FILTER_SUBTYPE_PAYLOAD_THROUGH, FILTER_SUBTYPE_TLV, FILTER_SUBTYPE_PTP, })
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface FilterSubtype {}
|
||||
/** @hide */
|
||||
public static final int FILTER_SUBTYPE_UNDEFINED = 0;
|
||||
/** @hide */
|
||||
public static final int FILTER_SUBTYPE_SECTION = 1;
|
||||
/** @hide */
|
||||
public static final int FILTER_SUBTYPE_PES = 2;
|
||||
/** @hide */
|
||||
public static final int FILTER_SUBTYPE_AUDIO = 3;
|
||||
/** @hide */
|
||||
public static final int FILTER_SUBTYPE_VIDEO = 4;
|
||||
/** @hide */
|
||||
public static final int FILTER_SUBTYPE_DOWNLOAD = 5;
|
||||
/** @hide */
|
||||
public static final int FILTER_SUBTYPE_RECORD = 6;
|
||||
/** @hide */
|
||||
public static final int FILTER_SUBTYPE_TS = 7;
|
||||
/** @hide */
|
||||
public static final int FILTER_SUBTYPE_PCR = 8;
|
||||
/** @hide */
|
||||
public static final int FILTER_SUBTYPE_TEMI = 9;
|
||||
/** @hide */
|
||||
public static final int FILTER_SUBTYPE_MMPT = 10;
|
||||
/** @hide */
|
||||
public static final int FILTER_SUBTYPE_NTP = 11;
|
||||
/** @hide */
|
||||
public static final int FILTER_SUBTYPE_IP_PAYLOAD = 12;
|
||||
/** @hide */
|
||||
public static final int FILTER_SUBTYPE_IP = 13;
|
||||
/** @hide */
|
||||
public static final int FILTER_SUBTYPE_PAYLOAD_THROUGH = 14;
|
||||
/** @hide */
|
||||
public static final int FILTER_SUBTYPE_TLV = 15;
|
||||
/** @hide */
|
||||
public static final int FILTER_SUBTYPE_PTP = 16;
|
||||
|
||||
/** @hide */
|
||||
@IntDef(flag = true, prefix = "FILTER_STATUS_", value = {FILTER_STATUS_DATA_READY,
|
||||
FILTER_STATUS_LOW_WATER, FILTER_STATUS_HIGH_WATER, FILTER_STATUS_OVERFLOW})
|
||||
@@ -501,23 +474,6 @@ public final class TunerConstants {
|
||||
public @interface FrontendModulation {}
|
||||
|
||||
|
||||
/** @hide */
|
||||
@IntDef({FILTER_SETTINGS_TS, FILTER_SETTINGS_MMTP, FILTER_SETTINGS_IP, FILTER_SETTINGS_TLV,
|
||||
FILTER_SETTINGS_ALP})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface FilterSettingsType {}
|
||||
/** @hide */
|
||||
public static final int FILTER_SETTINGS_TS = Constants.DemuxFilterMainType.TS;
|
||||
/** @hide */
|
||||
public static final int FILTER_SETTINGS_MMTP = Constants.DemuxFilterMainType.MMTP;
|
||||
/** @hide */
|
||||
public static final int FILTER_SETTINGS_IP = Constants.DemuxFilterMainType.IP;
|
||||
/** @hide */
|
||||
public static final int FILTER_SETTINGS_TLV = Constants.DemuxFilterMainType.TLV;
|
||||
/** @hide */
|
||||
public static final int FILTER_SETTINGS_ALP = Constants.DemuxFilterMainType.ALP;
|
||||
|
||||
|
||||
/** @hide */
|
||||
@IntDef({RESULT_SUCCESS, RESULT_UNAVAILABLE, RESULT_NOT_INITIALIZED, RESULT_INVALID_STATE,
|
||||
RESULT_INVALID_ARGUMENT, RESULT_OUT_OF_MEMORY, RESULT_UNKNOWN_ERROR})
|
||||
|
||||
@@ -19,9 +19,7 @@ package android.media.tv.tuner;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.hardware.tv.tuner.V1_0.Constants;
|
||||
import android.media.tv.tuner.TunerConstants.FilterSubtype;
|
||||
import android.media.tv.tuner.filter.FilterConfiguration;
|
||||
import android.media.tv.tuner.filter.FilterConfiguration.FilterType;
|
||||
import android.media.tv.tuner.filter.Filter;
|
||||
|
||||
/**
|
||||
* Utility class for tuner framework.
|
||||
@@ -50,91 +48,91 @@ public final class TunerUtils {
|
||||
* @param mainType filter main type.
|
||||
* @param subtype filter subtype.
|
||||
*/
|
||||
public static int getFilterSubtype(@FilterType int mainType, @FilterSubtype int subtype) {
|
||||
if (mainType == FilterConfiguration.FILTER_TYPE_TS) {
|
||||
public static int getFilterSubtype(@Filter.Type int mainType, @Filter.Subtype int subtype) {
|
||||
if (mainType == Filter.TYPE_TS) {
|
||||
switch (subtype) {
|
||||
case TunerConstants.FILTER_SUBTYPE_UNDEFINED:
|
||||
case Filter.SUBTYPE_UNDEFINED:
|
||||
return Constants.DemuxTsFilterType.UNDEFINED;
|
||||
case TunerConstants.FILTER_SUBTYPE_SECTION:
|
||||
case Filter.SUBTYPE_SECTION:
|
||||
return Constants.DemuxTsFilterType.SECTION;
|
||||
case TunerConstants.FILTER_SUBTYPE_PES:
|
||||
case Filter.SUBTYPE_PES:
|
||||
return Constants.DemuxTsFilterType.PES;
|
||||
case TunerConstants.FILTER_SUBTYPE_TS:
|
||||
case Filter.SUBTYPE_TS:
|
||||
return Constants.DemuxTsFilterType.TS;
|
||||
case TunerConstants.FILTER_SUBTYPE_AUDIO:
|
||||
case Filter.SUBTYPE_AUDIO:
|
||||
return Constants.DemuxTsFilterType.AUDIO;
|
||||
case TunerConstants.FILTER_SUBTYPE_VIDEO:
|
||||
case Filter.SUBTYPE_VIDEO:
|
||||
return Constants.DemuxTsFilterType.VIDEO;
|
||||
case TunerConstants.FILTER_SUBTYPE_PCR:
|
||||
case Filter.SUBTYPE_PCR:
|
||||
return Constants.DemuxTsFilterType.PCR;
|
||||
case TunerConstants.FILTER_SUBTYPE_RECORD:
|
||||
case Filter.SUBTYPE_RECORD:
|
||||
return Constants.DemuxTsFilterType.RECORD;
|
||||
case TunerConstants.FILTER_SUBTYPE_TEMI:
|
||||
case Filter.SUBTYPE_TEMI:
|
||||
return Constants.DemuxTsFilterType.TEMI;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (mainType == FilterConfiguration.FILTER_TYPE_MMTP) {
|
||||
} else if (mainType == Filter.TYPE_MMTP) {
|
||||
switch (subtype) {
|
||||
case TunerConstants.FILTER_SUBTYPE_UNDEFINED:
|
||||
case Filter.SUBTYPE_UNDEFINED:
|
||||
return Constants.DemuxMmtpFilterType.UNDEFINED;
|
||||
case TunerConstants.FILTER_SUBTYPE_SECTION:
|
||||
case Filter.SUBTYPE_SECTION:
|
||||
return Constants.DemuxMmtpFilterType.SECTION;
|
||||
case TunerConstants.FILTER_SUBTYPE_PES:
|
||||
case Filter.SUBTYPE_PES:
|
||||
return Constants.DemuxMmtpFilterType.PES;
|
||||
case TunerConstants.FILTER_SUBTYPE_MMPT:
|
||||
case Filter.SUBTYPE_MMTP:
|
||||
return Constants.DemuxMmtpFilterType.MMTP;
|
||||
case TunerConstants.FILTER_SUBTYPE_AUDIO:
|
||||
case Filter.SUBTYPE_AUDIO:
|
||||
return Constants.DemuxMmtpFilterType.AUDIO;
|
||||
case TunerConstants.FILTER_SUBTYPE_VIDEO:
|
||||
case Filter.SUBTYPE_VIDEO:
|
||||
return Constants.DemuxMmtpFilterType.VIDEO;
|
||||
case TunerConstants.FILTER_SUBTYPE_RECORD:
|
||||
case Filter.SUBTYPE_RECORD:
|
||||
return Constants.DemuxMmtpFilterType.RECORD;
|
||||
case TunerConstants.FILTER_SUBTYPE_DOWNLOAD:
|
||||
case Filter.SUBTYPE_DOWNLOAD:
|
||||
return Constants.DemuxMmtpFilterType.DOWNLOAD;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
} else if (mainType == FilterConfiguration.FILTER_TYPE_IP) {
|
||||
} else if (mainType == Filter.TYPE_IP) {
|
||||
switch (subtype) {
|
||||
case TunerConstants.FILTER_SUBTYPE_UNDEFINED:
|
||||
case Filter.SUBTYPE_UNDEFINED:
|
||||
return Constants.DemuxIpFilterType.UNDEFINED;
|
||||
case TunerConstants.FILTER_SUBTYPE_SECTION:
|
||||
case Filter.SUBTYPE_SECTION:
|
||||
return Constants.DemuxIpFilterType.SECTION;
|
||||
case TunerConstants.FILTER_SUBTYPE_NTP:
|
||||
case Filter.SUBTYPE_NTP:
|
||||
return Constants.DemuxIpFilterType.NTP;
|
||||
case TunerConstants.FILTER_SUBTYPE_IP_PAYLOAD:
|
||||
case Filter.SUBTYPE_IP_PAYLOAD:
|
||||
return Constants.DemuxIpFilterType.IP_PAYLOAD;
|
||||
case TunerConstants.FILTER_SUBTYPE_IP:
|
||||
case Filter.SUBTYPE_IP:
|
||||
return Constants.DemuxIpFilterType.IP;
|
||||
case TunerConstants.FILTER_SUBTYPE_PAYLOAD_THROUGH:
|
||||
case Filter.SUBTYPE_PAYLOAD_THROUGH:
|
||||
return Constants.DemuxIpFilterType.PAYLOAD_THROUGH;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (mainType == FilterConfiguration.FILTER_TYPE_TLV) {
|
||||
} else if (mainType == Filter.TYPE_TLV) {
|
||||
switch (subtype) {
|
||||
case TunerConstants.FILTER_SUBTYPE_UNDEFINED:
|
||||
case Filter.SUBTYPE_UNDEFINED:
|
||||
return Constants.DemuxTlvFilterType.UNDEFINED;
|
||||
case TunerConstants.FILTER_SUBTYPE_SECTION:
|
||||
case Filter.SUBTYPE_SECTION:
|
||||
return Constants.DemuxTlvFilterType.SECTION;
|
||||
case TunerConstants.FILTER_SUBTYPE_TLV:
|
||||
case Filter.SUBTYPE_TLV:
|
||||
return Constants.DemuxTlvFilterType.TLV;
|
||||
case TunerConstants.FILTER_SUBTYPE_PAYLOAD_THROUGH:
|
||||
case Filter.SUBTYPE_PAYLOAD_THROUGH:
|
||||
return Constants.DemuxTlvFilterType.PAYLOAD_THROUGH;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (mainType == FilterConfiguration.FILTER_TYPE_ALP) {
|
||||
} else if (mainType == Filter.TYPE_ALP) {
|
||||
switch (subtype) {
|
||||
case TunerConstants.FILTER_SUBTYPE_UNDEFINED:
|
||||
case Filter.SUBTYPE_UNDEFINED:
|
||||
return Constants.DemuxAlpFilterType.UNDEFINED;
|
||||
case TunerConstants.FILTER_SUBTYPE_SECTION:
|
||||
case Filter.SUBTYPE_SECTION:
|
||||
return Constants.DemuxAlpFilterType.SECTION;
|
||||
case TunerConstants.FILTER_SUBTYPE_PTP:
|
||||
case Filter.SUBTYPE_PTP:
|
||||
return Constants.DemuxAlpFilterType.PTP;
|
||||
case TunerConstants.FILTER_SUBTYPE_PAYLOAD_THROUGH:
|
||||
case Filter.SUBTYPE_PAYLOAD_THROUGH:
|
||||
return Constants.DemuxAlpFilterType.PAYLOAD_THROUGH;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -17,11 +17,16 @@
|
||||
package android.media.tv.tuner.dvr;
|
||||
|
||||
import android.annotation.BytesLong;
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.NonNull;
|
||||
import android.hardware.tv.tuner.V1_0.Constants;
|
||||
import android.media.tv.tuner.Tuner.Filter;
|
||||
import android.media.tv.tuner.TunerConstants.Result;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Digital Video Record (DVR) interface provides record control on Demux's output buffer and
|
||||
* playback control on Demux's input buffer.
|
||||
@@ -29,6 +34,37 @@ import android.os.ParcelFileDescriptor;
|
||||
* @hide
|
||||
*/
|
||||
public class Dvr {
|
||||
/** @hide */
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef(prefix = "PLAYBACK_STATUS_",
|
||||
value = {PLAYBACK_STATUS_EMPTY, PLAYBACK_STATUS_ALMOST_EMPTY,
|
||||
PLAYBACK_STATUS_ALMOST_FULL, PLAYBACK_STATUS_FULL})
|
||||
@interface PlaybackStatus {}
|
||||
|
||||
/**
|
||||
* The space of the playback is empty.
|
||||
*/
|
||||
public static final int PLAYBACK_STATUS_EMPTY = Constants.PlaybackStatus.SPACE_EMPTY;
|
||||
/**
|
||||
* The space of the playback is almost empty.
|
||||
*
|
||||
* <p> the threshold is set in {@link DvrSettings}.
|
||||
*/
|
||||
public static final int PLAYBACK_STATUS_ALMOST_EMPTY =
|
||||
Constants.PlaybackStatus.SPACE_ALMOST_EMPTY;
|
||||
/**
|
||||
* The space of the playback is almost full.
|
||||
*
|
||||
* <p> the threshold is set in {@link DvrSettings}.
|
||||
*/
|
||||
public static final int PLAYBACK_STATUS_ALMOST_FULL =
|
||||
Constants.PlaybackStatus.SPACE_ALMOST_FULL;
|
||||
/**
|
||||
* The space of the playback is full.
|
||||
*/
|
||||
public static final int PLAYBACK_STATUS_FULL = Constants.PlaybackStatus.SPACE_FULL;
|
||||
|
||||
|
||||
private long mNativeContext;
|
||||
private DvrCallback mCallback;
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
package android.media.tv.tuner.dvr;
|
||||
|
||||
import android.media.tv.tuner.TunerConstants.FilterStatus;
|
||||
import android.media.tv.tuner.dvr.Dvr.PlaybackStatus;
|
||||
|
||||
/**
|
||||
* Callback interface for receiving information from DVR interfaces.
|
||||
*
|
||||
@@ -25,9 +28,9 @@ public interface DvrCallback {
|
||||
/**
|
||||
* Invoked when record status changed.
|
||||
*/
|
||||
void onRecordStatusChanged(int status);
|
||||
void onRecordStatusChanged(@FilterStatus int status);
|
||||
/**
|
||||
* Invoked when playback status changed.
|
||||
*/
|
||||
void onPlaybackStatusChanged(int status);
|
||||
void onPlaybackStatusChanged(@PlaybackStatus int status);
|
||||
}
|
||||
|
||||
@@ -19,8 +19,11 @@ package android.media.tv.tuner.dvr;
|
||||
import android.annotation.BytesLong;
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.RequiresPermission;
|
||||
import android.content.Context;
|
||||
import android.hardware.tv.tuner.V1_0.Constants;
|
||||
import android.media.tv.tuner.TunerConstants.FilterStatus;
|
||||
import android.media.tv.tuner.TunerUtils;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@@ -94,9 +97,13 @@ public class DvrSettings {
|
||||
|
||||
/**
|
||||
* Creates a builder for {@link DvrSettings}.
|
||||
*
|
||||
* @param context the context of the caller.
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
|
||||
@NonNull
|
||||
public static Builder newBuilder() {
|
||||
public static Builder builder(Context context) {
|
||||
TunerUtils.checkTunerPermission(context);
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,9 +19,7 @@ package android.media.tv.tuner.filter;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.RequiresPermission;
|
||||
import android.content.Context;
|
||||
import android.media.tv.tuner.TunerConstants;
|
||||
import android.media.tv.tuner.TunerUtils;
|
||||
import android.media.tv.tuner.filter.FilterConfiguration.FilterType;
|
||||
|
||||
/**
|
||||
* Filter Settings for a Video and Audio.
|
||||
@@ -35,8 +33,8 @@ public class AvSettings extends Settings {
|
||||
super(TunerUtils.getFilterSubtype(
|
||||
mainType,
|
||||
isAudio
|
||||
? TunerConstants.FILTER_SUBTYPE_AUDIO
|
||||
: TunerConstants.FILTER_SUBTYPE_VIDEO));
|
||||
? Filter.SUBTYPE_AUDIO
|
||||
: Filter.SUBTYPE_VIDEO));
|
||||
mIsPassthrough = isPassthrough;
|
||||
}
|
||||
|
||||
@@ -57,7 +55,7 @@ public class AvSettings extends Settings {
|
||||
@RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
|
||||
@NonNull
|
||||
public static Builder builder(
|
||||
@NonNull Context context, @FilterType int mainType, boolean isAudio) {
|
||||
@NonNull Context context, @Filter.Type int mainType, boolean isAudio) {
|
||||
TunerUtils.checkTunerPermission(context);
|
||||
return new Builder(mainType, isAudio);
|
||||
}
|
||||
|
||||
@@ -19,9 +19,7 @@ package android.media.tv.tuner.filter;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.RequiresPermission;
|
||||
import android.content.Context;
|
||||
import android.media.tv.tuner.TunerConstants;
|
||||
import android.media.tv.tuner.TunerUtils;
|
||||
import android.media.tv.tuner.filter.FilterConfiguration.FilterType;
|
||||
|
||||
/**
|
||||
* Filter Settings for a Download.
|
||||
@@ -31,7 +29,7 @@ public class DownloadSettings extends Settings {
|
||||
private final int mDownloadId;
|
||||
|
||||
private DownloadSettings(int mainType, int downloadId) {
|
||||
super(TunerUtils.getFilterSubtype(mainType, TunerConstants.FILTER_SUBTYPE_DOWNLOAD));
|
||||
super(TunerUtils.getFilterSubtype(mainType, Filter.SUBTYPE_DOWNLOAD));
|
||||
mDownloadId = downloadId;
|
||||
}
|
||||
|
||||
@@ -50,7 +48,7 @@ public class DownloadSettings extends Settings {
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
|
||||
@NonNull
|
||||
public static Builder builder(@NonNull Context context, @FilterType int mainType) {
|
||||
public static Builder builder(@NonNull Context context, @Filter.Type int mainType) {
|
||||
TunerUtils.checkTunerPermission(context);
|
||||
return new Builder(mainType);
|
||||
}
|
||||
|
||||
@@ -17,9 +17,15 @@
|
||||
package android.media.tv.tuner.filter;
|
||||
|
||||
import android.annotation.BytesLong;
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.hardware.tv.tuner.V1_0.Constants;
|
||||
import android.media.tv.tuner.Tuner.FilterCallback;
|
||||
import android.media.tv.tuner.TunerConstants.Result;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Tuner data filter.
|
||||
@@ -29,6 +35,128 @@ import android.media.tv.tuner.Tuner.FilterCallback;
|
||||
* @hide
|
||||
*/
|
||||
public class Filter implements AutoCloseable {
|
||||
/** @hide */
|
||||
@IntDef(prefix = "TYPE_",
|
||||
value = {TYPE_TS, TYPE_MMTP, TYPE_IP, TYPE_TLV, TYPE_ALP})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Type {}
|
||||
|
||||
/**
|
||||
* TS filter type.
|
||||
*/
|
||||
public static final int TYPE_TS = Constants.DemuxFilterMainType.TS;
|
||||
/**
|
||||
* MMTP filter type.
|
||||
*/
|
||||
public static final int TYPE_MMTP = Constants.DemuxFilterMainType.MMTP;
|
||||
/**
|
||||
* IP filter type.
|
||||
*/
|
||||
public static final int TYPE_IP = Constants.DemuxFilterMainType.IP;
|
||||
/**
|
||||
* TLV filter type.
|
||||
*/
|
||||
public static final int TYPE_TLV = Constants.DemuxFilterMainType.TLV;
|
||||
/**
|
||||
* ALP filter type.
|
||||
*/
|
||||
public static final int TYPE_ALP = Constants.DemuxFilterMainType.ALP;
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = "SUBTYPE_",
|
||||
value = {SUBTYPE_UNDEFINED, SUBTYPE_SECTION, SUBTYPE_PES, SUBTYPE_AUDIO, SUBTYPE_VIDEO,
|
||||
SUBTYPE_DOWNLOAD, SUBTYPE_RECORD, SUBTYPE_TS, SUBTYPE_PCR, SUBTYPE_TEMI,
|
||||
SUBTYPE_MMTP, SUBTYPE_NTP, SUBTYPE_IP_PAYLOAD, SUBTYPE_IP,
|
||||
SUBTYPE_PAYLOAD_THROUGH, SUBTYPE_TLV, SUBTYPE_PTP, })
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Subtype {}
|
||||
/**
|
||||
* Filter subtype undefined.
|
||||
* @hide
|
||||
*/
|
||||
public static final int SUBTYPE_UNDEFINED = 0;
|
||||
/**
|
||||
* Section filter subtype.
|
||||
* @hide
|
||||
*/
|
||||
public static final int SUBTYPE_SECTION = 1;
|
||||
/**
|
||||
* PES filter subtype.
|
||||
* @hide
|
||||
*/
|
||||
public static final int SUBTYPE_PES = 2;
|
||||
/**
|
||||
* Audio filter subtype.
|
||||
* @hide
|
||||
*/
|
||||
public static final int SUBTYPE_AUDIO = 3;
|
||||
/**
|
||||
* Video filter subtype.
|
||||
* @hide
|
||||
*/
|
||||
public static final int SUBTYPE_VIDEO = 4;
|
||||
/**
|
||||
* Download filter subtype.
|
||||
* @hide
|
||||
*/
|
||||
public static final int SUBTYPE_DOWNLOAD = 5;
|
||||
/**
|
||||
* Record filter subtype.
|
||||
* @hide
|
||||
*/
|
||||
public static final int SUBTYPE_RECORD = 6;
|
||||
/**
|
||||
* TS filter subtype.
|
||||
* @hide
|
||||
*/
|
||||
public static final int SUBTYPE_TS = 7;
|
||||
/**
|
||||
* PCR filter subtype.
|
||||
* @hide
|
||||
*/
|
||||
public static final int SUBTYPE_PCR = 8;
|
||||
/**
|
||||
* TEMI filter subtype.
|
||||
* @hide
|
||||
*/
|
||||
public static final int SUBTYPE_TEMI = 9;
|
||||
/**
|
||||
* MMTP filter subtype.
|
||||
* @hide
|
||||
*/
|
||||
public static final int SUBTYPE_MMTP = 10;
|
||||
/**
|
||||
* NTP filter subtype.
|
||||
* @hide
|
||||
*/
|
||||
public static final int SUBTYPE_NTP = 11;
|
||||
/**
|
||||
* Payload filter subtype.
|
||||
* @hide
|
||||
*/
|
||||
public static final int SUBTYPE_IP_PAYLOAD = 12;
|
||||
/**
|
||||
* IP filter subtype.
|
||||
* @hide
|
||||
*/
|
||||
public static final int SUBTYPE_IP = 13;
|
||||
/**
|
||||
* Payload through filter subtype.
|
||||
* @hide
|
||||
*/
|
||||
public static final int SUBTYPE_PAYLOAD_THROUGH = 14;
|
||||
/**
|
||||
* TLV filter subtype.
|
||||
* @hide
|
||||
*/
|
||||
public static final int SUBTYPE_TLV = 15;
|
||||
/**
|
||||
* PTP filter subtype.
|
||||
* @hide
|
||||
*/
|
||||
public static final int SUBTYPE_PTP = 16;
|
||||
|
||||
|
||||
private long mNativeContext;
|
||||
private FilterCallback mCallback;
|
||||
private final int mId;
|
||||
@@ -56,6 +184,7 @@ public class Filter implements AutoCloseable {
|
||||
* @param config the configuration of the filter.
|
||||
* @return result status of the operation.
|
||||
*/
|
||||
@Result
|
||||
public int configure(@NonNull FilterConfiguration config) {
|
||||
int subType = -1;
|
||||
Settings s = config.getSettings();
|
||||
@@ -68,6 +197,7 @@ public class Filter implements AutoCloseable {
|
||||
/**
|
||||
* Gets the filter Id.
|
||||
*/
|
||||
@Result
|
||||
public int getId() {
|
||||
return nativeGetId();
|
||||
}
|
||||
@@ -84,6 +214,7 @@ public class Filter implements AutoCloseable {
|
||||
* use demux as data source if the filter instance is NULL.
|
||||
* @return result status of the operation.
|
||||
*/
|
||||
@Result
|
||||
public int setDataSource(@Nullable Filter source) {
|
||||
return nativeSetDataSource(source);
|
||||
}
|
||||
@@ -93,6 +224,7 @@ public class Filter implements AutoCloseable {
|
||||
*
|
||||
* @return result status of the operation.
|
||||
*/
|
||||
@Result
|
||||
public int start() {
|
||||
return nativeStartFilter();
|
||||
}
|
||||
@@ -103,6 +235,7 @@ public class Filter implements AutoCloseable {
|
||||
*
|
||||
* @return result status of the operation.
|
||||
*/
|
||||
@Result
|
||||
public int stop() {
|
||||
return nativeStopFilter();
|
||||
}
|
||||
@@ -112,6 +245,7 @@ public class Filter implements AutoCloseable {
|
||||
*
|
||||
* @return result status of the operation.
|
||||
*/
|
||||
@Result
|
||||
public int flush() {
|
||||
return nativeFlushFilter();
|
||||
}
|
||||
@@ -124,6 +258,7 @@ public class Filter implements AutoCloseable {
|
||||
* @param size the maximum number of bytes to read.
|
||||
* @return the number of bytes read.
|
||||
*/
|
||||
@Result
|
||||
public int read(@NonNull byte[] buffer, @BytesLong long offset, @BytesLong long size) {
|
||||
size = Math.min(size, buffer.length - offset);
|
||||
return nativeRead(buffer, offset, size);
|
||||
|
||||
@@ -32,7 +32,10 @@ import java.lang.annotation.RetentionPolicy;
|
||||
@SystemApi
|
||||
public abstract class FilterConfiguration {
|
||||
|
||||
/** @hide */
|
||||
/**
|
||||
* TODO: moved to Filter. Remove it here.
|
||||
* @hide
|
||||
*/
|
||||
@IntDef(prefix = "FILTER_TYPE_", value =
|
||||
{FILTER_TYPE_TS, FILTER_TYPE_MMTP, FILTER_TYPE_IP, FILTER_TYPE_TLV, FILTER_TYPE_ALP})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.media.tv.tuner.filter;
|
||||
|
||||
import android.annotation.BytesLong;
|
||||
import android.annotation.Nullable;
|
||||
import android.media.tv.tuner.Tuner.Filter;
|
||||
|
||||
@@ -28,23 +29,27 @@ public class MediaEvent extends FilterEvent{
|
||||
private final int mStreamId;
|
||||
private final boolean mIsPtsPresent;
|
||||
private final long mPts;
|
||||
private final int mDataLength;
|
||||
private final long mDataLength;
|
||||
private final long mOffset;
|
||||
private final Object mLinearBuffer;
|
||||
private final boolean mIsSecureMemory;
|
||||
private final long mDataId;
|
||||
private final int mMpuSequenceNumber;
|
||||
private final boolean mIsPrivateData;
|
||||
private final AudioDescriptor mExtraMetaData;
|
||||
|
||||
// This constructor is used by JNI code only
|
||||
private MediaEvent(int streamId, boolean isPtsPresent, long pts, int dataLength, Object buffer,
|
||||
boolean isSecureMemory, int mpuSequenceNumber, boolean isPrivateData,
|
||||
AudioDescriptor extraMetaData) {
|
||||
private MediaEvent(int streamId, boolean isPtsPresent, long pts, long dataLength, long offset,
|
||||
Object buffer, boolean isSecureMemory, long dataId, int mpuSequenceNumber,
|
||||
boolean isPrivateData, AudioDescriptor extraMetaData) {
|
||||
mStreamId = streamId;
|
||||
mIsPtsPresent = isPtsPresent;
|
||||
mPts = pts;
|
||||
mDataLength = dataLength;
|
||||
mOffset = offset;
|
||||
mLinearBuffer = buffer;
|
||||
mIsSecureMemory = isSecureMemory;
|
||||
mDataId = dataId;
|
||||
mMpuSequenceNumber = mpuSequenceNumber;
|
||||
mIsPrivateData = isPrivateData;
|
||||
mExtraMetaData = extraMetaData;
|
||||
@@ -76,10 +81,19 @@ public class MediaEvent extends FilterEvent{
|
||||
/**
|
||||
* Gets data size in bytes of audio or video frame.
|
||||
*/
|
||||
public int getDataLength() {
|
||||
@BytesLong
|
||||
public long getDataLength() {
|
||||
return mDataLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* The offset in the memory block which is shared among multiple Media Events.
|
||||
*/
|
||||
@BytesLong
|
||||
public long getOffset() {
|
||||
return mOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a linear buffer associated to the memory where audio or video data stays.
|
||||
* TODO: use LinearBuffer when it's ready.
|
||||
@@ -100,6 +114,15 @@ public class MediaEvent extends FilterEvent{
|
||||
return mIsSecureMemory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ID which is used by HAL to provide additional information for AV data.
|
||||
*
|
||||
* <p>For secure audio, it's the audio handle used by Audio Track.
|
||||
*/
|
||||
public long getAvDataId() {
|
||||
return mDataId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets MPU sequence number of filtered data.
|
||||
*/
|
||||
|
||||
@@ -39,7 +39,7 @@ public class MmtpFilterConfiguration extends FilterConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets MMPT PID.
|
||||
* Gets MMTP PID.
|
||||
*
|
||||
* <p>Packet ID is used to specify packets in MMTP.
|
||||
*/
|
||||
@@ -69,7 +69,7 @@ public class MmtpFilterConfiguration extends FilterConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets MMPT PID.
|
||||
* Sets MMTP PID.
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setMmtpPid(int mmtpPid) {
|
||||
|
||||
@@ -20,9 +20,7 @@ import android.annotation.NonNull;
|
||||
import android.annotation.RequiresPermission;
|
||||
import android.annotation.SystemApi;
|
||||
import android.content.Context;
|
||||
import android.media.tv.tuner.TunerConstants;
|
||||
import android.media.tv.tuner.TunerUtils;
|
||||
import android.media.tv.tuner.filter.FilterConfiguration.FilterType;
|
||||
|
||||
/**
|
||||
* Filter Settings for a PES Data.
|
||||
@@ -34,8 +32,8 @@ public class PesSettings extends Settings {
|
||||
private final int mStreamId;
|
||||
private final boolean mIsRaw;
|
||||
|
||||
private PesSettings(@FilterType int mainType, int streamId, boolean isRaw) {
|
||||
super(TunerUtils.getFilterSubtype(mainType, TunerConstants.FILTER_SUBTYPE_PES));
|
||||
private PesSettings(@Filter.Type int mainType, int streamId, boolean isRaw) {
|
||||
super(TunerUtils.getFilterSubtype(mainType, Filter.SUBTYPE_PES));
|
||||
mStreamId = streamId;
|
||||
mIsRaw = isRaw;
|
||||
}
|
||||
@@ -65,7 +63,7 @@ public class PesSettings extends Settings {
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
|
||||
@NonNull
|
||||
public static Builder builder(@NonNull Context context, @FilterType int mainType) {
|
||||
public static Builder builder(@NonNull Context context, @Filter.Type int mainType) {
|
||||
TunerUtils.checkTunerPermission(context);
|
||||
return new Builder(mainType);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import android.hardware.tv.tuner.V1_0.Constants;
|
||||
import android.media.tv.tuner.TunerConstants;
|
||||
import android.media.tv.tuner.TunerConstants.ScIndexType;
|
||||
import android.media.tv.tuner.TunerUtils;
|
||||
import android.media.tv.tuner.filter.FilterConfiguration.FilterType;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@@ -151,7 +150,7 @@ public class RecordSettings extends Settings {
|
||||
private final int mScIndexMask;
|
||||
|
||||
private RecordSettings(int mainType, int tsIndexType, int scIndexType, int scIndexMask) {
|
||||
super(TunerUtils.getFilterSubtype(mainType, TunerConstants.FILTER_SUBTYPE_RECORD));
|
||||
super(TunerUtils.getFilterSubtype(mainType, Filter.SUBTYPE_RECORD));
|
||||
mTsIndexMask = tsIndexType;
|
||||
mScIndexType = scIndexType;
|
||||
mScIndexMask = scIndexMask;
|
||||
@@ -187,7 +186,7 @@ public class RecordSettings extends Settings {
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
|
||||
@NonNull
|
||||
public static Builder builder(@NonNull Context context, @FilterType int mainType) {
|
||||
public static Builder builder(@NonNull Context context, @Filter.Type int mainType) {
|
||||
TunerUtils.checkTunerPermission(context);
|
||||
return new Builder(mainType);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package android.media.tv.tuner.filter;
|
||||
|
||||
import android.media.tv.tuner.TunerConstants;
|
||||
import android.media.tv.tuner.TunerUtils;
|
||||
|
||||
/**
|
||||
@@ -26,6 +25,6 @@ import android.media.tv.tuner.TunerUtils;
|
||||
public class SectionSettings extends Settings {
|
||||
|
||||
SectionSettings(int mainType) {
|
||||
super(TunerUtils.getFilterSubtype(mainType, TunerConstants.FILTER_SUBTYPE_SECTION));
|
||||
super(TunerUtils.getFilterSubtype(mainType, Filter.SUBTYPE_SECTION));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import android.annotation.NonNull;
|
||||
import android.annotation.RequiresPermission;
|
||||
import android.content.Context;
|
||||
import android.media.tv.tuner.TunerUtils;
|
||||
import android.media.tv.tuner.filter.FilterConfiguration.FilterType;
|
||||
|
||||
/**
|
||||
* Bits Settings for Section Filters.
|
||||
@@ -73,7 +72,7 @@ public class SectionSettingsWithSectionBits extends SectionSettings {
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
|
||||
@NonNull
|
||||
public static Builder builder(@NonNull Context context, @FilterType int mainType) {
|
||||
public static Builder builder(@NonNull Context context, @Filter.Type int mainType) {
|
||||
TunerUtils.checkTunerPermission(context);
|
||||
return new Builder(mainType);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import android.annotation.NonNull;
|
||||
import android.annotation.RequiresPermission;
|
||||
import android.content.Context;
|
||||
import android.media.tv.tuner.TunerUtils;
|
||||
import android.media.tv.tuner.filter.FilterConfiguration.FilterType;
|
||||
|
||||
/**
|
||||
* Table information for Section Filter.
|
||||
@@ -57,7 +56,7 @@ public class SectionSettingsWithTableInfo extends SectionSettings {
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
|
||||
@NonNull
|
||||
public static Builder builder(@NonNull Context context, @FilterType int mainType) {
|
||||
public static Builder builder(@NonNull Context context, @Filter.Type int mainType) {
|
||||
TunerUtils.checkTunerPermission(context);
|
||||
return new Builder(mainType);
|
||||
}
|
||||
|
||||
@@ -112,31 +112,31 @@ public class DvbsFrontendSettings extends FrontendSettings {
|
||||
public @interface Rolloff {}
|
||||
|
||||
/**
|
||||
* Roll Off undefined.
|
||||
* Rolloff range undefined.
|
||||
*/
|
||||
public static final int ROLLOFF_UNDEFINED = Constants.FrontendDvbsRolloff.UNDEFINED;
|
||||
/**
|
||||
* Roll Off 0_35.
|
||||
* Rolloff range 0,35.
|
||||
*/
|
||||
public static final int ROLLOFF_0_35 = Constants.FrontendDvbsRolloff.ROLLOFF_0_35;
|
||||
/**
|
||||
* Roll Off 0_25.
|
||||
* Rolloff range 0,25.
|
||||
*/
|
||||
public static final int ROLLOFF_0_25 = Constants.FrontendDvbsRolloff.ROLLOFF_0_25;
|
||||
/**
|
||||
* Roll Off 0_2.
|
||||
* Rolloff range 0,20.
|
||||
*/
|
||||
public static final int ROLLOFF_0_20 = Constants.FrontendDvbsRolloff.ROLLOFF_0_20;
|
||||
/**
|
||||
* Roll Off 0_15.
|
||||
* Rolloff range 0,15.
|
||||
*/
|
||||
public static final int ROLLOFF_0_15 = Constants.FrontendDvbsRolloff.ROLLOFF_0_15;
|
||||
/**
|
||||
* Roll Off 0_1.
|
||||
* Rolloff range 0,10.
|
||||
*/
|
||||
public static final int ROLLOFF_0_10 = Constants.FrontendDvbsRolloff.ROLLOFF_0_10;
|
||||
/**
|
||||
* Roll Off 0_5.
|
||||
* Rolloff range 0,5.
|
||||
*/
|
||||
public static final int ROLLOFF_0_5 = Constants.FrontendDvbsRolloff.ROLLOFF_0_5;
|
||||
|
||||
@@ -188,6 +188,25 @@ public class DvbsFrontendSettings extends FrontendSettings {
|
||||
*/
|
||||
public static final int STANDARD_S2X = Constants.FrontendDvbsStandard.S2X;
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = "VCM_MODE_",
|
||||
value = {VCM_MODE_UNDEFINED, VCM_MODE_AUTO, VCM_MODE_MANUAL})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface VcmMode {}
|
||||
|
||||
/**
|
||||
* VCM mode undefined.
|
||||
*/
|
||||
public static final int VCM_MODE_UNDEFINED = Constants.FrontendDvbsVcmMode.UNDEFINED;
|
||||
/**
|
||||
* Auto VCM mode.
|
||||
*/
|
||||
public static final int VCM_MODE_AUTO = Constants.FrontendDvbsVcmMode.AUTO;
|
||||
/**
|
||||
* Manual VCM mode.
|
||||
*/
|
||||
public static final int VCM_MODE_MANUAL = Constants.FrontendDvbsVcmMode.MANUAL;
|
||||
|
||||
|
||||
private final int mModulation;
|
||||
private final DvbsCodeRate mCoderate;
|
||||
@@ -196,9 +215,10 @@ public class DvbsFrontendSettings extends FrontendSettings {
|
||||
private final int mPilot;
|
||||
private final int mInputStreamId;
|
||||
private final int mStandard;
|
||||
private final int mVcmMode;
|
||||
|
||||
private DvbsFrontendSettings(int frequency, int modulation, DvbsCodeRate coderate,
|
||||
int symbolRate, int rolloff, int pilot, int inputStreamId, int standard) {
|
||||
int symbolRate, int rolloff, int pilot, int inputStreamId, int standard, int vcm) {
|
||||
super(frequency);
|
||||
mModulation = modulation;
|
||||
mCoderate = coderate;
|
||||
@@ -207,6 +227,7 @@ public class DvbsFrontendSettings extends FrontendSettings {
|
||||
mPilot = pilot;
|
||||
mInputStreamId = inputStreamId;
|
||||
mStandard = standard;
|
||||
mVcmMode = vcm;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -256,6 +277,13 @@ public class DvbsFrontendSettings extends FrontendSettings {
|
||||
public int getStandard() {
|
||||
return mStandard;
|
||||
}
|
||||
/**
|
||||
* Gets VCM mode.
|
||||
*/
|
||||
@VcmMode
|
||||
public int getVcmMode() {
|
||||
return mVcmMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a builder for {@link DvbsFrontendSettings}.
|
||||
@@ -280,6 +308,7 @@ public class DvbsFrontendSettings extends FrontendSettings {
|
||||
private int mPilot;
|
||||
private int mInputStreamId;
|
||||
private int mStandard;
|
||||
private int mVcmMode;
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
@@ -340,6 +369,14 @@ public class DvbsFrontendSettings extends FrontendSettings {
|
||||
mStandard = standard;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Sets VCM mode.
|
||||
*/
|
||||
@NonNull
|
||||
public Builder setVcmMode(@VcmMode int vcm) {
|
||||
mVcmMode = vcm;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a {@link DvbsFrontendSettings} object.
|
||||
@@ -347,7 +384,7 @@ public class DvbsFrontendSettings extends FrontendSettings {
|
||||
@NonNull
|
||||
public DvbsFrontendSettings build() {
|
||||
return new DvbsFrontendSettings(mFrequency, mModulation, mCoderate, mSymbolRate,
|
||||
mRolloff, mPilot, mInputStreamId, mStandard);
|
||||
mRolloff, mPilot, mInputStreamId, mStandard, mVcmMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -110,7 +110,7 @@ public class DvbtFrontendSettings extends FrontendSettings {
|
||||
*/
|
||||
public static final int BANDWIDTH_5MHZ = Constants.FrontendDvbtBandwidth.BANDWIDTH_5MHZ;
|
||||
/**
|
||||
* 1.7 MHz bandwidth.
|
||||
* 1,7 MHz bandwidth.
|
||||
*/
|
||||
public static final int BANDWIDTH_1_7MHZ = Constants.FrontendDvbtBandwidth.BANDWIDTH_1_7MHZ;
|
||||
/**
|
||||
@@ -232,39 +232,39 @@ public class DvbtFrontendSettings extends FrontendSettings {
|
||||
*/
|
||||
public static final int CODERATE_AUTO = Constants.FrontendDvbtCoderate.AUTO;
|
||||
/**
|
||||
* 1_2 code rate.
|
||||
* 1/2 code rate.
|
||||
*/
|
||||
public static final int CODERATE_1_2 = Constants.FrontendDvbtCoderate.CODERATE_1_2;
|
||||
/**
|
||||
* 2_3 code rate.
|
||||
* 2/3 code rate.
|
||||
*/
|
||||
public static final int CODERATE_2_3 = Constants.FrontendDvbtCoderate.CODERATE_2_3;
|
||||
/**
|
||||
* 3_4 code rate.
|
||||
* 3/4 code rate.
|
||||
*/
|
||||
public static final int CODERATE_3_4 = Constants.FrontendDvbtCoderate.CODERATE_3_4;
|
||||
/**
|
||||
* 5_6 code rate.
|
||||
* 5/6 code rate.
|
||||
*/
|
||||
public static final int CODERATE_5_6 = Constants.FrontendDvbtCoderate.CODERATE_5_6;
|
||||
/**
|
||||
* 7_8 code rate.
|
||||
* 7/8 code rate.
|
||||
*/
|
||||
public static final int CODERATE_7_8 = Constants.FrontendDvbtCoderate.CODERATE_7_8;
|
||||
/**
|
||||
* 4_5 code rate.
|
||||
* 4/5 code rate.
|
||||
*/
|
||||
public static final int CODERATE_3_5 = Constants.FrontendDvbtCoderate.CODERATE_3_5;
|
||||
/**
|
||||
* 4_5 code rate.
|
||||
* 4/5 code rate.
|
||||
*/
|
||||
public static final int CODERATE_4_5 = Constants.FrontendDvbtCoderate.CODERATE_4_5;
|
||||
/**
|
||||
* 6_7 code rate.
|
||||
* 6/7 code rate.
|
||||
*/
|
||||
public static final int CODERATE_6_7 = Constants.FrontendDvbtCoderate.CODERATE_6_7;
|
||||
/**
|
||||
* 8_9 code rate.
|
||||
* 8/9 code rate.
|
||||
*/
|
||||
public static final int CODERATE_8_9 = Constants.FrontendDvbtCoderate.CODERATE_8_9;
|
||||
|
||||
|
||||
@@ -87,47 +87,47 @@ public class Isdbs3FrontendSettings extends FrontendSettings {
|
||||
*/
|
||||
public static final int CODERATE_AUTO = Constants.FrontendIsdbs3Coderate.AUTO;
|
||||
/**
|
||||
* 1_3 code rate.
|
||||
* 1/3 code rate.
|
||||
*/
|
||||
public static final int CODERATE_1_3 = Constants.FrontendIsdbs3Coderate.CODERATE_1_3;
|
||||
/**
|
||||
* 2_5 code rate.
|
||||
* 2/5 code rate.
|
||||
*/
|
||||
public static final int CODERATE_2_5 = Constants.FrontendIsdbs3Coderate.CODERATE_2_5;
|
||||
/**
|
||||
* 1_2 code rate.
|
||||
* 1/2 code rate.
|
||||
*/
|
||||
public static final int CODERATE_1_2 = Constants.FrontendIsdbs3Coderate.CODERATE_1_2;
|
||||
/**
|
||||
* 3_5 code rate.
|
||||
* 3/5 code rate.
|
||||
*/
|
||||
public static final int CODERATE_3_5 = Constants.FrontendIsdbs3Coderate.CODERATE_3_5;
|
||||
/**
|
||||
* 2_3 code rate.
|
||||
* 2/3 code rate.
|
||||
*/
|
||||
public static final int CODERATE_2_3 = Constants.FrontendIsdbs3Coderate.CODERATE_2_3;
|
||||
/**
|
||||
* 3_4 code rate.
|
||||
* 3/4 code rate.
|
||||
*/
|
||||
public static final int CODERATE_3_4 = Constants.FrontendIsdbs3Coderate.CODERATE_3_4;
|
||||
/**
|
||||
* 7_9 code rate.
|
||||
* 7/9 code rate.
|
||||
*/
|
||||
public static final int CODERATE_7_9 = Constants.FrontendIsdbs3Coderate.CODERATE_7_9;
|
||||
/**
|
||||
* 4_5 code rate.
|
||||
* 4/5 code rate.
|
||||
*/
|
||||
public static final int CODERATE_4_5 = Constants.FrontendIsdbs3Coderate.CODERATE_4_5;
|
||||
/**
|
||||
* 5_6 code rate.
|
||||
* 5/6 code rate.
|
||||
*/
|
||||
public static final int CODERATE_5_6 = Constants.FrontendIsdbs3Coderate.CODERATE_5_6;
|
||||
/**
|
||||
* 7_8 code rate.
|
||||
* 7/8 code rate.
|
||||
*/
|
||||
public static final int CODERATE_7_8 = Constants.FrontendIsdbs3Coderate.CODERATE_7_8;
|
||||
/**
|
||||
* 9_10 code rate.
|
||||
* 9/10 code rate.
|
||||
*/
|
||||
public static final int CODERATE_9_10 = Constants.FrontendIsdbs3Coderate.CODERATE_9_10;
|
||||
|
||||
@@ -138,11 +138,11 @@ public class Isdbs3FrontendSettings extends FrontendSettings {
|
||||
public @interface Rolloff {}
|
||||
|
||||
/**
|
||||
* Roll off type undefined.
|
||||
* Rolloff type undefined.
|
||||
*/
|
||||
public static final int ROLLOFF_UNDEFINED = Constants.FrontendIsdbs3Rolloff.UNDEFINED;
|
||||
/**
|
||||
* 0.03 roll off type.
|
||||
* 0,03 Rolloff.
|
||||
*/
|
||||
public static final int ROLLOFF_0_03 = Constants.FrontendIsdbs3Rolloff.ROLLOFF_0_03;
|
||||
|
||||
|
||||
@@ -96,23 +96,23 @@ public class IsdbsFrontendSettings extends FrontendSettings {
|
||||
*/
|
||||
public static final int CODERATE_AUTO = Constants.FrontendIsdbsCoderate.AUTO;
|
||||
/**
|
||||
* 1_2 code rate.
|
||||
* 1/2 code rate.
|
||||
*/
|
||||
public static final int CODERATE_1_2 = Constants.FrontendIsdbsCoderate.CODERATE_1_2;
|
||||
/**
|
||||
* 2_3 code rate.
|
||||
* 2/3 code rate.
|
||||
*/
|
||||
public static final int CODERATE_2_3 = Constants.FrontendIsdbsCoderate.CODERATE_2_3;
|
||||
/**
|
||||
* 3_4 code rate.
|
||||
* 3/4 code rate.
|
||||
*/
|
||||
public static final int CODERATE_3_4 = Constants.FrontendIsdbsCoderate.CODERATE_3_4;
|
||||
/**
|
||||
* 5_6 code rate.
|
||||
* 5/6 code rate.
|
||||
*/
|
||||
public static final int CODERATE_5_6 = Constants.FrontendIsdbsCoderate.CODERATE_5_6;
|
||||
/**
|
||||
* 7_8 code rate.
|
||||
* 7/8 code rate.
|
||||
*/
|
||||
public static final int CODERATE_7_8 = Constants.FrontendIsdbsCoderate.CODERATE_7_8;
|
||||
|
||||
@@ -123,11 +123,11 @@ public class IsdbsFrontendSettings extends FrontendSettings {
|
||||
public @interface Rolloff {}
|
||||
|
||||
/**
|
||||
* Roll off type undefined.
|
||||
* Rolloff type undefined.
|
||||
*/
|
||||
public static final int ROLLOFF_UNDEFINED = Constants.FrontendIsdbs3Rolloff.UNDEFINED;
|
||||
/**
|
||||
* 0.35 roll off type.
|
||||
* 0,35 rolloff.
|
||||
*/
|
||||
public static final int ROLLOFF_0_35 = Constants.FrontendIsdbsRolloff.ROLLOFF_0_35;
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.media.tv.tuner.frontend;
|
||||
|
||||
|
||||
/**
|
||||
* Scan callback.
|
||||
*
|
||||
@@ -31,11 +32,11 @@ public interface ScanCallback {
|
||||
/** scan progress percent (0..100) */
|
||||
void onProgress(int percent);
|
||||
|
||||
/** Signal frequency in Hertz */
|
||||
void onFrequencyReport(int frequency);
|
||||
/** Signal frequencies in Hertz */
|
||||
void onFrequenciesReport(int[] frequency);
|
||||
|
||||
/** Symbols per second */
|
||||
void onSymbolRate(int rate);
|
||||
void onSymbolRates(int[] rate);
|
||||
|
||||
/** Locked Plp Ids for DVBT2 frontend. */
|
||||
void onPlpIds(int[] plpIds);
|
||||
@@ -46,15 +47,24 @@ public interface ScanCallback {
|
||||
/** Stream Ids. */
|
||||
void onInputStreamIds(int[] inputStreamIds);
|
||||
|
||||
/** Locked signal standard. */
|
||||
/** Locked signal standard for DVBS. */
|
||||
void onDvbsStandard(@DvbsFrontendSettings.Standard int dvbsStandandard);
|
||||
|
||||
/** Locked signal standard. */
|
||||
/** Locked signal standard. for DVBT */
|
||||
void onDvbtStandard(@DvbtFrontendSettings.Standard int dvbtStandard);
|
||||
|
||||
/** Locked signal SIF standard for Analog. */
|
||||
void onAnalogSifStandard(@AnalogFrontendSettings.SifStandard int sif);
|
||||
|
||||
/** PLP status in a tuned frequency band for ATSC3 frontend. */
|
||||
void onAtsc3PlpInfos(Atsc3PlpInfo[] atsc3PlpInfos);
|
||||
|
||||
/** Frontend hierarchy. */
|
||||
void onHierarchy(@DvbtFrontendSettings.Hierarchy int hierarchy);
|
||||
|
||||
/** Frontend hierarchy. */
|
||||
void onSignalType(@AnalogFrontendSettings.SignalType int signalType);
|
||||
|
||||
/** PLP information for ATSC3. */
|
||||
class Atsc3PlpInfo {
|
||||
private final int mPlpId;
|
||||
|
||||
Reference in New Issue
Block a user