Lines 1-169
Link Here
|
1 |
Description: Patch to build with FFmpeg 4.0 |
|
|
2 |
https://github.com/webcamoid/webcamoid/pull/119/ |
3 |
commits/52fbf8376085aded2d87397be58cda6e209d3bb7 |
4 |
Author: https://github.com/webcamoid/webcamoid/commits?author=jbeich |
5 |
Reviewed-By: Herbert Parentes Fortes Neto <hpfn@debian.org> |
6 |
Last-Update: 2018-07-21 |
7 |
Index: webcamoid/libAvKys/Plugins/MultiSink/src/ffmpeg/src/abstractstream.cpp |
8 |
=================================================================== |
9 |
--- webcamoid.orig/libAvKys/Plugins/MultiSink/src/ffmpeg/src/abstractstream.cpp |
10 |
+++ webcamoid/libAvKys/Plugins/MultiSink/src/ffmpeg/src/abstractstream.cpp |
11 |
@@ -62,7 +62,7 @@ AbstractStream::AbstractStream(const AVF |
12 |
|
13 |
// Some formats want stream headers to be separate. |
14 |
if (formatContext->oformat->flags & AVFMT_GLOBALHEADER) |
15 |
- this->m_codecContext->flags |= CODEC_FLAG_GLOBAL_HEADER; |
16 |
+ this->m_codecContext->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; |
17 |
|
18 |
this->m_codecContext->strict_std_compliance = CODEC_COMPLIANCE; |
19 |
|
20 |
Index: webcamoid/libAvKys/Plugins/MultiSink/src/ffmpeg/src/abstractstream.h |
21 |
=================================================================== |
22 |
--- webcamoid.orig/libAvKys/Plugins/MultiSink/src/ffmpeg/src/abstractstream.h |
23 |
+++ webcamoid/libAvKys/Plugins/MultiSink/src/ffmpeg/src/abstractstream.h |
24 |
@@ -29,6 +29,15 @@ extern "C" |
25 |
{ |
26 |
#include <libavformat/avformat.h> |
27 |
#include <libavcodec/avcodec.h> |
28 |
+ #ifndef AV_CODEC_CAP_EXPERIMENTAL |
29 |
+ #define AV_CODEC_CAP_EXPERIMENTAL CODEC_CAP_EXPERIMENTAL |
30 |
+ #endif |
31 |
+ #ifndef AV_CODEC_CAP_VARIABLE_FRAME_SIZE |
32 |
+ #define AV_CODEC_CAP_VARIABLE_FRAME_SIZE CODEC_CAP_VARIABLE_FRAME_SIZE |
33 |
+ #endif |
34 |
+ #ifndef AV_CODEC_FLAG_GLOBAL_HEADER |
35 |
+ #define AV_CODEC_FLAG_GLOBAL_HEADER CODEC_FLAG_GLOBAL_HEADER |
36 |
+ #endif |
37 |
} |
38 |
|
39 |
#define CODEC_COMPLIANCE FF_COMPLIANCE_VERY_STRICT |
40 |
Index: webcamoid/libAvKys/Plugins/MultiSink/src/ffmpeg/src/audiostream.cpp |
41 |
=================================================================== |
42 |
--- webcamoid.orig/libAvKys/Plugins/MultiSink/src/ffmpeg/src/audiostream.cpp |
43 |
+++ webcamoid/libAvKys/Plugins/MultiSink/src/ffmpeg/src/audiostream.cpp |
44 |
@@ -267,7 +267,7 @@ void AudioStream::convertPacket(const Ak |
45 |
this->deleteFrame(&this->m_frame); |
46 |
this->m_frame = oFrame; |
47 |
|
48 |
- if (codecContext->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE |
49 |
+ if (codecContext->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE |
50 |
|| oFrame->nb_samples >= codecContext->frame_size) { |
51 |
this->m_frameReady.wakeAll(); |
52 |
} |
53 |
@@ -280,7 +280,7 @@ int AudioStream::encodeData(AVFrame *fra |
54 |
auto codecContext = this->codecContext(); |
55 |
|
56 |
if (!frame |
57 |
- && codecContext->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE) |
58 |
+ && codecContext->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE) |
59 |
return AVERROR_EOF; |
60 |
|
61 |
if (frame) { |
62 |
@@ -366,7 +366,7 @@ AVFrame *AudioStream::dequeueFrame() |
63 |
this->m_frameMutex.lock(); |
64 |
|
65 |
if (!this->m_frame |
66 |
- || (!(codecContext->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE) |
67 |
+ || (!(codecContext->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE) |
68 |
&& this->m_frame->nb_samples < codecContext->frame_size)) { |
69 |
if (!this->m_frameReady.wait(&this->m_frameMutex, THREAD_WAIT_LIMIT)) { |
70 |
this->m_frameMutex.unlock(); |
71 |
@@ -377,7 +377,7 @@ AVFrame *AudioStream::dequeueFrame() |
72 |
|
73 |
AVFrame *oFrame = nullptr; |
74 |
|
75 |
- if (codecContext->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE |
76 |
+ if (codecContext->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE |
77 |
|| this->m_frame->nb_samples == codecContext->frame_size) { |
78 |
oFrame = this->m_frame; |
79 |
this->m_frame = nullptr; |
80 |
Index: webcamoid/libAvKys/Plugins/MultiSink/src/ffmpeg/src/videostream.cpp |
81 |
=================================================================== |
82 |
--- webcamoid.orig/libAvKys/Plugins/MultiSink/src/ffmpeg/src/videostream.cpp |
83 |
+++ webcamoid/libAvKys/Plugins/MultiSink/src/ffmpeg/src/videostream.cpp |
84 |
@@ -273,8 +273,10 @@ int VideoStream::encodeData(AVFrame *fra |
85 |
{ |
86 |
auto formatContext = this->formatContext(); |
87 |
|
88 |
+#ifdef AVFMT_RAWPICTURE |
89 |
if (!frame && formatContext->oformat->flags & AVFMT_RAWPICTURE) |
90 |
return AVERROR_EOF; |
91 |
+#endif |
92 |
|
93 |
auto codecContext = this->codecContext(); |
94 |
|
95 |
@@ -300,6 +302,7 @@ int VideoStream::encodeData(AVFrame *fra |
96 |
|
97 |
auto stream = this->stream(); |
98 |
|
99 |
+#ifdef AVFMT_RAWPICTURE |
100 |
if (formatContext->oformat->flags & AVFMT_RAWPICTURE) { |
101 |
// Raw video case - directly store the picture in the packet |
102 |
AVPacket pkt; |
103 |
@@ -315,6 +318,7 @@ int VideoStream::encodeData(AVFrame *fra |
104 |
|
105 |
return 0; |
106 |
} |
107 |
+#endif |
108 |
|
109 |
// encode the image |
110 |
#ifdef HAVE_SENDRECV |
111 |
Index: webcamoid/libAvKys/Plugins/MultiSrc/src/ffmpeg/src/abstractstream.cpp |
112 |
=================================================================== |
113 |
--- webcamoid.orig/libAvKys/Plugins/MultiSrc/src/ffmpeg/src/abstractstream.cpp |
114 |
+++ webcamoid/libAvKys/Plugins/MultiSrc/src/ffmpeg/src/abstractstream.cpp |
115 |
@@ -96,8 +96,10 @@ AbstractStream::AbstractStream(const AVF |
116 |
this->m_codecContext->idct_algo = FF_IDCT_AUTO; |
117 |
this->m_codecContext->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK; |
118 |
|
119 |
+#ifdef CODEC_FLAG_EMU_EDGE |
120 |
if (this->m_codec->capabilities & CODEC_CAP_DR1) |
121 |
this->m_codecContext->flags |= CODEC_FLAG_EMU_EDGE; |
122 |
+#endif |
123 |
|
124 |
av_dict_set(&this->m_codecOptions, "refcounted_frames", "0", 0); |
125 |
} |
126 |
Index: webcamoid/libAvKys/Plugins/VideoCapture/src/ffmpeg/src/convertvideoffmpeg.cpp |
127 |
=================================================================== |
128 |
--- webcamoid.orig/libAvKys/Plugins/VideoCapture/src/ffmpeg/src/convertvideoffmpeg.cpp |
129 |
+++ webcamoid/libAvKys/Plugins/VideoCapture/src/ffmpeg/src/convertvideoffmpeg.cpp |
130 |
@@ -19,6 +19,10 @@ |
131 |
|
132 |
#include <QMetaEnum> |
133 |
|
134 |
+#ifndef AV_CODEC_FLAG_TRUNCATED |
135 |
+#define AV_CODEC_FLAG_TRUNCATED CODEC_FLAG_TRUNCATED |
136 |
+#endif |
137 |
+ |
138 |
#include "convertvideoffmpeg.h" |
139 |
|
140 |
#define THREAD_WAIT_LIMIT 500 |
141 |
@@ -219,11 +223,13 @@ bool ConvertVideoFFmpeg::init(const AkCa |
142 |
if (!this->m_codecContext) |
143 |
return false; |
144 |
|
145 |
- if (codec->capabilities & CODEC_CAP_TRUNCATED) |
146 |
- this->m_codecContext->flags |= CODEC_FLAG_TRUNCATED; |
147 |
+ if (codec->capabilities & AV_CODEC_CAP_TRUNCATED) |
148 |
+ this->m_codecContext->flags |= AV_CODEC_FLAG_TRUNCATED; |
149 |
|
150 |
+#ifdef CODEC_FLAG_EMU_EDGE |
151 |
if (codec->capabilities & CODEC_CAP_DR1) |
152 |
this->m_codecContext->flags |= CODEC_FLAG_EMU_EDGE; |
153 |
+#endif |
154 |
|
155 |
this->m_codecContext->pix_fmt = rawToFF->value(fourcc, AV_PIX_FMT_NONE); |
156 |
this->m_codecContext->width = caps.property("width").toInt(); |
157 |
Index: webcamoid/libAvKys/Plugins/MultiSink/src/ffmpeg/src/mediawriterffmpeg.cpp |
158 |
=================================================================== |
159 |
--- webcamoid.orig/libAvKys/Plugins/MultiSink/src/ffmpeg/src/mediawriterffmpeg.cpp |
160 |
+++ webcamoid/libAvKys/Plugins/MultiSink/src/ffmpeg/src/mediawriterffmpeg.cpp |
161 |
@@ -251,7 +251,7 @@ class MediaWriterFFmpegGlobal |
162 |
AVCodec *codec = nullptr; |
163 |
|
164 |
while ((codec = av_codec_next(codec))) { |
165 |
- if (codec->capabilities & CODEC_CAP_EXPERIMENTAL |
166 |
+ if (codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL |
167 |
&& CODEC_COMPLIANCE > FF_COMPLIANCE_EXPERIMENTAL) |
168 |
continue; |
169 |
|