Sony SNC-M3W support ready for testing.

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
gneuf
Posts: 62
Joined: Mon Apr 19, 2004 7:24 pm

Sony SNC-M3W support ready for testing.

Post by gneuf »

I've added some code to zm_remote_camera.cpp and zm_remote_camera.h so that it can understand the mjpeg streams transmitted by the Sony SMC-M3/M3W (and presumably the SNC-M1/M1W).

Since I accidentally reformatted the code in my haste to get it working, making a diff produces a ridiculous patch file...

So, I've posted it here as a gzipped tar file containing both sources.

For now, backup the two files named above from your ZM ".../src/ " directory to somewhere safe (!), and replace them with the two files in this archive.

Then, in the ZM top-level directory, at a shell prompt, issue the command:
shell> make && make install
This should recompile and reinstall ZM with the modified zm_remote_camera routines.


IMPORTANT NOTE

For now, you must set the camera to the following configuration using (gulp) Internet Explorer:

MJPEG Mode
320x240 Image size
Frame rate 5 (or another value of your choice - just remember it for creating the monitor - the values must match for now)
Microphone disabled

Then, you can create a new monitor with the following values:

General
Name: <Your Choice>
Source: Remote
Function: Monitor
Maximum FPS: 5 (or the value you set with Internet Explorer)

Source
Remote Host Name: username:password@<camera ip address>
Remote Host Port: <camera remote port> (usually 9000 unless you changed)
Remote Host Path: /mjpeg?speed=5 (or the speed value you set with Internet Explorer)
Remote Image Colours: 24 bit colour
Capture Width: 320
Capture Height: 240

Once that's set, you should see video when you watch the new monitor!

Todo:
Make it modular so as to support other non-http/non-standard MJPEG headers from other cameras by simply describing the format of the header.
Re format it so a DIFF can be taken. :)

Disclaimer: All available disclaimers.
Warrantee: None of the available Warrantees.
Last edited by gneuf on Mon Apr 17, 2006 4:10 pm, edited 1 time in total.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Thanks for this. If you can mail me a diff when you get one I will put it 1.22.1 in the next couple of days.
Phil
gneuf
Posts: 62
Joined: Mon Apr 19, 2004 7:24 pm

Post by gneuf »

Looks like I'll have to re-edit from the original source to get a *changes-only* diff. Possibly I'll even get to it tonight: last night I got the SNC-M3W control script to work! Cleaning it up tonight, which should only take an hour...
nekrataal
Posts: 3
Joined: Sun Apr 16, 2006 9:13 pm

Post by nekrataal »

This is awsome!! The problem is the link is broken :cry: is there another way to get this?
nekrataal
Posts: 3
Joined: Sun Apr 16, 2006 9:13 pm

Post by nekrataal »

First off, thanks to gneuf for fixing the link, you rock! I got the files and rebuilt ZM but when I create the monitor I only get a black window. What is the ETA for the 1.22.1 with support for this camera? Thanks
gneuf
Posts: 62
Joined: Mon Apr 19, 2004 7:24 pm

Post by gneuf »

I'm processing the diff now for 1.22.1 for upload. I reformatted the original code and it makes a *huge* diff. I'm hand re-editing the code to reduce the diff to only the altered code.

You *must* be sure to set the camera to *no* sound (microphone *off*), as I haven't been able to test my hack that discards the sound packetry if the microphone is left on...sorry. And you must set the camera to a resolution that matches the rez you enter in the camera setup in ZM, e.g. camera rez in Internet Explorer setup window = u pixels by v pixels, camera rez in ZM = u pixels by v pixels.

Meaning: if you make the camera rez=320x240 in the Sony ActiveX setup window using Internet Explorer (the only way to set the camera parameters!), then you must setup the ZM camera specs to the *same* rez = 320x240.

Otherwise, the ZM code (wisely) will display only a black window.

Should that fail, turn debugging on to the max (meaning: set it to the value "9"), and send me the ZM debug output and I'll fix it as fast as I can.

I hate it when it works for me and fails for others! :evil:
inker
Posts: 3
Joined: Mon May 08, 2006 1:05 pm

Post by inker »

So is this code in 1.22.1? I have a SNC-M1 and I get the black screen too...


EDIT: See PM for debug logs location.

The offending line is:

05/08/06 15:30:59.244514 zmc_m1[19516].ERR-zm_image.cpp/440 [Attempting to crop outside image, 0,0 -> 320,240 not in 320,240]

Seems odd, even though i have the size set properly from what I can tell.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

This is due to a ZM problem with resizing monitors. It is fixed in 1.22.2 but for now you should re-edit your zone and make sure that the points only range from 0->319 and 0-239.
Phil
udoewich
Posts: 3
Joined: Thu May 18, 2006 3:27 pm

Post by udoewich »

Apparently gneuf's code hasn't made it into the 1.22.1 release.

gneuf: can you provide us with a diff against the official 1.22.1 files?

I've got three SNC-M1 cameras and I'd really like to get the streams directly from them if possible...

Cheers,
Ulrich
gneuf
Posts: 62
Joined: Mon Apr 19, 2004 7:24 pm

Post by gneuf »

Yes, since I never got the 1.22.0 diff finished and turned in [blush].

Of course, I'll have to install 1.22.1 and then carefully edit-in the changes without messing up all the whitespace, as I did before.

I'll try to do that this evening. Sorry it's taken so long: Life is what happens to you while you're making other plans. :)
udoewich
Posts: 3
Joined: Thu May 18, 2006 3:27 pm

Post by udoewich »

Did you get a chance to make the changes? :)

Cheers,
Ulrich
gneuf
Posts: 62
Joined: Mon Apr 19, 2004 7:24 pm

Post by gneuf »

Yes...but something's not working. I'm getting black after a few seconds of video. This happened when I modified the code the first time - it had to do with discarding the sound data from the camera. Can't remember what I changed to solve it, but I'm sure it'll come back to me when I take a third run at it.

You know how it is - code never works on the first try, and if it does...no one was watching! :)

I'll probably get it sorted out by this evening - I can get back to testing it after work today...sorry it's still taking some time. I'll do my best to get it done before morning.
gneuf
Posts: 62
Joined: Mon Apr 19, 2004 7:24 pm

Post by gneuf »

Ok, got it!

The two required patches plus the rudimentary control script for the camera (work-in-progress) are zipped into zm_remote_camera-patches.tgz.

I'd like to take some time and take advantage of the new "format" enum. The added logic renders this little hack into a *big* hack. :(

I need to properly code this hack into the new zm_remote... logic.

For now, for those in a hurry, this works.

Warning: If you're not running libpcre, then this patch doesn't work (yet). Easy fix - I just didn't put it in yet.
udoewich
Posts: 3
Joined: Thu May 18, 2006 3:27 pm

Post by udoewich »

Hey! Works like a charm. :D

Thanks for taking the time to update the patch.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

This would be a useful addition to the Wiki entry for that camera, if you feel like edting (or creating) an entry :D
Phil
Post Reply