Re: [Ekiga-devel-list] [Win32] Last version of libav-9



Here is a quick patch based on avcodec_decode_video2. I need to check
better my job.

austerlitz:~/win32> diff -u src/opal/plugins/video/common/dyna.cxx
src/opal/plugins/video/common/dyna.cxx.new
--- src/opal/plugins/video/common/dyna.cxx      2013-09-24
16:28:35.000000000 +0200
+++ src/opal/plugins/video/common/dyna.cxx.new  2013-09-24
15:22:33.000000000 +0200
@@ -217,14 +217,14 @@
 #endif
 
 
-FFMPEGLibrary::FFMPEGLibrary(CodecID codec)
+FFMPEGLibrary::FFMPEGLibrary(AVCodecID codec)
 {
   m_codec = codec;
-  if (m_codec==CODEC_ID_H264)
+  if (m_codec==AV_CODEC_ID_H264)
       snprintf( m_codecString, sizeof(m_codecString), "H264");
-  if (m_codec==CODEC_ID_H263P)
+  if (m_codec==AV_CODEC_ID_H263P)
       snprintf( m_codecString, sizeof(m_codecString), "H263+");
-  if (m_codec==CODEC_ID_MPEG4)
+  if (m_codec==AV_CODEC_ID_MPEG4)
       snprintf( m_codecString, sizeof(m_codecString), "MPEG4");
   m_isLoadedOK = false;
 }
@@ -268,12 +268,12 @@
   return true;
 }
 
-AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum CodecID id)
+AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum AVCodecID id)
 {
   return avcodec_find_encoder(id);
 }
 
-AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum CodecID id)
+AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum AVCodecID id)
 {
   WaitAndSignal m(processLock);
 
@@ -311,11 +311,28 @@
 int FFMPEGLibrary::AvcodecEncodeVideo(AVCodecContext *ctx, BYTE *buf,
int buf_size, const AVFrame *pict)
 {
   int res;
+//TS
+  AVPacket avpkt;
+  av_init_packet(&avpkt);
+  avpkt.data = buf;
+  avpkt.size = buf_size;
+
+  int gotPacket = 0;
+  res = avcodec_encode_video2(ctx, &avpkt, pict, &gotPacket);
+  if (res < 0) {
+       PTRACE(1, m_codecString, "Encoder failed");
+       return res;
+  }
+  if (gotPacket)
+       return avpkt.size;
+ 
+  PTRACE(3, m_codecString, "Encoder returned no data");
 
-  res = avcodec_encode_video(ctx, buf, buf_size, pict);
+  return 0;
+//TS  res = avcodec_encode_video(ctx, buf, buf_size, pict);
 
-  PTRACE(6, m_codecString, "DYNA\tEncoded into " << res << " bytes, max
" << buf_size);
-  return res;
+//TS  PTRACE(6, m_codecString, "DYNA\tEncoded into " << res << " bytes,
max " << buf_size);
+//TS  return res;
 }
 
 int FFMPEGLibrary::AvcodecDecodeVideo(AVCodecContext *ctx, AVFrame
*pict, int *got_picture_ptr, BYTE *buf, int buf_size)



On 09/24/2013 09:19 AM, Eugen Dedu wrote:
On 24/09/13 09:11, Thierry Simonnet wrote:
Le 23/09/2013 15:08, Eugen Dedu a écrit :
On 20/09/13 15:57, Thierry Simonnet wrote:
Hello,

I noticed that avcodec_encode_video doesn't exist any more in the
last version
of libav-9. It is replaced, of course,  by avcodec_encode_video2. 
It impacts

Please be more precise: what version of libav?  With which version
it worked?
I use trunk version of libav.

Ah!  I will take a look later.

It doesn't work since last week.

opal 3.10.12 (for me), and especially dyna mechanism.
I will have a look next week (if there is no patch from opal).




-- 

Thierry Simonnet

ESIEE-Paris

Par respect pour l’environnement, n’imprimez ce mail que si nécessaire




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]