Hi Reinhard, Thanks for your patch. I've changed your patch a little. Please see if it is good. Patch is as the attachment.
I'll prepare an upload to Debian experimental very soon.
Yours,
Paul
--
PaulLiu (劉穎駿)
E-mail: Ying-Chun Liu (PaulLiu) <[email protected]>
From: Reinhard Tartler <[email protected]> Subject: Fix FTBFS with libav 9 Bug-Debian: http://bugs.debian.org/692867 Last-Update: 2012-12-07 Index: avifile-0.7.48~20090503.ds/configure.in =================================================================== --- avifile-0.7.48~20090503.ds.orig/configure.in 2012-12-08 12:12:11.000000000 +0800 +++ avifile-0.7.48~20090503.ds/configure.in 2012-12-08 12:22:00.214823652 +0800 @@ -825,7 +825,7 @@ AM_PATH_FFMPEG tmp_LIBS="$LIBS" -AC_CHECK_LIB([avcodec], [avcodec_init], [], +AC_CHECK_LIB([avcodec], [avcodec_register_all], [], [AC_MSG_ERROR([libavcodec is required to build this package.])]) AC_CHECK_FUNCS([avcodec_decode_audio3 avcodec_decode_video2]) LIBS="$tmp_LIBS" Index: avifile-0.7.48~20090503.ds/lib/codeckeeper.cpp =================================================================== --- avifile-0.7.48~20090503.ds.orig/lib/codeckeeper.cpp 2009-04-25 07:42:12.000000000 +0800 +++ avifile-0.7.48~20090503.ds/lib/codeckeeper.cpp 2012-12-08 12:22:00.214823652 +0800 @@ -294,7 +294,6 @@ audio_codecs.clear(); // FFMPEG initialization - avcodec_init(); avcodec_register_all(); uncompressed_FillPlugins(video_codecs); Index: avifile-0.7.48~20090503.ds/lib/aviread/FFReadHandler.cpp =================================================================== --- avifile-0.7.48~20090503.ds.orig/lib/aviread/FFReadHandler.cpp 2012-12-08 12:12:11.000000000 +0800 +++ avifile-0.7.48~20090503.ds/lib/aviread/FFReadHandler.cpp 2012-12-08 12:22:00.214823652 +0800 @@ -62,27 +62,25 @@ delete m_Streams.back(); m_Streams.pop_back(); } - av_close_input_file(m_pContext); + avformat_close_input(&m_pContext); } } int FFReadHandler::Init(const char* url) { - AVFormatParameters avfp; AVInputFormat* fmt = 0; // av_find_input_format(url); //printf("find input format %p %s\n", fmt, b); - memset(&avfp, 0, sizeof(avfp)); - int r = av_open_input_file(&m_pContext, url, - fmt, 64000, &avfp); + int r = avformat_open_input(&m_pContext, url, + fmt, NULL); if (r < 0) { AVM_WRITE("FF reader", "Open Input failed %d\n", r); return -1; } - if (av_find_stream_info(m_pContext) < 0) + if (avformat_find_stream_info(m_pContext, NULL) < 0) return -1; AVM_WRITE("FF reader", "Format:'%s' Stream(s):%d\n", m_pContext->iformat->long_name, m_pContext->nb_streams); @@ -202,7 +200,7 @@ if (av_read_frame(m_pContext, &pkt) < 0) { p->Release(); - if (url_ferror(m_pContext->pb)) + if (m_pContext->pb && m_pContext->pb->error) AVM_WRITE("FF reader", "error seen\n"); //if (!url_feof(m_pContext->pb)) Index: avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFAudioDecoder.cpp =================================================================== --- avifile-0.7.48~20090503.ds.orig/plugins/libffmpeg/FFAudioDecoder.cpp 2012-12-08 12:12:11.000000000 +0800 +++ avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFAudioDecoder.cpp 2012-12-08 12:22:00.218823539 +0800 @@ -25,7 +25,7 @@ { if (!m_pAvContext) { - if (!(m_pAvContext = avcodec_alloc_context2(m_pAvCodec->type))) + if (!(m_pAvContext = avcodec_alloc_context3(m_pAvCodec))) return -1; m_pAvContext->channels = m_pFormat->nChannels; @@ -46,7 +46,7 @@ m_pAvContext->extradata_size = m_pFormat->cbSize - skip; } - if (avcodec_open(m_pAvContext, m_pAvCodec) < 0) + if (avcodec_open2(m_pAvContext, m_pAvCodec, NULL) < 0) { AVM_WRITE("FFAudioDecoder", "WARNING: can't open avcodec\n"); free(m_pAvContext); Index: avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFVideoDecoder.cpp =================================================================== --- avifile-0.7.48~20090503.ds.orig/plugins/libffmpeg/FFVideoDecoder.cpp 2012-12-08 12:12:11.000000000 +0800 +++ avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFVideoDecoder.cpp 2012-12-08 13:30:28.768349356 +0800 @@ -117,7 +117,6 @@ pic->type = FF_BUFFER_TYPE_USER; pImage->m_iType = pic->pict_type; - pic->age = (pImage->GetAge() != pImage->MAX_AGE) ? pic->coded_picture_number - pImage->GetAge() : (1 << 30); if (pic->reference) pImage->Age(pic->coded_picture_number); else @@ -125,7 +124,7 @@ Debug printf("FF: <<<< GetBuffer %p %s %dx%d %p:%p:%p s:%f f:%d r:%d age:%d\n", pImage, ftypes[pic->pict_type], avctx->width, avctx->height, pImage->Data(0), pImage->Data(2), pImage->Data(1), - (double)pImage->m_lTimestamp / 1000000., avctx->pix_fmt, pic->reference, pic->age); + (double)pImage->m_lTimestamp / 1000000., avctx->pix_fmt, pic->reference); return 0; } @@ -162,7 +161,9 @@ //printf("FFMPEG space %p \n", m_pAvContext); m_Dest.Print(); pImage->GetFmt()->Print(); if (!m_pAvContext) { - if (!(m_pAvContext = avcodec_alloc_context2(m_pAvCodec->type))) + AVDictionary *dict = NULL; + + if (!(m_pAvContext = avcodec_alloc_context3(m_pAvCodec))) return -1; // for autodetection errors m_pAvContext->codec_tag = m_pFormat->biCompression; @@ -175,7 +176,7 @@ m_pAvContext->extradata_size = int(m_pFormat->biSize - sizeof(BITMAPINFOHEADER)); m_pAvContext->extradata = (uint8_t*)m_pFormat + sizeof(BITMAPINFOHEADER); if (m_pAvContext->extradata_size > 40) - m_pAvContext->flags |= CODEC_FLAG_EXTERN_HUFF; // somewhat useless + av_dict_set(&dict, "extern_huff", "1", 0); } m_uiBuffers = (pImage && pImage->GetAllocator()) ? pImage->GetAllocator()->GetImages() : 0; @@ -230,7 +231,7 @@ #endif #if 1 - m_pAvContext->error_recognition = FF_ER_COMPLIANT; + m_pAvContext->err_recognition = AV_EF_BITSTREAM; m_pAvContext->error_concealment = FF_EC_GUESS_MVS; m_pAvContext->workaround_bugs = FF_BUG_AUTODETECT; #endif @@ -281,12 +282,13 @@ m_pAvContext->workaround_bugs |= p->flag; } */ - if (avcodec_open(m_pAvContext, m_pAvCodec) < 0) + if (avcodec_open2(m_pAvContext, m_pAvCodec, &dict) < 0) { AVM_WRITE(m_Info.GetPrivateName(), "WARNING: FFVideoDecoder::DecodeFrame() can't open avcodec\n"); Stop(); return -1; } + av_dict_free(&dict); } // try using draw_horiz_band if DR1 is unsupported Index: avifile-0.7.48~20090503.ds/plugins/libffmpeg/Makefile.am =================================================================== --- avifile-0.7.48~20090503.ds.orig/plugins/libffmpeg/Makefile.am 2012-12-08 12:12:11.000000000 +0800 +++ avifile-0.7.48~20090503.ds/plugins/libffmpeg/Makefile.am 2012-12-08 12:22:00.218823539 +0800 @@ -13,7 +13,7 @@ libffmpeg.cpp FFMPEG_CFLAGS = -I$(top_srcdir)/ffmpeg -ffmpeg_la_LIBADD = ../../lib/libaviplay.la -lavcodec -lavformat +ffmpeg_la_LIBADD = ../../lib/libaviplay.la -lavcodec -lavformat -lavutil ffmpeg_la_LDFLAGS = -module -avoid-version AM_CPPFLAGS = $(LTNOPIC) $(INSTRUMENT) $(FFMPEG_CFLAGS) Index: avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFVideoEncoder.cpp =================================================================== --- avifile-0.7.48~20090503.ds.orig/plugins/libffmpeg/FFVideoEncoder.cpp 2009-04-05 04:49:32.000000000 +0800 +++ avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFVideoEncoder.cpp 2012-12-08 12:22:00.218823539 +0800 @@ -122,7 +122,7 @@ if (!m_pAvContext) { - m_pAvContext = avcodec_alloc_context(); + m_pAvContext = avcodec_alloc_context3(NULL); m_pAvContext->width = m_bh.biWidth; m_pAvContext->height = m_obh.biHeight; //m_pAvContext->pix_fmt = PIX_FMT_YUV420P; @@ -138,7 +138,7 @@ printf("CODEC opening %dx%d\n", m_bh.biWidth, m_obh.biHeight); - if (avcodec_open(m_pAvContext, m_pAvCodec) < 0) + if (avcodec_open2(m_pAvContext, m_pAvCodec, NULL) < 0) { free(m_pAvContext); m_pAvContext = 0; Index: avifile-0.7.48~20090503.ds/lib/aviread/FFReadStream.cpp =================================================================== --- avifile-0.7.48~20090503.ds.orig/lib/aviread/FFReadStream.cpp 2012-12-08 12:12:11.000000000 +0800 +++ avifile-0.7.48~20090503.ds/lib/aviread/FFReadStream.cpp 2012-12-08 12:22:00.218823539 +0800 @@ -62,12 +62,12 @@ //printf("CODECRA %d %d %d\n", avs->codec->frame_rate, avs->codec->frame_rate_base, avs->r_frame_rate_base); if (0 && avs->codec->codec_id == CODEC_ID_MPEG1VIDEO) { - m_pAvContext = avcodec_alloc_context(); + m_pAvContext = avcodec_alloc_context3(NULL); //AVCodec* codec = avcodec_find_encoder(avs->codec->codec_id); if (m_pAvContext) { AVCodec* codec = avcodec_find_decoder(avs->codec->codec_id); - if (codec && avcodec_open(m_pAvContext, codec) == 0) + if (codec && avcodec_open2(m_pAvContext, codec, NULL) == 0) { m_pAvContext->flags |= CODEC_FLAG_TRUNCATED; m_pAvContext->skip_frame = AVDISCARD_NONKEY;
signature.asc
Description: OpenPGP digital signature

