diff --git a/pkgs/development/libraries/ffmpeg/2.8.nix b/pkgs/development/libraries/ffmpeg/2.8.nix deleted file mode 100644 index 0df810ff10b0..000000000000 --- a/pkgs/development/libraries/ffmpeg/2.8.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ callPackage, ... } @ args: - -callPackage ./generic.nix (rec { - version = "${branch}.17"; - branch = "2.8"; - sha256 = "05bnhvs2f82aq95z1wd3wr42sljdfq4kiyzqwhpji983mndx14vl"; - knownVulnerabilities = [ - "CVE-2021-30123" - ]; - doCheck = false; -} // args) diff --git a/pkgs/games/stepmania/0001-fix-build-with-ffmpeg-4.patch b/pkgs/games/stepmania/0001-fix-build-with-ffmpeg-4.patch new file mode 100644 index 000000000000..65686f5546c4 --- /dev/null +++ b/pkgs/games/stepmania/0001-fix-build-with-ffmpeg-4.patch @@ -0,0 +1,136 @@ +From 33d928c54f4b35f8877cacd1e2c77b68b4dddc06 Mon Sep 17 00:00:00 2001 +From: Zane van Iperen +Date: Sun, 7 Nov 2021 15:46:37 +1000 +Subject: [PATCH] fix build with ffmpeg 4 + +--- + src/arch/MovieTexture/MovieTexture_FFMpeg.cpp | 5 +---- + src/arch/MovieTexture/MovieTexture_FFMpeg.h | 22 +++++++++---------- + 2 files changed, 12 insertions(+), 15 deletions(-) + +diff --git a/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp b/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp +index bdf2356..f79fea2 100644 +--- a/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp ++++ b/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp +@@ -445,7 +445,7 @@ RString MovieDecoder_FFMpeg::Open( RString sFile ) + return "Couldn't find any video streams"; + m_pStream = m_fctx->streams[stream_idx]; + +- if( m_pStream->codec->codec_id == avcodec::CODEC_ID_NONE ) ++ if( m_pStream->codec->codec_id == avcodec::AV_CODEC_ID_NONE ) + return ssprintf( "Unsupported codec %08x", m_pStream->codec->codec_tag ); + + RString sError = OpenCodec(); +@@ -474,9 +474,6 @@ RString MovieDecoder_FFMpeg::OpenCodec() + m_pStream->codec->idct_algo = FF_IDCT_AUTO; + m_pStream->codec->error_concealment = 3; + +- if( pCodec->capabilities & CODEC_CAP_DR1 ) +- m_pStream->codec->flags |= CODEC_FLAG_EMU_EDGE; +- + LOG->Trace("Opening codec %s", pCodec->name ); + + int ret = avcodec::avcodec_open2( m_pStream->codec, pCodec, NULL ); +diff --git a/src/arch/MovieTexture/MovieTexture_FFMpeg.h b/src/arch/MovieTexture/MovieTexture_FFMpeg.h +index f4d25ef..32564e5 100644 +--- a/src/arch/MovieTexture/MovieTexture_FFMpeg.h ++++ b/src/arch/MovieTexture/MovieTexture_FFMpeg.h +@@ -64,7 +64,7 @@ private: + + avcodec::AVStream *m_pStream; + avcodec::AVFrame *m_Frame; +- avcodec::PixelFormat m_AVTexfmt; /* PixelFormat of output surface */ ++ avcodec::AVPixelFormat m_AVTexfmt; /* PixelFormat of output surface */ + avcodec::SwsContext *m_swsctx; + + avcodec::AVFormatContext *m_fctx; +@@ -90,7 +90,7 @@ static struct AVPixelFormat_t + { + int bpp; + uint32_t masks[4]; +- avcodec::PixelFormat pf; ++ avcodec::AVPixelFormat pf; + bool bHighColor; + bool bByteSwapOnLittleEndian; + MovieDecoderPixelFormatYCbCr YUV; +@@ -101,7 +101,7 @@ static struct AVPixelFormat_t + 0x00FF0000, + 0x0000FF00, + 0x000000FF }, +- avcodec::PIX_FMT_YUYV422, ++ avcodec::AV_PIX_FMT_YUYV422, + false, /* N/A */ + true, + PixelFormatYCbCr_YUYV422, +@@ -112,7 +112,7 @@ static struct AVPixelFormat_t + 0x00FF0000, + 0xFF000000, + 0x000000FF }, +- avcodec::PIX_FMT_BGRA, ++ avcodec::AV_PIX_FMT_BGRA, + true, + true, + PixelFormatYCbCr_Invalid, +@@ -123,7 +123,7 @@ static struct AVPixelFormat_t + 0x0000FF00, + 0x000000FF, + 0xFF000000 }, +- avcodec::PIX_FMT_ARGB, ++ avcodec::AV_PIX_FMT_ARGB, + true, + true, + PixelFormatYCbCr_Invalid, +@@ -135,7 +135,7 @@ static struct AVPixelFormat_t + 0x0000FF00, + 0x00FF0000, + 0xFF000000 }, +- avcodec::PIX_FMT_ABGR, ++ avcodec::AV_PIX_FMT_ABGR, + true, + true, + PixelFormatYCbCr_Invalid, +@@ -146,7 +146,7 @@ static struct AVPixelFormat_t + 0x00FF0000, + 0x0000FF00, + 0x000000FF }, +- avcodec::PIX_FMT_RGBA, ++ avcodec::AV_PIX_FMT_RGBA, + true, + true, + PixelFormatYCbCr_Invalid, +@@ -157,7 +157,7 @@ static struct AVPixelFormat_t + 0x00FF00, + 0x0000FF, + 0x000000 }, +- avcodec::PIX_FMT_RGB24, ++ avcodec::AV_PIX_FMT_RGB24, + true, + true, + PixelFormatYCbCr_Invalid, +@@ -168,7 +168,7 @@ static struct AVPixelFormat_t + 0x00FF00, + 0xFF0000, + 0x000000 }, +- avcodec::PIX_FMT_BGR24, ++ avcodec::AV_PIX_FMT_BGR24, + true, + true, + PixelFormatYCbCr_Invalid, +@@ -179,12 +179,12 @@ static struct AVPixelFormat_t + 0x03E0, + 0x001F, + 0x0000 }, +- avcodec::PIX_FMT_RGB555, ++ avcodec::AV_PIX_FMT_RGB555, + false, + false, + PixelFormatYCbCr_Invalid, + }, +- { 0, { 0,0,0,0 }, avcodec::PIX_FMT_NB, true, false, PixelFormatYCbCr_Invalid } ++ { 0, { 0,0,0,0 }, avcodec::AV_PIX_FMT_NB, true, false, PixelFormatYCbCr_Invalid } + }; + + #endif +-- +2.31.1 + diff --git a/pkgs/games/stepmania/default.nix b/pkgs/games/stepmania/default.nix index 70e1acb1f34f..c7f8f0d7a27f 100644 --- a/pkgs/games/stepmania/default.nix +++ b/pkgs/games/stepmania/default.nix @@ -14,6 +14,10 @@ stdenv.mkDerivation rec { sha256 = "0a7y9l7xm510vgnpmj1is7p9m6d6yd0fcaxrjcickz295k5w3rdn"; }; + patches = [ + ./0001-fix-build-with-ffmpeg-4.patch + ]; + nativeBuildInputs = [ cmake nasm ]; buildInputs = [ diff --git a/pkgs/misc/emulators/pcsxr/0001-libpcsxcore-fix-build-with-ffmpeg-4.patch b/pkgs/misc/emulators/pcsxr/0001-libpcsxcore-fix-build-with-ffmpeg-4.patch new file mode 100644 index 000000000000..0edc6281a7ef --- /dev/null +++ b/pkgs/misc/emulators/pcsxr/0001-libpcsxcore-fix-build-with-ffmpeg-4.patch @@ -0,0 +1,76 @@ +From 351be6b3f2ad10d86ec4ae711db5a1067acc592a Mon Sep 17 00:00:00 2001 +From: Zane van Iperen +Date: Sun, 7 Nov 2021 15:17:07 +1000 +Subject: [PATCH] libpcsxcore: fix build with ffmpeg 4 + +--- + libpcsxcore/cdriso.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c +index f89678e..6314482 100644 +--- a/libpcsxcore/cdriso.c ++++ b/libpcsxcore/cdriso.c +@@ -266,14 +266,14 @@ static int decode_compressed_cdda_track(FILE* outfile, const char* infilepath, s + } + + if (!decoded_frame) { +- if (!(decoded_frame = avcodec_alloc_frame())) { ++ if (!(decoded_frame = av_frame_alloc())) { + SysMessage(_(" -> Error allocating audio frame buffer. This track will not be available.")); + avformat_close_input(&inAudioFormat); +- avcodec_free_frame(&decoded_frame); ++ av_frame_free(&decoded_frame); + return 1; // error decoding frame + } + } else { +- avcodec_get_frame_defaults(decoded_frame); ++ av_frame_unref(decoded_frame); + } + len = avcodec_decode_audio4(c, decoded_frame, &got_frame, &avpkt); + if (len > 0 && got_frame) { +@@ -285,7 +285,7 @@ static int decode_compressed_cdda_track(FILE* outfile, const char* infilepath, s + fwrite(decoded_frame->data[0], 1, data_size, outfile); + } + av_free_packet(&avpkt); +- //avcodec_free_frame(&decoded_frame); ++ //av_frame_free(&decoded_frame); + } while (moreFrames >= 0); // TODO: check for possible leaks + + // file will be closed later on, now just flush it +@@ -294,7 +294,7 @@ static int decode_compressed_cdda_track(FILE* outfile, const char* infilepath, s + avformat_close_input(&inAudioFormat); + //avcodec_close(c); + //av_free(c); +- avcodec_free_frame(&decoded_frame); ++ av_frame_free(&decoded_frame); + return 0; + } + #endif +@@ -340,12 +340,12 @@ static int decode_compressed_cdda_track(FILE* outfile, FILE* infile, enum AVCode + while (avpkt.size > 0) { + int got_frame = 0; + if (!decoded_frame) { +- if (!(decoded_frame = avcodec_alloc_frame())) { ++ if (!(decoded_frame = av_frame_alloc())) { + SysPrintf(" -> Error allocating audio frame buffer. Track will not be available."); + return 1; // error decoding frame + } + } else { +- avcodec_get_frame_defaults(decoded_frame); ++ av_frame_unref(decoded_frame); + } + + len = avcodec_decode_audio4(c, decoded_frame, &got_frame, &avpkt); +@@ -383,7 +383,7 @@ static int decode_compressed_cdda_track(FILE* outfile, FILE* infile, enum AVCode + + avcodec_close(c); + av_free(c); +- avcodec_free_frame(&decoded_frame); ++ av_frame_free(&decoded_frame); + return 0; + } + #endif +-- +2.31.1 + diff --git a/pkgs/misc/emulators/pcsxr/default.nix b/pkgs/misc/emulators/pcsxr/default.nix index 099795c63fd1..e3126efe82db 100644 --- a/pkgs/misc/emulators/pcsxr/default.nix +++ b/pkgs/misc/emulators/pcsxr/default.nix @@ -47,6 +47,7 @@ stdenv.mkDerivation rec { }) ./uncompress2.patch + ./0001-libpcsxcore-fix-build-with-ffmpeg-4.patch ]; nativeBuildInputs = [ autoreconfHook intltool pkg-config wrapGAppsHook ]; diff --git a/pkgs/misc/gnash/0001-fix-build-with-ffmepg-4.patch b/pkgs/misc/gnash/0001-fix-build-with-ffmepg-4.patch new file mode 100644 index 000000000000..f6316ae972fd --- /dev/null +++ b/pkgs/misc/gnash/0001-fix-build-with-ffmepg-4.patch @@ -0,0 +1,57 @@ +From cb13c20332526a4db99e7fd0818b9a75829affad Mon Sep 17 00:00:00 2001 +From: Zane van Iperen +Date: Sun, 7 Nov 2021 15:36:02 +1000 +Subject: [PATCH] fix build with ffmepg 4 + +--- + libmedia/ffmpeg/MediaHandlerFfmpeg.cpp | 2 +- + libmedia/ffmpeg/MediaParserFfmpeg.cpp | 6 +++--- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/libmedia/ffmpeg/MediaHandlerFfmpeg.cpp b/libmedia/ffmpeg/MediaHandlerFfmpeg.cpp +index 127aaaa..216d96b 100644 +--- a/libmedia/ffmpeg/MediaHandlerFfmpeg.cpp ++++ b/libmedia/ffmpeg/MediaHandlerFfmpeg.cpp +@@ -149,7 +149,7 @@ MediaHandlerFfmpeg::cameraNames(std::vector& /*names*/) const + size_t + MediaHandlerFfmpeg::getInputPaddingSize() const + { +- return FF_INPUT_BUFFER_PADDING_SIZE; ++ return AV_INPUT_BUFFER_PADDING_SIZE; + } + + } // gnash.media.ffmpeg namespace +diff --git a/libmedia/ffmpeg/MediaParserFfmpeg.cpp b/libmedia/ffmpeg/MediaParserFfmpeg.cpp +index 9ceb8b0..a27ca56 100644 +--- a/libmedia/ffmpeg/MediaParserFfmpeg.cpp ++++ b/libmedia/ffmpeg/MediaParserFfmpeg.cpp +@@ -64,7 +64,7 @@ AVInputFormat* + MediaParserFfmpeg::probeStream() + { + const size_t probeSize = 4096; +- const size_t bufSize = probeSize + FF_INPUT_BUFFER_PADDING_SIZE; ++ const size_t bufSize = probeSize + AV_INPUT_BUFFER_PADDING_SIZE; + + std::unique_ptr buffer(new std::uint8_t[bufSize]); + +@@ -173,7 +173,7 @@ MediaParserFfmpeg::parseVideoFrame(AVPacket& packet) + + // TODO: We might avoid the copy as a whole by making EncodedVideoFrame + // virtual. +- size_t allocSize = packet.size + FF_INPUT_BUFFER_PADDING_SIZE; ++ size_t allocSize = packet.size + AV_INPUT_BUFFER_PADDING_SIZE; + std::uint8_t* data = new std::uint8_t[allocSize]; + std::copy(packet.data, packet.data+packet.size, data); + std::unique_ptr frame(new EncodedVideoFrame(data, packet.size, 0, timestamp)); +@@ -221,7 +221,7 @@ MediaParserFfmpeg::parseAudioFrame(AVPacket& packet) + + // TODO: We might avoid the copy as a whole by making EncodedAudioFrame + // virtual. +- size_t allocSize = packet.size + FF_INPUT_BUFFER_PADDING_SIZE; ++ size_t allocSize = packet.size + AV_INPUT_BUFFER_PADDING_SIZE; + std::uint8_t* data = new std::uint8_t[allocSize]; + std::copy(packet.data, packet.data+packet.size, data); + +-- +2.31.1 + diff --git a/pkgs/misc/gnash/default.nix b/pkgs/misc/gnash/default.nix index 9f5f022b8538..fc7148b40489 100644 --- a/pkgs/misc/gnash/default.nix +++ b/pkgs/misc/gnash/default.nix @@ -16,7 +16,7 @@ , enableQt ? false, qt4 ? null # media -, enableFFmpeg ? true, ffmpeg_2 ? null +, enableFFmpeg ? true, ffmpeg ? null # misc , enableJemalloc ? true, jemalloc ? null @@ -55,7 +55,7 @@ assert enableSDL -> available SDL; assert enableQt -> available qt4; # media libraries -assert enableFFmpeg -> available ffmpeg_2 ; +assert enableFFmpeg -> available ffmpeg ; # misc assert enableJemalloc -> available jemalloc; @@ -88,7 +88,7 @@ stdenv.mkDerivation { ] ++ optional enableAGG agg ++ optional enableCairo cairo ++ optional enableQt qt4 - ++ optional enableFFmpeg ffmpeg_2 + ++ optional enableFFmpeg ffmpeg ++ optional enableJemalloc jemalloc ++ optional enableHwAccel [ libGL libGLU ] ++ optionals enableOpenGL [ libGL libGLU ] @@ -107,6 +107,8 @@ stdenv.mkDerivation { url = "https://savannah.gnu.org/file/0001-Do-not-depend-on-pangox.patch?file_id=48366"; sha256 = "02x7sl5zwd1ld2n4b6bp16c5gk91qsap0spfbb5iwpglq3galv2l"; }) + + ./0001-fix-build-with-ffmepg-4.patch ]; configureFlags = with lib; [ diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d97f407163d7..39e4105451f3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16051,9 +16051,6 @@ with pkgs; linbox = callPackage ../development/libraries/linbox { }; - ffmpeg_2_8 = callPackage ../development/libraries/ffmpeg/2.8.nix { - inherit (darwin.apple_sdk.frameworks) Cocoa; - }; ffmpeg_3_4 = callPackage ../development/libraries/ffmpeg/3.4.nix { inherit (darwin.apple_sdk.frameworks) Cocoa CoreMedia; }; @@ -16062,7 +16059,6 @@ with pkgs; }; # Aliases - ffmpeg_2 = ffmpeg_2_8; ffmpeg_3 = ffmpeg_3_4; # Please make sure this is updated to the latest version on the next major # update to ffmpeg @@ -27242,9 +27238,7 @@ with pkgs; pcloud = callPackage ../applications/networking/pcloud { }; - pcsxr = callPackage ../misc/emulators/pcsxr { - ffmpeg = ffmpeg_2; - }; + pcsxr = callPackage ../misc/emulators/pcsxr { }; pcsx2 = callPackage ../misc/emulators/pcsx2 { wxGTK = wxGTK30-gtk3; @@ -30468,9 +30462,7 @@ with pkgs; sdlpop = callPackage ../games/sdlpop { }; - stepmania = callPackage ../games/stepmania { - ffmpeg = ffmpeg_2; - }; + stepmania = callPackage ../games/stepmania { }; streamlit = python3Packages.callPackage ../applications/science/machine-learning/streamlit { };