summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author shubang <shubang@google.com> 2019-12-27 12:02:08 -0800
committer Shubang Lu <shubang@google.com> 2020-01-06 18:28:05 +0000
commit7343fee9a8f84d75c147579f52aeeaa70eea22e6 (patch)
treee2b1ee6ed4d01660bfae9ad3437e174d874d7855
parent3c5d179ab3c1e8c41ef98ca491e7458acd1bcdf1 (diff)
Complete Java APIs of demux.hal
Test: make Change-Id: Ied9df878620632eb60ec16fd5ec7c3f989ffb7c4
-rw-r--r--media/java/android/media/tv/tuner/Tuner.java57
-rw-r--r--media/jni/android_media_tv_Tuner.cpp21
2 files changed, 78 insertions, 0 deletions
diff --git a/media/java/android/media/tv/tuner/Tuner.java b/media/java/android/media/tv/tuner/Tuner.java
index b8ab7eea248e..fcb03c0305a8 100644
--- a/media/java/android/media/tv/tuner/Tuner.java
+++ b/media/java/android/media/tv/tuner/Tuner.java
@@ -110,6 +110,10 @@ public final class Tuner implements AutoCloseable {
private native int nativeSetLnb(int lnbId);
private native int nativeSetLna(boolean enable);
private native FrontendStatus[] nativeGetFrontendStatus(int[] statusTypes);
+ private native int nativeGetAvSyncHwId(Filter filter);
+ private native long nativeGetAvSyncTime(int avSyncId);
+ private native int nativeConnectCiCam(int ciCamId);
+ private native int nativeDisconnectCiCam();
private native Filter nativeOpenFilter(int type, int subType, int bufferSize);
private native List<Integer> nativeGetLnbIds();
@@ -351,6 +355,59 @@ public final class Tuner implements AutoCloseable {
return nativeGetFrontendStatus(statusTypes);
}
+ /**
+ * Gets hardware sync ID for audio and video.
+ *
+ * @param filter the filter instance for the hardware sync ID.
+ * @return the id of hardware A/V sync.
+ * @hide
+ */
+ public int getAvSyncHwId(Filter filter) {
+ return nativeGetAvSyncHwId(filter);
+ }
+ /**
+ * Gets the current timestamp for A/V sync
+ *
+ * The timestamp is maintained by hardware. The timestamp based on 90KHz, and it's format is the
+ * same as PTS (Presentation Time Stamp).
+ *
+ * @param avSyncHwId the hardware id of A/V sync.
+ * @return the current timestamp of hardware A/V sync.
+ * @hide
+ */
+ public long getAvSyncTime(int avSyncHwId) {
+ return nativeGetAvSyncTime(avSyncHwId);
+ }
+
+
+ /**
+ * Connects Conditional Access Modules (CAM) through Common Interface (CI)
+ *
+ * The demux uses the output from the frontend as the input by default, and must change to use
+ * the output from CI-CAM as the input after this call.
+ *
+ * @param ciCamId specify CI-CAM Id to connect.
+ * @return result status of the operation.
+ * @hide
+ */
+ @Result
+ public int connectCiCam(int ciCamId) {
+ return nativeConnectCiCam(ciCamId);
+ }
+
+ /**
+ * Disconnects Conditional Access Modules (CAM)
+ *
+ * The demux will use the output from the frontend as the input after this call.
+ *
+ * @return result status of the operation.
+ * @hide
+ */
+ @Result
+ public int disconnectCiCam() {
+ return nativeDisconnectCiCam();
+ }
+
private List<Integer> getFrontendIds() {
mFrontendIds = nativeGetFrontendIds();
return mFrontendIds;
diff --git a/media/jni/android_media_tv_Tuner.cpp b/media/jni/android_media_tv_Tuner.cpp
index da52696506b5..9d2e85539da8 100644
--- a/media/jni/android_media_tv_Tuner.cpp
+++ b/media/jni/android_media_tv_Tuner.cpp
@@ -636,6 +636,22 @@ static jobjectArray android_media_tv_Tuner_get_frontend_status(JNIEnv, jobject,
return NULL;
}
+static int android_media_tv_Tuner_gat_av_sync_hw_id(JNIEnv*, jobject, jobject) {
+ return 0;
+}
+
+static jlong android_media_tv_Tuner_gat_av_sync_time(JNIEnv*, jobject, jint) {
+ return 0;
+}
+
+static int android_media_tv_Tuner_connect_cicam(JNIEnv*, jobject, jint) {
+ return 0;
+}
+
+static int android_media_tv_Tuner_disconnect_cicam(JNIEnv*, jobject) {
+ return 0;
+}
+
static jobject android_media_tv_Tuner_get_lnb_ids(JNIEnv *env, jobject thiz) {
sp<JTuner> tuner = getTuner(env, thiz);
return tuner->getLnbIds();
@@ -944,6 +960,11 @@ static const JNINativeMethod gTunerMethods[] = {
{ "nativeSetLna", "(Z)I", (void *)android_media_tv_Tuner_set_lna },
{ "nativeGetFrontendStatus", "([I)[Landroid/media/tv/tuner/FrontendStatus;",
(void *)android_media_tv_Tuner_get_frontend_status },
+ { "nativeGetAvSyncHwId", "(Landroid/media/tv/tuner/Tuner$Filter;)I",
+ (void *)android_media_tv_Tuner_gat_av_sync_hw_id },
+ { "nativeGetAvSyncTime", "(I)J", (void *)android_media_tv_Tuner_gat_av_sync_time },
+ { "nativeConnectCiCam", "(I)I", (void *)android_media_tv_Tuner_connect_cicam },
+ { "nativeDisconnectCiCam", "()I", (void *)android_media_tv_Tuner_disconnect_cicam },
{ "nativeOpenFilter", "(III)Landroid/media/tv/tuner/Tuner$Filter;",
(void *)android_media_tv_Tuner_open_filter },
{ "nativeGetLnbIds", "()Ljava/util/List;",