summaryrefslogtreecommitdiffstats
path: root/tvouthack/main.cpp
diff options
context:
space:
mode:
authorPawit Pornkitprasan <p.pawit@gmail.com>2011-12-06 14:45:41 +0700
committerPawit Pornkitprasan <p.pawit@gmail.com>2011-12-06 14:45:54 +0700
commitcdf27513762c3313f8ef8e606bb31533e5f25087 (patch)
tree56fcffba956b8305ded2e104758a2f744cfb2285 /tvouthack/main.cpp
parent71012e283db265ba0d4b93400ea802e2a84c46bf (diff)
downloaddevice_samsung_aries-common-cdf27513762c3313f8ef8e606bb31533e5f25087.zip
device_samsung_aries-common-cdf27513762c3313f8ef8e606bb31533e5f25087.tar.gz
device_samsung_aries-common-cdf27513762c3313f8ef8e606bb31533e5f25087.tar.bz2
Add TV Out support
Diffstat (limited to 'tvouthack/main.cpp')
-rw-r--r--tvouthack/main.cpp49
1 files changed, 49 insertions, 0 deletions
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 <stdio.h>
+#include <binder/IPCThreadState.h>
+#include <binder/ProcessState.h>
+#include <binder/IServiceManager.h>
+#include <utils/Log.h>
+
+using namespace android;
+
+int main() {
+ sp<IServiceManager> sm = defaultServiceManager();
+ sp<IBinder> 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<IBinder> 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