Jun 242009
 

Found something cute – Here is a ASDF interface of Win32 for SBCL, seems I can create Win32 application easily with it.

So, I’m kind of away from Ada now since the new GNAT 2009 did not solve the Win32 binding issue, my work on Ada became a interpretter, that is, reading C/C++ specification of Win32 APIs, and then use Ada to rewrite them, I’m pretty sure I was bored with it so I slowered down the development.

Lisp … seems like a different story, the community is a lot more active (based on discussion in USENET), also there are more than one compiler/interpreter providers vs. one from Ada (yes, GNAT is great, but it’s GNAT only), I can see SBCL and CMUCL are pretty promissing, while a lot other providers are coming up.

I may go write the PPCam program again, with Lisp, I know I’m stubborn, but I just want to get it done, with any non-Microsoft, and non-Borland software.

BTW, I gave up the idea of finding an IDE, I’ll work on command line to build a GUI application ๐Ÿ™‚

May 292009
 

Yesterday (actually, May 27) I encountered a pretty long “glitch” on http://libre.adacore.com, and was wondering either there were too many downloads that brought down the site, or AdaCore gurus were working on the site for the coming release.

I’m genius ๐Ÿ˜€ – it turned out GNAT GPL 2009 is ready today, I’ve been waiting for this version for quite some time, most because of the new feature that can generate Ada specification based on C/C++ header files.

I’m going to see if I can get Ada specification files for DirectShow stuffs, I believe this kind of feature works fine on *nix, but for Windows … I don’t have much confidence as Windows is at the bottom of the supporting list in open source world.

Let’s see.

May 202009
 

There are some promising features, the most important one to me is generate Ada specification based on C/C++ header files, this will give me a break on creating my own bindings.

Let’s see – their web site mentioned late May, so it could be just couple of days ahead.

Apr 162009
 

After some tough time dealing with DirectShow stuffs, finally I can preview video from my own web cam now.

There will be something to be tuned at this moment, like how to arrange the command area and video areas, but I believe I’ve overcome one of the most difficult stuff.

There are still three potential headache ahead:

  1. P2P communication, theoratically it won’t be hard as I did it before, but with Ada I have to deal with those UDP stuffs again, just now sure how easy Ada can handle it
  2. Stream video out, means I need to have my own filter, or, maybe I can find an existing one doing that, but again, I’m not sure
  3. Showing streamed video from the other side (the remote window), have no idea so far

A friend told me I can rely on existing protocols like RSTP or MMS, I have the concerns of violating copyright/patents, but I do some research before picking the protocol I’m going to use. At this moment I prefer some cross platform protocol, maybe all of them are, but again (yes, again and again), I’m not sure.

I will try to see if there anyone who can give me some hints on how to do the layout, by now, I will pause the development for couple of days, take some rest, as I’ve made what I promised (preview video by the end of this week). ๐Ÿ™‚

Apr 152009
 

I guess I’ve got all necessary functions from DirectShow for PPCam project, and created a DirectShow binding. It is still partial as I didn’t check other APIs that are unrelated to PPCam project.

I keyed ~1,800 lines of codes today (include blank and comment lines), what I did is reading MSDN, dig out what kind of APIs I need to use, then check Windows SDK to get the C version of declaration, and write binding. There is a great sample from adapower.org, which taught me how to make it.

Actually this is a nice exercise, using Ada doing DirectShow stuffs is actually using C interface. DirectShow is purely COM based so using OO language, especially C++ is the most natual way, but, I still believe using C is the best way to understand what’s inside, and this helps me know more about the whole structure, and do help implementing good programs.

Apr 112009
 

I got a sample from Windows SDK that uses DirectShow to capture video from webcam, it works for now but I’m still reading, just need to know how much it can fit into my PPCam project.

The problem is, I need to make the C program works for me to capture video and put an extra filter to grab data and send to the other end, and after that I need to convert the program from C to Ada. Or, I should start from the sample provided by the SDK and convert it to Ada, then see how to get the extra filter.

I just made the decision to go with the #2 option, it will make more activities in PPCam project, and would let me think more in Ada way.

By the way, I got all my useful search results from Yahoo, it seems to me Yahoo is not that far away from Google in web search, guess we can slowly get market share back.

Apr 072009
 

I was trying to figure out how to load a file from the path where the executable stays, the first thing came to my mind is using Win32’s GetCommandLine, and then do GetFullPathName. It seems ideal in C/C++ world but obviously things don’t work quite well in Ada, especially delimiter changed from / to and then changed back, I have no idea what does Ada’s run-time library is doing.

Then I found Ada has this package – Ada.Directories, it is actually what I want. Using GetCommandLine to get the executable’s full path name, and use Ada.Directories.Containing_Directory to get the directory, all set.

This got me recall similar things in C/UNIX, though UNIX API can do whatever I want, it is usually convenience to use C functions as it fit the language well. Things are getting worse with Ada on Windows, since we all know Windows was not developed by Ada …

BTW, Ada’s identifier is really long, and actually this is the style I’m trying to follow.

Apr 042009
 

I just checked in new codes of PPCam to SVN on sourceforge.net, I guess I won’t spend too much time on visual effect in the future, so what we have now is most likely what we have all the time:

  • no Windows gadget, i.e. no toolbox, no menu, no border, no title bar
  • semi-transparent effect, means you can still read content on windows below PPCam
  • Moving by any point, means you can click on any position of the window and drag & drop the window to the new place, this is a must as it does not have title bar for this

Note that this is data driven ๐Ÿ˜‰ , I learnt the idea from previous music player project – you can just provide a bmp file, and the application will take top-left point as “transparent sample”, then any points in the bmp that has the same color as top-left point will be treated as transparent. This feature makes really easier to change the look and feel.

Other than these visible changes, that are some codes related changes, may or may not be that interesting:

  • Added win32api.ads to include those Win32 APIs that the project needs to use, but are missing in win32ada binding
  • PPCam now becomes a dummy top level package, it used to have those data conversion functions but obviously I can use those from win32ada
  • Added a bmp to the source, this is the bmp I used to debug/demo
  • I’m trying to turn some functions to procedures whenever I don’t need a return code, I think this is another C habit needs to be changed

There will be couple of parts of features to be done in the coming days

  1. Include vfw features, I haven’t got any idea so far
  2. Pop-up menus for the interface to let user enter user name/password/server name, etc
  3. Network, UDP only, then later on I need to have P2P based on it
  4. Server, another GNAT Ada program that will be running on a server to handle authentication, port discovery, etc

I believe this project will be running pretty long thinking of how much I have to learn, if I can make a workable version by June I will be super happy.

I will try to check in at least every week so to make the project active, I will also post documents (svn first, web site later) so to make it possible for others to understand the whole project well.

Apr 042009
 

Slowly, I found more and more evidence that win32ada is based on really old Win32 APIs, be more precisely, it may support Windows 95 but definitely not Windows NT 4.0. I believe the mainstream Windows platform today is XP, with some Vista, so win32ada misses a lot.

I was thinking to create a new package to include those missing APIs that are necessary to my project, but turned out sometime it is impossible – some structures are not 4.0 compatible, so most likely I am still programming for Windows 95.

Now I am, seriously, thinking about creating my own binding, which supports modern Windows APIs, either Vista, or 2008. I can start with manually creating bindings that my project needs, then after making sure I’m doing the right thing, I can run those tools to create full set binding in a (semi-) automatic way.

I will try to avoid layered packages, as I don’t want to do “use” unless it is really necessary (such as “use type” for operators), but remembering where the definition comes from is really tough – WinUser? WinDef? WinGDI? I think they are just C functions stay in same name space, so should be safe to put them in same package.

I know it will be a super big package, but I don’t think people even want to know about it.