[FIX] A couple minor bugfixes for ZM 1.24.2

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.
Post Reply
User avatar
Setarcos
Posts: 44
Joined: Thu Jan 25, 2007 4:51 pm
Location: San Jose, CA

[FIX] A couple minor bugfixes for ZM 1.24.2

Post by Setarcos »

I ran into a couple problems when upgrading from ZM 1.23.3 to 1.24.2 when compiling from ZM source on my CentOS 4.8 box and figured I should share my findings in case anyone else runs into these issues. I found most of the solutions on the ZM forums, but some some of the proposed solutions were distro/release-specific, so I chose to implement them to be portable to other releases/distros or incorporation into the mainline code thanks to extensive use of ifdefs.

If you just want to grab the patches without getting into the gory details, they are here: ZM-1.24.2-diffs.tar.gz Copy all the .patch files to your top-level ZM 1.24.2 source directory, then run the following command for each of the .patch files: patch -p1 -N < filename.patch


Patch details

zm_ffmpeg_camera.cpp.patch, zm_mpeg.cpp.patch
errno is not defined in the scope these are compiled in, and without these patches you will get errors like the following when compiling:

Code: Select all

zm_ffmpeg_camera.cpp: In member function `virtual int FfmpegCamera::PrimeCapture()':
zm_ffmpeg_camera.cpp:84: error: `errno' was not declared in this scope
zm_ffmpeg_camera.cpp:84: warning: unused variable 'errno'
zm_ffmpeg_camera.cpp:88: error: `errno' was not declared in this scope
zm_ffmpeg_camera.cpp:88: warning: unused variable 'errno'
zm_local_camera.cpp.patch
The 2.6.9-89 kernel used with CentOS/RHEL 4.8 does not have several of the V4L2 formats defined in the kernel headers that ZM 1.24.2 expects, and without this patch you will get errors like the following when compiling.

Code: Select all

zm_local_camera.cpp: In function `PixelFormat getFfPixFormatFromV4lPalette(int, int)':
zm_local_camera.cpp:115: error: `V4L2_PIX_FMT_HM12' was not declared in this scope
zm_local_camera.cpp:124: error: `V4L2_PIX_FMT_PWC1' was not declared in this scope
zm_local_camera.cpp:125: error: `V4L2_PIX_FMT_PWC2' was not declared in this scope
zm_local_camera.cpp:126: error: `V4L2_PIX_FMT_ET61X251' was not declared in this scope
zm_local_camera.cpp:115: warning: unused variable 'V4L2_PIX_FMT_HM12'
zm_local_camera.cpp:124: warning: unused variable 'V4L2_PIX_FMT_PWC1'
zm_local_camera.cpp:125: warning: unused variable 'V4L2_PIX_FMT_PWC2'
zm_local_camera.cpp:126: warning: unused variable 'V4L2_PIX_FMT_ET61X251'
zm_local_camera.cpp: In static member function `static bool LocalCamera::GetCurrentSettings(const char*, char*, int, bool)':
zm_local_camera.cpp:786: error: `V4L2_CAP_SLICED_VBI_CAPTURE' was not declared in this scope
zm_local_camera.cpp:787: error: `V4L2_CAP_SLICED_VBI_OUTPUT' was not declared in this scope
zm_local_camera.cpp:786: warning: unused variable 'V4L2_CAP_SLICED_VBI_CAPTURE'
zm_local_camera.cpp:787: warning: unused variable 'V4L2_CAP_SLICED_VBI_OUTPUT'
zm_sdp.cpp.patch
Some older ffmpeg releases use av_alloc_format_context() which is deprecated by avformat_alloc_context() in later releases. This patch will allow you to use both newer and older ffmpeg versions without the compiler blowing up like this:

Code: Select all

zm_sdp.cpp: In member function `AVFormatContext* SessionDescriptor::generateFormatContext() const':
zm_sdp.cpp:290: error: `avformat_alloc_context' was not declared in this scope
zm_sdp.cpp:290: warning: unused variable 'avformat_alloc_context'
database.php.patch
This patch changes the query show table status where Name = (MySQL 5.0 and up) to show table status like which is compatible with MySQL 4.0 and up. Without it, you will be unable to do some important things like creating new monitors, and will get errors like the following in your logs:

Code: Select all

[client 127.0.0.1] SQL-ERROR(AA05CD): show table status where Name = 'Monitors', referer: http://localhost/zm/index.php
[client 127.0.0.1] SQL-ERROR(AA05CD): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where Name = 'Monitors'' at line 1, referer: http://localhost/zm/index.php

Have fun!
antec84
Posts: 3
Joined: Tue Jul 13, 2010 2:04 am

Post by antec84 »

It sounds like you have the solution to my problem. But how do I navigate to this "top level source directory for zm". Please be very specific because my understanding of linux is rudimentary at best, but I just about have my system working, and getting my camera to work is just the last step!
User avatar
Setarcos
Posts: 44
Joined: Thu Jan 25, 2007 4:51 pm
Location: San Jose, CA

Post by Setarcos »

antec84 wrote:It sounds like you have the solution to my problem. But how do I navigate to this "top level source directory for zm". Please be very specific because my understanding of linux is rudimentary at best, but I just about have my system working, and getting my camera to work is just the last step!
Hi antec84, the top level ZM source directory is the 'src' directory from wherever you unpacked the ZoneMinder source distribution during setup ala: /usr/tmp/ZoneMinder-1.24.2/src/
Post Reply