Package: zoneminder
Version: 1.25.0-3
Severity: important
Tags: patch

Dear Maintainer,

The zoneminder package currently FTBFS against libav9 because it uses an
outdated API. I have attached a quick patch that allows
compilation. Please test the patch and discuss it with upstream.

x86_64-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I..  -I/usr/include -I/usr/include 
-Wall -Wno-sign-compare -fno-inline -I/usr/include -D_FORTIFY_SOURCE=2 
-D__STDC_CONSTANT_MACROS -D__STDC_CONSTANT_MACROS -g -O2 -fstack-protector 
--param=ssp-buffer-size=4 -Wformat -Werror=format-security -DZM_FFMPEG_CVS 
-DHAVE_LIBCRYPTO -MT zm_local_camera.o -MD -MP -MF .deps/zm_local_camera.Tpo -c 
-o zm_local_camera.o zm_local_camera.cpp
In file included from zm_local_camera.cpp:24:0:
zm_local_camera.h:101:5: error: 'PixelFormat' does not name a type
zm_local_camera.h:102:5: error: 'PixelFormat' does not name a type
zm_local_camera.h:103:12: error: 'AVFrame' does not name a type
zm_local_camera.cpp:44:8: error: 'PixelFormat' does not name a type
zm_local_camera.cpp:259:1: error: 'AVFrame' does not name a type
zm_local_camera.cpp: In constructor 'LocalCamera::LocalCamera(int, const 
string&, int, int, const string&, int, int, int, int, int, int, int, bool)':
zm_local_camera.cpp:324:9: error: 'imagePixFormat' was not declared in this 
scope
zm_local_camera.cpp:324:39: error: 'PIX_FMT_GRAY8' was not declared in this 
scope
zm_local_camera.cpp:324:53: error: 'PIX_FMT_RGB24' was not declared in this 
scope
zm_local_camera.cpp:325:9: error: 'capturePixFormat' was not declared in this 
scope
zm_local_camera.cpp:325:79: error: 'getFfPixFormatFromV4lPalette' was not 
declared in this scope
zm_local_camera.cpp: In member function 'void LocalCamera::Initialise()':
zm_local_camera.cpp:341:27: error: 'AV_LOG_DEBUG' was not declared in this scope
zm_local_camera.cpp:341:40: error: 'av_log_set_level' was not declared in this 
scope
zm_local_camera.cpp:343:27: error: 'AV_LOG_QUIET' was not declared in this scope
zm_local_camera.cpp:343:40: error: 'av_log_set_level' was not declared in this 
scope
zm_local_camera.cpp:464:9: error: 'capturePictures' was not declared in this 
scope
zm_local_camera.cpp:464:31: error: expected type-specifier before 'AVFrame'
zm_local_camera.cpp:464:31: error: expected ';' before 'AVFrame'
zm_local_camera.cpp:488:18: error: 'imagePixFormat' was not declared in this 
scope
zm_local_camera.cpp:488:36: error: 'capturePixFormat' was not declared in this 
scope
zm_local_camera.cpp:490:58: error: 'avcodec_alloc_frame' was not declared in 
this scope
zm_local_camera.cpp:493:34: error: 'AVPicture' was not declared in this scope
zm_local_camera.cpp:493:45: error: expected primary-expression before ')' token
zm_local_camera.cpp:493:187: error: 'avpicture_fill' was not declared in this 
scope
zm_local_camera.cpp:631:9: error: 'capturePictures' was not declared in this 
scope
zm_local_camera.cpp:631:31: error: expected type-specifier before 'AVFrame'
zm_local_camera.cpp:631:31: error: expected ';' before 'AVFrame'
zm_local_camera.cpp:639:18: error: 'imagePixFormat' was not declared in this 
scope
zm_local_camera.cpp:639:36: error: 'capturePixFormat' was not declared in this 
scope
zm_local_camera.cpp:641:58: error: 'avcodec_alloc_frame' was not declared in 
this scope
zm_local_camera.cpp:644:34: error: 'AVPicture' was not declared in this scope
zm_local_camera.cpp:644:45: error: expected primary-expression before ')' token
zm_local_camera.cpp:644:161: error: 'avpicture_fill' was not declared in this 
scope
zm_local_camera.cpp: In static member function 'static bool 
LocalCamera::GetCurrentSettings(const char*, char*, int, bool)':
zm_local_camera.cpp:775:22: error: 'PATH_MAX' was not declared in this scope
zm_local_camera.cpp:780:21: error: 'queryDevice' was not declared in this scope
zm_local_camera.cpp:782:22: error: 'queryDevice' was not declared in this scope
zm_local_camera.cpp:783:29: error: 'queryDevice' was not declared in this scope
zm_local_camera.cpp:800:67: error: 'queryDevice' was not declared in this scope
zm_local_camera.cpp:802:54: error: 'queryDevice' was not declared in this scope
zm_local_camera.cpp:812:92: error: 'queryDevice' was not declared in this scope
zm_local_camera.cpp:937:91: error: 'queryDevice' was not declared in this scope
zm_local_camera.cpp:962:82: error: 'queryDevice' was not declared in this scope
zm_local_camera.cpp:1087:90: error: 'queryDevice' was not declared in this scope
zm_local_camera.cpp: In member function 'virtual int 
LocalCamera::Capture(Image&)':
zm_local_camera.cpp:1644:16: error: 'AVFrame' does not name a type
zm_local_camera.cpp:1646:14: error: 'imagePixFormat' was not declared in this 
scope
zm_local_camera.cpp:1646:32: error: 'capturePixFormat' was not declared in this 
scope
zm_local_camera.cpp:1650:146: error: 'SWS_BICUBIC' was not declared in this 
scope
zm_local_camera.cpp:1650:176: error: 'sws_getCachedContext' was not declared in 
this scope
zm_local_camera.cpp:1654:17: error: 'tmpPicture' was not declared in this scope
zm_local_camera.cpp:1654:50: error: 'avcodec_alloc_frame' was not declared in 
this scope
zm_local_camera.cpp:1657:85: error: 'avpicture_get_size' was not declared in 
this scope
zm_local_camera.cpp:1658:74: error: 'av_malloc' was not declared in this scope
zm_local_camera.cpp:1661:34: error: 'AVPicture' was not declared in this scope
zm_local_camera.cpp:1661:45: error: expected primary-expression before ')' token
zm_local_camera.cpp:1661:103: error: 'avpicture_fill' was not declared in this 
scope
zm_local_camera.cpp:1663:46: error: 'capturePictures' was not declared in this 
scope
zm_local_camera.cpp:1663:137: error: 'tmpPicture' was not declared in this scope
zm_local_camera.cpp:1663:176: error: 'sws_scale' was not declared in this scope
make[3]: *** [zm_local_camera.o] Error 1

Thank you very much for your assistance
Reinhard


-- System Information:
Debian Release: wheezy/sid
  APT prefers precise-updates
  APT policy: (500, 'precise-updates'), (500, 'precise-security'), (500, 
'precise-proposed'), (500, 'precise')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-33-generic (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Description: Fixes compilation against libav 9
Author: Reinhard Tartler <siret...@ubuntu.com>

---
Origin: Ubuntu
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: no
Last-Update: 2012-11-24

--- zoneminder-1.25.0.orig/configure.ac
+++ zoneminder-1.25.0/configure.ac
@@ -278,8 +278,8 @@ AC_CHECK_LIB(x264,x264_predict_16x16_ini
 AC_CHECK_LIB(avutil,av_malloc,,AC_MSG_WARN(libavutil.a may be required for MPEG streaming))
 # Don't bother to warn about this one
 AC_CHECK_LIB(avcore,av_image_copy,,)
-AC_CHECK_LIB(avcodec,avcodec_init,,AC_MSG_WARN(libavcodec.a is required for MPEG streaming))
-AC_CHECK_LIB(avformat,av_new_stream,,AC_MSG_WARN(libavformat.a is required for MPEG streaming))
+AC_CHECK_LIB(avcodec,avcodec_version,,AC_MSG_WARN(libavcodec.a is required for MPEG streaming))
+AC_CHECK_LIB(avformat,avformat_version,,AC_MSG_WARN(libavformat.a is required for MPEG streaming))
 AC_CHECK_LIB(avdevice,avdevice_register_all,,AC_MSG_WARN(libavdevice.a may be required for MPEG streaming))
 AC_CHECK_LIB(swscale,sws_scale,,,-lswscale)
 AC_CHECK_LIB(bz2,BZ2_bzCompress,,AC_MSG_WARN(zm requires libbz2.a for recent versions of ffmpeg))
--- zoneminder-1.25.0.orig/src/zm_ffmpeg_camera.cpp
+++ zoneminder-1.25.0/src/zm_ffmpeg_camera.cpp
@@ -58,8 +58,7 @@ FfmpegCamera::~FfmpegCamera()
     }
     if ( mFormatContext )
     {
-        av_close_input_file( mFormatContext );
-        mFormatContext = NULL;
+        avformat_close_input( &mFormatContext );
     }
 
 	if ( capture )
@@ -91,11 +90,11 @@ int FfmpegCamera::PrimeCapture()
     Info( "Priming capture from %s", mPath.c_str() );
 
     // Open the input, not necessarily a file
-    if ( av_open_input_file( &mFormatContext, mPath.c_str(), NULL, 0, NULL ) !=0 )
+    if ( avformat_open_input( &mFormatContext, mPath.c_str(), NULL, NULL ) !=0 )
         Fatal( "Unable to open input %s due to: %s", mPath.c_str(), strerror(errno) );
 
     // Locate stream info from input
-    if ( av_find_stream_info( mFormatContext ) < 0 )
+    if ( avformat_find_stream_info( mFormatContext, NULL ) < 0 )
         Fatal( "Unable to find stream info from %s due to: %s", mPath.c_str(), strerror(errno) );
     
     // Find first video stream present
@@ -122,7 +121,7 @@ int FfmpegCamera::PrimeCapture()
         Fatal( "Can't find codec for video stream from %s", mPath.c_str() );
 
     // Open the codec
-    if ( avcodec_open( mCodecContext, mCodec ) < 0 )
+    if ( avcodec_open2( mCodecContext, mCodec, NULL ) < 0 )
         Fatal( "Unable to open codec for video stream from %s", mPath.c_str() );
 
     // Allocate space for the native video frame
--- zoneminder-1.25.0.orig/src/zm_sdp.cpp
+++ zoneminder-1.25.0/src/zm_sdp.cpp
@@ -334,7 +334,7 @@ AVFormatContext *SessionDescriptor::gene
     for ( int i = 0; i < mMediaList.size(); i++ )
     {
         const MediaDescriptor *mediaDesc = mMediaList[i];
-        AVStream *stream = av_new_stream( formatContext, i );
+        AVStream *stream = avformat_new_stream( formatContext, NULL );
 
         Debug( 1, "Looking for codec for %s payload type %d / %s",  mediaDesc->getType().c_str(), mediaDesc->getPayloadType(), mediaDesc->getPayloadDesc().c_str() );
 #if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,2,1)
--- zoneminder-1.25.0.orig/src/zm_mpeg.cpp
+++ zoneminder-1.25.0/src/zm_mpeg.cpp
@@ -77,7 +77,7 @@ void VideoStream::SetupCodec( int colour
 	ost = NULL;
 	if (of->video_codec != CODEC_ID_NONE)
 	{
-		ost = av_new_stream(ofc, 0);
+		ost = avformat_new_stream(ofc, 0);
 		if (!ost)
 		{
 			Panic( "Could not alloc stream" );
@@ -126,17 +126,6 @@ void VideoStream::SetupCodec( int colour
 	}
 }
 
-void VideoStream::SetParameters()
-{
-	/* set the output parameters (must be done even if no
-	   parameters). */
-	if ( av_set_parameters(ofc, NULL) < 0 )
-	{
-		Panic( "Invalid output format parameters" );
-	}
-	//dump_format(ofc, 0, filename, 1);
-}
-
 const char *VideoStream::MimeType() const
 {
 	for ( int i = 0; i < sizeof(mime_data)/sizeof(*mime_data); i++ )
@@ -176,7 +165,7 @@ void VideoStream::OpenStream()
 		}
 
 		/* open the codec */
-		if ( avcodec_open(c, codec) < 0 )
+		if ( avcodec_open2(c, codec, NULL) < 0 )
 		{
 			Panic( "Could not open codec" );
 		}
@@ -222,7 +211,7 @@ void VideoStream::OpenStream()
 	if ( !(of->flags & AVFMT_NOFILE) )
 	{
 #if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,2,1)
-		if ( avio_open(&ofc->pb, filename, URL_WRONLY) < 0 )
+		if ( avio_open(&ofc->pb, filename, AVIO_FLAG_WRITE) < 0 )
 #else
 		if ( url_fopen(&ofc->pb, filename, URL_WRONLY) < 0 )
 #endif
@@ -241,7 +230,7 @@ void VideoStream::OpenStream()
 	}
 
 	/* write the stream header, if any */
-	av_write_header(ofc);
+	avformat_write_header(ofc, NULL);
 }
 
 VideoStream::VideoStream( const char *filename, const char *format, int bitrate, double frame_rate, int colours, int width, int height )
@@ -253,7 +242,6 @@ VideoStream::VideoStream( const char *fi
 
 	SetupFormat( filename, format );
 	SetupCodec( colours, width, height, bitrate, frame_rate );
-	SetParameters();
 }
 
 VideoStream::~VideoStream()
--- zoneminder-1.25.0.orig/src/zm_ffmpeg.h
+++ zoneminder-1.25.0/src/zm_ffmpeg.h
@@ -32,6 +32,7 @@ extern "C" {
 #if HAVE_LIBAVUTIL_AVUTIL_H
 #include <libavutil/avutil.h>
 #include <libavutil/mathematics.h>
+#include <libavutil/pixfmt.h>
 #endif
 #if HAVE_LIBAVCODEC_AVCODEC_H
 #include <libavcodec/avcodec.h>
--- zoneminder-1.25.0.orig/src/zm_remote_camera_rtsp.cpp
+++ zoneminder-1.25.0/src/zm_remote_camera_rtsp.cpp
@@ -145,7 +145,7 @@ int RemoteCameraRtsp::PrimeCapture()
         Panic( "Unable to locate codec %d decoder", codecContext->codec_id );
 
     // Open codec
-    if ( avcodec_open( codecContext, codec ) < 0 )
+    if ( avcodec_open2( codecContext, codec, NULL ) < 0 )
         Panic( "Can't open codec" );
 
     picture = avcodec_alloc_frame();
--- zoneminder-1.25.0.orig/src/zm_mpeg.h
+++ zoneminder-1.25.0/src/zm_mpeg.h
@@ -55,7 +55,6 @@ protected:
 
 	void SetupFormat( const char *p_filename, const char *format );
 	void SetupCodec( int colours, int width, int height, int bitrate, double frame_rate );
-	void SetParameters();
 
 public:
 	VideoStream( const char *filename, const char *format, int bitrate, double frame_rate, int colours, int width, int height );
_______________________________________________
pkg-multimedia-maintainers mailing list
pkg-multimedia-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-multimedia-maintainers

Reply via email to