From: Good Guy Date: Sat, 11 Jan 2020 02:44:20 +0000 (-0700) Subject: add x10tv ati remote rework, android remote rework, wintv remote tweaks X-Git-Tag: 2020-01~9 X-Git-Url: https://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=32a609a6bd1181993569399ab51f314dc7cb4fba;p=goodguy%2Fcinelerra.git add x10tv ati remote rework, android remote rework, wintv remote tweaks --- diff --git a/CineRmt/.idea/assetWizardSettings.xml b/CineRmt/.idea/assetWizardSettings.xml new file mode 100644 index 00000000..2a9c5e01 --- /dev/null +++ b/CineRmt/.idea/assetWizardSettings.xml @@ -0,0 +1,14 @@ + + + + + + \ No newline at end of file diff --git a/CineRmt/.idea/codeStyles/Project.xml b/CineRmt/.idea/codeStyles/Project.xml index 30aa626c..ae78c113 100644 --- a/CineRmt/.idea/codeStyles/Project.xml +++ b/CineRmt/.idea/codeStyles/Project.xml @@ -1,29 +1,113 @@ - - - - - - - - - - + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
\ No newline at end of file diff --git a/CineRmt/.idea/dictionaries/root.xml b/CineRmt/.idea/dictionaries/root.xml new file mode 100644 index 00000000..5023c4b8 --- /dev/null +++ b/CineRmt/.idea/dictionaries/root.xml @@ -0,0 +1,7 @@ + + + + volup + + + \ No newline at end of file diff --git a/CineRmt/.idea/gradle.xml b/CineRmt/.idea/gradle.xml index 7ac24c77..ee635a31 100644 --- a/CineRmt/.idea/gradle.xml +++ b/CineRmt/.idea/gradle.xml @@ -3,6 +3,9 @@ diff --git a/CineRmt/.idea/vcs.xml b/CineRmt/.idea/vcs.xml new file mode 100644 index 00000000..6c0b8635 --- /dev/null +++ b/CineRmt/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/CineRmt/app/release/output.json b/CineRmt/app/release/output.json index 9f0c9596..c429e316 100644 --- a/CineRmt/app/release/output.json +++ b/CineRmt/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] \ No newline at end of file diff --git a/CineRmt/app/src/main/java/com/local/cinermt/MainActivity.java b/CineRmt/app/src/main/java/com/local/cinermt/MainActivity.java index dd28537b..327454df 100644 --- a/CineRmt/app/src/main/java/com/local/cinermt/MainActivity.java +++ b/CineRmt/app/src/main/java/com/local/cinermt/MainActivity.java @@ -160,7 +160,11 @@ public class MainActivity extends Activity img.setOnClickListener(this); img = (ImageButton)findViewById(R.id.buttonF); img.setOnClickListener(this); - img = (ImageButton)findViewById(R.id.button_dot); + img = (ImageButton)findViewById(R.id.buttonDOT); + img.setOnClickListener(this); + img = (ImageButton)findViewById(R.id.buttonTV); + img.setOnClickListener(this); + img = (ImageButton)findViewById(R.id.quit); img.setOnClickListener(this); img = (ImageButton)findViewById(R.id.fast_lt); img.setOnClickListener(this); @@ -190,12 +194,22 @@ public class MainActivity extends Activity img.setOnClickListener(this); img = (ImageButton)findViewById(R.id.rplay); img.setOnClickListener(this); + img = (ImageButton)findViewById(R.id.vol_dn); + img.setOnClickListener(this); + img = (ImageButton)findViewById(R.id.vol_up); + img.setOnClickListener(this); + img = (ImageButton)findViewById(R.id.mute); + img.setOnClickListener(this); + img = (ImageButton)findViewById(R.id.ch_up); + img.setOnClickListener(this); + img = (ImageButton)findViewById(R.id.ch_dn); + img.setOnClickListener(this); img = (ImageButton)findViewById(R.id.suspend); img.setOnClickListener(this); img = (ImageButton)findViewById(R.id.config); img.setOnClickListener(this); - img = (ImageButton)findViewById(R.id.exit); + img = (ImageButton)findViewById(R.id.buttonCC); img.setOnClickListener(this); img = (ImageButton)findViewById(R.id.power); img.setOnClickListener(this); @@ -212,9 +226,7 @@ public class MainActivity extends Activity public void onClick(View v) { if (v instanceof ImageButton) { int id = ((ImageButton)v).getId(); - if (id == R.id.stop) { send("stop"); } - else if (id == R.id.play) { send("play"); } - else if (id == R.id.rplay) { send("rplay"); } + if (id == R.id.menu) { send("menu"); } else if (id == R.id.button0) { send("key 0"); } else if (id == R.id.button1) { send("key 1"); } else if (id == R.id.button2) { send("key 2"); } @@ -230,18 +242,28 @@ public class MainActivity extends Activity else if (id == R.id.buttonC) { send("key C"); } else if (id == R.id.buttonD) { send("key D"); } else if (id == R.id.buttonE) { send("key E"); } - else if (id == R.id.buttonF) { send("key F"); } - else if (id == R.id.fast_lt) { send("fast_lt"); } - else if (id == R.id.media_up) { send("media_up"); } - else if (id == R.id.fast_rt) { send("fast_rt"); } - else if (id == R.id.menu) { send("menu"); } + else if (id == R.id.buttonF) { send("book"); } + else if (id == R.id.rplay) { send("rplay"); } + else if (id == R.id.stop) { send("stop"); } + else if (id == R.id.play) { send("play"); } else if (id == R.id.media_lt) { send("media_lt"); } - else if (id == R.id.pause) { send("pause"); } else if (id == R.id.media_rt) { send("media_rt"); } - else if (id == R.id.slow_lt) { send("slow_lt"); } + else if (id == R.id.media_up) { send("media_up"); } else if (id == R.id.media_dn) { send("media_dn"); } + else if (id == R.id.pause) { send("pause"); } + else if (id == R.id.slow_lt) { send("slow_lt"); } else if (id == R.id.slow_rt) { send("slow_rt"); } - else if (id == R.id.full_scr) { send("key F"); } + else if (id == R.id.fast_lt) { send("fast_lt"); } + else if (id == R.id.fast_rt) { send("fast_rt"); } + else if (id == R.id.full_scr) { send("fscrn"); } + else if (id == R.id.mute) { send("mute"); } + else if (id == R.id.vol_up) { send("vol_up"); } + else if (id == R.id.vol_dn) { send("vol_dn"); } + else if (id == R.id.ch_up) { send("ch_up"); } + else if (id == R.id.ch_dn) { send("ch_dn"); } + else if (id == R.id.buttonDOT) { send("key dot"); } + else if (id == R.id.buttonCC) { send("key cc"); } + else if (id == R.id.buttonTV) { send("key tv"); } else { save_defaults(); if (id == R.id.config) { @@ -251,12 +273,13 @@ public class MainActivity extends Activity it.putExtra("PORT", dport); startActivity(it); } - else if (id == R.id.suspend) - send("suspend"); - else if (id == R.id.power) - send("power"); - else if (id != R.id.exit) + else if (id == R.id.quit) send("hand"); + else if (id == R.id.suspend) send("suspend"); + else if (id == R.id.power) send("power"); + else { + Toast.makeText(this, "unknown msg",Toast.LENGTH_SHORT).show(); return; + } finish(); } } diff --git a/CineRmt/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/CineRmt/app/src/main/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index 1f6bb290..00000000 --- a/CineRmt/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - diff --git a/CineRmt/app/src/main/res/drawable/ic_launcher_background.xml b/CineRmt/app/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 0d025f9b..00000000 --- a/CineRmt/app/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/CineRmt/app/src/main/res/layout/activity_main.xml b/CineRmt/app/src/main/res/layout/activity_main.xml index cc20cb30..4d458265 100644 --- a/CineRmt/app/src/main/res/layout/activity_main.xml +++ b/CineRmt/app/src/main/res/layout/activity_main.xml @@ -1,5 +1,6 @@ - + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingTop="6sp" + android:orientation="vertical"> + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="horizontal"> - + android:layout_height="match_parent" + android:orientation="vertical" + android:gravity="center_vertical"> - + - + + - + android:orientation="vertical"> - - + - + + - + - + - + - + + - + + + + + + + + android:layout_height="match_parent" + android:orientation="vertical" + android:gravity="center_vertical"> + + + + + + android:layout_height="wrap_content" + android:orientation="horizontal" + android:paddingTop="20sp" + android:gravity="center_vertical"> - + - + - + - + - + + android:layout_height="wrap_content" + android:gravity="center_horizontal"> - - - + + + - - + - + - - + + + + + + + - - + + + - - + + + + android:layout_height="match_parent" + android:paddingBottom="12sp"> - + + - + - + - + - - + + + + - + - + - + - + + + + + + android:orientation="horizontal" + android:gravity="center_horizontal"> + + + + + + + + + + - + - + - + - +q diff --git a/CineRmt/app/src/main/res/menu/menu_main.xml b/CineRmt/app/src/main/res/menu/menu_main.xml index 2d8b5edc..dadc2694 100644 --- a/CineRmt/app/src/main/res/menu/menu_main.xml +++ b/CineRmt/app/src/main/res/menu/menu_main.xml @@ -11,7 +11,7 @@ diff --git a/CineRmt/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/CineRmt/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index eca70cfe..00000000 --- a/CineRmt/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/CineRmt/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/CineRmt/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index eca70cfe..00000000 --- a/CineRmt/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/CineRmt/app/src/main/res/mipmap-hdpi/ic_launcher.png b/CineRmt/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index cde69bcc..00000000 Binary files a/CineRmt/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/CineRmt/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/CineRmt/app/src/main/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index dffca360..00000000 Binary files a/CineRmt/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/CineRmt/app/src/main/res/mipmap-hdpi/exit.png b/CineRmt/app/src/main/res/mipmap-hdpi/zfigcc.png similarity index 100% rename from CineRmt/app/src/main/res/mipmap-hdpi/exit.png rename to CineRmt/app/src/main/res/mipmap-hdpi/zfigcc.png diff --git a/CineRmt/app/src/main/res/mipmap-mdpi/ic_launcher.png b/CineRmt/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index c133a0cb..00000000 Binary files a/CineRmt/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/CineRmt/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/CineRmt/app/src/main/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index dae5e082..00000000 Binary files a/CineRmt/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/CineRmt/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/CineRmt/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index bfa42f0e..00000000 Binary files a/CineRmt/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/CineRmt/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/CineRmt/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index 14ed0af3..00000000 Binary files a/CineRmt/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/CineRmt/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/CineRmt/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 324e72cd..00000000 Binary files a/CineRmt/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/CineRmt/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/CineRmt/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index d8ae0315..00000000 Binary files a/CineRmt/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/CineRmt/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/CineRmt/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index aee44e13..00000000 Binary files a/CineRmt/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/CineRmt/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/CineRmt/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index beed3cdd..00000000 Binary files a/CineRmt/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/CineRmt/app/src/main/res/values/styles.xml b/CineRmt/app/src/main/res/values/styles.xml index 0d653f37..dfec0e48 100644 --- a/CineRmt/app/src/main/res/values/styles.xml +++ b/CineRmt/app/src/main/res/values/styles.xml @@ -7,5 +7,12 @@ @color/colorPrimaryDark @color/colorAccent - + + diff --git a/CineRmt/build.gradle b/CineRmt/build.gradle index 8d3ef8e5..ded884a6 100644 --- a/CineRmt/build.gradle +++ b/CineRmt/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.android.tools.build:gradle:3.5.3' // NOTE: Do not place your application dependencies here; they belong diff --git a/CineRmt/gradle/wrapper/gradle-wrapper.properties b/CineRmt/gradle/wrapper/gradle-wrapper.properties index 9a4163a4..21c12743 100644 --- a/CineRmt/gradle/wrapper/gradle-wrapper.properties +++ b/CineRmt/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Wed Jan 08 17:24:50 MST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip diff --git a/cinelerra-5.1/cinelerra/Makefile b/cinelerra-5.1/cinelerra/Makefile index 2efc5354..7e69a503 100644 --- a/cinelerra-5.1/cinelerra/Makefile +++ b/cinelerra-5.1/cinelerra/Makefile @@ -368,6 +368,7 @@ OBJS := $(OVERLAYS) \ $(OBJDIR)/wavecache.o \ $(OBJDIR)/wintv.o \ $(OBJDIR)/wwindow.o \ + $(OBJDIR)/x10tv.o \ $(OBJDIR)/zoombar.o \ $(OBJDIR)/zoompanel.o \ $(OBJDIR)/zwindow.o \ diff --git a/cinelerra-5.1/cinelerra/androidcontrol.C b/cinelerra-5.1/cinelerra/androidcontrol.C index 69d0c10c..61e43c97 100644 --- a/cinelerra-5.1/cinelerra/androidcontrol.C +++ b/cinelerra-5.1/cinelerra/androidcontrol.C @@ -59,6 +59,8 @@ bool AndroidControl::is_msg(const char *cp) void AndroidControl::press(int key) { // printf("press 0x%04x\n",key); + if( key == KPMENU && mwindow_gui->keyev_grab_remote() ) + printf("android grab remote\n"); if( mwindow_gui->key_listener(key) ) return; mwindow_gui->remote_control->remote_key(key); } @@ -96,19 +98,7 @@ void AndroidControl::run() if( !len || !msg_len || *pin != *msg ) continue; ++msg; --msg_len; if( msg_len <= 0 ) continue; - if( is_msg("stop") ) press(KPSTOP); - else if( is_msg("play") ) press(KPPLAY); - else if( is_msg("rplay") ) press(KPREV); - else if( is_msg("pause") ) press(' '); - else if( is_msg("fast_lt") ) press(KPBACK); - else if( is_msg("media_up") ) press(UP); - else if( is_msg("fast_rt") ) press(KPFWRD); - else if( is_msg("menu") ) press(KPMENU); - else if( is_msg("media_lt") ) press(LEFT); - else if( is_msg("media_rt") ) press(RIGHT); - else if( is_msg("slow_lt") ) press(KPRECD); - else if( is_msg("media_dn") ) press(DOWN); - else if( is_msg("slow_rt") ) press(KPAUSE); + if( is_msg("menu") ) press(KPMENU); else if( is_msg("key 0") ) press('0'); else if( is_msg("key 1") ) press('1'); else if( is_msg("key 2") ) press('2'); @@ -124,7 +114,29 @@ void AndroidControl::run() else if( is_msg("key C") ) press('c'); else if( is_msg("key D") ) press('d'); else if( is_msg("key E") ) press('e'); - else if( is_msg("key F") ) press('f'); + else if( is_msg("book") ) press(KPBOOK); + else if( is_msg("rplay") ) press(KPREV); + else if( is_msg("stop") ) press(KPSTOP); + else if( is_msg("play") ) press(KPPLAY); + else if( is_msg("media_lt") ) press(LEFT); + else if( is_msg("media_rt") ) press(RIGHT); + else if( is_msg("media_up") ) press(UP); + else if( is_msg("media_dn") ) press(DOWN); + else if( is_msg("pause") ) press(' '); + else if( is_msg("slow_lt") ) press(KPRECD); + else if( is_msg("slow_rt") ) press(KPAUSE); + else if( is_msg("fast_lt") ) press(KPBACK); + else if( is_msg("fast_rt") ) press(KPFWRD); + else if( is_msg("fscrn") ) press(KPFSCRN); + else if( is_msg("mute") ) press(KPMUTE); + else if( is_msg("vol_up") ) press(KPVOLUP); + else if( is_msg("vol_dn") ) press(KPVOLDN); + else if( is_msg("ch_up") ) press(KPCHUP); + else if( is_msg("ch_dn") ) press(KPCHDN); + else if( is_msg("key dot") ) press('.'); + else if( is_msg("key cc") ) press(KPCC); + else if( is_msg("key tv") ) press(KPTV); + else if( is_msg("hand") ) press(KPHAND); else if( is_msg("suspend") ) { system("sync; sleep 1; acpitool -s"); } diff --git a/cinelerra-5.1/cinelerra/cwindow.C b/cinelerra-5.1/cinelerra/cwindow.C index bb8df6ea..43281623 100644 --- a/cinelerra-5.1/cinelerra/cwindow.C +++ b/cinelerra-5.1/cinelerra/cwindow.C @@ -50,7 +50,6 @@ #include "trackcanvas.h" #include "tracks.h" #include "transportque.h" -#include "wintv.h" #include @@ -270,8 +269,8 @@ void CWindow::refresh_frame(int change_type, int dir) refresh_frame(change_type, mwindow->edl, dir); } -CWindowRemoteHandler:: -CWindowRemoteHandler(RemoteControl *remote_control) +CWindowKeyEvHandler:: +CWindowKeyEvHandler(RemoteControl *remote_control) : RemoteHandler(remote_control->gui, RED) { this->remote_control = remote_control; @@ -280,17 +279,17 @@ CWindowRemoteHandler(RemoteControl *remote_control) key = -1; } -CWindowRemoteHandler:: -~CWindowRemoteHandler() +CWindowKeyEvHandler:: +~CWindowKeyEvHandler() { } -int CWindowRemoteHandler::process_key(int key) +int CWindowKeyEvHandler::remote_key(int key) { return remote_process_key(remote_control, key); } -int CWindowRemoteHandler::remote_process_key(RemoteControl *remote_control, int key) +int CWindowKeyEvHandler::remote_process_key(RemoteControl *remote_control, int key) { EDL *edl = mwindow->edl; if( !edl ) return 0; @@ -326,13 +325,7 @@ int CWindowRemoteHandler::remote_process_key(RemoteControl *remote_control, int case 'a': remote_control->gui->tile_windows(0); return 1; case 'b': remote_control->gui->tile_windows(1); return 1; case 'c': remote_control->gui->tile_windows(2); return 1; -#ifdef HAVE_DVB - case 'd': - mwindow->gui->channel_info->toggle_scan(); - return 1; -#endif - case 'e': - break; + case KPFSCRN: case 'f': { CWindowCanvas *canvas = mwindow->cwindow->gui->canvas; int on = canvas->get_fullscreen() ? 0 : 1; diff --git a/cinelerra-5.1/cinelerra/cwindow.h b/cinelerra-5.1/cinelerra/cwindow.h index 643c34bc..449cc468 100644 --- a/cinelerra-5.1/cinelerra/cwindow.h +++ b/cinelerra-5.1/cinelerra/cwindow.h @@ -80,13 +80,14 @@ public: CPlayback *playback_engine; }; -class CWindowRemoteHandler : public RemoteHandler +class CWindowKeyEvHandler : public RemoteHandler { public: - CWindowRemoteHandler(RemoteControl *remote_control); - ~CWindowRemoteHandler(); - int process_key(int key); + CWindowKeyEvHandler(RemoteControl *remote_control); + ~CWindowKeyEvHandler(); + int remote_key(int key); int remote_process_key(RemoteControl *remote_control, int key); + int is_keytv() { return 1; } int key, last_key; RemoteControl *remote_control; diff --git a/cinelerra-5.1/cinelerra/cwindow.inc b/cinelerra-5.1/cinelerra/cwindow.inc index a685b0f7..a3ceb1db 100644 --- a/cinelerra-5.1/cinelerra/cwindow.inc +++ b/cinelerra-5.1/cinelerra/cwindow.inc @@ -23,6 +23,6 @@ #define CWINDOW_INC class CWindow; -class CWindowRemoteHandler; +class KeyEvCWindowHandler; #endif diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index 78bc2bec..cf998890 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -132,6 +132,7 @@ #include "wavecache.h" #include "wintv.h" #include "wwindow.h" +#include "x10tv.h" #include "zoombar.h" #include "zwindow.h" #include "zwindowgui.h" @@ -244,6 +245,7 @@ MWindow::MWindow() beeper = 0; shuttle = 0; wintv = 0; + x10tv = 0; mixers_align = 0; } @@ -269,6 +271,9 @@ MWindow::~MWindow() delete shuttle; shuttle = 0; #ifdef HAVE_WINTV delete wintv; wintv = 0; +#endif +#ifdef HAVE_X10TV + delete x10tv; x10tv = 0; #endif delete batch_render; batch_render = 0; delete convert_render; convert_render = 0; @@ -1608,6 +1613,14 @@ void MWindow::init_wintv() wintv->start(); #endif } +void MWindow::init_x10tv() +{ +#ifdef HAVE_X10TV + x10tv = X10TV::probe(this); + if( x10tv ) + x10tv->start(); +#endif +} void MWindow::init_brender() @@ -2683,7 +2696,10 @@ void MWindow::create_objects(int want_gui, strcat(string, "/" FONT_SEARCHPATH); BC_Resources::init_fontconfig(string); if(debug) PRINT_TRACE - init_wintv(); +// use if plugged + init_x10tv(); + if( !x10tv ) + init_wintv(); // Default project created here init_edl(); diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h index b7034d8d..afbf3564 100644 --- a/cinelerra-5.1/cinelerra/mwindow.h +++ b/cinelerra-5.1/cinelerra/mwindow.h @@ -103,6 +103,7 @@ #include "wwindow.inc" #include "wavecache.inc" #include "wintv.inc" +#include "x10tv.inc" #define FONT_SEARCHPATH "fonts" @@ -771,6 +772,7 @@ public: void init_signals(); void init_shuttle(); void init_wintv(); + void init_x10tv(); void init_theme(); void init_compositor(); void init_levelwindow(); @@ -797,6 +799,7 @@ public: int in_destructor; Shuttle *shuttle; WinTV *wintv; + X10TV *x10tv; }; #endif diff --git a/cinelerra-5.1/cinelerra/mwindowgui.C b/cinelerra-5.1/cinelerra/mwindowgui.C index 69204d9c..0033b268 100644 --- a/cinelerra-5.1/cinelerra/mwindowgui.C +++ b/cinelerra-5.1/cinelerra/mwindowgui.C @@ -74,6 +74,7 @@ #include "vwindowgui.h" #include "vwindow.h" #include "wintv.h" +#include "x10tv.h" #include "zoombar.h" #define PANE_DRAG_MARGIN MAX(mwindow->theme->pane_w, mwindow->theme->pane_h) @@ -165,21 +166,26 @@ void MWindowGUI::create_objects() if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__); set_icon(mwindow->theme->get_image("mwindow_icon")); remote_control = new RemoteControl(this); + cwindow_remote_handler = 0; + record_remote_handler = 0; +#ifdef HAVE_X10TV +// should be first, use if plugged + if( !cwindow_remote_handler && mwindow->x10tv ) { + cwindow_remote_handler = (RemoteHandler*) + new X10TVCWindowHandler(mwindow->x10tv, remote_control); + record_remote_handler = (RemoteHandler*) + new X10TVRecordHandler(mwindow->x10tv, remote_control); + } +#endif #ifdef HAVE_WINTV - WinTV *wintv = mwindow->wintv; - if( wintv ) { + if( !cwindow_remote_handler && mwindow->wintv ) { cwindow_remote_handler = (RemoteHandler*) - new WinTVCWindowHandler(wintv, remote_control); + new WinTVCWindowHandler(mwindow->wintv, remote_control); record_remote_handler = (RemoteHandler*) - new WinTVRecordHandler(wintv, remote_control); + new WinTVRecordHandler(mwindow->wintv, remote_control); } #endif - if( !cwindow_remote_handler ) cwindow_remote_handler = - (RemoteHandler*)new CWindowRemoteHandler(remote_control); - if( !record_remote_handler ) record_remote_handler = - (RemoteHandler*)new RecordRemoteHandler(remote_control); mwindow->reset_android_remote(); - if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__); int x1 = get_w() - MainShBtns::calculate_w(-1, 0, -1) - xS(5); @@ -1313,6 +1319,19 @@ void MWindowGUI::use_android_remote(int on) if( android_control ) return; android_control = new AndroidControl(this); } +int MWindowGUI::keyev_grab_remote() +{ + if( cwindow_remote_handler && cwindow_remote_handler->is_keytv() && + record_remote_handler && record_remote_handler->is_keytv() ) + return 0; + delete cwindow_remote_handler; + delete record_remote_handler; + cwindow_remote_handler = (RemoteHandler*) + new CWindowKeyEvHandler(mwindow->gui->remote_control); + record_remote_handler = (RemoteHandler*) + new RecordKeyEvHandler(mwindow->gui->remote_control); + return 1; +} int MWindowGUI::close_event() { diff --git a/cinelerra-5.1/cinelerra/mwindowgui.h b/cinelerra-5.1/cinelerra/mwindowgui.h index 4ac94fed..bc3aa3a6 100644 --- a/cinelerra-5.1/cinelerra/mwindowgui.h +++ b/cinelerra-5.1/cinelerra/mwindowgui.h @@ -56,6 +56,7 @@ #include "trackscroll.inc" #include "transitionpopup.inc" #include "wintv.inc" +#include "x10tv.inc" #include "zoombar.inc" @@ -167,6 +168,7 @@ public: int keyboard_listener(BC_WindowBase *wp); int key_listener(int key); void use_android_remote(int on); + int keyev_grab_remote(); int close_event(); int quit(); void stop_drawing(); @@ -271,6 +273,7 @@ public: AndroidControl *android_control; RemoteControl *remote_control; WinTV *wintv; + X10TV *x10tv; RemoteHandler *cwindow_remote_handler; RemoteHandler *record_remote_handler; }; diff --git a/cinelerra-5.1/cinelerra/record.C b/cinelerra-5.1/cinelerra/record.C index c2aab72b..ad293f7b 100644 --- a/cinelerra-5.1/cinelerra/record.C +++ b/cinelerra-5.1/cinelerra/record.C @@ -76,6 +76,7 @@ #include "videoconfig.h" #include "videodevice.h" #include "wintv.h" +#include "x10tv.h" #include #include @@ -349,7 +350,8 @@ void Record::run() record_gui->show_window(); record_gui->flush(); - if( mwindow->gui->remote_control->deactivate() ) + if( mwindow->gui->remote_control->deactivate() && + mwindow->gui->record_remote_handler ) mwindow->gui->record_remote_handler->activate(); if( video_window_open ) { @@ -388,7 +390,8 @@ void Record::run() stop(0); edl->Garbage::remove_user(); - if( mwindow->gui->remote_control->deactivate() ) + if( mwindow->gui->remote_control->deactivate() && + mwindow->gui->cwindow_remote_handler ) mwindow->gui->cwindow_remote_handler->activate(); // Save everything again @@ -1523,16 +1526,22 @@ void Record::stop_skimming() {} void Record::update_skimming(int v) {} #endif -RecordRemoteHandler::RecordRemoteHandler(RemoteControl *remote_control) +RecordKeyEvHandler::RecordKeyEvHandler(RemoteControl *remote_control) : RemoteHandler(remote_control->gui, GREEN) { this->remote_control = remote_control; } -RecordRemoteHandler::~RecordRemoteHandler() +RecordKeyEvHandler::~RecordKeyEvHandler() { } +int RecordKeyEvHandler::remote_key(int key) +{ + Record *record = remote_control->mwindow_gui->record; + return record->record_process_key(remote_control, key); +} + void Record:: display_video_text(int x, int y, const char *text, int font, int bg_color, int color, int alpha, double secs, double scale) @@ -1757,34 +1766,63 @@ void Record::add_key(int ch) BIGFONT, WHITE, BLACK, 0, 3., 2.); } -int RecordRemoteHandler::process_key(int key) -{ - Record *record = remote_control->mwindow_gui->record; - return record->record_process_key(remote_control, key); -} - int Record::record_process_key(RemoteControl *remote_control, int key) { int ch = key; switch( key ) { case KPENTER: - if( last_key == KPENTER ) { - set_channel_name(keybfr); - clear_keybfr(); - break; - } - ch = '.'; // fall through - case '0': if( last_key == '0' && ch == '0' ) { + if( last_key != KPENTER ) break; + case KPCC: + set_channel_name(keybfr); clear_keybfr(); break; - } - case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': + case '0': + if( last_key == '0' && ch == '0' ) { + clear_keybfr(); + break; + } // fall thru + case '1': case '2': case '3': + case '4': case '5': case '6': + case '7': case '8': case '9': + case '.': add_key(ch); break; - //case UP: case DOWN: case LEFT: case RIGHT: - //case KPPLAY: case KPBACK: case KPFORW: + //case UP: case DOWN: + //case LEFT: case RIGHT: + //case KPPLAY: case KPFWRD: + case KPMUTE: + case 'a': // toggle mute audio + if( !monitor_audio ) { set_mute_gain(1); set_play_gain(1); } + set_audio_monitoring(monitor_audio ? 0 : 1); + break; + case KPBACK: case 'm': // toggle metering audio + set_audio_metering(metering_audio ? 0 : 1); + break; + case 'd': case KPSLASH: + display_channel_info(); + break; + case 'e': case KPSTAR: + display_channel_schedule(); + break; + case KPCHUP: case KPPLUS: + channel_up(); + break; + case KPCHDN: case KPMINUS: + channel_down(); + break; + case KPVOLUP: { + set_play_gain(play_gain * 1.25); + break; } + case KPVOLDN: { + set_play_gain(play_gain * 0.75); + break; } + case KPFSCRN: + case 'f': { + RecordMonitorCanvas *canvas = record_monitor->window->canvas; + int on = canvas->get_fullscreen() ? 0 : 1; + canvas->Canvas::set_fullscreen(on, 0); + break; } #ifdef HAVE_COMMERCIAL case KPRECD: case 'c': // start capture, mark endpoint if( !deletions ) { @@ -1798,43 +1836,17 @@ int Record::record_process_key(RemoteControl *remote_control, int key) } display_cut_icon(10,20); break; - case KPSTOP: case 'd': // end capture, start cutting + case KPSTOP: case 's': // end capture, start cutting remote_control->set_color(YELLOW); stop_commercial_capture(1); break; case KPAUSE: case 'x': // ignore current commercial mark_commercial_capture(DEL_SKIP); break; -#endif - case KPBACK: case 'a': // toggle mute audio - if( !monitor_audio ) { set_mute_gain(1); set_play_gain(1); } - set_audio_monitoring(monitor_audio ? 0 : 1); - break; - case 'm': // toggle metering audio - set_audio_metering(metering_audio ? 0 : 1); - break; -#ifdef HAVE_COMMERCIAL - case KPPLAY: case 's': // ignore previous endpoint + case KPPLAY: case 'z': // ignore previous endpoint mark_commercial_capture(DEL_OOPS); break; #endif - case KPFWRD: case KPSLASH: - display_channel_info(); - break; - case KPMAXW: case KPSTAR: - display_channel_schedule(); - break; - case KPCHUP: case KPPLUS: - channel_up(); - break; - case KPCHDN: case KPMINUS: - channel_down(); - break; - case 'f': { - RecordMonitorCanvas *canvas = record_monitor->window->canvas; - int on = canvas->get_fullscreen() ? 0 : 1; - canvas->Canvas::set_fullscreen(on, 0); - break; } default: return -1; } @@ -1846,7 +1858,6 @@ int Record::record_process_key(RemoteControl *remote_control, int key) int Record::wintv_process_code(int code) { #ifdef HAVE_WINTV - WinTV *wintv = (WinTV *)mwindow->gui->cwindow_remote_handler; switch( code ) { case WTV_OK: break; case WTV_LT: break; @@ -1862,12 +1873,10 @@ int Record::wintv_process_code(int code) set_audio_metering(metering_audio ? 0 : 1); break; case WTV_VOLUP: { - double gain = adevice->get_play_gain() * 1.25; - set_play_gain(gain); + set_play_gain(play_gain * 1.125); break; } case WTV_VOLDN: { - double gain = adevice->get_play_gain() * 0.75; - set_play_gain(gain); + set_play_gain(play_gain * 0.875); break; } case WTV_CH_UP: channel_up(); @@ -1875,11 +1884,14 @@ int Record::wintv_process_code(int code) case WTV_CH_DN: channel_down(); break; - case WTV_0: - if( wintv->last_code == WTV_0 ) { + case WTV_0: { + WinTVRecordHandler *wintv_remote = (WinTVRecordHandler *) + mwindow->gui->remote_control->handler; + WinTV *wintv = !wintv_remote ? 0 : wintv_remote->wintv; + if( !wintv || wintv->last_code == WTV_0 ) { clear_keybfr(); break; - } // fall thru + } } // fall thru case WTV_1: case WTV_2: case WTV_3: case WTV_4: case WTV_5: case WTV_6: case WTV_7: case WTV_8: case WTV_9: { @@ -1920,6 +1932,94 @@ int Record::wintv_process_code(int code) return 0; } +int Record::x10tv_process_code(int code) +{ +#ifdef HAVE_X10TV + switch( code ) { + case X10_A: // toggle metering audio + set_audio_metering(metering_audio ? 0 : 1); + break; + case X10_B: break; + case X10_POWER: break; + case X10_TV: break; + case X10_DVD: break; + case X10_WWW: break; + case X10_BOOK: break; + case X10_EDIT: break; + case X10_VOLUP: { + set_play_gain(play_gain * 1.125); + break; } + case X10_VOLDN: { + set_play_gain(play_gain * 0.875); + break; } + case X10_MUTE: // toggle mute audio + if( !monitor_audio ) { + set_mute_gain(1); + set_play_gain(play_gain); + } + set_audio_monitoring(monitor_audio ? 0 : 1); + break; + case X10_CH_UP: + channel_up(); + break; + case X10_CH_DN: + channel_down(); + break; + case X10_0: { + X10TVRecordHandler *x10tv_remote = (X10TVRecordHandler *) + mwindow->gui->remote_control->handler; + X10TV *x10tv = !x10tv_remote ? 0 : x10tv_remote->x10tv; + if( x10tv->last_code == X10_0 ) { + clear_keybfr(); + break; + } } // fall thru + case X10_1: case X10_2: case X10_3: case X10_4: + case X10_5: case X10_6: case X10_7: case X10_8: + case X10_9: { + int ch = code - X10_0 + '0'; + add_key(ch); + break; } + case X10_MENU: // add decimal point + add_key('.'); + break; + case X10_SETUP: // change channel + set_channel_name(keybfr); + clear_keybfr(); + break; + case X10_C: + display_channel_schedule(); + break; + case X10_UP: break; + case X10_D: + display_channel_info(); + break; + case X10_PROPS: break; + case X10_LT: break; + case X10_OK: break; + case X10_RT: break; + case X10_SCRN: { + RecordMonitorCanvas *canvas = record_monitor->window->canvas; + int on = canvas->get_fullscreen() ? 0 : 1; + canvas->Canvas::set_fullscreen(on, 0); + break; } + case X10_E: break; + case X10_DN: break; + case X10_F: break; + case X10_REW: break; + case X10_PLAY: break; + case X10_FWD: break; + case X10_REC: break; + case X10_STOP: break; + case X10_PAUSE: break; + + default: + printf("x10tv record: unknown code: %04x\n", code); + break; + } +#endif + return 0; +} + #ifdef HAVE_COMMERCIAL int Record::start_commercial_capture() { diff --git a/cinelerra-5.1/cinelerra/record.h b/cinelerra-5.1/cinelerra/record.h index 480b3329..d99a7254 100644 --- a/cinelerra-5.1/cinelerra/record.h +++ b/cinelerra-5.1/cinelerra/record.h @@ -235,6 +235,7 @@ public: void add_key(int ch); int record_process_key(RemoteControl *remote_control, int key); int wintv_process_code(int code); + int x10tv_process_code(int code); int spawn(const char *fmt, ...); void display_video_text(int x, int y, const char *text, int font, int bg_color, int color, int alpha, double secs, double scale); @@ -358,14 +359,15 @@ public: ~RecordSchedule() { remove_all_objects(); } }; -class RecordRemoteHandler : public RemoteHandler +class RecordKeyEvHandler : public RemoteHandler { public: - int process_key(int key); + int remote_key(int key); int spawn(const char *fmt, ...); - RecordRemoteHandler(RemoteControl *remote_control); - ~RecordRemoteHandler(); + RecordKeyEvHandler(RemoteControl *remote_control); + ~RecordKeyEvHandler(); + int is_keytv() { return 1; } RemoteControl *remote_control; }; diff --git a/cinelerra-5.1/cinelerra/record.inc b/cinelerra-5.1/cinelerra/record.inc index d9eba106..8ec8d606 100644 --- a/cinelerra-5.1/cinelerra/record.inc +++ b/cinelerra-5.1/cinelerra/record.inc @@ -25,7 +25,7 @@ class RecordMenuItem; class Record; -class RecordRemoteHandler; +class KeyEvRecordHandler; class RecordCutAdsStatus; class RecordBlinkStatus; diff --git a/cinelerra-5.1/cinelerra/remotecontrol.C b/cinelerra-5.1/cinelerra/remotecontrol.C index de2bc271..457d3313 100644 --- a/cinelerra-5.1/cinelerra/remotecontrol.C +++ b/cinelerra-5.1/cinelerra/remotecontrol.C @@ -53,11 +53,13 @@ RemoteControl::~RemoteControl() int RemoteControl::activate(RemoteHandler *handler) { int result = 0; - active_lock->lock("RemoteControl::activate"); - if( !is_active() ) { - if( !handler ) handler = !mwindow_gui->record->running() ? + deactivate(); + if( !handler ) + handler = !mwindow_gui->record->running() ? (RemoteHandler *)mwindow_gui->cwindow_remote_handler : (RemoteHandler *)mwindow_gui->record_remote_handler ; + active_lock->lock("RemoteControl::activate"); + if( handler ) { gui->lock_window("RemoteControl::activate"); gui->set_active(handler); gui->set_color(handler->color); @@ -72,19 +74,21 @@ int RemoteControl::activate(RemoteHandler *handler) int RemoteControl::deactivate() { int result = 0; - active_lock->lock("RemoteControl::deactivate"); if( is_active() ) { - gui->set_inactive(); - result = 1; + active_lock->lock("RemoteControl::deactivate"); + if( is_active() ) { + gui->set_inactive(); + result = 1; + } + active_lock->unlock(); } - active_lock->unlock(); return result; } int RemoteControl::remote_key(int key) { if( !is_active() ) return 0; - return handler->process_key(key); + return handler->remote_key(key); } void RemoteControl::set_color(int color) @@ -182,4 +186,14 @@ RemoteHandler::~RemoteHandler() { } +int RemoteHandler::remote_key(int key) +{ + gui->set_inactive(); + return -1; +} + +int RemoteHandler::process_key(int key) +{ + return -1; +} diff --git a/cinelerra-5.1/cinelerra/remotecontrol.h b/cinelerra-5.1/cinelerra/remotecontrol.h index 1a50d999..81ded583 100644 --- a/cinelerra-5.1/cinelerra/remotecontrol.h +++ b/cinelerra-5.1/cinelerra/remotecontrol.h @@ -45,7 +45,12 @@ public: int color; void activate() { gui->set_active(this); } - virtual int process_key(int key) { return -1; } + virtual int remote_key(int key); + virtual int process_key(int key); + + virtual int is_keytv() { return 0; } + virtual int is_wintv() { return 0; } + virtual int is_x10tv() { return 0; } RemoteHandler(RemoteGUI *gui, int color); virtual ~RemoteHandler(); diff --git a/cinelerra-5.1/cinelerra/wintv.C b/cinelerra-5.1/cinelerra/wintv.C index 5e067936..532a4704 100644 --- a/cinelerra-5.1/cinelerra/wintv.C +++ b/cinelerra-5.1/cinelerra/wintv.C @@ -75,7 +75,7 @@ int WinTV::open_usb_input(int vendor, int product, int &version) char path[PATH_MAX]; struct stat st; snprintf(path, PATH_MAX, "%s/%s", dev_input, fn); if( stat(path, &st) < 0 ) continue; - if( S_ISDIR(st.st_mode) ) continue; + if( !S_ISCHR(st.st_mode) ) continue; int fd = open(path, O_RDONLY); if( fd < 0 ) continue; if( !ioctl(fd, EVIOCGID, &dev_id) ) { @@ -126,11 +126,11 @@ int WinTV::check_menu_keys(int code) break; case WTV_TV: { Record *record = mwindow->gui->record; - if( !record->running() ) - record->start(); - else - record->record_gui->interrupt_thread->start(0); - break; } + if( !record->running() ) + record->start(); + else + record->record_gui->interrupt_thread->start(0); + break; } case WTV_MENU: #ifdef HAVE_DVB mwindow->gui->channel_info->toggle_scan(); @@ -139,7 +139,7 @@ int WinTV::check_menu_keys(int code) case WTV_RED: { RemoteControl *remote_control = mwindow->gui->remote_control; if( !remote_control->deactivate() ) - remote_control->activate(); + remote_control->activate(); break; } default: result = 0; @@ -176,15 +176,15 @@ void WinTV::handle_event() int WinTVCWindowHandler::wintv_process_code(int code) { - MWindow *mwindow = wintv->mwindow; - EDL *edl = mwindow->edl; - if( !edl ) return 0; - PlayTransport *transport = mwindow->gui->mbuttons->transport; - if( !transport->get_edl() ) return 0; - PlaybackEngine *engine = transport->engine; - double position = engine->get_tracking_position(); - double length = edl->tracks->total_length(); - int next_command = -1; + MWindow *mwindow = wintv->mwindow; + EDL *edl = mwindow->edl; + if( !edl ) return 0; + PlayTransport *transport = mwindow->gui->mbuttons->transport; + if( !transport->get_edl() ) return 0; + PlaybackEngine *engine = transport->engine; + double position = engine->get_tracking_position(); + double length = edl->tracks->total_length(); + int next_command = -1; switch( code ) { case WTV_OK: @@ -214,10 +214,10 @@ int WinTVCWindowHandler::wintv_process_code(int code) case WTV_DN: position -= 60.0; break; case WTV_BACK: return 1; case WTV_HOME: { - CWindowCanvas *canvas = mwindow->cwindow->gui->canvas; - int on = canvas->get_fullscreen() ? 0 : 1; - canvas->Canvas::set_fullscreen(on, 0); - return 1; } + CWindowCanvas *canvas = mwindow->cwindow->gui->canvas; + int on = canvas->get_fullscreen() ? 0 : 1; + canvas->Canvas::set_fullscreen(on, 0); + return 1; } case WTV_VOLUP: return 1; case WTV_VOLDN: return 1; case WTV_CH_UP: return 1; @@ -240,7 +240,7 @@ int WinTVCWindowHandler::wintv_process_code(int code) if( next_command < 0 ) { if( position < 0 ) position = 0; transport->change_position(position); - } + } else transport->handle_transport(next_command); return 0; diff --git a/cinelerra-5.1/cinelerra/wintv.h b/cinelerra-5.1/cinelerra/wintv.h index cefb6440..669cc7f9 100644 --- a/cinelerra-5.1/cinelerra/wintv.h +++ b/cinelerra-5.1/cinelerra/wintv.h @@ -75,6 +75,7 @@ public: WinTVCWindowHandler(WinTV *wintv, RemoteControl *remote_control); int wintv_process_code(int code); int process_key(int key); + int is_wintv() { return 1; } WinTV *wintv; }; @@ -85,6 +86,7 @@ public: WinTVRecordHandler(WinTV *wintv, RemoteControl *remote_control); int wintv_process_code(int code); int process_key(int key); + int is_wintv() { return 1; } WinTV *wintv; }; diff --git a/cinelerra-5.1/cinelerra/x10tv.C b/cinelerra-5.1/cinelerra/x10tv.C new file mode 100644 index 00000000..d97b7453 --- /dev/null +++ b/cinelerra-5.1/cinelerra/x10tv.C @@ -0,0 +1,319 @@ +#ifdef HAVE_X10TV + +#include "channelinfo.h" +#include "cwindow.h" +#include "cwindowgui.h" +#include "edl.h" +#include "mbuttons.h" +#include "mwindow.h" +#include "mwindowgui.h" +#include "language.h" +#include "playbackengine.h" +#include "playtransport.h" +#include "record.h" +#include "recordgui.h" +#include "recordmonitor.h" +#include "remotecontrol.h" +#include "tracks.h" +#include "x10tv.h" + +#include +#include + +X10TV::X10TV(MWindow *mwindow, int *fds, int nfds) +{ + this->mwindow = mwindow; + this->ifds = new int[nfds]; + this->nfds = nfds; + for( int i=0; iifds[i] = fds[i]; + + ev = new input_event; + memset(ev, 0, sizeof(*ev)); + ev->code = -1; + done = -1; + last_code = -1; + code = -1; + FD_ZERO(&rfds); + mfd = -1; +} + +X10TV::~X10TV() +{ + stop(); + delete ev; +} + +void X10TV::stop() +{ + done = 1; + for( int i=nfds; --i>=0; ) { + ioctl(ifds[i], EVIOCGRAB, 0); + close(ifds[i]); + } + nfds = 0; + if( running() ) { + cancel(); + join(); + } +} + +void X10TV::start() +{ + FD_ZERO(&rfds); + mfd = -1; + for( int i=nfds; --i>=0; ) { + int fd = ifds[i]; + ioctl(fd, EVIOCGRAB, 1); + if( fd >= mfd ) mfd = fd+1; + FD_SET(fd, &rfds); + } + done = 0; + Thread::start(); +} + +int X10TV::open_usb_inputs(int vendor, int product, int &version, + int *ifds, int mxfds) +{ + int ret = -1; + const char *dev_input = "/dev/input"; + DIR *dir = opendir(dev_input); + if( !dir ) return ret; + + struct dirent64 *dp; + struct input_id dev_id; + int nfds = 0; + while( nfds < mxfds && (dp = readdir64(dir)) != 0 ) { + char *fn = dp->d_name; + if( !strcmp(fn, ".") || !strcmp(fn, "..") ) continue; + char path[PATH_MAX]; struct stat st; + snprintf(path, PATH_MAX, "%s/%s", dev_input, fn); + if( stat(path, &st) < 0 ) continue; + if( !S_ISCHR(st.st_mode) ) continue; + int fd = open(path, O_RDONLY); + if( fd < 0 ) continue; + if( !ioctl(fd, EVIOCGID, &dev_id) ) { + if( dev_id.bustype == BUS_USB && + dev_id.vendor == vendor && + dev_id.product == product ) { + unsigned props = 0; + // quirk, reports pointing_stick for keys + unsigned mptrs = + (1< 0 ? nfds : 0; + while( --k >= 0 ) { + int ifd = ifds[k]; + if( FD_ISSET(ifd, &rds) ) { + fd = ifd; break; + } + } + if( fd < 0 ) { + printf("select failed\n"); + usleep(100000); continue; + } + ret = read(fd, ev, sizeof(*ev)); + if( done ) break; + if( ret != sizeof(*ev) ) { + if( ret < 0 ) { perror("read event"); break; } + fprintf(stderr, "bad read: %d\n", ret); + break; + } + handle_event(fd); + } +} + +int X10TV::check_menu_keys(int code) +{ + int result = 1; + switch( code ) { + case X10_POWER: + mwindow->quit(); + break; + case X10_TV: { + Record *record = mwindow->gui->record; + if( !record->running() ) + record->start(); + else + record->record_gui->interrupt_thread->start(0); + break; } + case X10_BOOK: +#ifdef HAVE_DVB + mwindow->gui->channel_info->toggle_scan(); +#endif + break; + case X10_EDIT: { + RemoteControl *remote_control = mwindow->gui->remote_control; + if( !remote_control->deactivate() ) + remote_control->activate(); + break; } + default: + result = 0; + } + return result; +} + +void X10TV::handle_event(int fd) +{ + switch(ev->type) { + case EV_KEY: { + if( !ev->value ) break; + this->last_code = this->code; + this->code = ev->code; + if( check_menu_keys(code) ) break; + RemoteHandler *handler = mwindow->gui->remote_control->handler; + if( handler ) + handler->process_key(ev->code); + break; } + case EV_SYN: + case EV_MSC: + break; + default: { + time_t t = ev->time.tv_sec; + struct tm *tp = localtime(&t); + printf("x10tv event %d: %4d/%02d/%02d %02d:%02d:%02d.%03d = (%d, %d, 0x%x)\n", + fd, tp->tm_year+1900, tp->tm_mon+1, tp->tm_mday, + tp->tm_hour, tp->tm_min, tp->tm_sec, + (int)ev->time.tv_usec/1000, ev->type, ev->code, ev->value); + break; } + } +} + + +int X10TVCWindowHandler::x10tv_process_code(int code) +{ + MWindow *mwindow = x10tv->mwindow; + EDL *edl = mwindow->edl; + if( !edl ) return 0; + PlayTransport *transport = mwindow->gui->mbuttons->transport; + if( !transport->get_edl() ) return 0; + PlaybackEngine *engine = transport->engine; + double position = engine->get_tracking_position(); + double length = edl->tracks->total_length(); + int next_command = -1; + + switch( code ) { + case X10_A: break; + case X10_B: break; + case X10_POWER: break; + case X10_TV: break; + case X10_DVD: break; + case X10_WWW: break; + case X10_BOOK: break; + case X10_EDIT: break; + case X10_VOLDN: return 1; + case X10_VOLUP: return 1; + case X10_MUTE: break; + case X10_CH_DN: break; + case X10_CH_UP: break; +// select window tile config = BACK 1,2,3 + case X10_1: case X10_2: case X10_3: + if( mwindow->x10tv->last_code == X10_MENU ) { + RemoteGUI *rgui = mwindow->gui->cwindow_remote_handler->gui; + rgui->tile_windows(code - X10_1); + return 1; + } // fall thru +// select asset program config = TEXT 1,2,3,4,5,6 + case X10_4: case X10_5: case X10_6: + if( mwindow->x10tv->last_code == X10_SETUP ) { + mwindow->select_asset(code - X10_1, 1); + break; + } // fall thru + case X10_7: case X10_8: case X10_9: + case X10_0: +// select position in 10 percent units + position = length * (code - X10_0)/10.0; + break; + case X10_MENU: return 0; + case X10_SETUP: return 0; + case X10_C: return 1; + case X10_UP: position += 60.0; break; + case X10_D: return 1; + case X10_PROPS: return 1; + case X10_LT: position -= 10.0; break; + case X10_OK: return 1; + case X10_RT: position += 10.0; break; + case X10_SCRN: { + CWindowCanvas *canvas = mwindow->cwindow->gui->canvas; + int on = canvas->get_fullscreen() ? 0 : 1; + canvas->Canvas::set_fullscreen(on, 0); + return 1; } + case X10_E: return 1; + case X10_DN: position -= 60.0; break; + case X10_F: return 1; + case X10_REW: next_command = FAST_REWIND; break; + case X10_PLAY: next_command = NORMAL_FWD; break; + case X10_FWD: next_command = FAST_FWD; break; + case X10_REC: next_command = SLOW_REWIND; break; + case X10_STOP: next_command = STOP; break; + case X10_PAUSE: next_command = SLOW_FWD; break; + + default: + printf("x10tv cwindow: unknown code: %04x\n", code); + return -1; + } + + if( next_command < 0 ) { + if( position < 0 ) position = 0; + transport->change_position(position); + } + else + transport->handle_transport(next_command); + return 0; +} + +int X10TVCWindowHandler::process_key(int key) +{ + return x10tv_process_code(key); +} + +int X10TVRecordHandler::process_key(int key) +{ + Record *record = x10tv->mwindow->gui->record; + return record->x10tv_process_code(key); +} + + +X10TVRecordHandler::X10TVRecordHandler(X10TV *x10tv, RemoteControl *remote_control) + : RemoteHandler(remote_control->gui, GREEN) +{ + this->x10tv = x10tv; +} + +X10TVCWindowHandler::X10TVCWindowHandler(X10TV *x10tv, RemoteControl *remote_control) + : RemoteHandler(remote_control->gui, BLUE) +{ + this->x10tv = x10tv; +} + +// HAVE_X10TV +#endif diff --git a/cinelerra-5.1/cinelerra/x10tv.h b/cinelerra-5.1/cinelerra/x10tv.h new file mode 100644 index 00000000..efb7fb0a --- /dev/null +++ b/cinelerra-5.1/cinelerra/x10tv.h @@ -0,0 +1,109 @@ +#ifndef __X10TV_H__ +#define __X10TV_H__ +#ifdef HAVE_X10TV + +#include "remotecontrol.h" +#include "thread.h" + +#define X10_A 0x001e +#define X10_B 0x0030 +#define X10_POWER 0x0074 +#define X10_TV 0x0179 +#define X10_DVD 0x0185 +#define X10_WWW 0x0096 +#define X10_BOOK 0x009c +#define X10_EDIT 0x00b0 +#define X10_VOLDN 0x0072 +#define X10_VOLUP 0x0073 +#define X10_MUTE 0x0071 +#define X10_CH_DN 0x0193 +#define X10_CH_UP 0x0192 +#define X10_1 0x0201 +#define X10_2 0x0202 +#define X10_3 0x0203 +#define X10_4 0x0204 +#define X10_5 0x0205 +#define X10_6 0x0206 +#define X10_7 0x0207 +#define X10_8 0x0208 +#define X10_9 0x0209 +#define X10_MENU 0x008b +#define X10_0 0x0200 +#define X10_SETUP 0x008d +#define X10_C 0x002e +#define X10_UP 0x0067 +#define X10_D 0x0020 +#define X10_PROPS 0x0082 +#define X10_LT 0x0069 +#define X10_OK 0x0160 +#define X10_RT 0x006a +#define X10_SCRN 0x0177 +#define X10_E 0x0012 +#define X10_DN 0x006c +#define X10_F 0x0021 +#define X10_REW 0x00a8 +#define X10_PLAY 0x00cf +#define X10_FWD 0x00d0 +#define X10_REC 0x00a7 +#define X10_STOP 0x00a6 +#define X10_PAUSE 0x0077 + +// unknown keysyms +//#define X10_NEXT 0x0000 +//#define X10_PREV 0x0000 +//#define X10_INFO 0x0000 +//#define X10_HOME 0x0000 +//#define X10_END 0x0000 +//#define X10_SELECT 0x0000 + +struct input_event; + +class X10TV : public Thread +{ +public: + X10TV(MWindow *mwindow, int *ifd, int nfds); + ~X10TV(); + + void stop(); + void start(); + static int open_usb_inputs(int vendor, int product, int &version, + int *ifds, int nfds); + static X10TV *probe(MWindow *mwindow); + void run(); + void handle_event(int fd); + int check_menu_keys(int code); + virtual int process_code() { return 1; } + + MWindow *mwindow; + input_event *ev; + int done; + int *ifds, nfds; + int last_code, code; + fd_set rfds; + int mfd; +}; + +class X10TVCWindowHandler : public RemoteHandler +{ +public: + X10TVCWindowHandler(X10TV *wintv, RemoteControl *remote_control); + int x10tv_process_code(int code); + int process_key(int key); + int is_x10tv() { return 1; } + + X10TV *x10tv; +}; + +class X10TVRecordHandler : public RemoteHandler +{ +public: + X10TVRecordHandler(X10TV *wintv, RemoteControl *remote_control); + int wintv_process_code(int code); + int process_key(int key); + int is_x10tv() { return 1; } + + X10TV *x10tv; +}; + +#endif +#endif diff --git a/cinelerra-5.1/cinelerra/x10tv.inc b/cinelerra-5.1/cinelerra/x10tv.inc new file mode 100644 index 00000000..523c6535 --- /dev/null +++ b/cinelerra-5.1/cinelerra/x10tv.inc @@ -0,0 +1,9 @@ +#ifndef __X10TV_INC__ +#define __X10TV_INC__ + +class X10TV; +class X10TVRemote; +class X10TVCWindowHandler; +class X10TVRecordHandler; + +#endif diff --git a/cinelerra-5.1/configure.ac b/cinelerra-5.1/configure.ac index e2360c0a..5067c681 100644 --- a/cinelerra-5.1/configure.ac +++ b/cinelerra-5.1/configure.ac @@ -57,6 +57,7 @@ CHECK_WITH([commercial],[enable commercial capture],[COMMERCIAL],[yes]) CHECK_WITH([thirdparty],[use thirdparty build],[CIN_3RDPARTY],[yes]) CHECK_WITH([shuttle],[shuttle device],[SHUTTLE],[yes]) CHECK_WITH([wintv],[usb 2040:826d wintv device],[WINTV],[yes]) +CHECK_WITH([x10tv],[usb 0bc7:0004 X10 remote device],[X10TV],[yes]) CHECK_WITH([vaapi],[video acceleration api],[VAAPI],[yes]) CHECK_WITH([vdpau],[video decode+presentation api for unix],[VDPAU],[yes]) CHECK_WITH([nv],[nvenc/nvdec ffnvcodec api],[NV],[yes]) @@ -887,7 +888,7 @@ fi for v in GL XFT XXF86VM OSS ALSA FIREWIRE DV DVB \ VIDEO4LINUX2 ESOUND PACTL OPENEXR LV2 \ COMMERCIAL LIBZMPEG SHUTTLE SHUTTLE_USB \ - VAAPI VDPAU CUDA NV WINTV; do + VAAPI VDPAU CUDA NV WINTV X10TV; do eval vv="\$WANT_$v" if test "x$vv" != "xno"; then CFG_CFLAGS+=" -DHAVE_$v" diff --git a/cinelerra-5.1/guicast/bcwindowbase.C b/cinelerra-5.1/guicast/bcwindowbase.C index a362095e..a12d71f6 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.C +++ b/cinelerra-5.1/guicast/bcwindowbase.C @@ -1261,35 +1261,8 @@ if( debug && event->type != ClientMessage ) { case XK_F10: key_pressed = KEY_F10; break; case XK_F11: key_pressed = KEY_F11; break; case XK_F12: key_pressed = KEY_F12; break; - +// activates remote case XK_Menu: key_pressed = KPMENU; break; /* menu */ -// remote control -// above case XK_KP_Enter: key_pressed = KPENTER; break; /* check */ - case XF86XK_MenuKB: key_pressed = KPMENU; break; /* menu */ -// intercepted case XF86XK_PowerDown: key_pressed = KPPOWER; break; /* Power */ - case XF86XK_Launch1: key_pressed = KPTV; break; /* TV */ - case XF86XK_Launch2: key_pressed = KPDVD; break; /* DVD */ -// intercepted case XF86XK_WWW: key_pressed = KPWWEB; break; /* WEB */ - case XF86XK_Launch3: key_pressed = KPBOOK; break; /* book */ - case XF86XK_Launch4: key_pressed = KPHAND; break; /* hand */ - case XF86XK_Reply: key_pressed = KPTMR; break; /* timer */ - case SunXK_Front: key_pressed = KPMAXW; break; /* max */ -// above case XK_Left: key_pressed = LEFT; break; /* left */ -// above case XK_Right: key_pressed = RIGHT; break; /* right */ -// above case XK_Down: key_pressed = DOWN; break; /* down */ -// above case XK_Up: key_pressed = UP; break; /* up */ -// above case XK_SPACE: key_pressed = KPSPACE; break; /* ok */ -// intercepted case XF86XK_AudioRaiseVolume: key_pressed = KPVOLU; break; /* VOL + */ -// intercepted case XF86XK_AudioMute: key_pressed = KPMUTE; break; /* MUTE */ -// intercepted case XF86XK_AudioLowerVolume: key_pressed = KPVOLD; break; /* VOL - */ - case XF86XK_ScrollUp: key_pressed = KPCHUP; break; /* CH + */ - case XF86XK_ScrollDown: key_pressed = KPCHDN; break; /* CH - */ - case XF86XK_AudioRecord: key_pressed = KPRECD; break; /* ( o) red */ - case XF86XK_Forward: key_pressed = KPPLAY; break; /* ( >) */ - case XK_Redo: key_pressed = KPFWRD; break; /* (>>) */ - case XF86XK_Back: key_pressed = KPBACK; break; /* (<<) */ - case XK_Cancel: key_pressed = KPSTOP; break; /* ([]) */ - case XK_Pause: key_pressed = KPAUSE; break; /* ('') */ default: key_pressed = keysym & 0xff; diff --git a/cinelerra-5.1/guicast/keys.h b/cinelerra-5.1/guicast/keys.h index a79230b3..801a7508 100644 --- a/cinelerra-5.1/guicast/keys.h +++ b/cinelerra-5.1/guicast/keys.h @@ -56,56 +56,13 @@ #define LEFTTAB 283 #define DELETE 284 -// ati_remote key bindings -// requires some substitions in kernel module -// due to deficiencies in X evdev et al. examples: -// need to know which dev created the event (duh) -// keycodes > 255 are dropped -// keycoodes are offset by 8 before xkb mapping -// a bunch of keycodes are intercepted by windowmanger -// KEY_OK = KEY_SPACE -// KEY_CHANNELUP = KEY_SCROLLUP -// KEY_CHANNELDOWN = KEY_SCROLLDOWN -// KEY_PLAY = KEY_FORWARD -// KEY_REWIND = KEY_BACK -// KEY_FORWARD = KEY_AGAIN -// - ati_remote.c, mapped in rc-ati-x10.c -#if 0 - { 0x18, KEY_KPENTER }, /* "check" */ - { 0x16, KEY_MENU }, /* "menu" */ - { 0x02, KEY_POWER }, /* Power */ - { 0x03, KEY_PROG1 }, /* TV */ /* was KEY_TV */ - { 0x04, KEY_PROG2 }, /* DVD */ /* was KEY_DVD */ - { 0x05, KEY_WWW }, /* WEB */ - { 0x06, KEY_PROG3 }, /* "book" */ /* was KEY_BOOKMARKS */ - { 0x07, KEY_PROG4 }, /* "hand" */ /* was KEY_EDIT */ - { 0x1c, KEY_REPLY }, /* "timer" */ /* was KEY_COFFEE */ - { 0x20, KEY_FRONT }, /* "max" */ - { 0x1d, KEY_LEFT }, /* left */ - { 0x1f, KEY_RIGHT }, /* right */ - { 0x22, KEY_DOWN }, /* down */ - { 0x1a, KEY_UP }, /* up */ - { 0x1e, KEY_SPACE }, /* "OK" */ /* was KEY_OK */ - { 0x09, KEY_VOLUMEDOWN }, /* VOL + */ - { 0x08, KEY_VOLUMEUP }, /* VOL - */ - { 0x0a, KEY_MUTE }, /* MUTE */ - { 0x0b, KEY_SCROLLUP }, /* CH + */ /* was KEY_CHANNELUP */ - { 0x0c, KEY_SCROLLDOWN }, /* CH - */ /* was KEY_CHANNELDOWN */ - { 0x27, KEY_RECORD }, /* ( o) red */ - { 0x25, KEY_FORWARD }, /* ( >) */ /* was KEY_PLAY */ - { 0x24, KEY_BACK }, /* (<<) */ /* was KEY_REWIND */ - { 0x26, KEY_AGAIN }, /* (>>) */ /* was KEY_FORWARD */ - { 0x28, KEY_STOP }, /* ([]) */ - { 0x29, KEY_PAUSE }, /* ('') */ -#endif -#define KPREV 284 #define KPMENU 285 #define KPTV 286 -#define KPDVD 287 +#define KPREV 287 #define KPBOOK 288 #define KPHAND 289 -#define KPTMR 290 -#define KPMAXW 291 +#define KPMUTE 290 +#define KPFSCRN 291 #define KPCHUP 292 #define KPCHDN 293 #define KPBACK 294 @@ -114,6 +71,7 @@ #define KPRECD 297 #define KPSTOP 298 #define KPAUSE 299 + // function keys #define KEY_F1 301 #define KEY_F2 302 @@ -127,6 +85,9 @@ #define KEY_F10 310 #define KEY_F11 311 #define KEY_F12 312 +#define KPVOLUP 313 +#define KPVOLDN 314 +#define KPCC 315 #define RETURN 13 #define NEWLINE 13