make this use avif instead of heif

Signed-off-by: Xe <me@christine.website>
This commit is contained in:
Cadey Ratio 2022-09-15 15:55:41 +00:00
parent 9badc7c997
commit d960234c10
9 changed files with 95 additions and 3 deletions

1
.envrc Normal file
View File

@ -0,0 +1 @@
use flake

2
.gitignore vendored
View File

@ -5,3 +5,5 @@
/*.yuv
/*.xml
/*.png
.direnv

View File

@ -8,8 +8,8 @@ import (
"io"
"os"
"github.com/Kagami/go-avif"
"github.com/docopt/docopt-go"
"tulpa.dev/cadey/avif"
)
const VERSION = "0.0.0"

View File

@ -6,7 +6,7 @@ import (
"log"
"os"
"github.com/Kagami/go-avif"
"tulpa.dev/cadey/avif"
)
const usageHelp = "Usage: %s src.jpg dst.avif"

42
flake.lock Normal file
View File

@ -0,0 +1,42 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1663087123,
"narHash": "sha256-cNIRkF/J4mRxDtNYw+9/fBNq/NOA2nCuPOa3EdIyeDs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9608ace7009ce5bc3aeb940095e01553e635cbc7",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"utils": "utils"
}
},
"utils": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

40
flake.nix Normal file
View File

@ -0,0 +1,40 @@
{
description = "/x/perimental code";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils }@attrs:
utils.lib.eachSystem [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
] (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
(final: prev: {
go = prev.go_1_19;
buildGoModule = prev.buildGo119Module;
})
];
};
in {
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
go
gopls
gotools
go-tools
pkg-config
libaom
];
};
});
}

5
go.mod Normal file
View File

@ -0,0 +1,5 @@
module tulpa.dev/cadey/avif
go 1.19
require github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815

2
go.sum Normal file
View File

@ -0,0 +1,2 @@
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 h1:bWDMxwH3px2JBh6AyO7hdCn/PkvCZXii8TGj7sbtEbQ=
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=

2
mp4.go
View File

@ -725,7 +725,7 @@ func muxFrame(w io.Writer, m image.Image, subsampling image.YCbCrSubsampleRatio,
fileData := boxMDAT{data: obuData}
fileType := boxFTYP{
majorBrand: itemTypeMIF1,
majorBrand: itemTypeAVIF,
compatibleBrands: []fourCC{itemTypeMIF1, itemTypeAVIF, itemTypeMIAF},
}
metadata := boxMETA{