PDA

View Full Version : DVD insertion event?



Ron
October 13th, 2002, 03:55 PM
I've created a CDROM/DVD insertion notifier plugin download it here:

Device Notifier (http://www.girder.nl/download.php?Link=118)

Let me know if it works for you.

Ron
October 13th, 2002, 03:55 PM
Yep, input plugins (aka Hardware/Driver plugins) go into the hardware dir. I think it says so on the download page... Anyways it will be included in the next release so then i'll have done that for you :smile:

-Ron

Ron
October 13th, 2002, 03:55 PM
Thats odd, I'm using win2k and the standard window messages to detect the new CD,.. but if the DVDSpy does just this, there is no need for my plugin :smile:

Ron
October 13th, 2002, 03:55 PM
Does windows treat a CD - DVD differently ?

according to this article:

M$KB (http://support.microsoft.com/support/kb/articles/Q163/5/03.asp)

It should work exactly the same.

My DVD drive isn't hooked up at the moment...


<font size=-1>[ This Message was edited by: RonB on 2001-05-27 10:19 ]</font>

Ron
October 13th, 2002, 03:55 PM
I'm looking into the problem with this plugin,....

Ron
October 13th, 2002, 03:55 PM
I've uploaded the DeviceNotifier plugin sourecode for people that would like to take a look how it works and maybe find why it sometimes doesn't work...

Ron
October 13th, 2002, 03:55 PM
[992] Girder event: 'ļ½ęDisc.Insert.F' sarg='' iarg=23657676.

At this point Girder crashed.


Is it possible that the string passed to girder isn't terminated, and thus causes Girder to look for the terminating zero outside of the allowed range ?

-Ron

mflaster
October 13th, 2002, 03:55 PM
Is there a way to detect when a DVD is inserted? Instead of having WinDVD setup to autoplay, I'd rather Girder detected it, and then kicked off whatever commands I want executed.

I see there's a TaskCreate plugin, which seems to detect when something is autorun, but I'm not sure if this would always detect when a DVD/CD is inserted.

What's the right way (if any) to do this?

Mike

mflaster
October 13th, 2002, 03:55 PM
Wow, talk about service! :smile:

I just downloaded it and tried it on my PC at my desk (which has a CDROM, but no DVD) and it worked great!

One point (that's I'm sure obvious to everyone else) is that this goes in the *hardware* plugin directory. I guess the "hardware" subdirectory is really for input device, and "software" is for actions.

Mike

mflaster
October 13th, 2002, 03:55 PM
Well, I just tried it on my computer with the DVDROM drive, and there seems to be a slight problem. This computer is running Win2k. It seems that the DVD drive (F:) is *always* there, even when there's no DVD in the drive. When I insert/remove the DVD, Girder doesn't notice.

Is this always true on Win2K, or is it just the way that my DVD drive is configured? Would you expect your plugin to work on Win2K?

Mike

mflaster
October 13th, 2002, 03:55 PM
Do you know if DVDSpy will work under Windows 2000? I guess I can just give it a try...

Mike

mflaster
October 13th, 2002, 03:55 PM
Another possibility is that I realize (now) that I'm running yxy, which is catching the DVD insertion event. I wonder if it doesn't propagate it? Is it possible for something to catch/block an event? I should try it when yxy is *not* running as well.

I'll also give DVDspy a try.

Mike

mflaster
October 13th, 2002, 03:55 PM
Well, I tried with yxy not running, and it didn't work. In fact, DVD Spy didn't work either. Maybe the way I'm testing it is bad? I'm using the logger plugin from Mark F I believe. It doesn't show any events, either from Ron's plugin or from DVD Spy.

I am using WinDVD, I believe WinDVD 2000 2.6.4 update. I'm on Win 2K.

Is there something basic I can check? Is Logger the right way to check for those events?

Mike

mflaster
October 13th, 2002, 03:55 PM
No events (other than from the keyboard).

I actually have a lot of trouble with the logger dll. Rather, it works fine when it's running, but on one machine (not my HTPC), I couldn't turn it off and exit Girder. I would start Girder, the Logger window popped up (I had the TaskCreate plugin enabled), I would disable the logger, and I would try to close Girder, and I would get 'application error', and Girder wouldn't close. I tried many different things, i.e. disabling task create, disabling/not disabling logger, but I could never close Girder (had to use Task Manager). I finally deleted the Logger.dll before starting Girder, and that fixed the problem.

On my HTPC, after I did my test, with the Logger and DVDSpy, I don't remember the exact details, but Girder crashed. I tried to restart it, and it got an application error before it could start. I deleted the Logger.dll, and still the same problem. Then I rebooted, and it worked fine again...

These are really all side issues, but I'm not confident that logger is working 100% on my system.

Ron, is there any way that you could build me your DVD insertion DLL that has lots of debugging info? You know, write stuff to a log file or something for every step in the process, then we could maybe figure out what step is going wrong?

Mike

mflaster
October 13th, 2002, 03:55 PM
On 2001-06-07 18:47, MMcM wrote:
Do insertion events otherwise work for you? Before you disabled YxY for the test, did you have it set to launch your DVD player? Did that work reliably?

Yup. That worked fine.


Do CD-ROMs with autoplay installation programs work reliably on this machine?

Don't know about CD-ROMs, but DVDs will automatically launch their PC Friendly app... (Which is why I ran yxy! :smile: )


Your DVD-ROM drive is an ordinary IDE device, I assume. Nothing out of the ordinary there, right?

Right, standard Toshiba slot-loading IDE DVDROM drive.

Very odd.

Isn't it possible that the plugins *are* seeing the event, but I don't realize they have? Would it be easy to build a DVDSpy / event notifier DLL which popped up a window/wrote to a log file every time these events happened? It seems like there are a few simple steps, and at least one isn't working - it would be nice to know *which* one.

Let me know if you want to build something for me - I'd be happy to give it a whirl.

Mike


<font size=-1>[ This Message was edited by: mflaster on 2001-06-07 20:41 ]</font>

mflaster
October 13th, 2002, 03:55 PM
I don't think polling is a good idea.

Personally, only supporting recent OS's (hey, '98 isn't even so recent) for this plugin is fine with me.

MMcM - do you agree with what Stringfellow said?

Mike

mflaster
October 13th, 2002, 03:55 PM
OK, thanks, I'll give it a try as soon as I can - hopefully tonight.

Mike

mflaster
October 13th, 2002, 03:55 PM
OK, I guess this is good news. DebugView captured lots of events, including probably the key one. Here's the log:

[992] Trecol Init
[992] DVDSpy monitor window started.
[992] WM_DEVICECHANGE received: wParam=8000.
[992] PDEV_BROADCAST_HDR.dbch_devicetype=2.
[992] PDEV_BROADCAST_VOLUME.dbcv_flags=1 .dbcv_unitmask=80000020.
[992] Girder event: 'ļ½ęDisc.Insert.F' sarg='' iarg=23657676.

At this point Girder crashed.

So is this AOK as far as you can tell up to this point? Anything odd in the above log? The DEVICECHANGE event seemed to come at just the right time.

Mike

mflaster
October 13th, 2002, 03:55 PM
More info - here's what happened when restarting Girder, and ejecting the DVD:
[1264] Trecol Init
[1264] DVDSpy monitor window started.
[1264] WM_DEVICECHANGE received: wParam=8004.
[1264] PDEV_BROADCAST_HDR.dbch_devicetype=2.
[1264] PDEV_BROADCAST_VOLUME.dbcv_flags=1 .dbcv_unitmask=20.
[1264] Girder event: '' sarg='' iarg=23657676.

No crash of Girder this time.

When I reinsert the DVD, same log messages, and same Girder crash. BTW, it says "Girder.exe has generated errors and ill be closed... An error log is being created." Do you need to see this error log? If so, where would I find it?

Mike

mflaster
October 13th, 2002, 03:55 PM
OK, I'll go try the new DLL. But at the risk of insulting my intelligence, which probably needs to be insulted, how would I set up a command to notice the DVD insertion event? I set the input type to "DVD Spy", then push 'learn event', then insert the DVD? For insertion, that's easy, but for next chapter and other events, it seems more difficult to try to catch the events... But I'll give that a try too. Maybe just the 'logger' isn't working right for me, but everything else does...

Mike

mflaster
October 13th, 2002, 03:55 PM
[retry]

OK, ignore a lot of my last post.

'eject' actually works fine - I was able to get Girder to play a 'wav' on a DVD eject.

But DVD insert still causes a crash, and I'm now using the production DVD spy.

Here is my Dr. Watson log - I cleared it just before I caused the crash:

http://www.geocities.com/mflaster/drwatson32.html

Mike

mflaster
October 13th, 2002, 03:55 PM
OK, here are the log files.
http://members.bellatlantic.net/~vze29dtq/Log_files/drwtsn32.log

and

http://members.bellatlantic.net/~vze29dtq/Log_files/handle_info.txt

Mike

mflaster
October 13th, 2002, 03:55 PM
OK, I'm hoping the lack of reply from MMcM is due to the fact that he's at Infocomm, instead of that he has no ideas... :smile:

Some more info. My HTPC is a dual-boot, Windows ME/Win2K machine.

I tried lots of tests, and all behaved the same. I tried both WinDVD and PowerDVD, under both Win2K and Win ME. I was also running Ron's plugin at the same time. In all cases, the eject was noticed by DVDSpy (logger also reported it, I think device 15) and I could make it play a wav on eject. But Ron's Event Notifier never noticed. On DVD insertion, Girder crashes, on both Win2K and ME, due to DVD Spy. (Event Notifier by itself causing nothing to happen.)

I'll be happy to try anything, as I'd really like this to work. MMcM, want to give me code with more debug statements? The same person (not me) configured both Win2K and Win ME, so I'm guessing that he configured them both somewhat "special" in a way that's not making either of these plugins work... That's the only explanation I can think of.

Mike

mflaster
October 13th, 2002, 03:55 PM
What, no 24x7 support? I don't get a pager number? :smile:

As far as I know, I *did* do the test on Win2K for those logs. But I repeated everything. Here are the log files:

http://members.bellatlantic.net/~vze29dtq/Log_files/drwtsn32.log

http://members.bellatlantic.net/~vze29dtq/Log_files/handle_info2.txt

http://members.bellatlantic.net/~vze29dtq/Log_files/LISTDLLS.txt

(The last one I just ran 'listdlls girder' - I hope that's sufficient.)

And thank you thank you thank you BTW!

Mike

mflaster
October 13th, 2002, 03:55 PM
Aha! I love obvious answers!

Ron - would this explain why your DVD code didn't work either? Is that only for 3.0.23pre as well?

Also, is 3.0.23pre relatively stable? I wanted to wait a bit and make sure before I tried it...

MMcM - your punishment is that I might ask for a new feature! :smile: Actually, what I want is if I play a playlist (i.e. of trailers), I want to get an event when the playlist *stops* (so that I can change the DVD player to Disc mode and start the DVD). For all I know, that capability is already there - I'll be sure to let you know! :smile:

Mike

mflaster
October 13th, 2002, 03:55 PM
Well, it worked!! (You thought I had falled off the face of the earth, didn't you! :smile: )

I have one question. What's the difference between the WinDVD events 0,1,2,3, and 4?

Using the logger, I seem to get lots of '1' events while my .vob file plays, but I get an occasional 0,2,3, and 4 as well. It also seems like a 'stop' is not 1 event, but a pattern - '0-1-2-4-3'.

Also, is there any data associated with these events?

If someone had a girder file that used DVDSpy, that they wanted to mail to me (flaster@alum.mit.edu), that would probably answer all my questions as well.

Thanks!

Mike

Mark F
October 13th, 2002, 03:55 PM
Do you see any events in the logger window?

BSchuler
October 13th, 2002, 03:55 PM
A similar problem, probably solved by the same approach.

I have multiple drives, and I have Cd's with Mp3's on them and a playlist on each one. I push one button, drive X playlist is used. I push 2nd button, drive Y playlist is used.

Problem:
Is there anyway to detect IF FILE EXISTS type function for when no cd is in?. If I use the above, Girder sends an error saying FILE DOES NOT EXIST. And I can't seem to nullify that.

Overall Solution:
The original post and mine could each be solved using some kind of IF FILE EXISTS and a registry counter. When the FILE EXISTS registry count increased, it would tell you something got inserted. IN NOT EXIST, the registry would go to O. Etc... For DVD you could use a vob file....mp3 a playlist... Any ideas?

MMcM
October 13th, 2002, 03:55 PM
The DVDSpy plug-in also generates DVD insertion events.

It puts the disc serial number and volume name in reg1 and treg1. The eventual idea is to display the title on an LCD display, although there is no clear consensus on where to get the serial number to title mapping database yet.

MMcM
October 13th, 2002, 03:55 PM
I generally use Win2K, so DVDSpy basically works there, yes. If you see the same problem, then I would be interested to try to track down what is going on. It too just monitors WM_DEVICECHANGE.

MMcM
October 13th, 2002, 03:55 PM
Do insertion events otherwise work for you? Before you disabled YxY for the test, did you have it set to launch your DVD player? Did that work reliably? Do CD-ROMs with autoplay installation programs work reliably on this machine? I am pretty sure that both of these and the two Girder plug-ins all use the same mechanism.

Your DVD-ROM drive is an ordinary IDE device, I assume. Nothing out of the ordinary there, right?

MMcM
October 13th, 2002, 03:55 PM
The QueryCancelAutoPlay message is indeed only delivered to the foreground application. However, this is something different. Its purpose is to allow an application that expects a new disc to be inserted soon to avoid the Explorer's launching the autoplay application. Since this is due to a user interaction, it makes sense for it to be restricted to the foreground application.

The mechanism that DVDSpy uses is the WM_DEVICECHANGE. This message is broadcast to all top-level (child of desktop) windows. RegisterDeviceNotification is only needed for non-top-level windows. See Q163503 (http://support.microsoft.com/support/kb/articles/Q163/5/03.asp).

I am fairly certain that AutoPlay works by the Explorer catching WM_DEVICECHANGE, sending QueryCancelAutoPlay to the foreground application, and, if permitted, launching what AUTOPLAY.INF points to.

DVDSpy does indeed do GetVolumeInformation, after receiving the insertion event. And it does indeed work reliably for me when not the foreground application, on Windows 2000. Rather than going to polling, it would be nice to know why some systems work differently.

The usual way to tell whether a disc just inserted is a DVD is to look for x:VIDEO_TS*.VOB. Of course, a hybrid disc might have audio tracks or computer programs as well. Right now, DVDSpy doesn't do anything like this. It just gives you the event anyway. But it could, if someone can propose a meaningful action.

MMcM
October 13th, 2002, 03:55 PM
I have added debug code to DVDSpy that prints out interesting facts about the insertion event using OutputDebugString.

If you do not already have a tool for displaying such messages, get DebugView (http://www.sysinternals.com/ntw2k/freeware/debugview.shtml). In fact, all the tools you will find on that site are useful if you want to know what your applications are doing. They and Microsoft's Spy++ are the key to this application control business.

I have placed a debug version of DVDSpy.DLL here (http://world.std.com/~jdostale/htpc/DVDSpy.dll). Save the release version, put that in place of it, and restart Girder.

MMcM
October 13th, 2002, 03:55 PM
Those trace messages indicate that the disc insertion broadcast message was received and processed and the proper Girder event was generated successfully. My guess is that the problems were on the receiving end. A more remote possibility is that something is holding on to the Girder semaphore for too long. Just to be sure, I added a new debug message for that case. You can download the updated DLL from the same place and try it again. I am guessing that it will look the same, though.

It's hard to say which plug-in caused the crash without looking at the log. To find out where it is, run Programs>Accessories>System Tools>System Information. Then Tools>Windows>Dr Watson. The Log file path is where they go. Usually it's a DrWatson folder under the Windows directory or under the All Users directory.

MMcM
October 13th, 2002, 03:55 PM
When you change the combo from All to DVDSpy and choose Learn Event, a dialog should pop up containing a list box and Learn and Close buttons. The list has all the events that it can generate. Select one and pick Learn. It should be learned just as if it had really been generated. You do not need to contrive to have it really happen at the right time, which is, as you say, hard.

MMcM
October 13th, 2002, 03:55 PM
Unfortunately, Dr. Watson only tells you what's mapped in when it has a .DBG file. So, you need to run HandleEx or ListDLLs (both from sysinternals.com) on the Girder process right before the crash and note down which plug-ins are mapped to which address ranges. Then we'll know who owns the return address for the branch to zero.

MMcM
October 13th, 2002, 03:55 PM
Sorry for the delay. This is really only a weekend activity.

If you did not get a debug message saying that the semaphore was held for too long, then that was not the problem.

The handle list you got here looks like it is from WinME. So it does not include the .DLL mappings (which work differently in a 16-bit OS). Can you do it from Win2K or include the LISTDLLS (which works on both) output as well?

MMcM
October 13th, 2002, 03:55 PM
I should have known that I was overlooking something obvious. :oops:

The LISTDLLS output confirms that the crash is inside DVDSpy.DLL, which is what I wanted it for. But it also indicates that you are running version 3.0.22 of Girder itself. You need 3.0.23 prerelease, since that's where setting registers from a hardware plug-in was added. I dunno why some version check didn't fail at startup. This is also consistent with the error from Dr. Watson, which shows a branch to zero. In this case, trying to call the register setting routine, which wasn't supplied by plug-in initialization.

Get the new one and give it a try. I sure hope it proves to be worth all your time and trouble.

<font size=-1>[ This Message was edited by: MMcM on 2001-06-16 17:56 ]</font>

waja
October 13th, 2002, 03:55 PM
I'm trying to get DVDSpy 1.2 to work and I am having problems. I have Girder 3.0.23pre3, WIN98se and a Toshiba SD-M1402 Firmware Rev. 1010.
I get an eject event after the insert event and I get a double eject event instead of a single. Without Girder running, I can start PowerDVD with the tray open. If I put in a DVD and push the tray in, PowerDVD's own OSD will display LOAD then EJECT shortly after this. If I configure PowerDVD to "Play automatically upon inserting disc", I get LOAD followed by PLAY. There doesn't seem to be an EJECT event (OR PowerDVD is able to suppress the EJECT event.) If I do not enable "Play automatically upon inserting disc", and try to use the Disc.Insert.D event then PowerDVD will not suppress the EJECT event. I get PLAY STOP EJECT displayed on PowerDVD.
Anyone one else see this behaviour? Is there a way to have Girder send the PLAY message after allowing the EJECT to pass thru? I've tried using a WAIT command in the execution of a Multi-Command for the Insert Notification and all that happens is the EJECT is delayed until all Commands under the Multi-Command are executed.

TIA,
Rick

stringfellow
October 13th, 2002, 03:55 PM
It is possible to cancel the AutoPlay Event, but this is only possible for the foreground application. Well, i think Girder is not almost always the foreground Application.

Search for
RegisterWindowMessage(TEXT("QueryCancelAutoPlay"));
on MSDN for detail - or ask me to send you the code snipplet from MSDN.

I think the only solution might be to disable the Autoplay feature complete, and start a thread in the Hardware-Plugin which polls the DiskDrive every 1 second. This should not be a big performance loss.


We could use
BOOL x = GetVolumeInformation("D:\", volName, 254, &sernr, &x, &flag, fsname, 254);
to determine if there is a disk load/eject and fire the event to girder.

The problem is to find out what type of cd-rom is in the drive. DVD/AUDIOCD/MP3/SVCD/VCD/DATA - how can these be done ?

stringfellow
October 13th, 2002, 03:55 PM
I am not 100% sure for now, but i think this only foreground-applications will receive this event. All other applications have to use "RegisterDeviceNotification". But this works only with Windows 2000 or Windows 98.

Might this be a problem or should we use the polling strategy?