[ffms2] fix
by Leigh Scott
commit dd53d9e9790ed70a4d2472b7038997076fc0952a
Author: Leigh Scott <leigh123linux(a)gmail.com>
Date: Sat Nov 13 19:46:50 2021 +0000
fix
45673149e9a2f5586855ad472e3059084eaa36b1.patch | 79 +++++++
586d87de3f896d0c4ff01b21f572375e11f9c3f1.patch | 27 +++
96cbf38ea9381829a1314f432a2c60495dcefaad.patch | 311 +++++++++++++++++++++++++
ffms2.spec | 11 +-
4 files changed, 426 insertions(+), 2 deletions(-)
---
diff --git a/45673149e9a2f5586855ad472e3059084eaa36b1.patch b/45673149e9a2f5586855ad472e3059084eaa36b1.patch
new file mode 100644
index 0000000..e144ef7
--- /dev/null
+++ b/45673149e9a2f5586855ad472e3059084eaa36b1.patch
@@ -0,0 +1,79 @@
+From 45673149e9a2f5586855ad472e3059084eaa36b1 Mon Sep 17 00:00:00 2001
+From: Derek Buitenhuis <derek.buitenhuis(a)gmail.com>
+Date: Tue, 4 May 2021 14:41:21 +0100
+Subject: [PATCH] Use auto for AVCodec
+
+The geniuses over at FFmpeg decided to constify this API, so old
+versions of the library will return AVCodec *, while new versions
+of the libary will return const AVCodec *, which, in C++, are not
+OK to convert between.
+
+Rather than use some macro hell in ffmscompat.h, we can work around
+this by using auto.
+
+Gross.
+
+Signed-off-by: Derek Buitenhuis <derek.buitenhuis(a)gmail.com>
+---
+ src/core/audiosource.cpp | 2 +-
+ src/core/indexing.cpp | 6 +++---
+ src/core/videosource.cpp | 2 +-
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/core/audiosource.cpp b/src/core/audiosource.cpp
+index e4ce97cdb..ac0966636 100644
+--- a/src/core/audiosource.cpp
++++ b/src/core/audiosource.cpp
+@@ -469,7 +469,7 @@ void FFMS_AudioSource::OpenFile() {
+
+ LAVFOpenFile(SourceFile.c_str(), FormatContext, TrackNumber);
+
+- AVCodec *Codec = avcodec_find_decoder(FormatContext->streams[TrackNumber]->codecpar->codec_id);
++ auto *Codec = avcodec_find_decoder(FormatContext->streams[TrackNumber]->codecpar->codec_id);
+ if (Codec == nullptr)
+ throw FFMS_Exception(FFMS_ERROR_DECODING, FFMS_ERROR_CODEC,
+ "Audio codec not found");
+diff --git a/src/core/indexing.cpp b/src/core/indexing.cpp
+index e547c5abf..59fb4e8ea 100644
+--- a/src/core/indexing.cpp
++++ b/src/core/indexing.cpp
+@@ -384,7 +384,7 @@ FFMS_TrackType FFMS_Indexer::GetTrackType(int Track) {
+ }
+
+ const char *FFMS_Indexer::GetTrackCodec(int Track) {
+- AVCodec *codec = avcodec_find_decoder(FormatContext->streams[Track]->codecpar->codec_id);
++ auto *codec = avcodec_find_decoder(FormatContext->streams[Track]->codecpar->codec_id);
+ return codec ? codec->name : nullptr;
+ }
+
+@@ -402,7 +402,7 @@ FFMS_Index *FFMS_Indexer::DoIndexing() {
+ UseDTS);
+
+ if (IndexMask.count(i) && FormatContext->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
+- AVCodec *VideoCodec = avcodec_find_decoder(FormatContext->streams[i]->codecpar->codec_id);
++ auto *VideoCodec = avcodec_find_decoder(FormatContext->streams[i]->codecpar->codec_id);
+ if (!VideoCodec) {
+ FormatContext->streams[i]->discard = AVDISCARD_ALL;
+ IndexMask.erase(i);
+@@ -433,7 +433,7 @@ FFMS_Index *FFMS_Indexer::DoIndexing() {
+ IndexMask.insert(i);
+ }
+ } else if (IndexMask.count(i) && FormatContext->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
+- AVCodec *AudioCodec = avcodec_find_decoder(FormatContext->streams[i]->codecpar->codec_id);
++ auto *AudioCodec = avcodec_find_decoder(FormatContext->streams[i]->codecpar->codec_id);
+ if (AudioCodec == nullptr)
+ throw FFMS_Exception(FFMS_ERROR_CODEC, FFMS_ERROR_UNSUPPORTED,
+ "Audio codec not found");
+diff --git a/src/core/videosource.cpp b/src/core/videosource.cpp
+index b889970e2..8956c2256 100644
+--- a/src/core/videosource.cpp
++++ b/src/core/videosource.cpp
+@@ -171,7 +171,7 @@ FFMS_VideoSource::FFMS_VideoSource(const char *SourceFile, FFMS_Index &Index, in
+
+ LAVFOpenFile(SourceFile, FormatContext, VideoTrack);
+
+- AVCodec *Codec = avcodec_find_decoder(FormatContext->streams[VideoTrack]->codecpar->codec_id);
++ auto *Codec = avcodec_find_decoder(FormatContext->streams[VideoTrack]->codecpar->codec_id);
+ if (Codec == nullptr)
+ throw FFMS_Exception(FFMS_ERROR_DECODING, FFMS_ERROR_CODEC,
+ "Video codec not found");
diff --git a/586d87de3f896d0c4ff01b21f572375e11f9c3f1.patch b/586d87de3f896d0c4ff01b21f572375e11f9c3f1.patch
new file mode 100644
index 0000000..6846346
--- /dev/null
+++ b/586d87de3f896d0c4ff01b21f572375e11f9c3f1.patch
@@ -0,0 +1,27 @@
+From 586d87de3f896d0c4ff01b21f572375e11f9c3f1 Mon Sep 17 00:00:00 2001
+From: Derek Buitenhuis <derek.buitenhuis(a)gmail.com>
+Date: Tue, 4 May 2021 14:20:47 +0100
+Subject: [PATCH] configure: Remove deprecated API use
+
+Signed-off-by: Derek Buitenhuis <derek.buitenhuis(a)gmail.com>
+---
+ configure.ac | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index b35ef80bc..d19714d0f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -102,10 +102,10 @@ CFLAGS="$_CFLAGS $FFMPEG_CFLAGS"
+
+ AC_DEFUN([TEST_FFMPEG],
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+- #include <libavcodec/avcodec.h>
++ #include <libavformat/avformat.h>
+ #include <libswscale/swscale.h>
+ ]],[[
+- avcodec_register_all();
++ avformat_network_init();
+ swscale_version();
+ ]])], [eval $1=yes], [eval $1=no])
+ ])
diff --git a/96cbf38ea9381829a1314f432a2c60495dcefaad.patch b/96cbf38ea9381829a1314f432a2c60495dcefaad.patch
new file mode 100644
index 0000000..d566ccf
--- /dev/null
+++ b/96cbf38ea9381829a1314f432a2c60495dcefaad.patch
@@ -0,0 +1,311 @@
+From 96cbf38ea9381829a1314f432a2c60495dcefaad Mon Sep 17 00:00:00 2001
+From: Derek Buitenhuis <derek.buitenhuis(a)gmail.com>
+Date: Tue, 4 May 2021 14:12:41 +0100
+Subject: [PATCH] all: Update AVPacket API usage
+
+AVPackets must all be on the heap now, since it is no longer
+part of the libav* ABI.
+
+Signed-off-by: Derek Buitenhuis <derek.buitenhuis(a)gmail.com>
+---
+ src/core/audiosource.cpp | 16 ++++++----
+ src/core/indexing.cpp | 63 ++++++++++++++++++++++------------------
+ src/core/indexing.h | 4 +--
+ src/core/utils.cpp | 6 ----
+ src/core/utils.h | 1 -
+ src/core/videosource.cpp | 30 ++++++++++---------
+ 6 files changed, 64 insertions(+), 56 deletions(-)
+
+diff --git a/src/core/audiosource.cpp b/src/core/audiosource.cpp
+index 37cf9aeef..e4ce97cdb 100644
+--- a/src/core/audiosource.cpp
++++ b/src/core/audiosource.cpp
+@@ -285,10 +285,15 @@ FFMS_AudioSource::AudioBlock *FFMS_AudioSource::CacheBlock(CacheIterator &pos) {
+ int FFMS_AudioSource::DecodeNextBlock(CacheIterator *pos) {
+ CurrentFrame = &Frames[PacketNumber];
+
+- AVPacket Packet;
+- if (!ReadPacket(&Packet))
++ AVPacket *Packet = av_packet_alloc();
++ if (!Packet)
++ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_ALLOCATION_FAILED,
++ "Could not allocate packet.");
++ if (!ReadPacket(Packet)) {
++ av_packet_free(&Packet);
+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_UNKNOWN,
+ "ReadPacket unexpectedly failed to read a packet");
++ }
+
+ // ReadPacket may have changed the packet number
+ CurrentFrame = &Frames[PacketNumber];
+@@ -297,8 +302,9 @@ int FFMS_AudioSource::DecodeNextBlock(CacheIterator *pos) {
+ int NumberOfSamples = 0;
+ AudioBlock *CachedBlock = nullptr;
+
+- int Ret = avcodec_send_packet(CodecContext, &Packet);
+- av_packet_unref(&Packet);
++ int Ret = avcodec_send_packet(CodecContext, Packet);
++ av_packet_unref(Packet);
++ av_packet_free(&Packet);
+
+ av_frame_unref(DecodeFrame);
+ Ret = avcodec_receive_frame(CodecContext, DecodeFrame);
+@@ -513,8 +519,6 @@ void FFMS_AudioSource::Seek() {
+ }
+
+ bool FFMS_AudioSource::ReadPacket(AVPacket *Packet) {
+- InitNullPacket(*Packet);
+-
+ while (av_read_frame(FormatContext, Packet) >= 0) {
+ if (Packet->stream_index == TrackNumber) {
+ // Required because not all audio packets, especially in ogg, have a pts. Use the previous valid packet's pts instead.
+diff --git a/src/core/indexing.cpp b/src/core/indexing.cpp
+index 23fb95b12..e547c5abf 100644
+--- a/src/core/indexing.cpp
++++ b/src/core/indexing.cpp
+@@ -320,7 +320,7 @@ void FFMS_Indexer::CheckAudioProperties(int Track, AVCodecContext *Context) {
+ }
+ }
+
+-void FFMS_Indexer::ParseVideoPacket(SharedAVContext &VideoContext, AVPacket &pkt, int *RepeatPict,
++void FFMS_Indexer::ParseVideoPacket(SharedAVContext &VideoContext, AVPacket *pkt, int *RepeatPict,
+ int *FrameType, bool *Invisible, enum AVPictureStructure *LastPicStruct) {
+ if (VideoContext.Parser) {
+ uint8_t *OB;
+@@ -330,8 +330,8 @@ void FFMS_Indexer::ParseVideoPacket(SharedAVContext &VideoContext, AVPacket &pkt
+ av_parser_parse2(VideoContext.Parser,
+ VideoContext.CodecContext,
+ &OB, &OBSize,
+- pkt.data, pkt.size,
+- pkt.pts, pkt.dts, pkt.pos);
++ pkt->data, pkt->size,
++ pkt->pts, pkt->dts, pkt->pos);
+
+ // H.264 (PAFF) and HEVC may have one field per packet, so we need to track
+ // when we have a full or half frame available, and mark one of them as
+@@ -351,15 +351,15 @@ void FFMS_Indexer::ParseVideoPacket(SharedAVContext &VideoContext, AVPacket &pkt
+
+ *RepeatPict = VideoContext.Parser->repeat_pict;
+ *FrameType = VideoContext.Parser->pict_type;
+- *Invisible = (IncompleteFrame || VideoContext.Parser->repeat_pict < 0 || (pkt.flags & AV_PKT_FLAG_DISCARD));
++ *Invisible = (IncompleteFrame || VideoContext.Parser->repeat_pict < 0 || (pkt->flags & AV_PKT_FLAG_DISCARD));
+ } else {
+- *Invisible = !!(pkt.flags & AV_PKT_FLAG_DISCARD);
++ *Invisible = !!(pkt->flags & AV_PKT_FLAG_DISCARD);
+ }
+
+ if (VideoContext.CodecContext->codec_id == AV_CODEC_ID_VP8)
+- ParseVP8(pkt.data[0], Invisible, FrameType);
++ ParseVP8(pkt->data[0], Invisible, FrameType);
+ else if (VideoContext.CodecContext->codec_id == AV_CODEC_ID_VP9)
+- ParseVP9(pkt.data[0], Invisible, FrameType);
++ ParseVP9(pkt->data[0], Invisible, FrameType);
+ }
+
+ void FFMS_Indexer::Free() {
+@@ -458,32 +458,36 @@ FFMS_Index *FFMS_Indexer::DoIndexing() {
+ }
+ }
+
+- AVPacket Packet;
+- InitNullPacket(Packet);
++ AVPacket *Packet = av_packet_alloc();
++ if (!Packet)
++ throw FFMS_Exception(FFMS_ERROR_CODEC, FFMS_ERROR_ALLOCATION_FAILED,
++ "Could not allocate packet.");
+ std::vector<int64_t> LastValidTS(FormatContext->nb_streams, AV_NOPTS_VALUE);
+
+ int64_t filesize = avio_size(FormatContext->pb);
+ enum AVPictureStructure LastPicStruct = AV_PICTURE_STRUCTURE_UNKNOWN;
+- while (av_read_frame(FormatContext, &Packet) >= 0) {
++ while (av_read_frame(FormatContext, Packet) >= 0) {
+ // Update progress
+ // FormatContext->pb can apparently be NULL when opening images.
+ if (IC && FormatContext->pb) {
+- if ((*IC)(FormatContext->pb->pos, filesize, ICPrivate))
++ if ((*IC)(FormatContext->pb->pos, filesize, ICPrivate)) {
++ av_packet_free(&Packet);
+ throw FFMS_Exception(FFMS_ERROR_CANCELLED, FFMS_ERROR_USER,
+ "Cancelled by user");
++ }
+ }
+- if (!IndexMask.count(Packet.stream_index)) {
+- av_packet_unref(&Packet);
++ if (!IndexMask.count(Packet->stream_index)) {
++ av_packet_unref(Packet);
+ continue;
+ }
+
+- int Track = Packet.stream_index;
++ int Track = Packet->stream_index;
+ FFMS_Track &TrackInfo = (*TrackIndices)[Track];
+- bool KeyFrame = !!(Packet.flags & AV_PKT_FLAG_KEY);
++ bool KeyFrame = !!(Packet->flags & AV_PKT_FLAG_KEY);
+ ReadTS(Packet, LastValidTS[Track], (*TrackIndices)[Track].UseDTS);
+
+ if (FormatContext->streams[Track]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
+- int64_t PTS = TrackInfo.UseDTS ? Packet.dts : Packet.pts;
++ int64_t PTS = TrackInfo.UseDTS ? Packet->dts : Packet->pts;
+ if (PTS == AV_NOPTS_VALUE) {
+ // VPx alt-refs are output as packets which lack timestmps or durations, since
+ // they are invisible. Currently, the timestamp mangling code in libavformat
+@@ -495,9 +499,11 @@ FFMS_Index *FFMS_Indexer::DoIndexing() {
+ // FFMS2 currently sorts packets by PTS, which will break decoding, otherwise.
+ bool HasAltRefs = (FormatContext->streams[Track]->codecpar->codec_id == AV_CODEC_ID_VP8 ||
+ FormatContext->streams[Track]->codecpar->codec_id == AV_CODEC_ID_VP9);
+- if (Packet.duration == 0 && !HasAltRefs)
++ if (Packet->duration == 0 && !HasAltRefs) {
++ av_packet_free(&Packet);
+ throw FFMS_Exception(FFMS_ERROR_INDEXING, FFMS_ERROR_PARSER,
+ "Invalid packet pts, dts, and duration");
++ }
+
+ if (TrackInfo.empty())
+ PTS = 0;
+@@ -513,7 +519,7 @@ FFMS_Index *FFMS_Indexer::DoIndexing() {
+ ParseVideoPacket(AVContexts[Track], Packet, &RepeatPict, &FrameType, &Invisible, &LastPicStruct);
+
+ TrackInfo.AddVideoFrame(PTS, RepeatPict, KeyFrame,
+- FrameType, Packet.pos, Invisible);
++ FrameType, Packet->pos, Invisible);
+ } else if (FormatContext->streams[Track]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
+ // For video seeking timestamps are used only if all packets have
+ // timestamps, while for audio they're used if any have timestamps,
+@@ -522,28 +528,29 @@ FFMS_Index *FFMS_Indexer::DoIndexing() {
+ TrackInfo.HasTS = true;
+
+ int64_t StartSample = AVContexts[Track].CurrentSample;
+- uint32_t SampleCount = IndexAudioPacket(Track, &Packet, AVContexts[Track], *TrackIndices);
++ uint32_t SampleCount = IndexAudioPacket(Track, Packet, AVContexts[Track], *TrackIndices);
+ TrackInfo.SampleRate = AVContexts[Track].CodecContext->sample_rate;
+
+ TrackInfo.AddAudioFrame(LastValidTS[Track],
+- StartSample, SampleCount, KeyFrame, Packet.pos, Packet.flags & AV_PKT_FLAG_DISCARD);
++ StartSample, SampleCount, KeyFrame, Packet->pos, Packet->flags & AV_PKT_FLAG_DISCARD);
+ }
+
+- if (!(Packet.flags & AV_PKT_FLAG_DISCARD))
+- TrackInfo.LastDuration = Packet.duration;
++ if (!(Packet->flags & AV_PKT_FLAG_DISCARD))
++ TrackInfo.LastDuration = Packet->duration;
+
+- av_packet_unref(&Packet);
++ av_packet_unref(Packet);
+ }
++ av_packet_free(&Packet);
+
+ TrackIndices->Finalize(AVContexts, FormatContext->iformat->name);
+ return TrackIndices.release();
+ }
+
+-void FFMS_Indexer::ReadTS(const AVPacket &Packet, int64_t &TS, bool &UseDTS) {
+- if (!UseDTS && Packet.pts != AV_NOPTS_VALUE)
+- TS = Packet.pts;
++void FFMS_Indexer::ReadTS(const AVPacket *Packet, int64_t &TS, bool &UseDTS) {
++ if (!UseDTS && Packet->pts != AV_NOPTS_VALUE)
++ TS = Packet->pts;
+ if (TS == AV_NOPTS_VALUE)
+ UseDTS = true;
+- if (UseDTS && Packet.dts != AV_NOPTS_VALUE)
+- TS = Packet.dts;
++ if (UseDTS && Packet->dts != AV_NOPTS_VALUE)
++ TS = Packet->dts;
+ }
+diff --git a/src/core/indexing.h b/src/core/indexing.h
+index 3cfc3c30b..5c0686889 100644
+--- a/src/core/indexing.h
++++ b/src/core/indexing.h
+@@ -80,10 +80,10 @@ struct FFMS_Indexer {
+ int64_t Filesize;
+ uint8_t Digest[20];
+
+- void ReadTS(const AVPacket &Packet, int64_t &TS, bool &UseDTS);
++ void ReadTS(const AVPacket *Packet, int64_t &TS, bool &UseDTS);
+ void CheckAudioProperties(int Track, AVCodecContext *Context);
+ uint32_t IndexAudioPacket(int Track, AVPacket *Packet, SharedAVContext &Context, FFMS_Index &TrackIndices);
+- void ParseVideoPacket(SharedAVContext &VideoContext, AVPacket &pkt, int *RepeatPict, int *FrameType, bool *Invisible, enum AVPictureStructure *LastPicStruct);
++ void ParseVideoPacket(SharedAVContext &VideoContext, AVPacket *pkt, int *RepeatPict, int *FrameType, bool *Invisible, enum AVPictureStructure *LastPicStruct);
+ void Free();
+ public:
+ FFMS_Indexer(const char *Filename);
+diff --git a/src/core/utils.cpp b/src/core/utils.cpp
+index ce67533fd..8a2e99710 100644
+--- a/src/core/utils.cpp
++++ b/src/core/utils.cpp
+@@ -62,12 +62,6 @@ void ClearErrorInfo(FFMS_ErrorInfo *ErrorInfo) {
+ }
+ }
+
+-void InitNullPacket(AVPacket &pkt) {
+- av_init_packet(&pkt);
+- pkt.data = nullptr;
+- pkt.size = 0;
+-}
+-
+ void FillAP(FFMS_AudioProperties &AP, AVCodecContext *CTX, FFMS_Track &Frames) {
+ AP.SampleFormat = static_cast<FFMS_SampleFormat>(av_get_packed_sample_fmt(CTX->sample_fmt));
+ AP.BitsPerSample = av_get_bytes_per_sample(CTX->sample_fmt) * 8;
+diff --git a/src/core/utils.h b/src/core/utils.h
+index 9819dc7c9..003ab794e 100644
+--- a/src/core/utils.h
++++ b/src/core/utils.h
+@@ -58,7 +58,6 @@ std::unique_ptr<T> make_unique(Args&&... args) {
+ }
+
+ void ClearErrorInfo(FFMS_ErrorInfo *ErrorInfo);
+-void InitNullPacket(AVPacket &pkt);
+ void FillAP(FFMS_AudioProperties &AP, AVCodecContext *CTX, FFMS_Track &Frames);
+
+ void LAVFOpenFile(const char *SourceFile, AVFormatContext *&FormatContext, int Track);
+diff --git a/src/core/videosource.cpp b/src/core/videosource.cpp
+index 06bd1610e..b889970e2 100644
+--- a/src/core/videosource.cpp
++++ b/src/core/videosource.cpp
+@@ -673,30 +673,34 @@ void FFMS_VideoSource::DecodeNextFrame(int64_t &AStartTime, int64_t &Pos) {
+ if (HasPendingDelayedFrames())
+ return;
+
+- AVPacket Packet;
+- InitNullPacket(Packet);
+-
+- while (ReadFrame(&Packet) >= 0) {
+- if (Packet.stream_index != VideoTrack) {
+- av_packet_unref(&Packet);
++ AVPacket *Packet = av_packet_alloc();
++ if (!Packet)
++ throw FFMS_Exception(FFMS_ERROR_DECODING, FFMS_ERROR_ALLOCATION_FAILED,
++ "Could not allocate packet.");
++
++ while (ReadFrame(Packet) >= 0) {
++ if (Packet->stream_index != VideoTrack) {
++ av_packet_unref(Packet);
+ continue;
+ }
+
+ if (AStartTime < 0)
+- AStartTime = Frames.UseDTS ? Packet.dts : Packet.pts;
++ AStartTime = Frames.UseDTS ? Packet->dts : Packet->pts;
+
+ if (Pos < 0)
+- Pos = Packet.pos;
++ Pos = Packet->pos;
+
+- bool FrameFinished = DecodePacket(&Packet);
+- av_packet_unref(&Packet);
+- if (FrameFinished)
++ bool FrameFinished = DecodePacket(Packet);
++ av_packet_unref(Packet);
++ if (FrameFinished) {
++ av_packet_free(&Packet);
+ return;
++ }
+ }
+
+ // Flush final frames
+- InitNullPacket(Packet);
+- DecodePacket(&Packet);
++ DecodePacket(Packet);
++ av_packet_free(&Packet);
+ }
+
+ bool FFMS_VideoSource::SeekTo(int n, int SeekOffset) {
diff --git a/ffms2.spec b/ffms2.spec
index 3ec3efe..5838feb 100644
--- a/ffms2.spec
+++ b/ffms2.spec
@@ -5,7 +5,9 @@ License: MIT
Summary: Wrapper library around libffmpeg
URL: https://github.com/FFMS/ffms2
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
-
+Patch0: %{url}/commit/96cbf38ea9381829a1314f432a2c60495dcefaad.patch
+Patch1: %{url}/commit/586d87de3f896d0c4ff01b21f572375e11f9c3f1.patch
+Patch2: %{url}/commit/45673149e9a2f5586855ad472e3059084eaa36b1.patch
BuildRequires: gcc
BuildRequires: gcc-c++
@@ -35,7 +37,12 @@ library around libffmpeg, plus some additional components to deal with file
formats libavformat has (or used to have) problems with.
%prep
-%autosetup -p1
+%setup -q
+%if 0%{?fedora} >= 36
+%patch0 -p1 -b ffmpeg45-0
+%patch1 -p1 -b ffmpeg45-1
+%patch2 -p1 -b ffmpeg45-2
+%endif
sed -i 's/\r$//' COPYING
mkdir -p src/config
autoreconf -vfi
3 years
[gstreamer1-libav] fix
by Leigh Scott
commit 9007d97f0f298ee9040d8ee489ca2b4a14e84640
Author: Leigh Scott <leigh123linux(a)gmail.com>
Date: Sat Nov 13 19:25:30 2021 +0000
fix
139.patch | 229 ++++++++++++++++++++++++++++++++++++++++++++++++++
gstreamer1-libav.spec | 7 +-
2 files changed, 234 insertions(+), 2 deletions(-)
---
diff --git a/139.patch b/139.patch
new file mode 100644
index 0000000..a3191e2
--- /dev/null
+++ b/139.patch
@@ -0,0 +1,229 @@
+From 42587384662d31d76b3fe953853ef2b59928df8f Mon Sep 17 00:00:00 2001
+From: "bradley.jarvis" <brad(a)pocketinnovations.com.au>
+Date: Wed, 11 Aug 2021 21:21:33 +1000
+Subject: [PATCH] Fix ffmpeg deprecated avcodec_get_context_defaults
+
+Fix build against latest ffmpeg after removal of deprecated avcodec_get_context_defaults()
+
+Resolves issue #97
+
+Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/139>
+---
+ ext/libav/gstavauddec.c | 16 ++++------------
+ ext/libav/gstavaudenc.c | 25 +++++++++----------------
+ ext/libav/gstavviddec.c | 16 ++++------------
+ ext/libav/gstavvidenc.c | 14 +++++---------
+ 4 files changed, 22 insertions(+), 49 deletions(-)
+
+diff --git a/ext/libav/gstavauddec.c b/ext/libav/gstavauddec.c
+index baf7aa5..4ce6a1f 100644
+--- a/ext/libav/gstavauddec.c
++++ b/ext/libav/gstavauddec.c
+@@ -169,11 +169,7 @@ gst_ffmpegauddec_finalize (GObject * object)
+
+ av_frame_free (&ffmpegdec->frame);
+
+- if (ffmpegdec->context != NULL) {
+- gst_ffmpeg_avcodec_close (ffmpegdec->context);
+- av_free (ffmpegdec->context);
+- ffmpegdec->context = NULL;
+- }
++ avcodec_free_context (&ffmpegdec->context);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+ }
+@@ -193,14 +189,10 @@ gst_ffmpegauddec_close (GstFFMpegAudDec * ffmpegdec, gboolean reset)
+ gst_ffmpeg_avcodec_close (ffmpegdec->context);
+ ffmpegdec->opened = FALSE;
+
+- if (ffmpegdec->context->extradata) {
+- av_free (ffmpegdec->context->extradata);
+- ffmpegdec->context->extradata = NULL;
+- }
++ av_freep (&ffmpegdec->context->extradata);
+
+ if (reset) {
+- if (avcodec_get_context_defaults3 (ffmpegdec->context,
+- oclass->in_plugin) < 0) {
++ if (gst_ffmpeg_avcodec_open (ffmpegdec->context, oclass->in_plugin) < 0) {
+ GST_DEBUG_OBJECT (ffmpegdec, "Failed to set context defaults");
+ return FALSE;
+ }
+@@ -220,7 +212,7 @@ gst_ffmpegauddec_start (GstAudioDecoder * decoder)
+
+ GST_OBJECT_LOCK (ffmpegdec);
+ gst_ffmpeg_avcodec_close (ffmpegdec->context);
+- if (avcodec_get_context_defaults3 (ffmpegdec->context, oclass->in_plugin) < 0) {
++ if (gst_ffmpeg_avcodec_open (ffmpegdec->context, oclass->in_plugin) < 0) {
+ GST_DEBUG_OBJECT (ffmpegdec, "Failed to set context defaults");
+ GST_OBJECT_UNLOCK (ffmpegdec);
+ return FALSE;
+diff --git a/ext/libav/gstavaudenc.c b/ext/libav/gstavaudenc.c
+index 3ff6432..87edaeb 100644
+--- a/ext/libav/gstavaudenc.c
++++ b/ext/libav/gstavaudenc.c
+@@ -175,10 +175,8 @@ gst_ffmpegaudenc_finalize (GObject * object)
+
+ /* clean up remaining allocated data */
+ av_frame_free (&ffmpegaudenc->frame);
+- gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
+- gst_ffmpeg_avcodec_close (ffmpegaudenc->refcontext);
+- av_free (ffmpegaudenc->context);
+- av_free (ffmpegaudenc->refcontext);
++ avcodec_free_context (&ffmpegaudenc->context);
++ avcodec_free_context (&ffmpegaudenc->refcontext);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+ }
+@@ -194,8 +192,7 @@ gst_ffmpegaudenc_start (GstAudioEncoder * encoder)
+ ffmpegaudenc->need_reopen = FALSE;
+
+ gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
+- if (avcodec_get_context_defaults3 (ffmpegaudenc->context,
+- oclass->in_plugin) < 0) {
++ if (gst_ffmpeg_avcodec_open (ffmpegaudenc->context, oclass->in_plugin) < 0) {
+ GST_DEBUG_OBJECT (ffmpegaudenc, "Failed to set context defaults");
+ return FALSE;
+ }
+@@ -243,8 +240,7 @@ gst_ffmpegaudenc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
+ if (ffmpegaudenc->opened) {
+ gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
+ ffmpegaudenc->opened = FALSE;
+- if (avcodec_get_context_defaults3 (ffmpegaudenc->context,
+- oclass->in_plugin) < 0) {
++ if (gst_ffmpeg_avcodec_open (ffmpegaudenc->context, oclass->in_plugin) < 0) {
+ GST_DEBUG_OBJECT (ffmpegaudenc, "Failed to set context defaults");
+ return FALSE;
+ }
+@@ -289,8 +285,7 @@ gst_ffmpegaudenc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
+ gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
+ GST_DEBUG_OBJECT (ffmpegaudenc, "avenc_%s: Failed to open FFMPEG codec",
+ oclass->in_plugin->name);
+- if (avcodec_get_context_defaults3 (ffmpegaudenc->context,
+- oclass->in_plugin) < 0)
++ if (gst_ffmpeg_avcodec_open (ffmpegaudenc->context, oclass->in_plugin) < 0)
+ GST_DEBUG_OBJECT (ffmpegaudenc, "Failed to set context defaults");
+
+ if ((oclass->in_plugin->capabilities & AV_CODEC_CAP_EXPERIMENTAL) &&
+@@ -314,8 +309,7 @@ gst_ffmpegaudenc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
+ gst_caps_unref (allowed_caps);
+ gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
+ GST_DEBUG ("Unsupported codec - no caps found");
+- if (avcodec_get_context_defaults3 (ffmpegaudenc->context,
+- oclass->in_plugin) < 0)
++ if (gst_ffmpeg_avcodec_open (ffmpegaudenc->context, oclass->in_plugin) < 0)
+ GST_DEBUG_OBJECT (ffmpegaudenc, "Failed to set context defaults");
+ return FALSE;
+ }
+@@ -333,8 +327,7 @@ gst_ffmpegaudenc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
+ icaps)) {
+ gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
+ gst_caps_unref (icaps);
+- if (avcodec_get_context_defaults3 (ffmpegaudenc->context,
+- oclass->in_plugin) < 0)
++ if (gst_ffmpeg_avcodec_open (ffmpegaudenc->context, oclass->in_plugin) < 0)
+ GST_DEBUG_OBJECT (ffmpegaudenc, "Failed to set context defaults");
+ return FALSE;
+ }
+@@ -403,8 +396,8 @@ buffer_info_free (void *opaque, guint8 * data)
+ gst_buffer_unmap (info->buffer, &info->map);
+ gst_buffer_unref (info->buffer);
+ } else {
+- av_free (info->ext_data);
+- av_free (info->ext_data_array);
++ av_freep (&info->ext_data);
++ av_freep (&info->ext_data_array);
+ }
+ g_slice_free (BufferInfo, info);
+ }
+diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c
+index a14b6df..c8f7a7d 100644
+--- a/ext/libav/gstavviddec.c
++++ b/ext/libav/gstavviddec.c
+@@ -341,11 +341,7 @@ gst_ffmpegviddec_finalize (GObject * object)
+
+ av_frame_free (&ffmpegdec->picture);
+
+- if (ffmpegdec->context != NULL) {
+- gst_ffmpeg_avcodec_close (ffmpegdec->context);
+- av_free (ffmpegdec->context);
+- ffmpegdec->context = NULL;
+- }
++ avcodec_free_context (&ffmpegdec->context);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+ }
+@@ -395,13 +391,9 @@ gst_ffmpegviddec_close (GstFFMpegVidDec * ffmpegdec, gboolean reset)
+
+ gst_buffer_replace (&ffmpegdec->palette, NULL);
+
+- if (ffmpegdec->context->extradata) {
+- av_free (ffmpegdec->context->extradata);
+- ffmpegdec->context->extradata = NULL;
+- }
++ av_freep (&ffmpegdec->context->extradata);
+ if (reset) {
+- if (avcodec_get_context_defaults3 (ffmpegdec->context,
+- oclass->in_plugin) < 0) {
++ if (gst_ffmpeg_avcodec_open (ffmpegdec->context, oclass->in_plugin) < 0) {
+ GST_DEBUG_OBJECT (ffmpegdec, "Failed to set context defaults");
+ return FALSE;
+ }
+@@ -2087,7 +2079,7 @@ gst_ffmpegviddec_start (GstVideoDecoder * decoder)
+
+ GST_OBJECT_LOCK (ffmpegdec);
+ gst_ffmpeg_avcodec_close (ffmpegdec->context);
+- if (avcodec_get_context_defaults3 (ffmpegdec->context, oclass->in_plugin) < 0) {
++ if (gst_ffmpeg_avcodec_open (ffmpegdec->context, oclass->in_plugin) < 0) {
+ GST_DEBUG_OBJECT (ffmpegdec, "Failed to set context defaults");
+ GST_OBJECT_UNLOCK (ffmpegdec);
+ return FALSE;
+diff --git a/ext/libav/gstavvidenc.c b/ext/libav/gstavvidenc.c
+index 0468d88..b17ff68 100644
+--- a/ext/libav/gstavvidenc.c
++++ b/ext/libav/gstavvidenc.c
+@@ -222,10 +222,8 @@ gst_ffmpegvidenc_finalize (GObject * object)
+
+ /* clean up remaining allocated data */
+ av_frame_free (&ffmpegenc->picture);
+- gst_ffmpeg_avcodec_close (ffmpegenc->context);
+- gst_ffmpeg_avcodec_close (ffmpegenc->refcontext);
+- av_free (ffmpegenc->context);
+- av_free (ffmpegenc->refcontext);
++ avcodec_free_context (&ffmpegenc->context);
++ avcodec_free_context (&ffmpegenc->refcontext);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+ }
+@@ -249,8 +247,7 @@ gst_ffmpegvidenc_set_format (GstVideoEncoder * encoder,
+ if (ffmpegenc->opened) {
+ gst_ffmpeg_avcodec_close (ffmpegenc->context);
+ ffmpegenc->opened = FALSE;
+- if (avcodec_get_context_defaults3 (ffmpegenc->context,
+- oclass->in_plugin) < 0) {
++ if (gst_ffmpeg_avcodec_open (ffmpegenc->context, oclass->in_plugin) < 0) {
+ GST_DEBUG_OBJECT (ffmpegenc, "Failed to set context defaults");
+ return FALSE;
+ }
+@@ -455,8 +452,7 @@ bad_input_fmt:
+ close_codec:
+ {
+ gst_ffmpeg_avcodec_close (ffmpegenc->context);
+- if (avcodec_get_context_defaults3 (ffmpegenc->context,
+- oclass->in_plugin) < 0)
++ if (gst_ffmpeg_avcodec_open (ffmpegenc->context, oclass->in_plugin) < 0)
+ GST_DEBUG_OBJECT (ffmpegenc, "Failed to set context defaults");
+ goto cleanup_stats_in;
+ }
+@@ -897,7 +893,7 @@ gst_ffmpegvidenc_start (GstVideoEncoder * encoder)
+
+ /* close old session */
+ gst_ffmpeg_avcodec_close (ffmpegenc->context);
+- if (avcodec_get_context_defaults3 (ffmpegenc->context, oclass->in_plugin) < 0) {
++ if (gst_ffmpeg_avcodec_open (ffmpegenc->context, oclass->in_plugin) < 0) {
+ GST_DEBUG_OBJECT (ffmpegenc, "Failed to set context defaults");
+ return FALSE;
+ }
+--
+GitLab
+
diff --git a/gstreamer1-libav.spec b/gstreamer1-libav.spec
index 6b793e8..65e92b0 100644
--- a/gstreamer1-libav.spec
+++ b/gstreamer1-libav.spec
@@ -9,6 +9,7 @@ Summary: GStreamer 1.0 libav-based plug-ins
License: LGPLv2+
URL: https://gstreamer.freedesktop.org/
Source0: %{url}/src/gst-libav/gst-libav-%{version}.tar.xz
+Patch0: https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/139.p...
BuildRequires: gcc-c++
BuildRequires: meson
@@ -46,8 +47,10 @@ plug-in.
%prep
-%autosetup -p1 -n gst-libav-%{version}
-
+%setup -n gst-libav-%{version}
+%if 0%{?fedora} >= 36
+%patch0 -p1 -b ffmpeg45
+%endif
%build
%meson \
3 years
[nvidia-persistenced/el8: 13/13] Merge branch 'master' into el8
by Nicolas Chauvet
commit 810ee2070004e8933ecdcf9f27918265e0db2f4a
Merge: 6c96d7b d4ad3bc
Author: Nicolas Chauvet <kwizart(a)gmail.com>
Date: Sat Nov 13 17:59:19 2021 +0100
Merge branch 'master' into el8
.gitignore | 46 ++--------------------------------------------
nvidia-persistenced.spec | 35 ++++++++++++++++++++++++++++++++++-
sources | 2 +-
3 files changed, 37 insertions(+), 46 deletions(-)
---
3 years
[nvidia-persistenced/el8] (13 commits) ...Merge branch 'master' into el8
by Nicolas Chauvet
Summary of changes:
7808c10... Update to 465.19.01 beta (*)
61f6cb9... Update to 465.24.02 release (*)
b8f711a... Update to 465.27 release (*)
27cff6e... Update to 465.31 release (*)
a5b2098... Update to 470.42.01 beta (*)
b84a3a4... Update to 470.57.02 release (*)
c5d1fe1... - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass (*)
6748f6a... Update to 470.63.01 release (*)
0c2e6ae... Update to 470.74 release (*)
a847080... Update to 495.29.05 beta (*)
f3f9b96... Update to 495.44 release (*)
d4ad3bc... Update gitignore (*)
810ee20... Merge branch 'master' into el8
(*) This commit already existed in another branch; no separate mail sent
3 years
[nvidia-persistenced] Update gitignore
by Nicolas Chauvet
commit d4ad3bcbb361ae625b3caaaab9ef8f9491c8ea2c
Author: Nicolas Chauvet <kwizart(a)gmail.com>
Date: Sat Nov 13 17:57:36 2021 +0100
Update gitignore
.gitignore | 54 ++----------------------------------------------------
1 file changed, 2 insertions(+), 52 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index f15ed94..7d70d9d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,53 +1,3 @@
nvidia-persistenced-*.tar.gz
-/nvidia-persistenced-390.42.tar.bz2
-/nvidia-persistenced-390.48.tar.bz2
-/nvidia-persistenced-396.24.tar.bz2
-/nvidia-persistenced-396.45.tar.bz2
-/nvidia-persistenced-396.51.tar.bz2
-/nvidia-persistenced-396.54.tar.bz2
-/nvidia-persistenced-410.57.tar.bz2
-/nvidia-persistenced-410.66.tar.bz2
-/nvidia-persistenced-410.73.tar.bz2
-/nvidia-persistenced-410.78.tar.bz2
-/nvidia-persistenced-415.18.tar.bz2
-/nvidia-persistenced-415.22.tar.bz2
-/nvidia-persistenced-415.23.tar.bz2
-/nvidia-persistenced-415.25.tar.bz2
-/nvidia-persistenced-415.27.tar.bz2
-/nvidia-persistenced-418.30.tar.bz2
-/nvidia-persistenced-418.43.tar.bz2
-/nvidia-persistenced-418.56.tar.bz2
-/nvidia-persistenced-430.09.tar.bz2
-/nvidia-persistenced-430.14.tar.bz2
-/nvidia-persistenced-430.26.tar.bz2
-/nvidia-persistenced-430.34.tar.bz2
-/nvidia-persistenced-430.40.tar.bz2
-/nvidia-persistenced-435.17.tar.bz2
-/nvidia-persistenced-435.21.tar.bz2
-/nvidia-persistenced-440.26.tar.bz2
-/nvidia-persistenced-440.31.tar.bz2
-/nvidia-persistenced-440.36.tar.bz2
-/nvidia-persistenced-440.44.tar.bz2
-/nvidia-persistenced-440.59.tar.bz2
-/nvidia-persistenced-440.64.tar.bz2
-/nvidia-persistenced-440.82.tar.bz2
-/nvidia-persistenced-450.51.tar.bz2
-/nvidia-persistenced-450.57.tar.bz2
-/nvidia-persistenced-450.66.tar.bz2
-/nvidia-persistenced-455.23.04.tar.bz2
-/nvidia-persistenced-455.28.tar.bz2
-/nvidia-persistenced-455.38.tar.bz2
-/nvidia-persistenced-455.45.01.tar.bz2
-/nvidia-persistenced-460.27.04.tar.bz2
-/nvidia-persistenced-460.32.03.tar.bz2
-/nvidia-persistenced-460.39.tar.bz2
-/nvidia-persistenced-460.56.tar.bz2
-/nvidia-persistenced-460.67.tar.bz2
-/nvidia-persistenced-465.19.01.tar.bz2
-/nvidia-persistenced-465.31.tar.bz2
-/nvidia-persistenced-470.42.01.tar.bz2
-/nvidia-persistenced-470.57.02.tar.bz2
-/nvidia-persistenced-470.63.01.tar.bz2
-/nvidia-persistenced-470.74.tar.bz2
-/nvidia-persistenced-495.29.05.tar.bz2
-/nvidia-persistenced-495.44.tar.bz2
+nvidia-persistenced-*.tar.bz2
+nvidia-persistenced-*.tar.xz
3 years
[fceux] Updated to new upstream release
by Andrea Musuruane
commit 9121f3a08352c8905b8968ac805fae4bb26252c4
Author: Andrea Musuruane <musuruan(a)gmail.com>
Date: Sat Nov 13 16:41:24 2021 +0100
Updated to new upstream release
.gitignore | 1 +
sources | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/.gitignore b/.gitignore
index d16bf4f..b884c8a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ fceux-2.2.2.src.tar.gz
/fceux-2.2.3.src.tar.gz
/fceux-2.3.0.tar.gz
/fceux-2.4.0.tar.gz
+/fceux-2.5.0.tar.gz
diff --git a/sources b/sources
index 8fdb559..1e4e42c 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-SHA512 (fceux-2.4.0.tar.gz) = 3f53db1091e28c91bff90a2d6c77bd3c022a7c20a29b07e6cb88e9ae4795ce7f9e68d15ac0f90721472f8c262907a2564e0be7adc8df2eb3ef252215717f30a0
+SHA512 (fceux-2.5.0.tar.gz) = bbff55b6f3efda8918b7dab21582d93f8c2a6396bf64a93e33f2f5f6cd345f95bcde7b958f0a663967e47e83110733c4a732dbf538afb7dbecb3147bc3090f01
3 years
[fceux] Updated to new upstream release
by Andrea Musuruane
commit fc5cdb4c12375123c5213988482b9de51764311b
Author: Andrea Musuruane <musuruan(a)gmail.com>
Date: Sat Nov 13 16:36:00 2021 +0100
Updated to new upstream release
fceux.spec | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/fceux.spec b/fceux.spec
index e7906e1..5498991 100644
--- a/fceux.spec
+++ b/fceux.spec
@@ -4,8 +4,8 @@
%global commit 941da60ecb283263a3810ed199d80abf94bd6494
Name: fceux
-Version: 2.4.0
-Release: 3%{?dist}
+Version: 2.5.0
+Release: 1%{?dist}
Summary: A cross platform, NTSC and PAL Famicom/NES emulator
License: GPLv2+
@@ -23,6 +23,8 @@ BuildRequires: minizip-devel
BuildRequires: minizip-compat-devel
%endif
BuildRequires: x264-devel
+BuildRequires: x265-devel
+BuildRequires: ffmpeg-devel
BuildRequires: desktop-file-utils
Requires: hicolor-icon-theme
@@ -113,6 +115,9 @@ desktop-file-validate \
%changelog
+* Fri Nov 12 2021 Andrea Musuruane <musuruan(a)gmail.com> - 2.5.0-1
+- Updated to new upstream release
+
* Mon Aug 02 2021 RPM Fusion Release Engineering <leigh123linux(a)gmail.com> - 2.4.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
3 years