From cdf27513762c3313f8ef8e606bb31533e5f25087 Mon Sep 17 00:00:00 2001
From: Pawit Pornkitprasan
Date: Tue, 6 Dec 2011 14:45:41 +0700
Subject: Add TV Out support
---
tvouthack/Android.mk | 27 +++++++++++++++++++++++++++
tvouthack/README.txt | 5 +++++
tvouthack/main.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 81 insertions(+)
create mode 100644 tvouthack/Android.mk
create mode 100644 tvouthack/README.txt
create mode 100644 tvouthack/main.cpp
(limited to 'tvouthack')
diff --git a/tvouthack/Android.mk b/tvouthack/Android.mk
new file mode 100644
index 0000000..a38be88
--- /dev/null
+++ b/tvouthack/Android.mk
@@ -0,0 +1,27 @@
+# Copyright (C) 2011 Pawit Pornkitprasan
+#
+# 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.
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := main.cpp
+
+LOCAL_SHARED_LIBRARIES := libutils libbinder
+
+LOCAL_MODULE := tvouthack
+
+include $(BUILD_EXECUTABLE)
+
diff --git a/tvouthack/README.txt b/tvouthack/README.txt
new file mode 100644
index 0000000..bea0307
--- /dev/null
+++ b/tvouthack/README.txt
@@ -0,0 +1,5 @@
+The proprietary daemon "tvoutserver" expects the system to tell it
+when the frames should be refreshed. Samsung implemented this by
+integrating TV Out in surfaceflinger and other graphic services.
+However, we will just run a daemon that brute sends the signal every
+150 ms.
\ No newline at end of file
diff --git a/tvouthack/main.cpp b/tvouthack/main.cpp
new file mode 100644
index 0000000..85005c7
--- /dev/null
+++ b/tvouthack/main.cpp
@@ -0,0 +1,49 @@
+#include
+#include
+#include
+#include
+#include
+
+using namespace android;
+
+int main() {
+ sp sm = defaultServiceManager();
+ sp binder;
+
+ do {
+ binder = sm->getService(String16("tvout"));
+ if (binder != 0) break;
+ usleep(500000); // 0.5 s
+ } while(true);
+
+ int ret;
+
+ Parcel s2, r2;
+ s2.writeInterfaceToken(String16("android.hardware.ITvOutService"));
+ binder->transact(1, s2, &r2);
+ sp binder2 = r2.readStrongBinder();
+
+ while (true) {
+ {
+ Parcel send, reply;
+ int code = 4;
+ send.writeInterfaceToken(String16("android.hardware.ITvOut"));
+ int ret = binder2->transact(code, send, &reply);
+ }
+ {
+ Parcel send, reply;
+ int code = 27;
+ send.writeInterfaceToken(String16("android.hardware.ITvOut"));
+ int ret = binder2->transact(code, send, &reply);
+ }
+ {
+ Parcel send, reply;
+ int code = 13;
+ send.writeInterfaceToken(String16("android.hardware.ITvOut"));
+ send.writeInt32(0);
+ int ret = binder2->transact(code, send, &reply);
+ }
+ usleep(15000); // Should give ~60 fps
+ }
+ return 0;
+}
\ No newline at end of file
--
cgit v1.1