Unverified Commit cce7304a authored by Tristan Ross's avatar Tristan Ross Committed by GitHub
Browse files

gpac: add ffmpeg support & refactor (#424904)

parents a3d5e2b9 62d9589a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -25995,6 +25995,11 @@
    githubId = 91203390;
    name = "Felix Kimmel";
  };
  thesn = {
    github = "thesn10";
    githubId = 38666407;
    name = "TheSN";
  };
  thesola10 = {
    email = "me@thesola.io";
    github = "Thesola10";
+110 −16
Original line number Diff line number Diff line
@@ -2,38 +2,131 @@
  lib,
  stdenv,
  fetchFromGitHub,
  gitUpdater,
  unstableGitUpdater,
  cctools,
  pkg-config,
  zlib,
}:
  ffmpeg-headless,
  freetype,
  libjpeg_turbo,
  libpng,
  libmad,
  faad2,
  libogg,
  libvorbis,
  libtheora,
  a52dec,
  nghttp2,
  openjpeg,
  libcaca,
  mesa,
  mesa_glu,
  xvidcore,
  openssl,
  jack2,
  alsa-lib,
  pulseaudio,
  SDL2,
  curl,
  xorg,

stdenv.mkDerivation rec {
  pname = "gpac";
  version = "2.4.0";
  withFullDeps ? false,
  withFfmpeg ? withFullDeps,
  releaseChannel ? "stable",
}:

let
  stable = rec {
    version = "2.4.0"; # See below TODO.
    src = fetchFromGitHub {
      owner = "gpac";
      repo = "gpac";
      rev = "v${version}";
      hash = "sha256-RADDqc5RxNV2EfRTzJP/yz66p0riyn81zvwU3r9xncM=";
    };
    updateScript = gitUpdater {
      odd-unstable = true;
      rev-prefix = "v";
      ignoredVersions = "^(abi|test)";
    };
  }
  // {
    # ffmpeg 7.0.2 works, but 7.1.1 (which is packaged in nixpkgs) doesn't
    # because v2.4.0 of this package relies on internal private ffmpeg fields.
    # TODO: remove this, and switch to simply using ffmpeg-headless,
    #       when updating stable to 2.6
    ffmpeg-headless = ffmpeg-headless.override {
      version = "7.0.2";
      hash = "sha256-6bcTxMt0rH/Nso3X7zhrFNkkmWYtxsbUqVQKh25R1Fs=";
    };
  };
  unstable = {
    version = "2.4-unstable-2025-10-26";
    src = fetchFromGitHub {
      owner = "gpac";
      repo = "gpac";
      rev = "e1a54e81b3befba2b0bffd1d4c1cf50da516c5f3";
      hash = "sha256-jSMBPuWPmTDCebImdmAcCZl0hEQpJK4QMNGcEXgs3A4=";
    };
    updateScript = unstableGitUpdater {
      tagFormat = "v*";
      tagPrefix = "v";
    };
    inherit ffmpeg-headless;
  };
  channelToUse = if releaseChannel == "unstable" then unstable else stable;
in
stdenv.mkDerivation (finalAttrs: {
  pname = "gpac";
  inherit (channelToUse) version src;

  # this is the bare minimum configuration, as I'm only interested in MP4Box
  # For most other functionality, this should probably be extended
  nativeBuildInputs = [
    pkg-config
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    cctools
  ]
  ++ lib.optionals withFfmpeg [
    channelToUse.ffmpeg-headless
  ];

  # ref: https://wiki.gpac.io/Build/build/GPAC-Build-Guide-for-Linux/#gpac-easy-build-recommended-for-most-users
  buildInputs = [
    zlib
  ]
  ++ lib.optionals withFullDeps [
    freetype
    libjpeg_turbo
    libpng
    libmad
    faad2
    libogg
    libvorbis
    libtheora
    a52dec
    nghttp2
    openjpeg
    libcaca
    xorg.libX11
    xorg.libXv
    xorg.xorgproto
    mesa
    mesa_glu
    xvidcore
    openssl
    jack2
    alsa-lib
    pulseaudio
    SDL2
    curl
  ];

  enableParallelBuilding = true;

  meta = with lib; {
  passthru.updateScript = channelToUse.updateScript;

  meta = {
    description = "Open Source multimedia framework for research and academic purposes";
    longDescription = ''
      GPAC is an Open Source multimedia framework for research and academic purposes.
@@ -48,10 +141,11 @@ stdenv.mkDerivation rec {
      And some server tools included in MP4Box and MP42TS applications.
    '';
    homepage = "https://gpac.wp.imt.fr";
    license = licenses.lgpl21;
    maintainers = with maintainers; [
    license = lib.licenses.lgpl21;
    maintainers = with lib.maintainers; [
      mgdelacroix
      thesn
    ];
    platforms = platforms.unix;
    platforms = lib.platforms.unix;
  };
}
})
+4 −0
Original line number Diff line number Diff line
@@ -14523,4 +14523,8 @@ with pkgs;
  davis = callPackage ../by-name/da/davis/package.nix {
    php = php83; # https://github.com/tchapi/davis/issues/195
  };

  gpac-unstable = callPackage ../by-name/gp/gpac/package.nix {
    releaseChannel = "unstable";
  };
}