diff -ruN liboutput.org/encode.c liboutput/encode.c --- 2/liboutput.org/encode.c 2013-02-22 20:05:34.000000000 +0100 +++ 1/liboutput/encode.c 2013-03-26 14:05:50.000000000 +0100 @@ -49,8 +49,13 @@ bool cEncode::Register() { - av_register_all(); + avcodec_init(); +#if 0 + // XXX to resolv: dosen't work with osdpip + register_avcodec(&mpeg2video_encoder); +#else avcodec_register_all(); +#endif m_pavCodec = avcodec_find_encoder(CODEC_ID_MPEG2VIDEO); if (!m_pavCodec) { @@ -95,7 +100,7 @@ AVCodecContext *pAVCC = NULL; AVFrame *pAVF = NULL; - pAVCC = avcodec_alloc_context3(m_pavCodec); + pAVCC = avcodec_alloc_context(); if (! pAVCC) { esyslog("imageplugin: Failed to alloc memory for AVCodecContext."); @@ -111,7 +116,7 @@ { SetupEncodingParameters(pAVCC); - if (avcodec_open2(pAVCC, m_pavCodec, NULL) < 0) + if (avcodec_open(pAVCC, m_pavCodec) < 0) { esyslog("imageplugin: Couldn't open Codec."); } @@ -137,7 +142,7 @@ context->height = m_nHeight; #if LIBAVCODEC_BUILD >= 4754 - context->time_base=(AVRational){1, (int)GetFrameRate()}; + context->time_base=(AVRational){1, GetFrameRate()}; #else context->frame_rate=GetFrameRate(); context->frame_rate_base=1; @@ -211,8 +216,6 @@ bool cEncode::EncodeFrames(AVCodecContext *context, AVFrame *frame) { - AVPacket outpkt; - int got_output; if(!m_pFrameSizes) { esyslog("imageplugin: Failed to add MPEG sequence, insufficient memory."); @@ -220,24 +223,23 @@ } unsigned int i; - av_init_packet(&outpkt); + m_nMPEGSize = 0; // Encode m_nNumberOfFramesToEncode number of frames for(i=0; (i < m_nNumberOfFramesToEncode) && (m_nMPEGSize < m_nMaxMPEGSize); ++i) { - outpkt.data = ( m_pMPEG + m_nMPEGSize); - outpkt.size = m_nMaxMPEGSize - m_nMPEGSize; - int err = avcodec_encode_video2(context, &outpkt,frame, &got_output); - if(err < 0) + int nFrameSize = avcodec_encode_video(context, m_pMPEG + m_nMPEGSize, + m_nMaxMPEGSize - m_nMPEGSize, frame); + if(nFrameSize < 0) { esyslog("imageplugin: Failed to add frame %d, insufficient memory.", i); return false; } - m_nMPEGSize += outpkt.size; - *(m_pFrameSizes + i) = outpkt.size; + m_nMPEGSize += nFrameSize; + *(m_pFrameSizes + i) = nFrameSize; } // Add four bytes MPEG end sequence