aboutsummaryrefslogtreecommitdiff
path: root/multimedia/zoneminder/files/patch-ffmpeg4
blob: 83e49595e0808c0b9343d04a682f26652ed5cad5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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;