diff -Nru avifile-0.7.48~20090503.ds/debian/changelog avifile-0.7.48~20090503.ds/debian/changelog --- avifile-0.7.48~20090503.ds/debian/changelog 2020-09-29 19:28:20.000000000 +0000 +++ avifile-0.7.48~20090503.ds/debian/changelog 2022-04-04 22:49:17.000000000 +0000 @@ -1,3 +1,29 @@ +avifile (1:0.7.48~20090503.ds-25) unstable; urgency=low + + * Fix autopkgtest fail on armhf: disable neon. (Closes: #1008752) + + -- Ying-Chun Liu (PaulLiu) Tue, 05 Apr 2022 06:49:17 +0800 + +avifile (1:0.7.48~20090503.ds-24) unstable; urgency=low + + * Fix autopkgtest fail on s390x: endian conversion. + + -- Ying-Chun Liu (PaulLiu) Tue, 05 Apr 2022 00:45:36 +0800 + +avifile (1:0.7.48~20090503.ds-23) unstable; urgency=low + + * Fix autopkgtest fail by adding g++ and pkg-config to depends. + + -- Ying-Chun Liu (PaulLiu) Sat, 19 Mar 2022 04:07:19 +0800 + +avifile (1:0.7.48~20090503.ds-22) unstable; urgency=low + + * Add debian/patches/ffmpeg5.0.patch: (Closes: #1004790) + - ported to ffmpeg5.0 (Closes: #1004789) + * Add autopkgtest for testing the decoding. + + -- Ying-Chun Liu (PaulLiu) Fri, 18 Mar 2022 18:19:49 +0800 + avifile (1:0.7.48~20090503.ds-21) unstable; urgency=low [ Ying-Chun Liu (PaulLiu) ] diff -Nru avifile-0.7.48~20090503.ds/debian/control avifile-0.7.48~20090503.ds/debian/control --- avifile-0.7.48~20090503.ds/debian/control 2020-09-29 19:28:20.000000000 +0000 +++ avifile-0.7.48~20090503.ds/debian/control 2022-03-18 09:56:48.000000000 +0000 @@ -8,10 +8,10 @@ dh-exec, liba52-dev, libavformat-dev (>= 6:10~), - libswresample-dev (>= 6:10~), libjpeg-dev, libogg-dev, libsdl1.2-dev, + libswresample-dev (>= 6:10~), libtool, libvorbis-dev, libxft-dev, @@ -43,7 +43,9 @@ Package: libavifile-0.7c2 Architecture: any Pre-Depends: ${misc:Pre-Depends} -Depends: libavifile-0.7-common (>= ${source:Version}), ${misc:Depends}, ${shlibs:Depends} +Depends: libavifile-0.7-common (>= ${source:Version}), + ${misc:Depends}, + ${shlibs:Depends} Breaks: avifile-divx-plugin (<< 1:0.7.48~20090503.ds-5), avifile-mad-plugin (<< 1:0.7.48~20090503.ds-5), avifile-mjpeg-plugin (<< 1:0.7.48~20090503.ds-5), @@ -85,7 +87,9 @@ Architecture: any Section: misc Pre-Depends: ${misc:Pre-Depends} -Depends: libavifile-0.7-common (>= ${source:Version}), ${misc:Depends}, ${shlibs:Depends} +Depends: libavifile-0.7-common (>= ${source:Version}), + ${misc:Depends}, + ${shlibs:Depends} Replaces: libavifile-0.7c2 (<< 1:0.7.48~20090503.ds-10) Conflicts: libavifile-0.7c2 (<< 1:0.7.48~20090503.ds-10) Description: toolkit for libavifile diff -Nru avifile-0.7.48~20090503.ds/debian/patches/ffmpeg5.0.patch avifile-0.7.48~20090503.ds/debian/patches/ffmpeg5.0.patch --- avifile-0.7.48~20090503.ds/debian/patches/ffmpeg5.0.patch 1970-01-01 00:00:00.000000000 +0000 +++ avifile-0.7.48~20090503.ds/debian/patches/ffmpeg5.0.patch 2022-03-18 10:19:49.000000000 +0000 @@ -0,0 +1,533 @@ +Description: Port to ffmpeg 5.0 + Just forward ported to ffmpeg5.0 to fix FTBFS. +Author: Ying-Chun Liu (PaulLiu) +Bug-Debian: http://bugs.debian.org/1004789 +Last-Update: 2022-03-18 +Index: avifile-0.7.48~20090503.ds/configure.in +=================================================================== +--- avifile-0.7.48~20090503.ds.orig/configure.in ++++ avifile-0.7.48~20090503.ds/configure.in +@@ -825,7 +825,7 @@ dnl ======================= + AM_PATH_FFMPEG + + tmp_LIBS="$LIBS" +-AC_CHECK_LIB([avcodec], [avcodec_register_all], [], ++AC_CHECK_LIB([avcodec], [avcodec_version], [], + [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 ++++ avifile-0.7.48~20090503.ds/lib/codeckeeper.cpp +@@ -294,7 +294,6 @@ static void plugin_fill() + audio_codecs.clear(); + + // FFMPEG initialization +- avcodec_register_all(); + + uncompressed_FillPlugins(video_codecs); + +Index: avifile-0.7.48~20090503.ds/plugins/libffmpeg/fillplugins.h +=================================================================== +--- avifile-0.7.48~20090503.ds.orig/plugins/libffmpeg/fillplugins.h ++++ avifile-0.7.48~20090503.ds/plugins/libffmpeg/fillplugins.h +@@ -28,7 +28,7 @@ struct FCodec { + + }; + +-static void libffmpeg_get_attr(avm::vector& a, AVCodec* codec) ++static void libffmpeg_get_attr(avm::vector& a, const AVCodec* codec) + { + if (!codec) + return; +Index: avifile-0.7.48~20090503.ds/lib/aviread/FFReadHandler.cpp +=================================================================== +--- avifile-0.7.48~20090503.ds.orig/lib/aviread/FFReadHandler.cpp ++++ avifile-0.7.48~20090503.ds/lib/aviread/FFReadHandler.cpp +@@ -3,6 +3,7 @@ + #include "avm_output.h" + + #include "avm_avformat.h" ++#include "avm_avcodec.h" + + #include + #include +@@ -24,7 +25,7 @@ public: + virtual ~AVStreamPacket() { + if (memory) + { +- av_free_packet(&packet); ++ av_packet_unref(&packet); + memory = 0; + } + } +@@ -46,7 +47,6 @@ FFReadHandler::FFReadHandler() + + if (!g_iInitilized) + { +- av_register_all(); + g_iInitilized++; + } + } +@@ -88,8 +88,10 @@ int FFReadHandler::Init(const char* url) + m_Streams.resize(m_pContext->nb_streams); + for (unsigned i = 0; i < m_pContext->nb_streams; ++i) + { +- AVCodecContext* avc = m_pContext->streams[i]->codec; +- AVCodec* codec = avcodec_find_decoder(avc->codec_id); ++ AVCodecParameters* avp = m_pContext->streams[i]->codecpar; ++ const AVCodec* codec = avcodec_find_decoder(avp->codec_id); ++ AVCodecContext* avc = avcodec_alloc_context3(codec); ++ avcodec_parameters_to_context(avc, avp); + AVM_WRITE("FF reader", "S: %d %s CodecID:%x bitrate:%d (%d) samplerate:%d chn:%d framerate:%d/%d wxh %dx%d %d/%d\n", + i, codec ? codec->name : "", avc->codec_id, avc->bit_rate, avc->bit_rate_tolerance, + avc->sample_rate, avc->channels, avc->time_base.num, avc->time_base.den, +@@ -127,7 +129,7 @@ IMediaReadStream* FFReadHandler::GetStre + + for (unsigned i = 0; i < m_pContext->nb_streams; ++i) + { +- if (m_pContext->streams[i]->codec->codec_type == t) ++ if (m_pContext->streams[i]->codecpar->codec_type == t) + { + if (cnt == stream_id) + return m_Streams[i]; +@@ -151,7 +153,7 @@ size_t FFReadHandler::GetStreamCount(ISt + } + + for (unsigned i = 0; i < m_pContext->nb_streams; ++i) +- if (m_pContext->streams[i]->codec->codec_type == t) ++ if (m_pContext->streams[i]->codecpar->codec_type == t) + cnt++; + return cnt; + } +@@ -239,7 +241,7 @@ int FFReadHandler::readPacket() + //else printf("Bitrate %d\n", ast->codec.bit_rate); + //printf("TIMESTAMP %" PRId64 " pts: %" PRId64 " dts: %" PRId64 "\n", p->timestamp, pkt.pts, pkt.dts); + +- switch (ast.codec->codec_type) ++ switch (ast.codecpar->codec_type) + { + case AVMEDIA_TYPE_AUDIO: + s.m_uiPosition += pkt.size; +Index: avifile-0.7.48~20090503.ds/lib/aviread/FFReadStream.cpp +=================================================================== +--- avifile-0.7.48~20090503.ds.orig/lib/aviread/FFReadStream.cpp ++++ avifile-0.7.48~20090503.ds/lib/aviread/FFReadStream.cpp +@@ -5,6 +5,7 @@ + #include "utils.h" + + #include "avm_avformat.h" ++#include "avm_avcodec.h" + + #include + #include +@@ -60,13 +61,13 @@ FFReadStream::FFReadStream(FFReadHandler + AVM_WRITE("FF stream", "Starttime:%" PRId64 " Duration:%fs\n", m_StartTime, m_dLength); + //printf("codec %d %.4s\n", avs->codec->codec_id, &avs->codec->codec_tag); + //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 == AV_CODEC_ID_MPEG1VIDEO) ++ if (0 && avs->codecpar->codec_id == AV_CODEC_ID_MPEG1VIDEO) + { + 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); ++ const AVCodec* codec = avcodec_find_decoder(avs->codecpar->codec_id); + if (codec && avcodec_open2(m_pAvContext, codec, NULL) == 0) + { + m_pAvContext->flags |= AV_CODEC_FLAG_TRUNCATED; +@@ -155,30 +156,30 @@ StreamInfo* FFReadStream::GetStreamInfo( + m_StreamInfo.m_p->m_iQuality = 0; + m_StreamInfo.m_p->m_iSampleSize = 1;//m_Header.dwSampleSize; + +- switch (avs->codec->codec_type) ++ switch (avs->codecpar->codec_type) + { + case AVMEDIA_TYPE_AUDIO: +- m_StreamInfo.m_p->setAudio(avs->codec->channels, +- avs->codec->sample_rate, +- avs->codec->frame_bits); ++ m_StreamInfo.m_p->setAudio(avs->codecpar->channels, ++ avs->codecpar->sample_rate, ++ avs->codecpar->frame_size); + m_StreamInfo.m_p->m_Type = StreamInfo::Audio; +- m_StreamInfo.m_p->m_uiFormat = avs->codec->codec_tag; ++ m_StreamInfo.m_p->m_uiFormat = avs->codecpar->codec_tag; + AVM_WRITE("FF stream", "Audio Format: %.4s (0x%x)\n", +- (const char*)&avs->codec->codec_tag, avs->codec->codec_tag); ++ (const char*)&avs->codecpar->codec_tag, avs->codecpar->codec_tag); + break; + case AVMEDIA_TYPE_VIDEO: +- m_StreamInfo.m_p->setVideo(avs->codec->width, avs->codec->height, +- 0, (float)avs->codec->sample_aspect_ratio.num / +- (float)avs->codec->sample_aspect_ratio.den); ++ m_StreamInfo.m_p->setVideo(avs->codecpar->width, avs->codecpar->height, ++ 0, (float)avs->codecpar->sample_aspect_ratio.num / ++ (float)avs->codecpar->sample_aspect_ratio.den); + m_StreamInfo.m_p->m_Type = StreamInfo::Video; +- m_StreamInfo.m_p->m_uiFormat = avs->codec->codec_tag; ++ m_StreamInfo.m_p->m_uiFormat = avs->codecpar->codec_tag; + AVM_WRITE("FF stream", "Codec tag format %.4s\n", (char*) &m_StreamInfo.m_p->m_uiFormat); + break; + default: + return 0; + } + if (m_StreamInfo.m_p->m_uiFormat == 0) { +- m_StreamInfo.m_p->m_uiFormat = get_fcc(avs->codec->codec_id); ++ m_StreamInfo.m_p->m_uiFormat = get_fcc(avs->codecpar->codec_id); + + if (m_StreamInfo.m_p->m_uiFormat == 0) + AVM_WRITE("FF stream", "StreamInfo extension neeeded\n"); +@@ -203,7 +204,7 @@ size_t FFReadStream::GetSampleSize() con + + IStream::StreamType FFReadStream::GetType() const + { +- switch (m_pHandler->m_pContext->streams[m_uiSId]->codec->codec_type) ++ switch (m_pHandler->m_pContext->streams[m_uiSId]->codecpar->codec_type) + { + case AVMEDIA_TYPE_AUDIO: return IStream::Audio; + case AVMEDIA_TYPE_VIDEO: return IStream::Video; +@@ -215,8 +216,8 @@ size_t FFReadStream::GetFormat(void *for + { + AVStream* avs = m_pHandler->m_pContext->streams[m_uiSId]; + +- int tag = get_fcc(avs->codec->codec_id); +- switch (avs->codec->codec_type) ++ int tag = get_fcc(avs->codecpar->codec_id); ++ switch (avs->codecpar->codec_type) + { + case AVMEDIA_TYPE_AUDIO: + if (format && size >= sizeof(WAVEFORMATEX)) +@@ -230,7 +231,7 @@ size_t FFReadStream::GetFormat(void *for + // using extension - there is no free place in original WAVEFORMATEX + wfx.wFormatTag = WAVE_FORMAT_EXTENSIBLE; + avm_set_le32(&ffwfx.wfex.SubFormat.f1, CodecInfo::FFMPEG); +- avm_set_le32(&ffwfx.dwCodecID, avs->codec->codec_id); ++ avm_set_le32(&ffwfx.dwCodecID, avs->codecpar->codec_id); + } else { + memset(&wfx, 0, sizeof(wfx)); + wfx.wFormatTag = (uint16_t)tag; +@@ -238,21 +239,21 @@ size_t FFReadStream::GetFormat(void *for + + //if (avs->codec->codec_tag == 0) wf->wFormatTag = av_codec_get_fourcc(avs->codec->codec_id); + //printf("CODEC %x %x %x\n", wf.wFormatTag, avs->codec->codec_id, avs->codec->codec_tag); +- wfx.nChannels = (uint16_t)avs->codec->channels; +- wfx.nSamplesPerSec = avs->codec->sample_rate; +- wfx.nAvgBytesPerSec = avs->codec->bit_rate / 8; +- //printf("SAMP:%d AVGBYTES:%d ALIGN:%d BITS:%d\n", avs->codec->sample_rate, avs->codec->bit_rate, avs->codec->block_align, avs->codec->bits_per_coded_sample); +- wfx.nBlockAlign = (uint16_t)avs->codec->block_align; +- wfx.wBitsPerSample = (uint16_t)avs->codec->bits_per_coded_sample; ++ wfx.nChannels = (uint16_t)avs->codecpar->channels; ++ wfx.nSamplesPerSec = avs->codecpar->sample_rate; ++ wfx.nAvgBytesPerSec = avs->codecpar->bit_rate / 8; ++ //printf("SAMP:%d AVGBYTES:%d ALIGN:%d BITS:%d\n", avs->codec->sample_rate, avs->codec->bit_rate, avs->codecpar->block_align, avs->codec->bits_per_coded_sample); ++ wfx.nBlockAlign = (uint16_t)avs->codecpar->block_align; ++ wfx.wBitsPerSample = (uint16_t)avs->codecpar->bits_per_coded_sample; + wfx.cbSize = tag ? 0 : sizeof(FFMPEGWAVEFORMATEX) - sizeof(WAVEFORMATEX); +- if (avs->codec->extradata +- && size >= (sizeof(WAVEFORMATEX) + wfx.cbSize + avs->codec->extradata_size)) ++ if (avs->codecpar->extradata ++ && size >= (sizeof(WAVEFORMATEX) + wfx.cbSize + avs->codecpar->extradata_size)) + { +- memcpy((uint8_t*)(&wfx + 1) + wfx.cbSize, avs->codec->extradata, avs->codec->extradata_size); +- wfx.cbSize = (uint16_t)(wfx.cbSize + avs->codec->extradata_size); ++ memcpy((uint8_t*)(&wfx + 1) + wfx.cbSize, avs->codecpar->extradata, avs->codecpar->extradata_size); ++ wfx.cbSize = (uint16_t)(wfx.cbSize + avs->codecpar->extradata_size); + } + +- if (avs->codec->codec_id == AV_CODEC_ID_AAC) { ++ if (avs->codecpar->codec_id == AV_CODEC_ID_AAC) { + // hmm currenly hack - ffmpeg seems to fail properly detect this stream + wfx.nChannels = 2; + wfx.nSamplesPerSec = 44100; +@@ -263,7 +264,7 @@ size_t FFReadStream::GetFormat(void *for + ///printf("AUDIO %d %x %x %d\n", avs->codec->extradata_size, wf->wFormatTag, avs->codec->codec_tag, avs->codec->codec_id); + } + return (tag ? sizeof(WAVEFORMATEX) : sizeof(FFMPEGWAVEFORMATEX)) +- + ((avs->codec->extradata) ? avs->codec->extradata_size : 0); ++ + ((avs->codecpar->extradata) ? avs->codecpar->extradata_size : 0); + case AVMEDIA_TYPE_VIDEO: + if (format && size >= sizeof(BITMAPINFOHEADER)) + { +@@ -271,28 +272,28 @@ size_t FFReadStream::GetFormat(void *for + BITMAPINFOHEADER& bih = *(BITMAPINFOHEADER*)format; + //printf("FORMAT %p %d %d\n", format, m_uiSId, avc->width); + bih.biSize = sizeof(BITMAPINFOHEADER); +- bih.biWidth = avs->codec->width; +- bih.biHeight = avs->codec->height; ++ bih.biWidth = avs->codecpar->width; ++ bih.biHeight = avs->codecpar->height; + bih.biPlanes = 1; +- bih.biCompression = get_fcc(avs->codec->codec_id); +- bih.biBitCount = (uint16_t)avs->codec->bits_per_coded_sample; ++ bih.biCompression = get_fcc(avs->codecpar->codec_id); ++ bih.biBitCount = (uint16_t)avs->codecpar->bits_per_coded_sample; + // hack which might be eventually usefull + //memcpy(&bih->biXPelsPerMeter, &m_pHandler->m_pContext, sizeof(void*)); + if (!bih.biCompression) { + bih.biCompression = CodecInfo::FFMPEG; +- bih.biSizeImage = avs->codec->codec_id; ++ bih.biSizeImage = avs->codecpar->codec_id; + } +- if (avs->codec->extradata && size >= (sizeof(BITMAPINFOHEADER) + avs->codec->extradata_size)) ++ if (avs->codecpar->extradata && size >= (sizeof(BITMAPINFOHEADER) + avs->codecpar->extradata_size)) + { +- bih.biSize += avs->codec->extradata_size; +- memcpy(&bih + 1, avs->codec->extradata, avs->codec->extradata_size); ++ bih.biSize += avs->codecpar->extradata_size; ++ memcpy(&bih + 1, avs->codecpar->extradata, avs->codecpar->extradata_size); + //printf("COPY EXTRA %d\n", avs->extradata_size); + //for (unsigned i = 0; i < size; i++) printf("%d 0x%x\n", i, ((uint8_t*)format)[i]); + } + //BitmapInfo(*bih).Print(); + } + return sizeof(BITMAPINFOHEADER) +- + ((avs->codec->extradata) ? avs->codec->extradata_size : 0); ++ + ((avs->codecpar->extradata) ? avs->codecpar->extradata_size : 0); + default: + return 0; + } +@@ -354,7 +355,7 @@ int FFReadStream::SeekTime(double time) + return m_pHandler->seek(time); + if (time < 1.) + { +- if (m_pAvStream->codec->codec_type == AVMEDIA_TYPE_AUDIO) ++ if (m_pAvStream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) + // check if more streams are available + // and seek only with the video + return 0; +Index: avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFVideoDecoder.cpp +=================================================================== +--- avifile-0.7.48~20090503.ds.orig/plugins/libffmpeg/FFVideoDecoder.cpp ++++ avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFVideoDecoder.cpp +@@ -25,7 +25,7 @@ typedef struct BufferData_ { + + AVM_BEGIN_NAMESPACE; + +-FFVideoDecoder::FFVideoDecoder(AVCodec* av, const CodecInfo& info, const BITMAPINFOHEADER& bh, int flip) ++FFVideoDecoder::FFVideoDecoder(const AVCodec* av, const CodecInfo& info, const BITMAPINFOHEADER& bh, int flip) + :IVideoDecoder(info, bh), m_pAvCodec(av), m_pAvContext(0), + m_Caps((CAPS)(CAP_YV12 | CAP_ALIGN16)), m_uiBuffers(0), m_bRestart(true), + m_Order(20), m_pImg(0), m_bUsed(false) +@@ -38,7 +38,7 @@ FFVideoDecoder::FFVideoDecoder(AVCodec* + if (0 && m_pFormat->biCompression == fccHFYU) + { + // for now disabled +- m_pAvCodec->capabilities &= ~(AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1); ++ //m_pAvCodec->capabilities &= ~(AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1); + AVM_WRITE(m_Info.GetPrivateName(), "if you have troubles - use Win32 codec instead\n"); + m_Caps = (CAPS) (m_Caps | CAP_YUY2); + } +@@ -314,12 +314,22 @@ int FFVideoDecoder::DecodeFrame(CImage* + + pic = av_frame_alloc(); + +-#ifdef HAVE_AVCODEC_DECODE_VIDEO2 +- int hr = avcodec_decode_video2(m_pAvContext, pic, &got_picture, &avpkt); +-#else +- int hr = avcodec_decode_video(m_pAvContext, pic, &got_picture, avpkt.data, +- avpkt.size); +-#endif ++ int hr=0; ++ //int hr = avcodec_decode_video2(m_pAvContext, pic, &got_picture, &avpkt); ++ hr = avcodec_send_packet(m_pAvContext, &avpkt); ++ if (hr < 0) { ++ printf("video error: sending a packet for decoding."); ++ return -1; ++ } ++ hr = avcodec_receive_frame(m_pAvContext, pic); ++ if (hr == AVERROR(EAGAIN) || hr == AVERROR_EOF) { ++ printf("video error: again or EOF\n"); ++ } else if (hr < 0) { ++ printf("video error: decoding error\n"); ++ return -1; ++ } else { ++ got_picture = 1; ++ } + //printf("DECFF got_picture %d %p del:%d hr:%d size:%d\n", got_picture, src, m_pAvContext->delay, hr, size); + //printf("PictType %d\n", m_pAvContext->pict_type); + //static int ctr=0; printf("WIDTH %dx%d %d r:%d\n", m_pAvContext->width, m_pAvContext->height, ctr++, m_pAvContext->pict_type); +Index: avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFAudioDecoder.cpp +=================================================================== +--- avifile-0.7.48~20090503.ds.orig/plugins/libffmpeg/FFAudioDecoder.cpp ++++ avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFAudioDecoder.cpp +@@ -5,7 +5,7 @@ + + AVM_BEGIN_NAMESPACE; + +-FFAudioDecoder::FFAudioDecoder(AVCodec* av, const CodecInfo& info, const WAVEFORMATEX* wf) ++FFAudioDecoder::FFAudioDecoder(const AVCodec* av, const CodecInfo& info, const WAVEFORMATEX* wf) + :IAudioDecoder(info, wf), m_pAvCodec(av), m_pAvContext(0), avr(NULL) + { + } +@@ -68,7 +68,20 @@ int FFAudioDecoder::Convert(const void* + avpkt.size = (int)in_size; + + int got_output; +- int hr = avcodec_decode_audio4(m_pAvContext, frame, &got_output, &avpkt); ++ int hr = 0; ++ //int hr = avcodec_decode_audio4(m_pAvContext, frame, &got_output, &avpkt); ++ hr = avcodec_send_packet(m_pAvContext, &avpkt); ++ if (hr < 0) { ++ printf("audio error: sending a packet for decoding.\n"); ++ return -1; ++ } ++ hr = avcodec_receive_frame(m_pAvContext, frame); ++ if (hr != 0) { ++ printf("audio decode error\n"); ++ return -1; ++ } else { ++ got_output = 1; ++ } + + if (size_read) + *size_read = (hr < 0) ? 1 : hr; +Index: avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFVideoEncoder.cpp +=================================================================== +--- avifile-0.7.48~20090503.ds.orig/plugins/libffmpeg/FFVideoEncoder.cpp ++++ avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFVideoEncoder.cpp +@@ -5,7 +5,7 @@ + + AVM_BEGIN_NAMESPACE; + +-static void libffmpeg_set_attr(avm::vector& a, AVCodec* codec) ++static void libffmpeg_set_attr(avm::vector& a, const AVCodec* codec) + { + if (!codec) + return; +@@ -103,7 +103,7 @@ static void libffmpeg_set_attr(avm::vect + } + + +-FFVideoEncoder::FFVideoEncoder(AVCodec* av, const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& bh) ++FFVideoEncoder::FFVideoEncoder(const AVCodec* av, const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& bh) + :IVideoEncoder(info), m_pAvCodec(av), m_pAvContext(0), m_Caps(CAP_YV12), + m_bh(bh), m_obh(bh) + { +@@ -228,12 +228,25 @@ int FFVideoEncoder::EncodeFrame(const CI + pkt.size = GetOutputSize(); + + int got_output; +- int ret = avcodec_encode_video2(m_pAvContext, &pkt, &f, &got_output); ++ int ret = 0; ++ //int ret = avcodec_encode_video2(m_pAvContext, &pkt, &f, &got_output); ++ ret = avcodec_send_frame(m_pAvContext, &f); ++ if (ret < 0) { ++ printf ("video error: sending packet for encoder\n"); ++ return -1; ++ } ++ ret = avcodec_receive_packet(m_pAvContext, &pkt); ++ if (ret < 0) { ++ printf ("video error: encoding error\n"); ++ return -1; ++ } else { ++ got_output = 1; ++ } + //printf("ECDING FF size %d\n", rsize); + if (size) + *size = pkt.size; + if (is_keyframe) { +- *is_keyframe = m_pAvContext->coded_frame->key_frame ? 16 : 0; ++ *is_keyframe = (pkt.flags | AV_PKT_FLAG_KEY) ? 16 : 0; + //printf("KEYFRAME %d\n", *is_keyframe); + } + if (conv) +Index: avifile-0.7.48~20090503.ds/plugins/libffmpeg/libffmpeg.cpp +=================================================================== +--- avifile-0.7.48~20090503.ds.orig/plugins/libffmpeg/libffmpeg.cpp ++++ avifile-0.7.48~20090503.ds/plugins/libffmpeg/libffmpeg.cpp +@@ -136,7 +136,7 @@ protected: + + static IVideoEncoder* ffmpeg_CreateVideoEncoder(const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& bh) + { +- AVCodec* av = avcodec_find_encoder_by_name(info.dll.c_str()); ++ const AVCodec* av = avcodec_find_encoder_by_name(info.dll.c_str()); + if (av) + { + switch (bh.biCompression) +@@ -160,7 +160,7 @@ static IVideoEncoder* ffmpeg_CreateVideo + static IVideoDecoder* ffmpeg_CreateVideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& bh, int flip) + { + AVM_WRITE("FFMPEG video decoder", "looking for %s %d\n", info.dll.c_str(), bh.biSizeImage); +- AVCodec* av = (bh.biCompression == CodecInfo::FFMPEG) ++ const AVCodec* av = (bh.biCompression == CodecInfo::FFMPEG) + ? avcodec_find_decoder(AVCodecID(bh.biSizeImage)) : avcodec_find_decoder_by_name(info.dll.c_str()); + if (av) + return new FFVideoDecoder(av, info, bh, flip); +@@ -174,7 +174,7 @@ static IAudioDecoder* ffmpeg_CreateAudio + + AVM_WRITE("FFMPEG video decoder", "looking for %s %x\n", info.dll.c_str(), fmt->wFormatTag); + +- AVCodec* av = (fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE ++ const AVCodec* av = (fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE + && avm_get_le32(&ffwfe.wfex.SubFormat.f1) == CodecInfo::FFMPEG) + ? avcodec_find_decoder(AVCodecID(avm_get_le32(&ffwfe.dwCodecID))) : + avcodec_find_decoder_by_name(info.dll.c_str()); +Index: avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFAudioDecoder.h +=================================================================== +--- avifile-0.7.48~20090503.ds.orig/plugins/libffmpeg/FFAudioDecoder.h ++++ avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFAudioDecoder.h +@@ -15,7 +15,7 @@ AVM_BEGIN_NAMESPACE; + class FFAudioDecoder: public IAudioDecoder + { + static const uint_t MIN_AC3_CHUNK_SIZE = 16384; +- AVCodec *m_pAvCodec; ++ const AVCodec *m_pAvCodec; + AVCodecContext* m_pAvContext; + AVFrame *frame; + SwrContext *avr; +@@ -23,7 +23,7 @@ class FFAudioDecoder: public IAudioDecod + int resample_rate; + uint64_t resample_layout; + public: +- FFAudioDecoder(AVCodec*, const CodecInfo&, const WAVEFORMATEX*); ++ FFAudioDecoder(const AVCodec*, const CodecInfo&, const WAVEFORMATEX*); + ~FFAudioDecoder(); + virtual int Convert(const void*, size_t, void*, size_t, size_t*, size_t*); + virtual size_t GetMinSize() const; +Index: avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFVideoDecoder.h +=================================================================== +--- avifile-0.7.48~20090503.ds.orig/plugins/libffmpeg/FFVideoDecoder.h ++++ avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFVideoDecoder.h +@@ -14,7 +14,7 @@ AVM_BEGIN_NAMESPACE; + class FFVideoDecoder: public IVideoDecoder, public IRtConfig + { + public: +- FFVideoDecoder(AVCodec* av,const CodecInfo& info, const BITMAPINFOHEADER& format, int flip); ++ FFVideoDecoder(const AVCodec* av,const CodecInfo& info, const BITMAPINFOHEADER& format, int flip); + virtual ~FFVideoDecoder(); + virtual int DecodeFrame(CImage* pImage, const void* src, size_t size, + int is_keyframe, bool render = true, +@@ -30,7 +30,7 @@ public: + virtual int SetValue(const char* name, int value); + + protected: +- AVCodec *m_pAvCodec; ++ const AVCodec *m_pAvCodec; + AVCodecContext* m_pAvContext; + struct AVStream* m_pAvStream; + CAPS m_Caps; +Index: avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFVideoEncoder.h +=================================================================== +--- avifile-0.7.48~20090503.ds.orig/plugins/libffmpeg/FFVideoEncoder.h ++++ avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFVideoEncoder.h +@@ -11,7 +11,7 @@ AVM_BEGIN_NAMESPACE; + class FFVideoEncoder: public IVideoEncoder + { + public: +- FFVideoEncoder(AVCodec* av, const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& header); ++ FFVideoEncoder(const AVCodec* av, const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& header); + ~FFVideoEncoder(); + // + // Encodes single frame +@@ -43,7 +43,7 @@ public: + virtual float GetFps() const { return m_fFps; } + virtual int SetFps(float fps); + protected: +- AVCodec* m_pAvCodec; ++ const AVCodec* m_pAvCodec; + AVCodecContext* m_pAvContext; + + CAPS m_Caps; diff -Nru avifile-0.7.48~20090503.ds/debian/patches/series avifile-0.7.48~20090503.ds/debian/patches/series --- avifile-0.7.48~20090503.ds/debian/patches/series 2020-09-29 19:28:20.000000000 +0000 +++ avifile-0.7.48~20090503.ds/debian/patches/series 2022-03-18 09:15:45.000000000 +0000 @@ -15,3 +15,4 @@ port-to-gcc6.patch reproducible-build.patch ffmpeg4.0.patch +ffmpeg5.0.patch diff -Nru avifile-0.7.48~20090503.ds/debian/tests/control avifile-0.7.48~20090503.ds/debian/tests/control --- avifile-0.7.48~20090503.ds/debian/tests/control 1970-01-01 00:00:00.000000000 +0000 +++ avifile-0.7.48~20090503.ds/debian/tests/control 2022-04-04 22:19:58.000000000 +0000 @@ -0,0 +1,12 @@ +Tests: decoding-test-mp4-raw +Depends: dpkg-dev, + g++, + gstreamer1.0-libav, + gstreamer1.0-plugins-good, + gstreamer1.0-tools, + libaubio-dev, + libavutil-dev, + make, + pkg-config, + @ +Restrictions: allow-stderr diff -Nru avifile-0.7.48~20090503.ds/debian/tests/decoding-test-data/gentestavi.sh avifile-0.7.48~20090503.ds/debian/tests/decoding-test-data/gentestavi.sh --- avifile-0.7.48~20090503.ds/debian/tests/decoding-test-data/gentestavi.sh 1970-01-01 00:00:00.000000000 +0000 +++ avifile-0.7.48~20090503.ds/debian/tests/decoding-test-data/gentestavi.sh 2022-03-18 09:20:09.000000000 +0000 @@ -0,0 +1,13 @@ +#!/bin/sh + +gst-launch-1.0 videotestsrc num-buffers=250 ! \ + 'video/x-raw,format=(string)I420,width=320,height=240,framerate=(fraction)25/1' \ + ! avenc_mpeg4 ! queue ! mux. audiotestsrc num-buffers=440 ! audioconvert ! \ + 'audio/x-raw,rate=44100,channels=2' ! lamemp3enc ! queue ! mux. \ + avimux name=mux ! filesink location=test_mp3.avi + +gst-launch-1.0 videotestsrc num-buffers=250 ! \ + 'video/x-raw,format=(string)I420,width=320,height=240,framerate=(fraction)25/1' \ + ! avenc_mpeg4 ! queue ! mux. audiotestsrc num-buffers=440 ! audioconvert ! \ + 'audio/x-raw,rate=44100,channels=2' ! queue ! mux. \ + avimux name=mux ! filesink location=test_raw.avi diff -Nru avifile-0.7.48~20090503.ds/debian/tests/decoding-test-data/Makefile avifile-0.7.48~20090503.ds/debian/tests/decoding-test-data/Makefile --- avifile-0.7.48~20090503.ds/debian/tests/decoding-test-data/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ avifile-0.7.48~20090503.ds/debian/tests/decoding-test-data/Makefile 2022-04-04 21:56:59.000000000 +0000 @@ -0,0 +1,19 @@ + +all: test1 + +AVIFILE_LIBS=$(shell pkg-config --libs avifile) +AVIFILE_CFLAGS=$(shell pkg-config --cflags avifile) +AUBIO_LIBS=$(shell pkg-config --libs aubio) +AUBIO_CFLAGS=$(shell pkg-config --cflags aubio) +FFMPEG_LIBS=$(shell pkg-config --libs libavutil) +FFMPEG_CFLAGS=$(shell pkg-config --cflags libavutil) + +test1: test1.cc + g++ -Wall -g -o test1 test1.cc \ + $(AVIFILE_LIBS) $(AVIFILE_CFLAGS) \ + $(AUBIO_LIBS) $(AUBIO_CFLAGS) \ + $(FFMPEG_LIBS) $(FFMPEG_CFLAGS) \ + -lm + +clean: + rm -f test1 diff -Nru avifile-0.7.48~20090503.ds/debian/tests/decoding-test-data/test1.cc avifile-0.7.48~20090503.ds/debian/tests/decoding-test-data/test1.cc --- avifile-0.7.48~20090503.ds/debian/tests/decoding-test-data/test1.cc 1970-01-01 00:00:00.000000000 +0000 +++ avifile-0.7.48~20090503.ds/debian/tests/decoding-test-data/test1.cc 2022-04-04 22:15:21.000000000 +0000 @@ -0,0 +1,389 @@ + +/* C++ header */ +#include + +/* C header */ +#include +#include +#include +#include +#include + +#include + +/* UNIX header */ +#include + +/* ffmpeg */ +extern "C" { +#include +} + +/* AVIFILE header */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* AUBIO */ +#include +#include + +float getFreq(const char *audioBuf, int audioBufSize, int bitsPerSample, int channels, int sampleRate) { + int i; + int n=0; + float freq=0.0; + fvec_t *input; + fvec_t *out; + aubio_pitch_t *pitch1; + + freq = nanf(""); + if (audioBuf == NULL || audioBufSize <= 0) { + return freq; + } + + if (bitsPerSample == 32) { + n = audioBufSize / 4; + n = n / channels; + pitch1 = new_aubio_pitch ("default", n, n, sampleRate); + input = new_fvec(n); + out = new_fvec(1); + for (i = 0; iGetStream(0, avm::IStream::Video); + if (!videoStream) { + std::cerr << "Cannot get video stream" << std::endl; + return 4; + } + if (videoStream->StartStreaming() != 0) { + std::cerr << "Cannot decode video stream" << std::endl; + return 5; + } + + /* open audio stream */ + audioStream = file->GetStream(0, avm::IStream::Audio); + if (!audioStream) { + std::cerr << "Cannot get audio stream" << std::endl; + return 4; + } + if (audioStream->StartStreaming() != 0) { + std::cerr << "Cannot decode audio stream" << std::endl; + return 5; + } + + /* get information of video stream */ + videoStream->GetOutputFormat(&bh, sizeof(bh)); + std::cout << "bh.biHeight = " << bh.biHeight << ", " + << "bh.biWidth = " << bh.biWidth << std::endl; + if (bh.biHeight < 0) { + bh.biHeight = -bh.biHeight; + std::cout << "bh.biHeight < 0, correct the value to " + << bh.biHeight << std::endl; + } + std::cout << "Movie size: " << bh.biWidth << " x " << bh.biHeight + << " [" << ((char *)(&bh.biCompression)) << "]" << std::endl; + width = bh.biWidth; + height = bh.biHeight; + if (width <= 0 || height <= 0) { + return 6; + } + + /* get information of audio stream */ + audioStream->GetAudioDecoder()->GetOutputFormat(&wave_fmt); + std::cout << "audio format: " << wave_fmt.wFormatTag << ", " + << "Channels: " << wave_fmt.nChannels << ", " + << "Samples/sec: " << wave_fmt.nSamplesPerSec << ", " + << "Bits/Sample: " << wave_fmt.wBitsPerSample << ", " + << "Bytes/sec: " << wave_fmt.nAvgBytesPerSec + << std::endl; + if (wave_fmt.nChannels <= 0 || wave_fmt.nSamplesPerSec <= 0) { + return 6; + } + + /* video length */ + std::cout << "Video Length: " << videoStream->GetLength() << std::endl; + std::cout << "Video Pos: " << videoStream->GetPos() << std::endl; + + if (videoStream->GetLength() <= 0) { + return 7; + } + + /* audio length */ + std::cout << "Audio Length: " << audioStream->GetLength() << std::endl; + std::cout << "Audio Pos: " << audioStream->GetPos() << std::endl; + + if (audioStream->GetLength() <= 0) { + return 7; + } + + /* video format */ + videoStream->GetVideoFormat(&bhy, sizeof(bhy)); + caps = videoStream->GetVideoDecoder()->GetCapabilities(); + std::cout << "Decoder YUV capabilities: 0x" << std::hex << caps + << std::dec << std::endl; + if (caps & avm::IVideoDecoder::CAP_YUY2) { + fcc = fccYUY2; + std::cout << "CAPS is CAP_YUY2" << std::endl; + } else if (caps & avm::IVideoDecoder::CAP_YV12) { + fcc = fccYV12; + std::cout << "CAPS is CAP_YV12" << std::endl; + } else if (caps & avm::IVideoDecoder::CAP_UYVY) { + fcc = fccUYVY; + std::cout << "CAPS is CAP_UYVY" << std::endl; + } else { + std::cerr << "YUV format unsupported by decoder" << std::endl; + return 8; + } + + if (fcc) { + if (videoStream->GetVideoDecoder()->SetDestFmt(0, fcc)) { + std::cerr << "Error setting YUV decoder output" << std::endl; + return 9; + } + } + + /* decoding video/audio */ + videoStream->SetBuffering(4, 0); + while (!videoStream->Eof() || !audioStream->Eof()) { + avm::CImage* im; + uint8_t *pixelData; + + std::cout << "TIME " << videoStream->GetTime() << " " << videoStream->GetPos() << std::endl; + + if (!videoStream->Eof()) { + videoStream->ReadFrame(true); + im = videoStream->GetFrame(); + } else { + im = NULL; + } + if (im) { + if (im->Width() != width || im->Height() != height) { + std::cerr << "IMAGE " << im->Width() << " x " << im->Height() << std::endl; + return 10; + } + + avm::BitmapInfo bi1(im->Width(), im->Height(), 24); + bi1.SetRGB(); + avm::CImage imRGB(im, &bi1); + + if (imRGB.Width() != im->Width() || imRGB.Height() != im->Height()) { + std::cerr << "imRGB size (" << imRGB.Width() + << " x " << imRGB.Height() << ")" + << " != " << "im size (" << im->Width() + << " x " << im->Height() << ")" << std::endl; + return 11; + } + + if (imRGB.Bpp() != 3) { + std::cerr << "imRGB.Bpp() = " << imRGB.Bpp() + << " != 3" << std::endl; + return 12; + } + + if (imRGB.Depth() != 24) { + std::cerr << "imRGB.Depth() = " << imRGB.Depth() + << " != 24" << std::endl; + return 13; + } + + /* Test for frame no. 100 ~ 120 */ + if (100 <= videoStream->GetPos() && videoStream->GetPos() <= 120) { + /* check for Red */ + pixelData = imRGB.At(im->Width()*11/14,im->Height()*1/3); + if (!(pixelData[0] > 128 && pixelData[1] < 128 && pixelData[2] < 128)) { + std::cerr << "Red check failed at frame " << videoStream->GetPos() << std::endl; + return 14; + } + /* check for Green */ + pixelData = imRGB.At(im->Width()*7/14,im->Height()*1/3); + if (!(pixelData[0] < 128 && pixelData[1] > 128 && pixelData[2] < 128)) { + std::cerr << "Green check failed at frame " << videoStream->GetPos() << std::endl; + return 15; + } + /* check for Blue */ + pixelData = imRGB.At(im->Width()*13/14,im->Height()*1/3); + if (!(pixelData[0] < 128 && pixelData[1] < 128 && pixelData[2] > 128)) { + std::cerr << "Blue check failed at frame " << videoStream->GetPos() << std::endl; + return 16; + } + std::cout << "RGB check passed" << std::endl; + } + im->Release(); + } else { + std::cout << "Zero image!" << std::endl; + } + while (!audioStream->Eof() && (audioStream->GetTime() <= videoStream->GetTime() || videoStream->Eof()) ) { + size_t samples_read; + size_t bytes_read; + audioStream->ReadFrames(audioBuf, sizeof(audioBuf), 1024, samples_read, bytes_read); + std::cout << "Audio read " << samples_read << " samples, " + << bytes_read << " bytes." << std::endl; + + float freq; + freq = getFreq(audioBuf, bytes_read, wave_fmt.wBitsPerSample, wave_fmt.nChannels, wave_fmt.nSamplesPerSec); + std::cout << "Audio frequency " << freq << " hz" << std::endl; + if (350.0 <= freq && freq <= 500.0) { + audioCheckedFlag = true; + } + totalAudioSamplesRead += samples_read; + totalAudioBytesRead += bytes_read; + } + } + std::cout << "audio: totalAudioSamplesRead = " << totalAudioSamplesRead + << std::endl; + std::cout << "audio: totalAudioBytesRead = " << totalAudioBytesRead + << std::endl; + if (totalAudioSamplesRead != audioStream->GetLength()) { + std::cerr << "totalAudioSampleRead " << totalAudioSamplesRead + << " != " << audioStream->GetLength() << std::endl; + return 17; + } + if (!audioCheckedFlag) { + std::cerr << "Didn't detect audio track with 440 hz" << std::endl; + return 18; + } + std::cout << "Test Pass" << std::endl; + aubio_cleanup (); + return 0; + +} diff -Nru avifile-0.7.48~20090503.ds/debian/tests/decoding-test-mp4-raw avifile-0.7.48~20090503.ds/debian/tests/decoding-test-mp4-raw --- avifile-0.7.48~20090503.ds/debian/tests/decoding-test-mp4-raw 1970-01-01 00:00:00.000000000 +0000 +++ avifile-0.7.48~20090503.ds/debian/tests/decoding-test-mp4-raw 2022-04-04 22:16:17.000000000 +0000 @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e + +TEMP=${AUTOPKGTEST_TMP:-${TMPDIR:-$(mktemp -d)}} +TDIR=$(mktemp -d $TEMP/decoding1XXXXXX) + +# Prepare data +cp debian/tests/decoding-test-data/* "$TDIR" +cd "$TDIR" + +./gentestavi.sh + +# Compile test +make + +# Run test +eval $(dpkg-architecture) +export DEB_BUILD_ARCH +./test1 ./test_raw.avi