tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
opal: bump version and fix build for ZHF
Luca Bruno
11 years ago
34732ba2
af52345e
+787
-40
4 changed files
expand all
collapse all
unified
split
pkgs
development
libraries
opal
default.nix
disable-samples-ftbfs.diff
libav10.patch
libav9.patch
+22
-40
pkgs/development/libraries/opal/default.nix
···
1
1
-
x@{builderDefsPackage
2
2
-
, doxygen, pkgconfig, ptlib, srtp, libtheora, speex
3
3
-
, ffmpeg, x264, cyrus_sasl, openldap, openssl, expat, unixODBC
4
4
-
, ...}:
5
5
-
builderDefsPackage
6
6
-
(a :
7
7
-
let
8
8
-
helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++
9
9
-
[];
1
1
+
{ stdenv, fetchurl, pkgconfig, ptlib, srtp, libtheora, speex
2
2
+
, ffmpeg, x264, cyrus_sasl, openldap, openssl, expat, unixODBC }:
10
3
11
11
-
buildInputs = map (n: builtins.getAttr n x)
12
12
-
(builtins.attrNames (builtins.removeAttrs x helperArgNames));
13
13
-
sourceInfo = rec {
14
14
-
baseName="opal";
15
15
-
baseVersion="3.6";
16
16
-
patchlevel="8";
17
17
-
version="${baseVersion}.${patchlevel}";
18
18
-
name="${baseName}-${version}";
19
19
-
url="mirror://gnome/sources/${baseName}/${baseVersion}/${name}.tar.bz2";
20
20
-
hash="0359wqmrxqajd94sw3q2dn6n6y3caggavwdcmzyn6maw7srspgwc";
21
21
-
};
22
22
-
in
23
23
-
rec {
24
24
-
src = a.fetchurl {
25
25
-
url = sourceInfo.url;
26
26
-
sha256 = sourceInfo.hash;
4
4
+
stdenv.mkDerivation rec {
5
5
+
name = "opal-3.10.10";
6
6
+
7
7
+
src = fetchurl {
8
8
+
url = "mirror://gnome/sources/opal/3.10/${name}.tar.xz";
9
9
+
sha256 = "f208985003461b2743575eccac13ad890b3e5baac35b68ddef17162460aff864";
27
10
};
28
11
29
29
-
inherit (sourceInfo) name version;
30
30
-
inherit buildInputs;
12
12
+
buildInputs = [ pkgconfig ptlib srtp libtheora speex
13
13
+
ffmpeg x264 cyrus_sasl openldap openssl expat unixODBC ];
31
14
32
32
-
/* doConfigure should be removed if not needed */
33
33
-
phaseNames = ["setVars" "doConfigure" "doMakeInstall"];
34
34
-
configureFlags = [
35
35
-
"--enable-h323"
36
36
-
];
37
37
-
setVars = a.noDepEntry (''
38
38
-
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -D__STDC_CONSTANT_MACROS=1"
39
39
-
'');
15
15
+
configureFlags = [ "--enable-h323" ];
16
16
+
17
17
+
enableParallelBuilding = true;
18
18
+
19
19
+
NIX_CFLAGS = "-D__STDC_CONSTANT_MACROS=1";
20
20
+
21
21
+
patches = [ ./disable-samples-ftbfs.diff ./libav9.patch ./libav10.patch ];
40
22
41
41
-
meta = {
23
23
+
meta = with stdenv.lib; {
42
24
description = "OPAL VoIP library";
43
43
-
maintainers = [ a.lib.maintainers.raskin ];
44
44
-
platforms = a.lib.platforms.linux;
45
45
-
broken = true;
25
25
+
maintainers = [ maintainers.raskin ];
26
26
+
platforms = platforms.linux;
46
27
};
28
28
+
47
29
passthru = {
48
30
updateInfo = {
49
31
downloadPage = "http://ftp.gnome.org/pub/GNOME/sources/opal";
50
32
};
51
33
};
52
52
-
}) x
34
34
+
}
53
35
+14
pkgs/development/libraries/opal/disable-samples-ftbfs.diff
···
1
1
+
Index: opal-3.10.4~dfsg/Makefile.in
2
2
+
===================================================================
3
3
+
--- opal-3.10.4~dfsg.orig/Makefile.in 2012-02-22 10:08:36.000000000 +1100
4
4
+
+++ opal-3.10.4~dfsg/Makefile.in 2012-03-08 08:32:44.000000000 +1100
5
5
+
@@ -45,8 +45,7 @@
6
6
+
samples/codectest \
7
7
+
samples/callgen \
8
8
+
samples/opalecho \
9
9
+
- samples/faxopal \
10
10
+
- samples/c_api
11
11
+
+ samples/faxopal
12
12
+
ifeq ($(OPAL_IVR),yes)
13
13
+
SUBDIRS += samples/opalmcu \
14
14
+
samples/ivropal \
+208
pkgs/development/libraries/opal/libav10.patch
···
1
1
+
Description: Fix compilation against libav10
2
2
+
Author: Reinhard Tartler <siretart@tauware.de>
3
3
+
Bug-Debian: http://bugs.debian.org/739439
4
4
+
5
5
+
--- a/plugins/video/H.263-1998/h263-1998.cxx
6
6
+
+++ b/plugins/video/H.263-1998/h263-1998.cxx
7
7
+
@@ -94,7 +94,7 @@ static struct StdSizes {
8
8
+
{ CIF16_WIDTH, CIF16_HEIGHT, PLUGINCODEC_CIF16_MPI },
9
9
+
};
10
10
+
11
11
+
-static FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_H263P);
12
12
+
+static FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_H263P);
13
13
+
14
14
+
15
15
+
/////////////////////////////////////////////////////////////////////////////
16
16
+
@@ -203,7 +203,7 @@ H263_Base_EncoderContext::~H263_Base_Enc
17
17
+
PTRACE(4, m_prefix, "Encoder closed");
18
18
+
}
19
19
+
20
20
+
-bool H263_Base_EncoderContext::Init(CodecID codecId)
21
21
+
+bool H263_Base_EncoderContext::Init(AVCodecID codecId)
22
22
+
{
23
23
+
PTRACE(5, m_prefix, "Opening encoder");
24
24
+
25
25
+
@@ -589,7 +589,7 @@ void H263_RFC2190_EncoderContext::RTPCal
26
26
+
27
27
+
bool H263_RFC2190_EncoderContext::Init()
28
28
+
{
29
29
+
- if (!H263_Base_EncoderContext::Init(CODEC_ID_H263))
30
30
+
+ if (!H263_Base_EncoderContext::Init(AV_CODEC_ID_H263))
31
31
+
return false;
32
32
+
33
33
+
#if LIBAVCODEC_RTP_MODE
34
34
+
@@ -632,7 +632,7 @@ H263_RFC2429_EncoderContext::~H263_RFC24
35
35
+
36
36
+
bool H263_RFC2429_EncoderContext::Init()
37
37
+
{
38
38
+
- return H263_Base_EncoderContext::Init(CODEC_ID_H263P);
39
39
+
+ return H263_Base_EncoderContext::Init(AV_CODEC_ID_H263P);
40
40
+
}
41
41
+
42
42
+
43
43
+
@@ -656,7 +656,7 @@ H263_Base_DecoderContext::H263_Base_Deco
44
44
+
if (!FFMPEGLibraryInstance.Load())
45
45
+
return;
46
46
+
47
47
+
- if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_H263)) == NULL) {
48
48
+
+ if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(AV_CODEC_ID_H263)) == NULL) {
49
49
+
PTRACE(1, m_prefix, "Codec not found for decoder");
50
50
+
return;
51
51
+
}
52
52
+
--- a/plugins/video/H.264/h264-x264.cxx
53
53
+
+++ b/plugins/video/H.264/h264-x264.cxx
54
54
+
@@ -105,7 +105,7 @@ static struct PluginCodec_information Li
55
55
+
56
56
+
///////////////////////////////////////////////////////////////////////////////
57
57
+
58
58
+
-FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_H264);
59
59
+
+FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_H264);
60
60
+
61
61
+
PLUGINCODEC_CONTROL_LOG_FUNCTION_DEF
62
62
+
63
63
+
@@ -1065,17 +1065,17 @@ class MyDecoder : public PluginCodec<MY_
64
64
+
allows you to fail the create operation (return false), which cannot
65
65
+
be done in the normal C++ constructor. */
66
66
+
67
67
+
- if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_H264)) == NULL)
68
68
+
+ if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(AV_CODEC_ID_H264)) == NULL)
69
69
+
return false;
70
70
+
71
71
+
if ((m_context = FFMPEGLibraryInstance.AvcodecAllocContext(m_codec)) == NULL)
72
72
+
return false;
73
73
+
74
74
+
m_context->workaround_bugs = FF_BUG_AUTODETECT;
75
75
+
- m_context->idct_algo = FF_IDCT_H264;
76
76
+
+ m_context->idct_algo = FF_IDCT_AUTO;
77
77
+
m_context->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK;
78
78
+
m_context->flags = CODEC_FLAG_INPUT_PRESERVED | CODEC_FLAG_EMU_EDGE;
79
79
+
- m_context->flags2 = CODEC_FLAG2_SKIP_RD |
80
80
+
+ m_context->flags2 =
81
81
+
#ifdef CODEC_FLAG2_DROP_FRAME_TIMECODE
82
82
+
CODEC_FLAG2_DROP_FRAME_TIMECODE |
83
83
+
#endif
84
84
+
--- a/plugins/video/MPEG4-ffmpeg/mpeg4.cxx
85
85
+
+++ b/plugins/video/MPEG4-ffmpeg/mpeg4.cxx
86
86
+
@@ -205,7 +205,7 @@ const static struct mpeg4_resolution {
87
87
+
{ 0 }
88
88
+
};
89
89
+
90
90
+
-FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_MPEG4);
91
91
+
+FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_MPEG4);
92
92
+
93
93
+
94
94
+
static bool mpeg4IsIframe (BYTE * frameBuffer, unsigned int frameLen )
95
95
+
@@ -688,7 +688,7 @@ void MPEG4EncoderContext::ResizeEncoding
96
96
+
97
97
+
bool MPEG4EncoderContext::OpenCodec()
98
98
+
{
99
99
+
- if((m_avcodec = FFMPEGLibraryInstance.AvcodecFindEncoder(CODEC_ID_MPEG4)) == NULL){
100
100
+
+ if((m_avcodec = FFMPEGLibraryInstance.AvcodecFindEncoder(AV_CODEC_ID_MPEG4)) == NULL){
101
101
+
PTRACE(1, "MPEG4", "Encoder not found");
102
102
+
return false;
103
103
+
}
104
104
+
@@ -1390,7 +1390,7 @@ void MPEG4DecoderContext::ResizeDecoding
105
105
+
106
106
+
bool MPEG4DecoderContext::OpenCodec()
107
107
+
{
108
108
+
- if ((m_avcodec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_MPEG4)) == NULL) {
109
109
+
+ if ((m_avcodec = FFMPEGLibraryInstance.AvcodecFindDecoder(AV_CODEC_ID_MPEG4)) == NULL) {
110
110
+
PTRACE(1, "MPEG4", "Decoder not found for encoder");
111
111
+
return false;
112
112
+
}
113
113
+
--- a/plugins/video/H.263-1998/h263-1998.h
114
114
+
+++ b/plugins/video/H.263-1998/h263-1998.h
115
115
+
@@ -115,7 +115,7 @@ class H263_Base_EncoderContext
116
116
+
virtual ~H263_Base_EncoderContext();
117
117
+
118
118
+
virtual bool Init() = 0;
119
119
+
- virtual bool Init(CodecID codecId);
120
120
+
+ virtual bool Init(AVCodecID codecId);
121
121
+
122
122
+
virtual bool SetOptions(const char * const * options);
123
123
+
virtual void SetOption(const char * option, const char * value);
124
124
+
--- a/plugins/video/common/dyna.cxx
125
125
+
+++ b/plugins/video/common/dyna.cxx
126
126
+
@@ -217,14 +217,14 @@ static void logCallbackFFMPEG(void * avc
127
127
+
#endif
128
128
+
129
129
+
130
130
+
-FFMPEGLibrary::FFMPEGLibrary(CodecID codec)
131
131
+
+FFMPEGLibrary::FFMPEGLibrary(AVCodecID codec)
132
132
+
{
133
133
+
m_codec = codec;
134
134
+
- if (m_codec==CODEC_ID_H264)
135
135
+
+ if (m_codec==AV_CODEC_ID_H264)
136
136
+
snprintf( m_codecString, sizeof(m_codecString), "H264");
137
137
+
- if (m_codec==CODEC_ID_H263P)
138
138
+
+ if (m_codec==AV_CODEC_ID_H263P)
139
139
+
snprintf( m_codecString, sizeof(m_codecString), "H263+");
140
140
+
- if (m_codec==CODEC_ID_MPEG4)
141
141
+
+ if (m_codec==AV_CODEC_ID_MPEG4)
142
142
+
snprintf( m_codecString, sizeof(m_codecString), "MPEG4");
143
143
+
m_isLoadedOK = false;
144
144
+
}
145
145
+
@@ -268,12 +268,12 @@ bool FFMPEGLibrary::Load()
146
146
+
return true;
147
147
+
}
148
148
+
149
149
+
-AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum CodecID id)
150
150
+
+AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum AVCodecID id)
151
151
+
{
152
152
+
return avcodec_find_encoder(id);
153
153
+
}
154
154
+
155
155
+
-AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum CodecID id)
156
156
+
+AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum AVCodecID id)
157
157
+
{
158
158
+
WaitAndSignal m(processLock);
159
159
+
160
160
+
@@ -308,13 +308,18 @@ int FFMPEGLibrary::AvcodecClose(AVCodecC
161
161
+
return avcodec_close(ctx);
162
162
+
}
163
163
+
164
164
+
+#undef FFMAX
165
165
+
+#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
166
166
+
int FFMPEGLibrary::AvcodecEncodeVideo(AVCodecContext *ctx, BYTE *buf, int buf_size, const AVFrame *pict)
167
167
+
{
168
168
+
+ AVPacket pkt = { 0 };
169
169
+
+ int ret, got_output;
170
170
+
int res;
171
171
+
172
172
+
- res = avcodec_encode_video(ctx, buf, buf_size, pict);
173
173
+
+ ret = avcodec_encode_video2(ctx, &pkt, pict, &got_output);
174
174
+
175
175
+
- PTRACE(6, m_codecString, "DYNA\tEncoded into " << res << " bytes, max " << buf_size);
176
176
+
+ PTRACE(6, m_codecString, "DYNA\tEncoded into " << ret << " bytes, max " << buf_size);
177
177
+
+ memcpy(buf, pkt.data, FFMAX(pkt.size, buf_size));
178
178
+
return res;
179
179
+
}
180
180
+
181
181
+
--- a/plugins/video/common/dyna.h
182
182
+
+++ b/plugins/video/common/dyna.h
183
183
+
@@ -88,13 +88,13 @@ class DynaLink
184
184
+
class FFMPEGLibrary
185
185
+
{
186
186
+
public:
187
187
+
- FFMPEGLibrary(CodecID codec);
188
188
+
+ FFMPEGLibrary(AVCodecID codec);
189
189
+
~FFMPEGLibrary();
190
190
+
191
191
+
bool Load();
192
192
+
193
193
+
- AVCodec *AvcodecFindEncoder(enum CodecID id);
194
194
+
- AVCodec *AvcodecFindDecoder(enum CodecID id);
195
195
+
+ AVCodec *AvcodecFindEncoder(enum AVCodecID id);
196
196
+
+ AVCodec *AvcodecFindDecoder(enum AVCodecID id);
197
197
+
AVCodecContext *AvcodecAllocContext(AVCodec*);
198
198
+
AVFrame *AvcodecAllocFrame(void);
199
199
+
int AvcodecOpen(AVCodecContext *ctx, AVCodec *codec);
200
200
+
@@ -117,7 +117,7 @@ class FFMPEGLibrary
201
201
+
DynaLink m_libAvcodec;
202
202
+
DynaLink m_libAvutil;
203
203
+
204
204
+
- CodecID m_codec;
205
205
+
+ AVCodecID m_codec;
206
206
+
char m_codecString[32];
207
207
+
208
208
+
bool m_isLoadedOK;
+543
pkgs/development/libraries/opal/libav9.patch
···
1
1
+
Description: Backport changes for the libav 9 API
2
2
+
Also replace loading of libavcodec and libavutil via dlopen by linking against
3
3
+
it.
4
4
+
Author: Sebastian Ramacher <sramacher@debian.org>
5
5
+
Bug-Debian: http://bugs.debian.org/720824
6
6
+
Last-Update: 2013-09-12
7
7
+
8
8
+
--- a/plugins/video/H.263-1998/h263-1998.cxx
9
9
+
+++ b/plugins/video/H.263-1998/h263-1998.cxx
10
10
+
@@ -216,7 +216,7 @@
11
11
+
return false;
12
12
+
}
13
13
+
14
14
+
- m_context = FFMPEGLibraryInstance.AvcodecAllocContext();
15
15
+
+ m_context = FFMPEGLibraryInstance.AvcodecAllocContext(m_codec);
16
16
+
if (m_context == NULL) {
17
17
+
PTRACE(1, m_prefix, "Failed to allocate context for encoder");
18
18
+
return false;
19
19
+
@@ -312,6 +312,7 @@
20
20
+
return;
21
21
+
}
22
22
+
23
23
+
+#ifdef CODEC_FLAG_H263P_UMV
24
24
+
if (STRCMPI(option, H263_ANNEX_D) == 0) {
25
25
+
// Annex D: Unrestructed Motion Vectors
26
26
+
// Level 2+
27
27
+
@@ -322,6 +323,7 @@
28
28
+
m_context->flags &= ~CODEC_FLAG_H263P_UMV;
29
29
+
return;
30
30
+
}
31
31
+
+#endif
32
32
+
33
33
+
#if 0 // DO NOT ENABLE THIS FLAG. FFMPEG IS NOT THREAD_SAFE WHEN THIS FLAG IS SET
34
34
+
if (STRCMPI(option, H263_ANNEX_F) == 0) {
35
35
+
@@ -356,6 +358,7 @@
36
36
+
return;
37
37
+
}
38
38
+
39
39
+
+#ifdef CODEC_FLAG_H263P_SLICE_STRUCT
40
40
+
if (STRCMPI(option, H263_ANNEX_K) == 0) {
41
41
+
// Annex K: Slice Structure
42
42
+
// does not work with eyeBeam
43
43
+
@@ -365,7 +368,9 @@
44
44
+
m_context->flags &= ~CODEC_FLAG_H263P_SLICE_STRUCT;
45
45
+
return;
46
46
+
}
47
47
+
+#endif
48
48
+
49
49
+
+#ifdef CODEC_FLAG_H263P_AIV
50
50
+
if (STRCMPI(option, H263_ANNEX_S) == 0) {
51
51
+
// Annex S: Alternative INTER VLC mode
52
52
+
// does not work with eyeBeam
53
53
+
@@ -375,6 +380,7 @@
54
54
+
m_context->flags &= ~CODEC_FLAG_H263P_AIV;
55
55
+
return;
56
56
+
}
57
57
+
+#endif
58
58
+
59
59
+
if (STRCMPI(option, PLUGINCODEC_MEDIA_PACKETIZATION) == 0 ||
60
60
+
STRCMPI(option, PLUGINCODEC_MEDIA_PACKETIZATIONS) == 0) {
61
61
+
@@ -450,15 +456,6 @@
62
62
+
PTRACE(5, m_prefix, "qmax set to " << m_context->qmax);
63
63
+
PTRACE(5, m_prefix, "payload size set to " << m_context->rtp_payload_size);
64
64
+
65
65
+
- #define CODEC_TRACER_FLAG(tracer, flag) \
66
66
+
- PTRACE(4, m_prefix, #flag " is " << ((m_context->flags & flag) ? "enabled" : "disabled"));
67
67
+
- CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_UMV);
68
68
+
- CODEC_TRACER_FLAG(tracer, CODEC_FLAG_OBMC);
69
69
+
- CODEC_TRACER_FLAG(tracer, CODEC_FLAG_AC_PRED);
70
70
+
- CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_SLICE_STRUCT)
71
71
+
- CODEC_TRACER_FLAG(tracer, CODEC_FLAG_LOOP_FILTER);
72
72
+
- CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_AIV);
73
73
+
-
74
74
+
return FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec) == 0;
75
75
+
}
76
76
+
77
77
+
@@ -521,7 +518,7 @@
78
78
+
79
79
+
// Need to copy to local buffer to guarantee 16 byte alignment
80
80
+
memcpy(m_inputFrame->data[0], OPAL_VIDEO_FRAME_DATA_PTR(header), header->width*header->height*3/2);
81
81
+
- m_inputFrame->pict_type = (flags & PluginCodec_CoderForceIFrame) ? FF_I_TYPE : AV_PICTURE_TYPE_NONE;
82
82
+
+ m_inputFrame->pict_type = (flags & PluginCodec_CoderForceIFrame) ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_NONE;
83
83
+
84
84
+
/*
85
85
+
m_inputFrame->pts = (int64_t)srcRTP.GetTimestamp()*m_context->time_base.den/m_context->time_base.num/VIDEO_CLOCKRATE;
86
86
+
@@ -603,13 +600,19 @@
87
87
+
m_context->rtp_callback = &H263_RFC2190_EncoderContext::RTPCallBack;
88
88
+
m_context->opaque = this; // used to separate out packets from different encode threads
89
89
+
90
90
+
+#ifdef CODEC_FLAG_H263P_UMV
91
91
+
m_context->flags &= ~CODEC_FLAG_H263P_UMV;
92
92
+
+#endif
93
93
+
m_context->flags &= ~CODEC_FLAG_4MV;
94
94
+
#if LIBAVCODEC_RTP_MODE
95
95
+
m_context->flags &= ~CODEC_FLAG_H263P_AIC;
96
96
+
#endif
97
97
+
+#ifdef CODEC_FLAG_H263P_AIV
98
98
+
m_context->flags &= ~CODEC_FLAG_H263P_AIV;
99
99
+
+#endif
100
100
+
+#ifdef CODEC_FLAG_H263P_SLICE_STRUCT
101
101
+
m_context->flags &= ~CODEC_FLAG_H263P_SLICE_STRUCT;
102
102
+
+#endif
103
103
+
104
104
+
return true;
105
105
+
}
106
106
+
@@ -658,7 +661,7 @@
107
107
+
return;
108
108
+
}
109
109
+
110
110
+
- m_context = FFMPEGLibraryInstance.AvcodecAllocContext();
111
111
+
+ m_context = FFMPEGLibraryInstance.AvcodecAllocContext(m_codec);
112
112
+
if (m_context == NULL) {
113
113
+
PTRACE(1, m_prefix, "Failed to allocate context for decoder");
114
114
+
return;
115
115
+
--- a/plugins/video/H.264/h264-x264.cxx
116
116
+
+++ b/plugins/video/H.264/h264-x264.cxx
117
117
+
@@ -48,6 +48,7 @@
118
118
+
#include "shared/h264frame.h"
119
119
+
#include "shared/x264wrap.h"
120
120
+
121
121
+
+#include <cstdio>
122
122
+
123
123
+
#define MY_CODEC x264 // Name of codec (use C variable characters)
124
124
+
#define MY_CODEC_LOG "x264"
125
125
+
@@ -1067,18 +1068,17 @@
126
126
+
if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_H264)) == NULL)
127
127
+
return false;
128
128
+
129
129
+
- if ((m_context = FFMPEGLibraryInstance.AvcodecAllocContext()) == NULL)
130
130
+
+ if ((m_context = FFMPEGLibraryInstance.AvcodecAllocContext(m_codec)) == NULL)
131
131
+
return false;
132
132
+
133
133
+
m_context->workaround_bugs = FF_BUG_AUTODETECT;
134
134
+
- m_context->error_recognition = FF_ER_AGGRESSIVE;
135
135
+
m_context->idct_algo = FF_IDCT_H264;
136
136
+
m_context->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK;
137
137
+
m_context->flags = CODEC_FLAG_INPUT_PRESERVED | CODEC_FLAG_EMU_EDGE;
138
138
+
- m_context->flags2 = CODEC_FLAG2_BRDO |
139
139
+
- CODEC_FLAG2_MEMC_ONLY |
140
140
+
+ m_context->flags2 = CODEC_FLAG2_SKIP_RD |
141
141
+
+#ifdef CODEC_FLAG2_DROP_FRAME_TIMECODE
142
142
+
CODEC_FLAG2_DROP_FRAME_TIMECODE |
143
143
+
- CODEC_FLAG2_SKIP_RD |
144
144
+
+#endif
145
145
+
CODEC_FLAG2_CHUNKS;
146
146
+
147
147
+
if ((m_picture = FFMPEGLibraryInstance.AvcodecAllocFrame()) == NULL)
148
148
+
--- a/plugins/video/MPEG4-ffmpeg/mpeg4.cxx
149
149
+
+++ b/plugins/video/MPEG4-ffmpeg/mpeg4.cxx
150
150
+
@@ -589,17 +589,14 @@
151
151
+
m_avpicture->quality = m_videoQMin;
152
152
+
153
153
+
#ifdef USE_ORIG
154
154
+
- m_avcontext->flags |= CODEC_FLAG_PART; // data partitioning
155
155
+
m_avcontext->flags |= CODEC_FLAG_4MV; // 4 motion vectors
156
156
+
#else
157
157
+
m_avcontext->max_b_frames=0; /*don't use b frames*/
158
158
+
m_avcontext->flags|=CODEC_FLAG_AC_PRED;
159
159
+
- m_avcontext->flags|=CODEC_FLAG_H263P_UMV;
160
160
+
/*c->flags|=CODEC_FLAG_QPEL;*/ /*don't enable this one: this forces profile_level to advanced simple profile */
161
161
+
m_avcontext->flags|=CODEC_FLAG_4MV;
162
162
+
m_avcontext->flags|=CODEC_FLAG_GMC;
163
163
+
m_avcontext->flags|=CODEC_FLAG_LOOP_FILTER;
164
164
+
- m_avcontext->flags|=CODEC_FLAG_H263P_SLICE_STRUCT;
165
165
+
#endif
166
166
+
m_avcontext->opaque = this; // for use in RTP callback
167
167
+
}
168
168
+
@@ -691,7 +688,12 @@
169
169
+
170
170
+
bool MPEG4EncoderContext::OpenCodec()
171
171
+
{
172
172
+
- m_avcontext = FFMPEGLibraryInstance.AvcodecAllocContext();
173
173
+
+ if((m_avcodec = FFMPEGLibraryInstance.AvcodecFindEncoder(CODEC_ID_MPEG4)) == NULL){
174
174
+
+ PTRACE(1, "MPEG4", "Encoder not found");
175
175
+
+ return false;
176
176
+
+ }
177
177
+
+
178
178
+
+ m_avcontext = FFMPEGLibraryInstance.AvcodecAllocContext(m_avcodec);
179
179
+
if (m_avcontext == NULL) {
180
180
+
PTRACE(1, "MPEG4", "Encoder failed to allocate context for encoder");
181
181
+
return false;
182
182
+
@@ -703,11 +705,6 @@
183
183
+
return false;
184
184
+
}
185
185
+
186
186
+
- if((m_avcodec = FFMPEGLibraryInstance.AvcodecFindEncoder(CODEC_ID_MPEG4)) == NULL){
187
187
+
- PTRACE(1, "MPEG4", "Encoder not found");
188
188
+
- return false;
189
189
+
- }
190
190
+
-
191
191
+
#if PLUGINCODEC_TRACING
192
192
+
// debugging flags
193
193
+
if (PTRACE_CHECK(4)) {
194
194
+
@@ -804,7 +801,7 @@
195
195
+
// Should the next frame be an I-Frame?
196
196
+
if ((flags & PluginCodec_CoderForceIFrame) || (m_frameNum == 0))
197
197
+
{
198
198
+
- m_avpicture->pict_type = FF_I_TYPE;
199
199
+
+ m_avpicture->pict_type = AV_PICTURE_TYPE_I;
200
200
+
}
201
201
+
else // No IFrame requested, let avcodec decide what to do
202
202
+
{
203
203
+
@@ -1325,7 +1322,6 @@
204
204
+
205
205
+
void MPEG4DecoderContext::SetStaticDecodingParams() {
206
206
+
m_avcontext->flags |= CODEC_FLAG_4MV;
207
207
+
- m_avcontext->flags |= CODEC_FLAG_PART;
208
208
+
m_avcontext->workaround_bugs = 0; // no workaround for buggy implementations
209
209
+
}
210
210
+
211
211
+
@@ -1399,7 +1395,7 @@
212
212
+
return false;
213
213
+
}
214
214
+
215
215
+
- m_avcontext = FFMPEGLibraryInstance.AvcodecAllocContext();
216
216
+
+ m_avcontext = FFMPEGLibraryInstance.AvcodecAllocContext(m_avcodec);
217
217
+
if (m_avcontext == NULL) {
218
218
+
PTRACE(1, "MPEG4", "Decoder failed to allocate context");
219
219
+
return false;
220
220
+
--- a/plugins/video/common/dyna.cxx
221
221
+
+++ b/plugins/video/common/dyna.cxx
222
222
+
@@ -38,6 +38,13 @@
223
223
+
* Matthias Schneider (ma30002000@yahoo.de)
224
224
+
*/
225
225
+
#include "dyna.h"
226
226
+
+#include <cstdio>
227
227
+
+#include <cstdarg>
228
228
+
+
229
229
+
+extern "C" {
230
230
+
+#include <libavcodec/avcodec.h>
231
231
+
+#include <libavutil/mem.h>
232
232
+
+}
233
233
+
234
234
+
bool DynaLink::Open(const char *name)
235
235
+
{
236
236
+
@@ -228,101 +235,15 @@
237
237
+
m_libAvutil.Close();
238
238
+
}
239
239
+
240
240
+
-#define CHECK_AVUTIL(name, func) \
241
241
+
- (seperateLibAvutil ? \
242
242
+
- m_libAvutil.GetFunction(name, (DynaLink::Function &)func) : \
243
243
+
- m_libAvcodec.GetFunction(name, (DynaLink::Function &)func) \
244
244
+
- ) \
245
245
+
-
246
246
+
-
247
247
+
bool FFMPEGLibrary::Load()
248
248
+
{
249
249
+
WaitAndSignal m(processLock);
250
250
+
if (IsLoaded())
251
251
+
return true;
252
252
+
253
253
+
- bool seperateLibAvutil = false;
254
254
+
-
255
255
+
-#ifdef LIBAVCODEC_LIB_NAME
256
256
+
- if (m_libAvcodec.Open(LIBAVCODEC_LIB_NAME))
257
257
+
- seperateLibAvutil = true;
258
258
+
- else
259
259
+
-#endif
260
260
+
- if (m_libAvcodec.Open("libavcodec"))
261
261
+
- seperateLibAvutil = false;
262
262
+
- else if (m_libAvcodec.Open("avcodec-" AV_STRINGIFY(LIBAVCODEC_VERSION_MAJOR)))
263
263
+
- seperateLibAvutil = true;
264
264
+
- else {
265
265
+
- PTRACE(1, m_codecString, "Failed to load FFMPEG libavcodec library");
266
266
+
- return false;
267
267
+
- }
268
268
+
-
269
269
+
- if (seperateLibAvutil &&
270
270
+
- !(
271
271
+
-#ifdef LIBAVUTIL_LIB_NAME
272
272
+
- m_libAvutil.Open(LIBAVUTIL_LIB_NAME) ||
273
273
+
-#endif
274
274
+
- m_libAvutil.Open("libavutil") ||
275
275
+
- m_libAvutil.Open("avutil-" AV_STRINGIFY(LIBAVUTIL_VERSION_MAJOR))
276
276
+
- ) ) {
277
277
+
- PTRACE(1, m_codecString, "Failed to load FFMPEG libavutil library");
278
278
+
- return false;
279
279
+
- }
280
280
+
-
281
281
+
- strcpy(m_libAvcodec.m_codecString, m_codecString);
282
282
+
- strcpy(m_libAvutil.m_codecString, m_codecString);
283
283
+
-
284
284
+
- if (!m_libAvcodec.GetFunction("avcodec_init", (DynaLink::Function &)Favcodec_init))
285
285
+
- return false;
286
286
+
-
287
287
+
- if (!m_libAvcodec.GetFunction("av_init_packet", (DynaLink::Function &)Fav_init_packet))
288
288
+
- return false;
289
289
+
-
290
290
+
- if (!m_libAvcodec.GetFunction("avcodec_register_all", (DynaLink::Function &)Favcodec_register_all))
291
291
+
- return false;
292
292
+
-
293
293
+
- if (!m_libAvcodec.GetFunction("avcodec_find_encoder", (DynaLink::Function &)Favcodec_find_encoder))
294
294
+
- return false;
295
295
+
-
296
296
+
- if (!m_libAvcodec.GetFunction("avcodec_find_decoder", (DynaLink::Function &)Favcodec_find_decoder))
297
297
+
- return false;
298
298
+
-
299
299
+
- if (!m_libAvcodec.GetFunction("avcodec_alloc_context", (DynaLink::Function &)Favcodec_alloc_context))
300
300
+
- return false;
301
301
+
-
302
302
+
- if (!m_libAvcodec.GetFunction("avcodec_alloc_frame", (DynaLink::Function &)Favcodec_alloc_frame))
303
303
+
- return false;
304
304
+
-
305
305
+
- if (!m_libAvcodec.GetFunction("avcodec_open", (DynaLink::Function &)Favcodec_open))
306
306
+
- return false;
307
307
+
-
308
308
+
- if (!m_libAvcodec.GetFunction("avcodec_close", (DynaLink::Function &)Favcodec_close))
309
309
+
- return false;
310
310
+
-
311
311
+
- if (!m_libAvcodec.GetFunction("avcodec_encode_video", (DynaLink::Function &)Favcodec_encode_video))
312
312
+
- return false;
313
313
+
-
314
314
+
- if (!m_libAvcodec.GetFunction("avcodec_decode_video2", (DynaLink::Function &)Favcodec_decode_video))
315
315
+
- return false;
316
316
+
-
317
317
+
- if (!m_libAvcodec.GetFunction("avcodec_set_dimensions", (DynaLink::Function &)Favcodec_set_dimensions))
318
318
+
- return false;
319
319
+
-
320
320
+
- if (!CHECK_AVUTIL("av_free", Favcodec_free))
321
321
+
- return false;
322
322
+
-
323
323
+
- if(!m_libAvcodec.GetFunction("avcodec_version", (DynaLink::Function &)Favcodec_version))
324
324
+
- return false;
325
325
+
-
326
326
+
- if (!CHECK_AVUTIL("av_log_set_level", FAv_log_set_level))
327
327
+
- return false;
328
328
+
-
329
329
+
- if (!CHECK_AVUTIL("av_log_set_callback", FAv_log_set_callback))
330
330
+
- return false;
331
331
+
-
332
332
+
// must be called before using avcodec lib
333
333
+
334
334
+
- unsigned libVer = Favcodec_version();
335
335
+
+ unsigned libVer = avcodec_version();
336
336
+
if (libVer != LIBAVCODEC_VERSION_INT) {
337
337
+
PTRACE(2, m_codecString, "Warning: compiled against libavcodec headers from version "
338
338
+
<< LIBAVCODEC_VERSION_MAJOR << '.' << LIBAVCODEC_VERSION_MINOR << '.' << LIBAVCODEC_VERSION_MICRO
339
339
+
@@ -334,8 +255,7 @@
340
340
+
<< (libVer >> 16) << ((libVer>>8) & 0xff) << (libVer & 0xff));
341
341
+
}
342
342
+
343
343
+
- Favcodec_init();
344
344
+
- Favcodec_register_all ();
345
345
+
+ avcodec_register_all();
346
346
+
347
347
+
#if PLUGINCODEC_TRACING
348
348
+
AvLogSetLevel(AV_LOG_DEBUG);
349
349
+
@@ -350,49 +270,49 @@
350
350
+
351
351
+
AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum CodecID id)
352
352
+
{
353
353
+
- return Favcodec_find_encoder(id);
354
354
+
+ return avcodec_find_encoder(id);
355
355
+
}
356
356
+
357
357
+
AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum CodecID id)
358
358
+
{
359
359
+
WaitAndSignal m(processLock);
360
360
+
361
361
+
- return Favcodec_find_decoder(id);
362
362
+
+ return avcodec_find_decoder(id);
363
363
+
}
364
364
+
365
365
+
-AVCodecContext *FFMPEGLibrary::AvcodecAllocContext(void)
366
366
+
+AVCodecContext *FFMPEGLibrary::AvcodecAllocContext(AVCodec *codec)
367
367
+
{
368
368
+
WaitAndSignal m(processLock);
369
369
+
370
370
+
- return Favcodec_alloc_context();
371
371
+
+ return avcodec_alloc_context3(codec);
372
372
+
}
373
373
+
374
374
+
AVFrame *FFMPEGLibrary::AvcodecAllocFrame(void)
375
375
+
{
376
376
+
WaitAndSignal m(processLock);
377
377
+
378
378
+
- return Favcodec_alloc_frame();
379
379
+
+ return avcodec_alloc_frame();
380
380
+
}
381
381
+
382
382
+
int FFMPEGLibrary::AvcodecOpen(AVCodecContext *ctx, AVCodec *codec)
383
383
+
{
384
384
+
WaitAndSignal m(processLock);
385
385
+
386
386
+
- return Favcodec_open(ctx, codec);
387
387
+
+ return avcodec_open2(ctx, codec, NULL);
388
388
+
}
389
389
+
390
390
+
int FFMPEGLibrary::AvcodecClose(AVCodecContext *ctx)
391
391
+
{
392
392
+
WaitAndSignal m(processLock);
393
393
+
394
394
+
- return Favcodec_close(ctx);
395
395
+
+ return avcodec_close(ctx);
396
396
+
}
397
397
+
398
398
+
int FFMPEGLibrary::AvcodecEncodeVideo(AVCodecContext *ctx, BYTE *buf, int buf_size, const AVFrame *pict)
399
399
+
{
400
400
+
int res;
401
401
+
402
402
+
- res = Favcodec_encode_video(ctx, buf, buf_size, pict);
403
403
+
+ res = avcodec_encode_video(ctx, buf, buf_size, pict);
404
404
+
405
405
+
PTRACE(6, m_codecString, "DYNA\tEncoded into " << res << " bytes, max " << buf_size);
406
406
+
return res;
407
407
+
@@ -401,35 +321,35 @@
408
408
+
int FFMPEGLibrary::AvcodecDecodeVideo(AVCodecContext *ctx, AVFrame *pict, int *got_picture_ptr, BYTE *buf, int buf_size)
409
409
+
{
410
410
+
AVPacket avpkt;
411
411
+
- Fav_init_packet(&avpkt);
412
412
+
+ av_init_packet(&avpkt);
413
413
+
avpkt.data = buf;
414
414
+
avpkt.size = buf_size;
415
415
+
416
416
+
- return Favcodec_decode_video(ctx, pict, got_picture_ptr, &avpkt);
417
417
+
+ return avcodec_decode_video2(ctx, pict, got_picture_ptr, &avpkt);
418
418
+
}
419
419
+
420
420
+
void FFMPEGLibrary::AvcodecFree(void * ptr)
421
421
+
{
422
422
+
WaitAndSignal m(processLock);
423
423
+
424
424
+
- Favcodec_free(ptr);
425
425
+
+ av_free(ptr);
426
426
+
}
427
427
+
428
428
+
void FFMPEGLibrary::AvSetDimensions(AVCodecContext *s, int width, int height)
429
429
+
{
430
430
+
WaitAndSignal m(processLock);
431
431
+
432
432
+
- Favcodec_set_dimensions(s, width, height);
433
433
+
+ avcodec_set_dimensions(s, width, height);
434
434
+
}
435
435
+
436
436
+
void FFMPEGLibrary::AvLogSetLevel(int level)
437
437
+
{
438
438
+
- FAv_log_set_level(level);
439
439
+
+ av_log_set_level(level);
440
440
+
}
441
441
+
442
442
+
void FFMPEGLibrary::AvLogSetCallback(void (*callback)(void*, int, const char*, va_list))
443
443
+
{
444
444
+
- FAv_log_set_callback(callback);
445
445
+
+ av_log_set_callback(callback);
446
446
+
}
447
447
+
448
448
+
bool FFMPEGLibrary::IsLoaded()
449
449
+
--- a/plugins/video/common/dyna.h
450
450
+
+++ b/plugins/video/common/dyna.h
451
451
+
@@ -95,7 +95,7 @@
452
452
+
453
453
+
AVCodec *AvcodecFindEncoder(enum CodecID id);
454
454
+
AVCodec *AvcodecFindDecoder(enum CodecID id);
455
455
+
- AVCodecContext *AvcodecAllocContext(void);
456
456
+
+ AVCodecContext *AvcodecAllocContext(AVCodec*);
457
457
+
AVFrame *AvcodecAllocFrame(void);
458
458
+
int AvcodecOpen(AVCodecContext *ctx, AVCodec *codec);
459
459
+
int AvcodecClose(AVCodecContext *ctx);
460
460
+
@@ -120,26 +120,6 @@
461
461
+
CodecID m_codec;
462
462
+
char m_codecString[32];
463
463
+
464
464
+
- void (*Favcodec_init)(void);
465
465
+
- void (*Fav_init_packet)(AVPacket *pkt);
466
466
+
-
467
467
+
- void (*Favcodec_register_all)(void);
468
468
+
- AVCodec *(*Favcodec_find_encoder)(enum CodecID id);
469
469
+
- AVCodec *(*Favcodec_find_decoder)(enum CodecID id);
470
470
+
- AVCodecContext *(*Favcodec_alloc_context)(void);
471
471
+
- AVFrame *(*Favcodec_alloc_frame)(void);
472
472
+
- int (*Favcodec_open)(AVCodecContext *ctx, AVCodec *codec);
473
473
+
- int (*Favcodec_close)(AVCodecContext *ctx);
474
474
+
- int (*Favcodec_encode_video)(AVCodecContext *ctx, BYTE *buf, int buf_size, const AVFrame *pict);
475
475
+
- int (*Favcodec_decode_video)(AVCodecContext *ctx, AVFrame *pict, int *got_picture_ptr, AVPacket *avpkt);
476
476
+
- unsigned (*Favcodec_version)(void);
477
477
+
- void (*Favcodec_set_dimensions)(AVCodecContext *ctx, int width, int height);
478
478
+
-
479
479
+
- void (*Favcodec_free)(void *);
480
480
+
-
481
481
+
- void (*FAv_log_set_level)(int level);
482
482
+
- void (*FAv_log_set_callback)(void (*callback)(void*, int, const char*, va_list));
483
483
+
-
484
484
+
bool m_isLoadedOK;
485
485
+
};
486
486
+
487
487
+
--- a/plugins/video/common/ffmpeg.h
488
488
+
+++ b/plugins/video/common/ffmpeg.h
489
489
+
@@ -45,11 +45,13 @@
490
490
+
491
491
+
#include "platform.h"
492
492
+
493
493
+
-#include "libavcodec/avcodec.h"
494
494
+
+extern "C" {
495
495
+
+#include <libavcodec/avcodec.h>
496
496
+
// AVPacket was declared in avformat.h before April 2009
497
497
+
#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(52, 25, 0)
498
498
+
-#include "libavformat/avformat.h"
499
499
+
+#include <libavformat/avformat.h>
500
500
+
#endif
501
501
+
+}
502
502
+
503
503
+
#ifndef LIBAVCODEC_VERSION_INT
504
504
+
#error Libavcodec include is not correct
505
505
+
--- a/plugins/video/H.263-1998/Makefile.in
506
506
+
+++ b/plugins/video/H.263-1998/Makefile.in
507
507
+
@@ -34,8 +34,8 @@
508
508
+
$(COMMONDIR)/mpi.cxx \
509
509
+
$(COMMONDIR)/dyna.cxx
510
510
+
511
511
+
-CFLAGS += @LIBAVCODEC_CFLAGS@ -I$(COMMONDIR)
512
512
+
-LIBS += @DL_LIBS@
513
513
+
+CFLAGS += @LIBAVCODEC_CFLAGS@ @LIBAVUTIL_CFLAGS@ -I$(COMMONDIR)
514
514
+
+LIBS += @DL_LIBS@ @LIBAVCODEC_LIBS@ @LIBAVUTIL_LIBS@
515
515
+
516
516
+
HAVE_LIBAVCODEC_RTP_MODE=@HAVE_LIBAVCODEC_RTP_MODE@
517
517
+
ifeq ($(HAVE_LIBAVCODEC_RTP_MODE),yes)
518
518
+
--- a/plugins/video/H.264/Makefile.in
519
519
+
+++ b/plugins/video/H.264/Makefile.in
520
520
+
@@ -34,8 +34,8 @@
521
521
+
$(SHAREDDIR)/x264wrap.cxx \
522
522
+
$(COMMONDIR)/dyna.cxx \
523
523
+
524
524
+
-CFLAGS += @LIBAVCODEC_CFLAGS@ -I$(COMMONDIR) -DLIB_DIR='"$(libdir)"' -DVC_PLUGIN_DIR='"@VC_PLUGIN_DIR@"'
525
525
+
-LIBS += @DL_LIBS@
526
526
+
+CFLAGS += @LIBAVCODEC_CFLAGS@ @LIBAVUTIL_CFLAGS@ -I$(COMMONDIR) -DLIB_DIR='"$(libdir)"' -DVC_PLUGIN_DIR='"@VC_PLUGIN_DIR@"'
527
527
+
+LIBS += @DL_LIBS@ @LIBAVCODEC_LIBS@ @LIBAVUTIL_LIBS@
528
528
+
529
529
+
IS_H264_LICENSED:=@IS_H264_LICENSED@
530
530
+
ifeq ($(IS_H264_LICENSED),yes)
531
531
+
--- a/plugins/video/MPEG4-ffmpeg/Makefile.in
532
532
+
+++ b/plugins/video/MPEG4-ffmpeg/Makefile.in
533
533
+
@@ -30,8 +30,8 @@
534
534
+
SRCDIR := .
535
535
+
SRCS := mpeg4.cxx $(COMMONDIR)/dyna.cxx
536
536
+
537
537
+
-CFLAGS += @LIBAVCODEC_CFLAGS@ -I$(COMMONDIR)
538
538
+
-LIBS += @DL_LIBS@
539
539
+
+CFLAGS += @LIBAVCODEC_CFLAGS@ @LIBAVUTIL_CFLAGS@ -I$(COMMONDIR)
540
540
+
+LIBS += @DL_LIBS@ @LIBAVCODEC_LIBS@ @LIBAVUTIL_LIBS@
541
541
+
542
542
+
# Add LIBAVCODEC_SOURCE_DIR to the include path so we can #include <libavcodec/...h>
543
543
+
# Also add libavutil, so ffmpeg headers can #include "log.h".