Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 May 2018 18:30:14 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r468862 - in head/multimedia: zoneminder zoneminder-h264 zoneminder-h264/files zoneminder/files
Message-ID:  <201805021830.w42IUEaL003755@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Wed May  2 18:30:13 2018
New Revision: 468862
URL: https://svnweb.freebsd.org/changeset/ports/468862

Log:
  multimedia/zoneminder{,-h264}: unbreak with ffmpeg 4.0
  
  src/zm_mpeg.cpp:243:19: error: use of undeclared identifier 'CODEC_FLAG_QSCALE'
        c->flags |= CODEC_FLAG_QSCALE;
                    ^
  src/zm_mpeg.cpp:268:19: error: use of undeclared identifier 'CODEC_FLAG_GLOBAL_HEADER'
        c->flags |= CODEC_FLAG_GLOBAL_HEADER;
                    ^
  src/zm_mpeg.cpp:428:22: error: use of undeclared identifier 'AVFMT_RAWPICTURE'
    if ( !(of->flags & AVFMT_RAWPICTURE) )
                       ^
  src/zm_mpeg.cpp:675:20: error: use of undeclared identifier 'AVFMT_RAWPICTURE'
    if ( of->flags & AVFMT_RAWPICTURE )
                     ^
  src/zm_sdp.cpp:497:38: error: use of undeclared
        identifier 'FF_INPUT_BUFFER_PADDING_SIZE'
                       packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
                                       ^
  src/zm_videostore.cpp:116:31: error: use of undeclared identifier 'CODEC_FLAG_GLOBAL_HEADER'
      video_st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
                                ^
  src/zm_videostore.cpp:149:35: error: use of undeclared identifier 'CODEC_FLAG_GLOBAL_HEADER'
          audio_st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
                                    ^
  src/zm_videostore.cpp:286:74: error: use of undeclared identifier 'AVFMT_RAWPICTURE'
    if (video_st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (fmt->flags & AVFMT_RAWPICTURE)) {
                                                                           ^
  
  PR:		227726
  Reported by:	antoine (via exp-run)

Added:
  head/multimedia/zoneminder-h264/files/patch-ffmpeg4   (contents, props changed)
  head/multimedia/zoneminder/files/patch-ffmpeg4   (contents, props changed)
Modified:
  head/multimedia/zoneminder-h264/Makefile   (contents, props changed)
  head/multimedia/zoneminder/Makefile   (contents, props changed)

Modified: head/multimedia/zoneminder-h264/Makefile
==============================================================================
--- head/multimedia/zoneminder-h264/Makefile	Wed May  2 18:22:11 2018	(r468861)
+++ head/multimedia/zoneminder-h264/Makefile	Wed May  2 18:30:13 2018	(r468862)
@@ -10,7 +10,6 @@ COMMENT=	Complete security camera solution, fully web 
 
 LICENSE=	GPLv2
 
-BROKEN=		fails to build with ffmpeg 4.0
 CONFLICTS_INSTALL=	zoneminder
 
 ZM_DEPENDS=	p5-DBI>=0:databases/p5-DBI \

Added: head/multimedia/zoneminder-h264/files/patch-ffmpeg4
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/zoneminder-h264/files/patch-ffmpeg4	Wed May  2 18:30:13 2018	(r468862)
@@ -0,0 +1,122 @@
+Partially based on https://github.com/ZoneMinder/zoneminder/commit/e17bcb9178d0
+
+--- src/zm_mpeg.cpp.orig	2017-02-21 21:28:53 UTC
++++ src/zm_mpeg.cpp
+@@ -240,7 +240,11 @@ void VideoStream::SetupCodec( int colours, int subpixe
+     {
+       // Quality based bitrate control (VBR). Scale is 1..31 where 1 is best.
+       // This gets rid of artifacts in the beginning of the movie; and well, even quality.
++#if LIBAVCODEC_VERSION_CHECK(56, 35, 0, 64, 0)
++      c->flags |= AV_CODEC_FLAG_QSCALE;
++#else
+       c->flags |= CODEC_FLAG_QSCALE;
++#endif
+       c->global_quality = FF_QP2LAMBDA * (31 - (31 * (bitrate / 100.0)));
+     }
+     else
+@@ -265,7 +269,11 @@ void VideoStream::SetupCodec( int colours, int subpixe
+ 
+     // some formats want stream headers to be separate
+     if ( of->flags & AVFMT_GLOBALHEADER )
++#if LIBAVCODEC_VERSION_CHECK(56, 35, 0, 64, 0)
++      c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
++#else
+       c->flags |= CODEC_FLAG_GLOBAL_HEADER;
++#endif
+   }
+   else
+   {
+@@ -425,7 +433,9 @@ void VideoStream::OpenStream( )
+   }
+ 
+   video_outbuf = NULL;
++#if !LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0)
+   if ( !(of->flags & AVFMT_RAWPICTURE) )
++#endif
+   {
+     /* allocate output buffer */
+     /* XXX: API change will be done */
+@@ -672,6 +682,7 @@ double VideoStream::ActuallyEncodeFrame( const uint8_t
+   AVPacket *pkt = packet_buffers[packet_index];
+   av_init_packet( pkt );
+   int got_packet = 0;
++#if !LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0)
+   if ( of->flags & AVFMT_RAWPICTURE )
+   {
+ #if LIBAVCODEC_VERSION_CHECK(52, 30, 2, 30, 2)
+@@ -685,6 +696,7 @@ double VideoStream::ActuallyEncodeFrame( const uint8_t
+     got_packet = 1;
+   }
+   else
++#endif
+   {
+     opicture_ptr->pts = c->frame_number;
+     opicture_ptr->quality = c->global_quality;
+--- src/zm_sdp.cpp.orig	2017-02-21 21:28:53 UTC
++++ src/zm_sdp.cpp
+@@ -483,7 +483,11 @@ AVFormatContext *SessionDescriptor::generateFormatCont
+           uint8_t *dest = 
+           (uint8_t *)av_malloc(packet_size + sizeof(start_sequence) +
+                        stream->codec->extradata_size +
++#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0)
++                       AV_INPUT_BUFFER_PADDING_SIZE);
++#else
+                        FF_INPUT_BUFFER_PADDING_SIZE);
++#endif
+           if(dest) {
+               if(stream->codec->extradata_size) {
+                 // av_realloc?
+@@ -494,7 +498,11 @@ AVFormatContext *SessionDescriptor::generateFormatCont
+               memcpy(dest+stream->codec->extradata_size, start_sequence, sizeof(start_sequence));
+               memcpy(dest+stream->codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size);
+               memset(dest+stream->codec->extradata_size+sizeof(start_sequence)+
++#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0)
++                     packet_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
++#else
+                      packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
++#endif
+ 
+               stream->codec->extradata= dest;
+               stream->codec->extradata_size+= sizeof(start_sequence)+packet_size;
+--- src/zm_videostore.cpp.orig	2017-02-21 21:28:53 UTC
++++ src/zm_videostore.cpp
+@@ -113,7 +113,11 @@ VideoStore::VideoStore(const char *filename_in, const 
+ 
+   video_st->codec->codec_tag = 0;
+   if (oc->oformat->flags & AVFMT_GLOBALHEADER) {
++#if LIBAVCODEC_VERSION_CHECK(56, 35, 0, 64, 0)
++    video_st->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
++#else
+     video_st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
++#endif
+   }
+ 
+   if ( orientation ) {
+@@ -146,7 +150,11 @@ VideoStore::VideoStore(const char *filename_in, const 
+       }   
+       audio_st->codec->codec_tag = 0;
+       if (oc->oformat->flags & AVFMT_GLOBALHEADER) {
++#if LIBAVCODEC_VERSION_CHECK(56, 35, 0, 64, 0)
++        audio_st->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
++#else
+         audio_st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
++#endif
+       }
+     }
+   } else {
+@@ -283,6 +291,7 @@ int VideoStore::writeVideoFramePacket(AVPacket *ipkt, 
+ 
+   /*opkt.flags |= AV_PKT_FLAG_KEY;*/
+ 
++#if !LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0)
+   if (video_st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (fmt->flags & AVFMT_RAWPICTURE)) {
+     /* store AVPicture in AVPacket, as expected by the output format */
+     avpicture_fill(&pict, opkt.data, video_st->codec->pix_fmt, video_st->codec->width, video_st->codec->height);
+@@ -290,6 +299,7 @@ int VideoStore::writeVideoFramePacket(AVPacket *ipkt, 
+     opkt.size = sizeof(AVPicture);
+     opkt.flags |= AV_PKT_FLAG_KEY;
+   }
++#endif
+ 
+   memcpy(&safepkt, &opkt, sizeof(AVPacket));
+ 

Modified: head/multimedia/zoneminder/Makefile
==============================================================================
--- head/multimedia/zoneminder/Makefile	Wed May  2 18:22:11 2018	(r468861)
+++ head/multimedia/zoneminder/Makefile	Wed May  2 18:30:13 2018	(r468862)
@@ -10,7 +10,6 @@ COMMENT=	Complete security camera solution, fully web 
 
 LICENSE=	GPLv2
 
-BROKEN=		fails to build with ffmpeg 4.0
 CONFLICTS_INSTALL=	zoneminder-h264
 
 ZM_DEPENDS=	p5-DBI>=0:databases/p5-DBI \

Added: head/multimedia/zoneminder/files/patch-ffmpeg4
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/zoneminder/files/patch-ffmpeg4	Wed May  2 18:30:13 2018	(r468862)
@@ -0,0 +1,80 @@
+Partially based on https://github.com/ZoneMinder/zoneminder/commit/e17bcb9178d0
+
+--- src/zm_mpeg.cpp.orig	2017-05-09 14:54:48 UTC
++++ src/zm_mpeg.cpp
+@@ -240,7 +240,11 @@ void VideoStream::SetupCodec( int colours, int subpixe
+     {
+       // Quality based bitrate control (VBR). Scale is 1..31 where 1 is best.
+       // This gets rid of artifacts in the beginning of the movie; and well, even quality.
++#if LIBAVCODEC_VERSION_CHECK(56, 35, 0, 64, 0)
++      c->flags |= AV_CODEC_FLAG_QSCALE;
++#else
+       c->flags |= CODEC_FLAG_QSCALE;
++#endif
+       c->global_quality = FF_QP2LAMBDA * (31 - (31 * (bitrate / 100.0)));
+     }
+     else
+@@ -265,7 +269,11 @@ void VideoStream::SetupCodec( int colours, int subpixe
+ 
+     // some formats want stream headers to be separate
+     if ( of->flags & AVFMT_GLOBALHEADER )
++#if LIBAVCODEC_VERSION_CHECK(56, 35, 0, 64, 0)
++      c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
++#else
+       c->flags |= CODEC_FLAG_GLOBAL_HEADER;
++#endif
+   }
+   else
+   {
+@@ -425,7 +433,9 @@ void VideoStream::OpenStream( )
+   }
+ 
+   video_outbuf = NULL;
++#if !LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0)
+   if ( !(of->flags & AVFMT_RAWPICTURE) )
++#endif
+   {
+     /* allocate output buffer */
+     /* XXX: API change will be done */
+@@ -672,6 +682,7 @@ double VideoStream::ActuallyEncodeFrame( const uint8_t
+   AVPacket *pkt = packet_buffers[packet_index];
+   av_init_packet( pkt );
+   int got_packet = 0;
++#if !LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0)
+   if ( of->flags & AVFMT_RAWPICTURE )
+   {
+ #if LIBAVCODEC_VERSION_CHECK(52, 30, 2, 30, 2)
+@@ -685,6 +696,7 @@ double VideoStream::ActuallyEncodeFrame( const uint8_t
+     got_packet = 1;
+   }
+   else
++#endif
+   {
+     opicture_ptr->pts = c->frame_number;
+     opicture_ptr->quality = c->global_quality;
+--- src/zm_sdp.cpp.orig	2017-05-09 14:54:48 UTC
++++ src/zm_sdp.cpp
+@@ -483,7 +483,11 @@ AVFormatContext *SessionDescriptor::generateFormatCont
+           uint8_t *dest = 
+           (uint8_t *)av_malloc(packet_size + sizeof(start_sequence) +
+                        stream->codec->extradata_size +
++#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0)
++                       AV_INPUT_BUFFER_PADDING_SIZE);
++#else
+                        FF_INPUT_BUFFER_PADDING_SIZE);
++#endif
+           if(dest) {
+               if(stream->codec->extradata_size) {
+                 // av_realloc?
+@@ -494,7 +498,11 @@ AVFormatContext *SessionDescriptor::generateFormatCont
+               memcpy(dest+stream->codec->extradata_size, start_sequence, sizeof(start_sequence));
+               memcpy(dest+stream->codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size);
+               memset(dest+stream->codec->extradata_size+sizeof(start_sequence)+
++#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0)
++                     packet_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
++#else
+                      packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
++#endif
+ 
+               stream->codec->extradata= dest;
+               stream->codec->extradata_size+= sizeof(start_sequence)+packet_size;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805021830.w42IUEaL003755>