interactive filters - keystrokes - preview

Support for my VirtualDub filters
Post Reply
DAE avatar
hwahlberg
Posts: 19
Joined: Sun Sep 28, 2014 6:22 pm

interactive filters - keystrokes - preview

Post by hwahlberg »

Hi.

I have made ExoticPan a bit more interactive, but it annoys me that I cant control the whole show with the keyboard.
It was my plan to keyboard enable the exotic pan settings dialog, so it could be controlled with keystrokes only, but i ran into a problem with window focus.

Arrow keys together with Shift and Alt has a meaning for the preview window.
I was planning to use 'w' (up), 's' (down) , 'a' (left), 'd' (right) to move placement of the ExoticPan frame 9 pixels in the given direction. Combined with "Shift" would move 27, and combine with "Control" to fine adjust, moving 3 pixels only. (Shift and Control right now works in that manner together with mouse press on the wsad buttons.)

Problem is that I cannot tell preview pane (if that one has focus) to send useless keystrokes like e.g. ctrl-w to the dialog, and likewise I don't know how to send Alt-Right Arrow on to the preview pane if the dialog has focus.
If I could do that, I could keep the focus on one of the windows (preview or settings dialog), and still maneuver the whole thing from the keyboard.

I could probably use dirty tricks, like traversing top level windows, recognize the preview window, and install a hook on that one.
But that would take me a long time to develop, and next version of VDub could change that.

Even being able to switch focus back to the preview pane would help a lot, but i get a Boolean back when activating the preview, not something that points the a window handle.

Any ideas?

Thanks in advance.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: interactive filters - keystrokes - preview

Post by admin »

I'll do some experiments with your filter and post again.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: interactive filters - keystrokes - preview

Post by admin »

It's not hard to control the preview window from the focused dialog window.

Check the small changes here: http://rationalqm.us/misc/Henrik.rar

Load a file and get your filter dialog up with preview. Then focus your dialog and hit your little d button. I re-purposed it to cause the preview to advance one frame. You could instead catch your right arrow key in the dialog and then do the send message to the preview window.

You can enhance this basic mechanism as required using needed keyboard messages. It's highly unlikely that a future Vdub version would change this. Anyway, is Avery Lee even still developing VirtualDub, I think not.
DAE avatar
hwahlberg
Posts: 19
Joined: Sun Sep 28, 2014 6:22 pm

Re: interactive filters - keystrokes - preview

Post by hwahlberg »

Hi.
Thanks a lot.
I'll try to incorporate it into the code.
Probably I'd need to add a timer to move focus back to the dialog if you have been moving the slider in the preview, after checking preview's really is in front still).

Regards Henrik.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: interactive filters - keystrokes - preview

Post by admin »

You're welcome. Your plan sounds good. It is fairly easy to seize back the focus.
DAE avatar
hwahlberg
Posts: 19
Joined: Sun Sep 28, 2014 6:22 pm

Re: interactive filters - keystrokes - preview

Post by hwahlberg »

Hi Donald.
For now i have used basics ideas of your example to send focus back to the preview every time i press a button.
(half hour fix)
That seems to work.

In the meantime i have been reading up on how to install a windows hook ex on the preview windows and thereby steal the keystrokes really meant for the dialog.
It puzzled me until today that I should supply a DDL reference and thread ID.

Today I did try it, with code adapted from some example, and it worked first time :-)
I nearly have it programmed, and it works all way around it seems as long as I use the preview button in the DLG to close the preview and uninstall the hook.
If I use the read X on the preview my uninstall isn't called.
But probably I can check if I have a live hook when I close the DLG.


Another thing I have been wanting to do is to add or remove a frame now and then.
Would you know if that's possible, and maybe even have ref to doc or code?

Best regards Henrik
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: interactive filters - keystrokes - preview

Post by admin »

Hi Henrik,

Sounds like you are making great progress.

"If I use the read X on the preview my uninstall isn't called."

Can't you just process the destroy event in your dialog code and make the call?

"Another thing I have been wanting to do is to add or remove a frame now and then."

If I understand things correctly, the latest VirtualDub filter SDK may allow this. Read this thread. It veers into that territory.

viewtopic.php?f=10&t=512
DAE avatar
hwahlberg
Posts: 19
Joined: Sun Sep 28, 2014 6:22 pm

Re: interactive filters - keystrokes - preview

Post by hwahlberg »

Hi Donald.

Not sure I could see the connection between the link you posted and my question on adding / removing frames.
VD itself can do that through the "Video frame rate control" dialog.
If you have a 25 FPS movie, and input 50 in the "Convert to FPS" field, then every frame is doubled.

In the VDub source (1.10.4) I can see this links to:

Code: Select all

optdlg.cpp:1322		LONG lv = GetDlgItemInt(mhdlg, IDC_DECIMATE_VALUE, NULL, TRUE);
optdlg.cpp:1330		newFRD = lv;
optdlg.cpp:1375		mOpts.video.frameRateDecimation = newFRD;
optdlg.cpp:1479		DubOptions& mOpts;
f_convolute.cpp:319  	extern DubOptions g_dubOpts;
command.h:36			class DubOptions;
Dub.h:144				class DubOptions {
Dub.h:256				InitVideoStreamValuesStatic(
I see none of this in the FilterSDK though.

The SDK indicates that linear relation between source and out frames may not be required:
/// Filter's output is purely a function of configuration parameters and source image data, and not
/// source or output frame numbers. In other words, two output frames produced by a filter instance
/// can be assumed to be identical images if:
///
/// - the same number of source frames are prefetched
/// - the same type of prefetches are performed (direct vs. non-direct)
/// - the frame numbers for the two prefetch lists, taken in order, correspond to identical
/// source frames
/// - the prefetch cookies match
///
/// Enabling this flag improves the ability of the host to identify identical frames and drop them
/// in preview or in the output file.
///
FILTERPARAM_PURE_TRANSFORM = 0x00000010L,

But how that enables me to e.g. copy source frames #10 to #20 and insert them at some position in the output stream, hmm..

I actually have not seen filters manipulating frame sequence.
Some filters like DeShake uses information from consecutive frames (frame n-1, n-2 when processing frame n)

So I still wonder if it's at all possible to add or remove frames by a filter
Regards Henrik.
DAE avatar
hwahlberg
Posts: 19
Joined: Sun Sep 28, 2014 6:22 pm

Re: interactive filters - keystrokes - preview

Post by hwahlberg »

Hi.
Sorry, seems like I only read first page of the "64 bit deflicker" thread.
Need to read rest of that, and see if I can locate the "Remove Frame" filter mentioned by jpsdr from his github.

I'll return :-)

Regards Henrik.
DAE avatar
jpsdr
Posts: 214
Joined: Tue Sep 21, 2010 4:16 am

Re: interactive filters - keystrokes - preview

Post by jpsdr »

hwahlberg wrote:and see if I can locate the "Remove Frame" filter mentioned by jpsdr from his github.
So, have you been able to found what you were looking for ?
Post Reply