Changes to compile 1.24.4 on Debian Lenny

Forum for questions and support relating to the 1.24.x releases only.
Locked
davidc
Posts: 1
Joined: Mon Jun 06, 2011 1:05 pm

Changes to compile 1.24.4 on Debian Lenny

Post by davidc »

The following changes were necessary to compile ZM 1.24.4 on Debian Lenny which has slightly older versions of some packages. Also json_last_error doesn't exist in PHP 5.2.

Obviously you'll want to put some of these inside autoconf checks instead, but here's what I hacked in:

Code: Select all

diff -ur orig/ZoneMinder-1.24.4/src/zm_ffmpeg_camera.cpp ZoneMinder-1.24.4/src/zm_ffmpeg_camera.cpp
--- orig/ZoneMinder-1.24.4/src/zm_ffmpeg_camera.cpp     2011-05-16 23:36:02.000000000 +0100
+++ ZoneMinder-1.24.4/src/zm_ffmpeg_camera.cpp  2011-06-02 16:52:04.000000000 +0100
@@ -17,6 +17,7 @@
 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 //

+#include <errno.h>
 #include "zm.h"

 #if HAVE_LIBAVFORMAT
@@ -169,7 +170,7 @@
         Debug( 5, "Got packet from stream %d", packet.stream_index );
         if ( packet.stream_index == mVideoStreamId )
         {
-            if ( avcodec_decode_video2( mCodecContext, mRawFrame, &frameComplete, &packet ) < 0 )
+         if ( avcodec_decode_video( mCodecContext, mRawFrame, &frameComplete, packet.data, packet.\
size ) < 0 )
                 Fatal( "Unable to decode frame at frame %d", frameCount );

             Debug( 3, "Decoded video packet at frame %d", frameCount );
diff -ur orig/ZoneMinder-1.24.4/src/zm_ffmpeg.h ZoneMinder-1.24.4/src/zm_ffmpeg.h
--- orig/ZoneMinder-1.24.4/src/zm_ffmpeg.h      2008-07-25 10:33:23.000000000 +0100
+++ ZoneMinder-1.24.4/src/zm_ffmpeg.h   2011-06-02 16:41:56.000000000 +0100
@@ -25,6 +25,10 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
+
+#define AV_VERSION_INT(a,b,c) ((a<<16)+(b<<8)+c)
+
+
 #if HAVE_LIBAVUTIL_AVUTIL_H
 #include <libavutil/avutil.h>
 #elif HAVE_FFMPEG_AVUTIL_H
diff -ur orig/ZoneMinder-1.24.4/src/zm_mpeg.cpp ZoneMinder-1.24.4/src/zm_mpeg.cpp
--- orig/ZoneMinder-1.24.4/src/zm_mpeg.cpp      2011-05-15 21:39:06.000000000 +0100
+++ ZoneMinder-1.24.4/src/zm_mpeg.cpp   2011-06-02 16:52:47.000000000 +0100
@@ -17,6 +17,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

+#include <errno.h>
 #include <stdlib.h>
 #include <string.h>

@@ -47,11 +48,11 @@
        format = p_format;

        /* auto detect the output format from the name. default is mpeg. */
-       of = av_guess_format( format, NULL, NULL);
+       of = guess_format( format, NULL, NULL);
        if ( !of )
        {
                Warning( "Could not deduce output format from file extension: using mpeg" );
-               of = av_guess_format("mpeg", NULL, NULL);
+               of = guess_format("mpeg", NULL, NULL);
        }
        if ( !of )
        {
diff -ur orig/ZoneMinder-1.24.4/src/zm_remote_camera_rtsp.cpp ZoneMinder-1.24.4/src/zm_remote_camer\
a_rtsp.cpp
--- orig/ZoneMinder-1.24.4/src/zm_remote_camera_rtsp.cpp        2011-05-15 21:39:06.000000000 +0100
+++ ZoneMinder-1.24.4/src/zm_remote_camera_rtsp.cpp     2011-06-02 16:53:39.000000000 +0100
@@ -213,7 +213,7 @@
                 int got_picture = false;
                 packet.data = buffer.head();
                 packet.size = buffer.size();
-                int len = avcodec_decode_video2( codecContext, picture, &got_picture, &packet );
+                int len = avcodec_decode_video( codecContext, picture, &got_picture, packet.data, packet.size );
                 if ( len < 0 )
                 {
                     if ( frameCount > initialFrameCount )
diff -ur orig/ZoneMinder-1.24.4/src/zm_sdp.cpp ZoneMinder-1.24.4/src/zm_sdp.cpp
--- orig/ZoneMinder-1.24.4/src/zm_sdp.cpp       2011-05-15 21:39:06.000000000 +0100
+++ ZoneMinder-1.24.4/src/zm_sdp.cpp    2011-06-02 16:56:55.000000000 +0100
@@ -17,6 +17,7 @@
 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 //

+#include <string.h>
 #include "zm.h"

 #if HAVE_LIBAVFORMAT
@@ -326,7 +327,7 @@

 AVFormatContext *SessionDescriptor::generateFormatContext() const
 {
-    AVFormatContext *formatContext = avformat_alloc_context();
+    AVFormatContext *formatContext = av_alloc_format_context();

     strncpy( formatContext->filename, mUrl.c_str(), sizeof(formatContext->filename) );

diff -ur orig/ZoneMinder-1.24.4/src/zm_sdp.h ZoneMinder-1.24.4/src/zm_sdp.h
--- orig/ZoneMinder-1.24.4/src/zm_sdp.h 2011-05-15 21:39:06.000000000 +0100
+++ ZoneMinder-1.24.4/src/zm_sdp.h      2011-06-02 16:54:10.000000000 +0100
@@ -40,7 +40,7 @@
     {
         int payloadType;
         const char payloadName[6];
-        enum AVMediaType codecType;
+        enum CodecType codecType;
         enum CodecID codecId;
         int clockRate;
         int autoChannels;
@@ -49,7 +49,7 @@
     struct DynamicPayloadDesc
     {
         const char payloadName[32];
-        enum AVMediaType codecType;
+        enum CodecType codecType;
         enum CodecID codecId;
         //int clockRate;
         //int autoChannels;
diff -ur orig/ZoneMinder-1.24.4/web/includes/functions.php ZoneMinder-1.24.4/web/includes/functions\
.php
--- orig/ZoneMinder-1.24.4/web/includes/functions.php   2011-05-23 16:15:37.000000000 +0100
+++ ZoneMinder-1.24.4/web/includes/functions.php        2011-06-06 14:07:12.000000000 +0100
@@ -2192,7 +2192,8 @@
     if ( function_exists('json_encode') )
     {
         $string = json_encode( $value );
-        checkJsonError();
+//        checkJsonError();
+         if (!$string) die("JSON error");
         return( $string );
     }

@@ -2233,7 +2234,8 @@
     if ( function_exists('json_decode') )
     {
         $object = json_decode( $value, true );
-        checkJsonError();
+//        checkJsonError();
+          if ($object === null) die("JSON error");
         return( $object );
     }

vst
Posts: 6
Joined: Wed Sep 01, 2010 8:42 am

Re: Changes to compile 1.24.4 on Debian Lenny

Post by vst »

davidc: You have a malformed patch there.
This forum mangles text between

Code: Select all

 tags :(
By the way, THANKS A MILLION for providing this patch on the forums, it helped me to effortlessly upgrade my slackware 13.0 ZM installation to 1.24.4 \o/
A working, indented version of the above patch can be found here:
Last edited by vst on Tue Jun 28, 2011 11:02 am, edited 1 time in total.
vst
Posts: 6
Joined: Wed Sep 01, 2010 8:42 am

Re: Changes to compile 1.24.4 on Debian Lenny

Post by vst »

Locked