Package: zoneminder Version: 1.28.1-8 Severity: important Tags: patch User: pkg-multimedia-maintain...@lists.alioth.debian.org Usertags: ffmpeg2.9
Dear Maintainer, your package fails to build with the upcoming ffmpeg 2.9. This bug will become release-critical at some point when the ffmpeg2.9 transition gets closer. Attached is a patch replacing the deprecated functionality. It also works with ffmpeg 2.8. Please apply this patch and forward it upstream, if necessary. These changes have little regression potential. Best regards, Andreas
diff --git a/debian/patches/ffmpeg_2.9.patch b/debian/patches/ffmpeg_2.9.patch new file mode 100644 index 0000000..1e4442b --- /dev/null +++ b/debian/patches/ffmpeg_2.9.patch @@ -0,0 +1,794 @@ +Description: Replace deprecated FFmpeg API +Author: Andreas Cadhalpun <andreas.cadhal...@googlemail.com> +Last-Update: <2015-11-02> + +--- zoneminder-1.28.1.orig/src/zm_ffmpeg.cpp ++++ zoneminder-1.28.1/src/zm_ffmpeg.cpp +@@ -24,8 +24,8 @@ + #if HAVE_LIBAVCODEC || HAVE_LIBAVUTIL || HAVE_LIBSWSCALE + + #if HAVE_LIBAVUTIL +-enum PixelFormat GetFFMPEGPixelFormat(unsigned int p_colours, unsigned p_subpixelorder) { +- enum PixelFormat pf; ++enum AVPixelFormat GetFFMPEGPixelFormat(unsigned int p_colours, unsigned p_subpixelorder) { ++ enum AVPixelFormat pf; + + Debug(8,"Colours: %d SubpixelOrder: %d",p_colours,p_subpixelorder); + +@@ -34,10 +34,10 @@ enum PixelFormat GetFFMPEGPixelFormat(un + { + if(p_subpixelorder == ZM_SUBPIX_ORDER_BGR) { + /* BGR subpixel order */ +- pf = PIX_FMT_BGR24; ++ pf = AV_PIX_FMT_BGR24; + } else { + /* Assume RGB subpixel order */ +- pf = PIX_FMT_RGB24; ++ pf = AV_PIX_FMT_RGB24; + } + break; + } +@@ -45,25 +45,25 @@ enum PixelFormat GetFFMPEGPixelFormat(un + { + if(p_subpixelorder == ZM_SUBPIX_ORDER_ARGB) { + /* ARGB subpixel order */ +- pf = PIX_FMT_ARGB; ++ pf = AV_PIX_FMT_ARGB; + } else if(p_subpixelorder == ZM_SUBPIX_ORDER_ABGR) { + /* ABGR subpixel order */ +- pf = PIX_FMT_ABGR; ++ pf = AV_PIX_FMT_ABGR; + } else if(p_subpixelorder == ZM_SUBPIX_ORDER_BGRA) { + /* BGRA subpixel order */ +- pf = PIX_FMT_BGRA; ++ pf = AV_PIX_FMT_BGRA; + } else { + /* Assume RGBA subpixel order */ +- pf = PIX_FMT_RGBA; ++ pf = AV_PIX_FMT_RGBA; + } + break; + } + case ZM_COLOUR_GRAY8: +- pf = PIX_FMT_GRAY8; ++ pf = AV_PIX_FMT_GRAY8; + break; + default: + Panic("Unexpected colours: %d",p_colours); +- pf = PIX_FMT_GRAY8; /* Just to shush gcc variable may be unused warning */ ++ pf = AV_PIX_FMT_GRAY8; /* Just to shush gcc variable may be unused warning */ + break; + } + +@@ -76,13 +76,13 @@ SWScale::SWScale() : gotdefaults(false), + Debug(4,"SWScale object created"); + + /* Allocate AVFrame for the input */ +- input_avframe = avcodec_alloc_frame(); ++ input_avframe = av_frame_alloc(); + if(input_avframe == NULL) { + Fatal("Failed allocating AVFrame for the input"); + } + + /* Allocate AVFrame for the output */ +- output_avframe = avcodec_alloc_frame(); ++ output_avframe = av_frame_alloc(); + if(output_avframe == NULL) { + Fatal("Failed allocating AVFrame for the output"); + } +@@ -91,10 +91,10 @@ SWScale::SWScale() : gotdefaults(false), + SWScale::~SWScale() { + + /* Free up everything */ +- av_free(input_avframe); ++ av_frame_free(&input_avframe); + input_avframe = NULL; + +- av_free(output_avframe); ++ av_frame_free(&output_avframe); + output_avframe = NULL; + + if(swscale_ctx) { +@@ -105,7 +105,7 @@ SWScale::~SWScale() { + Debug(4,"SWScale object destroyed"); + } + +-int SWScale::SetDefaults(enum PixelFormat in_pf, enum PixelFormat out_pf, unsigned int width, unsigned int height) { ++int SWScale::SetDefaults(enum AVPixelFormat in_pf, enum AVPixelFormat out_pf, unsigned int width, unsigned int height) { + + /* Assign the defaults */ + default_input_pf = in_pf; +@@ -118,7 +118,7 @@ int SWScale::SetDefaults(enum PixelForma + return 0; + } + +-int SWScale::Convert(const uint8_t* in_buffer, const size_t in_buffer_size, uint8_t* out_buffer, const size_t out_buffer_size, enum PixelFormat in_pf, enum PixelFormat out_pf, unsigned int width, unsigned int height) { ++int SWScale::Convert(const uint8_t* in_buffer, const size_t in_buffer_size, uint8_t* out_buffer, const size_t out_buffer_size, enum AVPixelFormat in_pf, enum AVPixelFormat out_pf, unsigned int width, unsigned int height) { + /* Parameter checking */ + if(in_buffer == NULL || out_buffer == NULL) { + Error("NULL Input or output buffer"); +@@ -181,7 +181,7 @@ int SWScale::Convert(const uint8_t* in_b + return 0; + } + +-int SWScale::Convert(const Image* img, uint8_t* out_buffer, const size_t out_buffer_size, enum PixelFormat in_pf, enum PixelFormat out_pf, unsigned int width, unsigned int height) { ++int SWScale::Convert(const Image* img, uint8_t* out_buffer, const size_t out_buffer_size, enum AVPixelFormat in_pf, enum AVPixelFormat out_pf, unsigned int width, unsigned int height) { + if(img->Width() != width) { + Error("Source image width differs. Source: %d Output: %d",img->Width(), width); + return -12; +--- zoneminder-1.28.1.orig/src/zm_ffmpeg.h ++++ zoneminder-1.28.1/src/zm_ffmpeg.h +@@ -94,14 +94,8 @@ extern "C" { + #endif + #endif + +-/* Fix for not having SWS_CPU_CAPS_SSE2 defined */ +-#ifndef SWS_CPU_CAPS_SSE2 +-#define SWS_CPU_CAPS_SSE2 0x02000000 +-#endif +- +- + #if HAVE_LIBAVUTIL +-enum PixelFormat GetFFMPEGPixelFormat(unsigned int p_colours, unsigned p_subpixelorder); ++enum AVPixelFormat GetFFMPEGPixelFormat(unsigned int p_colours, unsigned p_subpixelorder); + #endif // HAVE_LIBAVUTIL + + +@@ -111,19 +105,19 @@ class SWScale { + public: + SWScale(); + ~SWScale(); +- int SetDefaults(enum PixelFormat in_pf, enum PixelFormat out_pf, unsigned int width, unsigned int height); ++ int SetDefaults(enum AVPixelFormat in_pf, enum AVPixelFormat out_pf, unsigned int width, unsigned int height); + int ConvertDefaults(const Image* img, uint8_t* out_buffer, const size_t out_buffer_size); + int ConvertDefaults(const uint8_t* in_buffer, const size_t in_buffer_size, uint8_t* out_buffer, const size_t out_buffer_size); +- int Convert(const Image* img, uint8_t* out_buffer, const size_t out_buffer_size, enum PixelFormat in_pf, enum PixelFormat out_pf, unsigned int width, unsigned int height); +- int Convert(const uint8_t* in_buffer, const size_t in_buffer_size, uint8_t* out_buffer, const size_t out_buffer_size, enum PixelFormat in_pf, enum PixelFormat out_pf, unsigned int width, unsigned int height); ++ int Convert(const Image* img, uint8_t* out_buffer, const size_t out_buffer_size, enum AVPixelFormat in_pf, enum AVPixelFormat out_pf, unsigned int width, unsigned int height); ++ int Convert(const uint8_t* in_buffer, const size_t in_buffer_size, uint8_t* out_buffer, const size_t out_buffer_size, enum AVPixelFormat in_pf, enum AVPixelFormat out_pf, unsigned int width, unsigned int height); + + protected: + bool gotdefaults; + struct SwsContext* swscale_ctx; + AVFrame* input_avframe; + AVFrame* output_avframe; +- enum PixelFormat default_input_pf; +- enum PixelFormat default_output_pf; ++ enum AVPixelFormat default_input_pf; ++ enum AVPixelFormat default_output_pf; + unsigned int default_width; + unsigned int default_height; + }; +--- zoneminder-1.28.1.orig/src/zm_ffmpeg_camera.cpp ++++ zoneminder-1.28.1/src/zm_ffmpeg_camera.cpp +@@ -56,13 +56,13 @@ FfmpegCamera::FfmpegCamera( int p_id, co + /* Has to be located inside the constructor so other components such as zma will receive correct colours and subpixel order */ + if(colours == ZM_COLOUR_RGB32) { + subpixelorder = ZM_SUBPIX_ORDER_RGBA; +- imagePixFormat = PIX_FMT_RGBA; ++ imagePixFormat = AV_PIX_FMT_RGBA; + } else if(colours == ZM_COLOUR_RGB24) { + subpixelorder = ZM_SUBPIX_ORDER_RGB; +- imagePixFormat = PIX_FMT_RGB24; ++ imagePixFormat = AV_PIX_FMT_RGB24; + } else if(colours == ZM_COLOUR_GRAY8) { + subpixelorder = ZM_SUBPIX_ORDER_NONE; +- imagePixFormat = PIX_FMT_GRAY8; ++ imagePixFormat = AV_PIX_FMT_GRAY8; + } else { + Panic("Unexpected colours: %d",colours); + } +@@ -182,7 +182,7 @@ int FfmpegCamera::Capture( Image &image + #if HAVE_LIBSWSCALE + if(mConvertContext == NULL) { + if(config.cpu_extensions && sseversion >= 20) { +- mConvertContext = sws_getContext( mCodecContext->width, mCodecContext->height, mCodecContext->pix_fmt, width, height, imagePixFormat, SWS_BICUBIC | SWS_CPU_CAPS_SSE2, NULL, NULL, NULL ); ++ mConvertContext = sws_getContext( mCodecContext->width, mCodecContext->height, mCodecContext->pix_fmt, width, height, imagePixFormat, SWS_BICUBIC, NULL, NULL, NULL ); + } else { + mConvertContext = sws_getContext( mCodecContext->width, mCodecContext->height, mCodecContext->pix_fmt, width, height, imagePixFormat, SWS_BICUBIC, NULL, NULL, NULL ); + } +@@ -320,10 +320,10 @@ int FfmpegCamera::OpenFfmpeg() { + Debug ( 1, "Opened codec" ); + + // Allocate space for the native video frame +- mRawFrame = avcodec_alloc_frame(); ++ mRawFrame = av_frame_alloc(); + + // Allocate space for the converted video frame +- mFrame = avcodec_alloc_frame(); ++ mFrame = av_frame_alloc(); + + if(mRawFrame == NULL || mFrame == NULL) + Fatal( "Unable to allocate frame for %s", mPath.c_str() ); +@@ -375,8 +375,8 @@ int FfmpegCamera::CloseFfmpeg(){ + + mCanCapture = false; + +- av_freep( &mFrame ); +- av_freep( &mRawFrame ); ++ av_frame_free( &mFrame ); ++ av_frame_free( &mRawFrame ); + + #if HAVE_LIBSWSCALE + if ( mConvertContext ) +--- zoneminder-1.28.1.orig/src/zm_ffmpeg_camera.h ++++ zoneminder-1.28.1/src/zm_ffmpeg_camera.h +@@ -46,7 +46,7 @@ protected: + AVCodec *mCodec; + AVFrame *mRawFrame; + AVFrame *mFrame; +- PixelFormat imagePixFormat; ++ AVPixelFormat imagePixFormat; + + int OpenFfmpeg(); + int ReopenFfmpeg(); +--- zoneminder-1.28.1.orig/src/zm_local_camera.cpp ++++ zoneminder-1.28.1/src/zm_local_camera.cpp +@@ -45,67 +45,67 @@ static int vidioctl( int fd, int request + } + + #if HAVE_LIBSWSCALE +-static PixelFormat getFfPixFormatFromV4lPalette( int v4l_version, int palette ) ++static AVPixelFormat getFfPixFormatFromV4lPalette( int v4l_version, int palette ) + { +- PixelFormat pixFormat = PIX_FMT_NONE; ++ AVPixelFormat pixFormat = AV_PIX_FMT_NONE; + + #if ZM_HAS_V4L2 + if ( v4l_version == 2 ) + { + switch( palette ) + { +-#if defined(V4L2_PIX_FMT_RGB444) && defined(PIX_FMT_RGB444) ++#if defined(V4L2_PIX_FMT_RGB444) && defined(AV_PIX_FMT_RGB444) + case V4L2_PIX_FMT_RGB444 : +- pixFormat = PIX_FMT_RGB444; ++ pixFormat = AV_PIX_FMT_RGB444; + break; + #endif // V4L2_PIX_FMT_RGB444 + case V4L2_PIX_FMT_RGB555 : +- pixFormat = PIX_FMT_RGB555; ++ pixFormat = AV_PIX_FMT_RGB555; + break; + case V4L2_PIX_FMT_RGB565 : +- pixFormat = PIX_FMT_RGB565; ++ pixFormat = AV_PIX_FMT_RGB565; + break; + case V4L2_PIX_FMT_BGR24 : +- pixFormat = PIX_FMT_BGR24; ++ pixFormat = AV_PIX_FMT_BGR24; + break; + case V4L2_PIX_FMT_RGB24 : +- pixFormat = PIX_FMT_RGB24; ++ pixFormat = AV_PIX_FMT_RGB24; + break; + case V4L2_PIX_FMT_BGR32 : +- pixFormat = PIX_FMT_BGRA; ++ pixFormat = AV_PIX_FMT_BGRA; + break; + case V4L2_PIX_FMT_RGB32 : +- pixFormat = PIX_FMT_ARGB; ++ pixFormat = AV_PIX_FMT_ARGB; + break; + case V4L2_PIX_FMT_GREY : +- pixFormat = PIX_FMT_GRAY8; ++ pixFormat = AV_PIX_FMT_GRAY8; + break; + case V4L2_PIX_FMT_YUYV : +- pixFormat = PIX_FMT_YUYV422; ++ pixFormat = AV_PIX_FMT_YUYV422; + break; + case V4L2_PIX_FMT_YUV422P : +- pixFormat = PIX_FMT_YUV422P; ++ pixFormat = AV_PIX_FMT_YUV422P; + break; + case V4L2_PIX_FMT_YUV411P : +- pixFormat = PIX_FMT_YUV411P; ++ pixFormat = AV_PIX_FMT_YUV411P; + break; + #ifdef V4L2_PIX_FMT_YUV444 + case V4L2_PIX_FMT_YUV444 : +- pixFormat = PIX_FMT_YUV444P; ++ pixFormat = AV_PIX_FMT_YUV444P; + break; + #endif // V4L2_PIX_FMT_YUV444 + case V4L2_PIX_FMT_YUV410 : +- pixFormat = PIX_FMT_YUV410P; ++ pixFormat = AV_PIX_FMT_YUV410P; + break; + case V4L2_PIX_FMT_YUV420 : +- pixFormat = PIX_FMT_YUV420P; ++ pixFormat = AV_PIX_FMT_YUV420P; + break; + case V4L2_PIX_FMT_JPEG : + case V4L2_PIX_FMT_MJPEG : +- pixFormat = PIX_FMT_YUVJ444P; ++ pixFormat = AV_PIX_FMT_YUVJ444P; + break; + case V4L2_PIX_FMT_UYVY : +- pixFormat = PIX_FMT_UYVY422; ++ pixFormat = AV_PIX_FMT_UYVY422; + break; + // These don't seem to have ffmpeg equivalents + // See if you can match any of the ones in the default clause below!? +@@ -147,32 +147,30 @@ static PixelFormat getFfPixFormatFromV4l + Fatal( "Can't find swscale format for palette %d", palette ); + break; + // These are all spare and may match some of the above +- pixFormat = PIX_FMT_YUVJ420P; +- pixFormat = PIX_FMT_YUVJ422P; +- pixFormat = PIX_FMT_XVMC_MPEG2_MC; +- pixFormat = PIX_FMT_XVMC_MPEG2_IDCT; +- pixFormat = PIX_FMT_UYVY422; +- pixFormat = PIX_FMT_UYYVYY411; +- pixFormat = PIX_FMT_BGR565; +- pixFormat = PIX_FMT_BGR555; +- pixFormat = PIX_FMT_BGR8; +- pixFormat = PIX_FMT_BGR4; +- pixFormat = PIX_FMT_BGR4_BYTE; +- pixFormat = PIX_FMT_RGB8; +- pixFormat = PIX_FMT_RGB4; +- pixFormat = PIX_FMT_RGB4_BYTE; +- pixFormat = PIX_FMT_NV12; +- pixFormat = PIX_FMT_NV21; +- pixFormat = PIX_FMT_RGB32_1; +- pixFormat = PIX_FMT_BGR32_1; +- pixFormat = PIX_FMT_GRAY16BE; +- pixFormat = PIX_FMT_GRAY16LE; +- pixFormat = PIX_FMT_YUV440P; +- pixFormat = PIX_FMT_YUVJ440P; +- pixFormat = PIX_FMT_YUVA420P; +- //pixFormat = PIX_FMT_VDPAU_H264; +- //pixFormat = PIX_FMT_VDPAU_MPEG1; +- //pixFormat = PIX_FMT_VDPAU_MPEG2; ++ pixFormat = AV_PIX_FMT_YUVJ420P; ++ pixFormat = AV_PIX_FMT_YUVJ422P; ++ pixFormat = AV_PIX_FMT_UYVY422; ++ pixFormat = AV_PIX_FMT_UYYVYY411; ++ pixFormat = AV_PIX_FMT_BGR565; ++ pixFormat = AV_PIX_FMT_BGR555; ++ pixFormat = AV_PIX_FMT_BGR8; ++ pixFormat = AV_PIX_FMT_BGR4; ++ pixFormat = AV_PIX_FMT_BGR4_BYTE; ++ pixFormat = AV_PIX_FMT_RGB8; ++ pixFormat = AV_PIX_FMT_RGB4; ++ pixFormat = AV_PIX_FMT_RGB4_BYTE; ++ pixFormat = AV_PIX_FMT_NV12; ++ pixFormat = AV_PIX_FMT_NV21; ++ pixFormat = AV_PIX_FMT_RGB32_1; ++ pixFormat = AV_PIX_FMT_BGR32_1; ++ pixFormat = AV_PIX_FMT_GRAY16BE; ++ pixFormat = AV_PIX_FMT_GRAY16LE; ++ pixFormat = AV_PIX_FMT_YUV440P; ++ pixFormat = AV_PIX_FMT_YUVJ440P; ++ pixFormat = AV_PIX_FMT_YUVA420P; ++ //pixFormat = AV_PIX_FMT_VDPAU_H264; ++ //pixFormat = AV_PIX_FMT_VDPAU_MPEG1; ++ //pixFormat = AV_PIX_FMT_VDPAU_MPEG2; + } + } + } +@@ -184,67 +182,65 @@ static PixelFormat getFfPixFormatFromV4l + { + case VIDEO_PALETTE_RGB32 : + if(BigEndian) +- pixFormat = PIX_FMT_ARGB; ++ pixFormat = AV_PIX_FMT_ARGB; + else +- pixFormat = PIX_FMT_BGRA; ++ pixFormat = AV_PIX_FMT_BGRA; + break; + case VIDEO_PALETTE_RGB24 : + if(BigEndian) +- pixFormat = PIX_FMT_RGB24; ++ pixFormat = AV_PIX_FMT_RGB24; + else +- pixFormat = PIX_FMT_BGR24; ++ pixFormat = AV_PIX_FMT_BGR24; + break; + case VIDEO_PALETTE_GREY : +- pixFormat = PIX_FMT_GRAY8; ++ pixFormat = AV_PIX_FMT_GRAY8; + break; + case VIDEO_PALETTE_RGB555 : +- pixFormat = PIX_FMT_RGB555; ++ pixFormat = AV_PIX_FMT_RGB555; + break; + case VIDEO_PALETTE_RGB565 : +- pixFormat = PIX_FMT_RGB565; ++ pixFormat = AV_PIX_FMT_RGB565; + break; + case VIDEO_PALETTE_YUYV : + case VIDEO_PALETTE_YUV422 : +- pixFormat = PIX_FMT_YUYV422; ++ pixFormat = AV_PIX_FMT_YUYV422; + break; + case VIDEO_PALETTE_YUV422P : +- pixFormat = PIX_FMT_YUV422P; ++ pixFormat = AV_PIX_FMT_YUV422P; + break; + case VIDEO_PALETTE_YUV420P : +- pixFormat = PIX_FMT_YUV420P; ++ pixFormat = AV_PIX_FMT_YUV420P; + break; + default : + { + Fatal( "Can't find swscale format for palette %d", palette ); + break; + // These are all spare and may match some of the above +- pixFormat = PIX_FMT_YUVJ420P; +- pixFormat = PIX_FMT_YUVJ422P; +- pixFormat = PIX_FMT_YUVJ444P; +- pixFormat = PIX_FMT_XVMC_MPEG2_MC; +- pixFormat = PIX_FMT_XVMC_MPEG2_IDCT; +- pixFormat = PIX_FMT_UYVY422; +- pixFormat = PIX_FMT_UYYVYY411; +- pixFormat = PIX_FMT_BGR565; +- pixFormat = PIX_FMT_BGR555; +- pixFormat = PIX_FMT_BGR8; +- pixFormat = PIX_FMT_BGR4; +- pixFormat = PIX_FMT_BGR4_BYTE; +- pixFormat = PIX_FMT_RGB8; +- pixFormat = PIX_FMT_RGB4; +- pixFormat = PIX_FMT_RGB4_BYTE; +- pixFormat = PIX_FMT_NV12; +- pixFormat = PIX_FMT_NV21; +- pixFormat = PIX_FMT_RGB32_1; +- pixFormat = PIX_FMT_BGR32_1; +- pixFormat = PIX_FMT_GRAY16BE; +- pixFormat = PIX_FMT_GRAY16LE; +- pixFormat = PIX_FMT_YUV440P; +- pixFormat = PIX_FMT_YUVJ440P; +- pixFormat = PIX_FMT_YUVA420P; +- //pixFormat = PIX_FMT_VDPAU_H264; +- //pixFormat = PIX_FMT_VDPAU_MPEG1; +- //pixFormat = PIX_FMT_VDPAU_MPEG2; ++ pixFormat = AV_PIX_FMT_YUVJ420P; ++ pixFormat = AV_PIX_FMT_YUVJ422P; ++ pixFormat = AV_PIX_FMT_YUVJ444P; ++ pixFormat = AV_PIX_FMT_UYVY422; ++ pixFormat = AV_PIX_FMT_UYYVYY411; ++ pixFormat = AV_PIX_FMT_BGR565; ++ pixFormat = AV_PIX_FMT_BGR555; ++ pixFormat = AV_PIX_FMT_BGR8; ++ pixFormat = AV_PIX_FMT_BGR4; ++ pixFormat = AV_PIX_FMT_BGR4_BYTE; ++ pixFormat = AV_PIX_FMT_RGB8; ++ pixFormat = AV_PIX_FMT_RGB4; ++ pixFormat = AV_PIX_FMT_RGB4_BYTE; ++ pixFormat = AV_PIX_FMT_NV12; ++ pixFormat = AV_PIX_FMT_NV21; ++ pixFormat = AV_PIX_FMT_RGB32_1; ++ pixFormat = AV_PIX_FMT_BGR32_1; ++ pixFormat = AV_PIX_FMT_GRAY16BE; ++ pixFormat = AV_PIX_FMT_GRAY16LE; ++ pixFormat = AV_PIX_FMT_YUV440P; ++ pixFormat = AV_PIX_FMT_YUVJ440P; ++ pixFormat = AV_PIX_FMT_YUVA420P; ++ //pixFormat = AV_PIX_FMT_VDPAU_H264; ++ //pixFormat = AV_PIX_FMT_VDPAU_MPEG1; ++ //pixFormat = AV_PIX_FMT_VDPAU_MPEG2; + } + } + } +@@ -369,7 +365,7 @@ LocalCamera::LocalCamera( int p_id, cons + #if HAVE_LIBSWSCALE + /* Get ffmpeg pixel format based on capture palette and endianness */ + capturePixFormat = getFfPixFormatFromV4lPalette( v4l_version, palette ); +- imagePixFormat = PIX_FMT_NONE; ++ imagePixFormat = AV_PIX_FMT_NONE; + #endif // HAVE_LIBSWSCALE + } + +@@ -412,13 +408,13 @@ LocalCamera::LocalCamera( int p_id, cons + Debug(2,"Using swscale for image conversion"); + if(colours == ZM_COLOUR_RGB32) { + subpixelorder = ZM_SUBPIX_ORDER_RGBA; +- imagePixFormat = PIX_FMT_RGBA; ++ imagePixFormat = AV_PIX_FMT_RGBA; + } else if(colours == ZM_COLOUR_RGB24) { + subpixelorder = ZM_SUBPIX_ORDER_RGB; +- imagePixFormat = PIX_FMT_RGB24; ++ imagePixFormat = AV_PIX_FMT_RGB24; + } else if(colours == ZM_COLOUR_GRAY8) { + subpixelorder = ZM_SUBPIX_ORDER_NONE; +- imagePixFormat = PIX_FMT_GRAY8; ++ imagePixFormat = AV_PIX_FMT_GRAY8; + } else { + Panic("Unexpected colours: %d",colours); + } +@@ -530,13 +526,13 @@ LocalCamera::LocalCamera( int p_id, cons + Debug(2,"Using swscale for image conversion"); + if(colours == ZM_COLOUR_RGB32) { + subpixelorder = ZM_SUBPIX_ORDER_RGBA; +- imagePixFormat = PIX_FMT_RGBA; ++ imagePixFormat = AV_PIX_FMT_RGBA; + } else if(colours == ZM_COLOUR_RGB24) { + subpixelorder = ZM_SUBPIX_ORDER_RGB; +- imagePixFormat = PIX_FMT_RGB24; ++ imagePixFormat = AV_PIX_FMT_RGB24; + } else if(colours == ZM_COLOUR_GRAY8) { + subpixelorder = ZM_SUBPIX_ORDER_NONE; +- imagePixFormat = PIX_FMT_GRAY8; ++ imagePixFormat = AV_PIX_FMT_GRAY8; + } else { + Panic("Unexpected colours: %d",colours); + } +@@ -611,7 +607,7 @@ LocalCamera::LocalCamera( int p_id, cons + #if HAVE_LIBSWSCALE + /* Initialize swscale stuff */ + if(capture && conversion_type == 1) { +- tmpPicture = avcodec_alloc_frame(); ++ tmpPicture = av_frame_alloc(); + if ( !tmpPicture ) + Fatal( "Could not allocate temporary picture" ); + +@@ -621,7 +617,7 @@ LocalCamera::LocalCamera( int p_id, cons + } + + if(config.cpu_extensions && sseversion >= 20) { +- imgConversionContext = sws_getContext(width, height, capturePixFormat, width, height, imagePixFormat, SWS_BICUBIC | SWS_CPU_CAPS_SSE2, NULL, NULL, NULL ); ++ imgConversionContext = sws_getContext(width, height, capturePixFormat, width, height, imagePixFormat, SWS_BICUBIC, NULL, NULL, NULL ); + } else { + imgConversionContext = sws_getContext(width, height, capturePixFormat, width, height, imagePixFormat, SWS_BICUBIC, NULL, NULL, NULL ); + } +@@ -644,7 +640,7 @@ LocalCamera::~LocalCamera() + sws_freeContext(imgConversionContext); + imgConversionContext = NULL; + +- av_free(tmpPicture); ++ av_frame_free(&tmpPicture); + tmpPicture = NULL; + } + #endif +@@ -841,7 +837,7 @@ void LocalCamera::Initialise() + Fatal( "Can't map video buffer %d (%d bytes) to memory: %s(%d)", i, vid_buf.length, strerror(errno), errno ); + + #if HAVE_LIBSWSCALE +- capturePictures[i] = avcodec_alloc_frame(); ++ capturePictures[i] = av_frame_alloc(); + if ( !capturePictures[i] ) + Fatal( "Could not allocate picture" ); + avpicture_fill( (AVPicture *)capturePictures[i], (uint8_t*)v4l2_data.buffers[i].start, capturePixFormat, v4l2_data.fmt.fmt.pix.width, v4l2_data.fmt.fmt.pix.height ); +@@ -995,7 +991,7 @@ void LocalCamera::Initialise() + v4l1_data.buffers[i].height = height; + v4l1_data.buffers[i].format = palette; + +- capturePictures[i] = avcodec_alloc_frame(); ++ capturePictures[i] = av_frame_alloc(); + if ( !capturePictures[i] ) + Fatal( "Could not allocate picture" ); + avpicture_fill( (AVPicture *)capturePictures[i], (unsigned char *)v4l1_data.bufptr+v4l1_data.frames.offsets[i], capturePixFormat, width, height ); +@@ -1066,7 +1062,7 @@ void LocalCamera::Terminate() + for ( unsigned int i = 0; i < v4l2_data.reqbufs.count; i++ ) { + #if HAVE_LIBSWSCALE + /* Free capture pictures */ +- av_free(capturePictures[i]); ++ av_frame_free(&capturePictures[i]); + capturePictures[i] = NULL; + #endif + if ( munmap( v4l2_data.buffers[i].start, v4l2_data.buffers[i].length ) < 0 ) +@@ -1084,7 +1080,7 @@ void LocalCamera::Terminate() + #if HAVE_LIBSWSCALE + for(int i=0; i < v4l1_data.frames.frames; i++) { + /* Free capture pictures */ +- av_free(capturePictures[i]); ++ av_frame_free(&capturePictures[i]); + capturePictures[i] = NULL; + } + #endif +--- zoneminder-1.28.1.orig/src/zm_local_camera.h ++++ zoneminder-1.28.1/src/zm_local_camera.h +@@ -104,8 +104,8 @@ protected: + + #if HAVE_LIBSWSCALE + static AVFrame **capturePictures; +- PixelFormat imagePixFormat; +- PixelFormat capturePixFormat; ++ AVPixelFormat imagePixFormat; ++ AVPixelFormat capturePixFormat; + struct SwsContext *imgConversionContext; + AVFrame *tmpPicture; + #endif // HAVE_LIBSWSCALE +--- zoneminder-1.28.1.orig/src/zm_mpeg.cpp ++++ zoneminder-1.28.1/src/zm_mpeg.cpp +@@ -131,10 +131,10 @@ void VideoStream::SetupCodec( int colour + { + if(subpixelorder == ZM_SUBPIX_ORDER_BGR) { + /* BGR subpixel order */ +- pf = PIX_FMT_BGR24; ++ pf = AV_PIX_FMT_BGR24; + } else { + /* Assume RGB subpixel order */ +- pf = PIX_FMT_RGB24; ++ pf = AV_PIX_FMT_RGB24; + } + break; + } +@@ -142,21 +142,21 @@ void VideoStream::SetupCodec( int colour + { + if(subpixelorder == ZM_SUBPIX_ORDER_ARGB) { + /* ARGB subpixel order */ +- pf = PIX_FMT_ARGB; ++ pf = AV_PIX_FMT_ARGB; + } else if(subpixelorder == ZM_SUBPIX_ORDER_ABGR) { + /* ABGR subpixel order */ +- pf = PIX_FMT_ABGR; ++ pf = AV_PIX_FMT_ABGR; + } else if(subpixelorder == ZM_SUBPIX_ORDER_BGRA) { + /* BGRA subpixel order */ +- pf = PIX_FMT_BGRA; ++ pf = AV_PIX_FMT_BGRA; + } else { + /* Assume RGBA subpixel order */ +- pf = PIX_FMT_RGBA; ++ pf = AV_PIX_FMT_RGBA; + } + break; + } + case ZM_COLOUR_GRAY8: +- pf = PIX_FMT_GRAY8; ++ pf = AV_PIX_FMT_GRAY8; + break; + default: + Panic("Unexpected colours: %d",colours); +@@ -234,7 +234,7 @@ void VideoStream::SetupCodec( int colour + c->codec_id = codec->id; + c->codec_type = codec->type; + +- c->pix_fmt = strcmp( "mjpeg", ofc->oformat->name ) == 0 ? PIX_FMT_YUVJ422P : PIX_FMT_YUV420P; ++ c->pix_fmt = strcmp( "mjpeg", ofc->oformat->name ) == 0 ? AV_PIX_FMT_YUVJ422P : AV_PIX_FMT_YUV420P; + if ( bitrate <= 100 ) + { + // Quality based bitrate control (VBR). Scale is 1..31 where 1 is best. +@@ -323,7 +323,7 @@ void VideoStream::OpenStream( ) + Debug( 1, "Opened codec" ); + + /* allocate the encoded raw picture */ +- opicture = avcodec_alloc_frame( ); ++ opicture = av_frame_alloc( ); + if ( !opicture ) + { + Panic( "Could not allocate opicture" ); +@@ -333,7 +333,7 @@ void VideoStream::OpenStream( ) + uint8_t *opicture_buf = (uint8_t *)av_malloc( size ); + if ( !opicture_buf ) + { +- av_free( opicture ); ++ av_frame_free( &opicture ); + Panic( "Could not allocate opicture_buf" ); + } + avpicture_fill( (AVPicture *)opicture, opicture_buf, c->pix_fmt, c->width, c->height ); +@@ -344,7 +344,7 @@ void VideoStream::OpenStream( ) + tmp_opicture = NULL; + if ( c->pix_fmt != pf ) + { +- tmp_opicture = avcodec_alloc_frame( ); ++ tmp_opicture = av_frame_alloc( ); + if ( !tmp_opicture ) + { + Panic( "Could not allocate tmp_opicture" ); +@@ -353,7 +353,7 @@ void VideoStream::OpenStream( ) + uint8_t *tmp_opicture_buf = (uint8_t *)av_malloc( size ); + if ( !tmp_opicture_buf ) + { +- av_free( tmp_opicture ); ++ av_frame_free( &tmp_opicture ); + Panic( "Could not allocate tmp_opicture_buf" ); + } + avpicture_fill( (AVPicture *)tmp_opicture, tmp_opicture_buf, pf, c->width, c->height ); +@@ -500,11 +500,11 @@ VideoStream::~VideoStream( ) + { + avcodec_close( ost->codec ); + av_free( opicture->data[0] ); +- av_free( opicture ); ++ av_frame_free( &opicture ); + if ( tmp_opicture ) + { + av_free( tmp_opicture->data[0] ); +- av_free( tmp_opicture ); ++ av_frame_free( &tmp_opicture ); + } + av_free( video_outbuf ); + } +--- zoneminder-1.28.1.orig/src/zm_mpeg.h ++++ zoneminder-1.28.1/src/zm_mpeg.h +@@ -42,7 +42,7 @@ protected: + const char *filename; + const char *format; + const char *codec_name; +- enum PixelFormat pf; ++ enum AVPixelFormat pf; + AVOutputFormat *of; + AVFormatContext *ofc; + AVStream *ost; +--- zoneminder-1.28.1.orig/src/zm_remote_camera_rtsp.cpp ++++ zoneminder-1.28.1/src/zm_remote_camera_rtsp.cpp +@@ -62,13 +62,13 @@ RemoteCameraRtsp::RemoteCameraRtsp( int + /* Has to be located inside the constructor so other components such as zma will receive correct colours and subpixel order */ + if(colours == ZM_COLOUR_RGB32) { + subpixelorder = ZM_SUBPIX_ORDER_RGBA; +- imagePixFormat = PIX_FMT_RGBA; ++ imagePixFormat = AV_PIX_FMT_RGBA; + } else if(colours == ZM_COLOUR_RGB24) { + subpixelorder = ZM_SUBPIX_ORDER_RGB; +- imagePixFormat = PIX_FMT_RGB24; ++ imagePixFormat = AV_PIX_FMT_RGB24; + } else if(colours == ZM_COLOUR_GRAY8) { + subpixelorder = ZM_SUBPIX_ORDER_NONE; +- imagePixFormat = PIX_FMT_GRAY8; ++ imagePixFormat = AV_PIX_FMT_GRAY8; + } else { + Panic("Unexpected colours: %d",colours); + } +@@ -77,8 +77,8 @@ RemoteCameraRtsp::RemoteCameraRtsp( int + + RemoteCameraRtsp::~RemoteCameraRtsp() + { +- av_freep( &mFrame ); +- av_freep( &mRawFrame ); ++ av_frame_free( &mFrame ); ++ av_frame_free( &mRawFrame ); + + #if HAVE_LIBSWSCALE + if ( mConvertContext ) +@@ -191,10 +191,10 @@ int RemoteCameraRtsp::PrimeCapture() + Panic( "Can't open codec" ); + + // Allocate space for the native video frame +- mRawFrame = avcodec_alloc_frame(); ++ mRawFrame = av_frame_alloc(); + + // Allocate space for the converted video frame +- mFrame = avcodec_alloc_frame(); ++ mFrame = av_frame_alloc(); + + if(mRawFrame == NULL || mFrame == NULL) + Fatal( "Unable to allocate frame(s)"); +@@ -320,7 +320,7 @@ int RemoteCameraRtsp::Capture( Image &im + #if HAVE_LIBSWSCALE + if(mConvertContext == NULL) { + if(config.cpu_extensions && sseversion >= 20) { +- mConvertContext = sws_getContext( mCodecContext->width, mCodecContext->height, mCodecContext->pix_fmt, width, height, imagePixFormat, SWS_BICUBIC | SWS_CPU_CAPS_SSE2, NULL, NULL, NULL ); ++ mConvertContext = sws_getContext( mCodecContext->width, mCodecContext->height, mCodecContext->pix_fmt, width, height, imagePixFormat, SWS_BICUBIC, NULL, NULL, NULL ); + } else { + mConvertContext = sws_getContext( mCodecContext->width, mCodecContext->height, mCodecContext->pix_fmt, width, height, imagePixFormat, SWS_BICUBIC, NULL, NULL, NULL ); + } +--- zoneminder-1.28.1.orig/src/zm_remote_camera_rtsp.h ++++ zoneminder-1.28.1/src/zm_remote_camera_rtsp.h +@@ -58,7 +58,7 @@ protected: + AVCodec *mCodec; + AVFrame *mRawFrame; + AVFrame *mFrame; +- PixelFormat imagePixFormat; ++ AVPixelFormat imagePixFormat; + #endif // HAVE_LIBAVFORMAT + + #if HAVE_LIBSWSCALE +--- zoneminder-1.28.1.orig/src/zm_sdp.cpp ++++ zoneminder-1.28.1/src/zm_sdp.cpp +@@ -404,7 +404,6 @@ AVFormatContext *SessionDescriptor::gene + if ( smStaticPayloads[i].payloadType == mediaDesc->getPayloadType() ) + { + Debug( 1, "Got static payload type %d, %s", smStaticPayloads[i].payloadType, smStaticPayloads[i].payloadName ); +- strncpy( stream->codec->codec_name, smStaticPayloads[i].payloadName, sizeof(stream->codec->codec_name) );; + stream->codec->codec_type = smStaticPayloads[i].codecType; + stream->codec->codec_id = smStaticPayloads[i].codecId; + stream->codec->sample_rate = smStaticPayloads[i].clockRate; +@@ -420,7 +419,6 @@ AVFormatContext *SessionDescriptor::gene + if ( smDynamicPayloads[i].payloadName == mediaDesc->getPayloadDesc() ) + { + Debug( 1, "Got dynamic payload type %d, %s", mediaDesc->getPayloadType(), smDynamicPayloads[i].payloadName ); +- strncpy( stream->codec->codec_name, smDynamicPayloads[i].payloadName, sizeof(stream->codec->codec_name) );; + stream->codec->codec_type = smDynamicPayloads[i].codecType; + stream->codec->codec_id = smDynamicPayloads[i].codecId; + stream->codec->sample_rate = mediaDesc->getClock(); +@@ -428,7 +426,7 @@ AVFormatContext *SessionDescriptor::gene + } + } + } +- if ( !stream->codec->codec_name[0] ) ++ if ( stream->codec->codec_id == AV_CODEC_ID_NONE ) + { + Warning( "Can't find payload details for %s payload type %d, name %s", mediaDesc->getType().c_str(), mediaDesc->getPayloadType(), mediaDesc->getPayloadDesc().c_str() ); + //return( 0 ); diff --git a/debian/patches/series b/debian/patches/series index 131fb9f..7770829 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -20,3 +20,4 @@ pod_zmupdate-to-pod2usage.patch respect-privacy.patch use_libjs-mootools.patch zmtrigger-plus.patch +ffmpeg_2.9.patch