]> git.pld-linux.org Git - packages/opal.git/blob - opal-ffmpeg08.patch
a2133a34340590d96056dfc5488cb577a460871d
[packages/opal.git] / opal-ffmpeg08.patch
1 Index: opal-3.6.8/plugins/configure.ac
2 ===================================================================
3 --- opal-3.6.8.orig/plugins/configure.ac
4 +++ opal-3.6.8/plugins/configure.ac
5 @@ -237,9 +237,9 @@ PKG_CHECK_MODULES([LIBAVCODEC],
6                                           HAVE_H264_DECODER=yes
7                                           ;;
8                                       * ) 
9 -                                         AC_CHECK_LIB(avcodec, h263p_encoder, [HAVE_H263P=yes], [HAVE_H263P=no])
10 -                                         AC_CHECK_LIB(avcodec, mpeg4_encoder, [HAVE_MPEG4=yes], [HAVE_MPEG4=no])
11 -                                         AC_CHECK_LIB(avcodec, h264_decoder, [HAVE_H264_DECODER=yes], [HAVE_H264_DECODER=no])
12 +                                         OPAL_CODEC_CHECK(HAVE_H263P, encoder, CODEC_ID_H263P)
13 +                                         OPAL_CODEC_CHECK(HAVE_MPEG4, encoder, CODEC_ID_MPEG4)
14 +                                         OPAL_CODEC_CHECK(HAVE_H264_DECODER, decoder, CODEC_ID_H264)
15                                           ;;
16                     esac
17                     AC_SUBST(HAVE_H263P)
18 Index: opal-3.6.8/plugins/video/common/dyna.cxx
19 ===================================================================
20 --- opal-3.6.8.orig/plugins/video/common/dyna.cxx
21 +++ opal-3.6.8/plugins/video/common/dyna.cxx
22 @@ -240,43 +240,7 @@ bool FFMPEGLibrary::Load(int ver)
23      return false;
24    }
25  
26 -  if (_codec==CODEC_ID_H264) {
27 -    if (!libAvcodec.GetFunction("h264_decoder", (DynaLink::Function &)Favcodec_h264_decoder)) {
28 -      TRACE (1, _codecString << "\tDYNA\tFailed to load h264_decoder");
29 -      return false;
30 -    }
31 -  }
32 -  
33 -  if (_codec==CODEC_ID_H263P) {
34 -    if (!libAvcodec.GetFunction("h263_encoder", (DynaLink::Function &)Favcodec_h263_encoder)) {
35 -      TRACE (1, _codecString << "\tDYNA\tFailed to load h263_encoder" );
36 -      return false;
37 -    }
38 -  
39 -    if (!libAvcodec.GetFunction("h263p_encoder", (DynaLink::Function &)Favcodec_h263p_encoder)) {
40 -      TRACE (1, _codecString << "\tDYNA\tFailed to load h263p_encoder" );
41 -      return false;
42 -    }
43 -
44 -    if (!libAvcodec.GetFunction("h263_decoder", (DynaLink::Function &)Favcodec_h263_decoder)) {
45 -      TRACE (1, _codecString << "\tDYNA\tFailed to load h263_decoder" );
46 -      return false;
47 -    }
48 -  }
49 -
50 -  if (_codec==CODEC_ID_MPEG4) {
51 -    if (!libAvcodec.GetFunction("mpeg4_encoder", (DynaLink::Function &)mpeg4_encoder)) {
52 -      TRACE (1, _codecString << "\tDYNA\tFailed to load mpeg4_encoder");
53 -      return false;
54 -    }
55 -
56 -    if (!libAvcodec.GetFunction("mpeg4_decoder", (DynaLink::Function &)mpeg4_decoder)) {
57 -      TRACE (1, _codecString << "\tDYNA\tFailed to load mpeg4_decoder");
58 -      return false;
59 -    }
60 -  }
61 -
62 -  if (!libAvcodec.GetFunction("register_avcodec", (DynaLink::Function &)Favcodec_register)) {
63 +  if (!libAvcodec.GetFunction("avcodec_register_all", (DynaLink::Function &)Favcodec_register_all)) {
64      TRACE (1, _codecString << "\tDYNA\tFailed to load register_avcodec");
65      return false;
66    }
67 @@ -370,20 +334,13 @@ bool FFMPEGLibrary::Load(int ver)
68      }
69  
70      Favcodec_init();
71 +    Favcodec_register_all();
72  
73 -    // register only the codecs needed (to have smaller code)
74 -    if (_codec==CODEC_ID_H264) 
75 -      Favcodec_register(Favcodec_h264_decoder);
76 -
77 -    if (_codec==CODEC_ID_H263P) {
78 -      Favcodec_register(Favcodec_h263_encoder);
79 -      Favcodec_register(Favcodec_h263p_encoder);
80 -      Favcodec_register(Favcodec_h263_decoder);
81 -    }
82 -
83 -    if (_codec==CODEC_ID_MPEG4) {
84 -      Favcodec_register(mpeg4_encoder);
85 -      Favcodec_register(mpeg4_decoder);
86 +    /* check for the codec */
87 +    if (Favcodec_find_decoder(_codec) == NULL &&
88 +       Favcodec_find_encoder(_codec) == NULL) {
89 +      TRACE (1, _codecString << "\tDYNA\tFailed to load codec");
90 +      return false;
91      }
92  
93      if (FFCheckAlignment() != 0) {
94 Index: opal-3.6.8/plugins/video/common/dyna.h
95 ===================================================================
96 --- opal-3.6.8.orig/plugins/video/common/dyna.h
97 +++ opal-3.6.8/plugins/video/common/dyna.h
98 @@ -187,14 +187,8 @@ class FFMPEGLibrary
99      char _codecString [32];
100  
101      void (*Favcodec_init)(void);
102 -    AVCodec *Favcodec_h263_encoder;
103 -    AVCodec *Favcodec_h263p_encoder;
104 -    AVCodec *Favcodec_h263_decoder;
105 -    AVCodec *Favcodec_h264_decoder;
106 -    AVCodec *mpeg4_encoder;
107 -    AVCodec *mpeg4_decoder;
108  
109 -    void (*Favcodec_register)(AVCodec *format);
110 +    void (*Favcodec_register_all)(void);
111      AVCodec *(*Favcodec_find_encoder)(enum CodecID id);
112      AVCodec *(*Favcodec_find_decoder)(enum CodecID id);
113      AVCodecContext *(*Favcodec_alloc_context)(void);
114 Index: opal-3.6.8/opal.m4
115 ===================================================================
116 --- opal-3.6.8.orig/opal.m4
117 +++ opal-3.6.8/opal.m4
118 @@ -1055,3 +1055,26 @@ AC_DEFUN([OPAL_DETERMINE_ILBC],
119                                         OPAL_MSG_CHECK([System iLBC], [$has_ilbc])
120                                 fi
121        ])
122 +
123 +dnl OPAL_CODEC_CHECK
124 +dnl check for a codec presence in ffmpeg
125 +dnl Arguments: $1 name of configure option
126 +dnl           $2 'encode' or 'decode'
127 +dnl           $3 name of codec to check for (define in ffmpeg)
128 +AC_DEFUN([OPAL_CODEC_CHECK],
129 +        [
130 +         AC_MSG_CHECKING(checking for codec $3 in libavcodec)
131 +         AC_LANG([C])
132 +         LIBS=-lavcodec
133 +         AC_RUN_IFELSE(
134 +           [AC_LANG_PROGRAM([[
135 +                               #include <libavcodec/avcodec.h>
136 +                            ]],
137 +                            [[
138 +                              avcodec_init();
139 +                              avcodec_register_all();
140 +                              return avcodec_find_$2($3) == NULL;
141 +                            ]]
142 +           )], [$1=yes], [$1=no], [$1=no])
143 +         AC_MSG_RESULT($$1)
144 +         ])
145 diff --git a/include/h323/h323ep.h b/include/h323/h323ep.h
146 --- a/include/h323/h323ep.h
147 +++ b/include/h323/h323ep.h
148 @@ -60,6 +60,7 @@ class H225_H221NonStandard;
149  class H225_H221NonStandard;
150  class H225_ServiceControlDescriptor;
151  class H225_FeatureSet;
152 +class H225_ArrayOf_SupportedProtocols;
153  
154  class H235SecurityInfo;
155  
156 diff --git a/plugins/video/H.264/shared/h264frame.cxx b/plugins/video/H.264/shared/h264frame.cxx
157 --- a/plugins/video/H.264/shared/h264frame.cxx
158 +++ b/plugins/video/H.264/shared/h264frame.cxx
159 @@ -86,7 +86,6 @@ H264Frame::~H264Frame ()
160  
161  #ifndef LICENCE_MPL
162  void H264Frame::SetFromFrame (x264_nal_t *NALs, int numberOfNALs) {
163 -  int vopBufferLen;
164    int currentNAL = 0;
165  
166    uint8_t* currentPositionInFrame=(uint8_t*) _encodedFrame;
167 @@ -99,8 +98,9 @@ void H264Frame::SetFromFrame (x264_nal_t
168  
169    // read the nals out of the encoder and create meta data about their location and size in the frame
170    for (currentNAL = 0; currentNAL < numberOfNALs; currentNAL++) {
171 -    int currentNALLen;
172 -    currentNALLen = X264_NAL_ENCODE(currentPositionInFrame, &vopBufferLen, 1, &NALs[currentNAL]);
173 +    int currentNALLen = NALs[currentNAL].i_payload;
174 +    memcpy(currentPositionInFrame, NALs[currentNAL].p_payload, NALs[currentNAL].i_payload);
175 +
176      if (currentNALLen > 0) 
177      {
178        _NALs[_numberOfNALsInFrame].length = currentNALLen;
179 --- opal-3.6.8/plugins/video/H.263-1998/h263-1998.cxx~  2010-05-27 08:52:46.000000000 +0200
180 +++ opal-3.6.8/plugins/video/H.263-1998/h263-1998.cxx   2011-06-30 16:50:50.842457173 +0200
181 @@ -688,7 +688,7 @@
182  
183    _inputFrame->data[1] = _inputFrame->data[0] + size;
184    _inputFrame->data[2] = _inputFrame->data[1] + (size / 4);
185 -  _inputFrame->pict_type = (flags && forceIFrame) ? FF_I_TYPE : 0;
186 +  _inputFrame->pict_type = AV_PICTURE_TYPE_I;
187  
188    currentMb = 0;
189    currentBytes = 0;
190 @@ -885,7 +885,7 @@
191    _inputFrame->data[0] = _inputFrameBuffer + FF_INPUT_BUFFER_PADDING_SIZE;
192    _inputFrame->data[1] = _inputFrame->data[0] + size;
193    _inputFrame->data[2] = _inputFrame->data[1] + (size / 4);
194 -  _inputFrame->pict_type = (flags && forceIFrame) ? FF_I_TYPE : 0;
195 +  _inputFrame->pict_type = AV_PICTURE_TYPE_I;
196   
197    _txH263PFrame->BeginNewFrame();
198    _txH263PFrame->SetTimestamp(srcRTP.GetTimestamp());
199 --- opal-3.6.8/plugins/video/MPEG4-ffmpeg/mpeg4.cxx~    2010-05-27 08:52:47.000000000 +0200
200 +++ opal-3.6.8/plugins/video/MPEG4-ffmpeg/mpeg4.cxx     2011-07-01 10:27:44.590440941 +0200
201 @@ -828,11 +828,7 @@
202          // Should the next frame be an I-Frame?
203          if ((flags & PluginCodec_CoderForceIFrame) || (_frameNum == 0))
204          {
205 -            _avpicture->pict_type = FF_I_TYPE;
206 -        }
207 -        else // No IFrame requested, let avcodec decide what to do
208 -        {
209 -            _avpicture->pict_type = 0;
210 +            _avpicture->pict_type = AV_PICTURE_TYPE_I;
211          }
212  
213          // Encode a frame
214 @@ -1363,7 +1359,7 @@
215      if (_doError) {
216          int errors = 0;
217          MpegEncContext *s = (MpegEncContext *) _avcontext->priv_data;
218 -        if (s->error_count && _avcontext->coded_frame->pict_type == FF_I_TYPE) {
219 +        if (s->error_count && _avcontext->coded_frame->pict_type == AV_PICTURE_TYPE_I) {
220              const uint8_t badflags = AC_ERROR | DC_ERROR | MV_ERROR;
221              for (int i = 0; i < s->mb_num && errors < threshold; ++i) {
222                  if (s->error_status_table[s->mb_index2xy[i]] & badflags)
This page took 0.095133 seconds and 2 git commands to generate.