diff --git a/pkgs/development/libraries/libmkv/A01-hbmv-pgs.patch b/pkgs/development/libraries/libmkv/A01-hbmv-pgs.patch new file mode 100644 index 000000000000..9f863cac4122 --- /dev/null +++ b/pkgs/development/libraries/libmkv/A01-hbmv-pgs.patch @@ -0,0 +1,12 @@ +diff --git a/include/libmkv.h b/include/libmkv.h +index 146a91f..f03d608 100644 +--- a/include/libmkv.h ++++ b/include/libmkv.h +@@ -94,6 +94,7 @@ extern "C" { + #define MK_SUBTITLE_USF "S_TEXT/USF" + #define MK_SUBTITLE_VOBSUB "S_VOBSUB" + #define MK_SUBTITLE_BMP "S_IMAGE/BMP" ++#define MK_SUBTITLE_PGS "S_HDMV/PGS" + + /* Official Tags */ + #define MK_TAG_TITLE "TITLE" diff --git a/pkgs/development/libraries/libmkv/A02-audio-out-sampling-freq.patch b/pkgs/development/libraries/libmkv/A02-audio-out-sampling-freq.patch new file mode 100644 index 000000000000..ea31957c1d29 --- /dev/null +++ b/pkgs/development/libraries/libmkv/A02-audio-out-sampling-freq.patch @@ -0,0 +1,28 @@ +diff --git a/include/libmkv.h b/include/libmkv.h +index 146a91f..f03d608 100644 +--- a/include/libmkv.h ++++ b/include/libmkv.h +@@ -203,6 +204,7 @@ struct mk_TrackConfig_s { + } video; + struct { + float samplingFreq; /* Sampling Frequency in Hz */ ++ float outputSamplingFreq; /* Playback Sampling Frequency in Hz (e.g. for AAC w/SBR) */ + unsigned channels; /* Number of channels for this track */ + unsigned bitDepth; /* Bits per sample (PCM) */ + } audio; +diff --git a/src/tracks.c b/src/tracks.c +index f9c7e48..a2a60ca 100644 +--- a/src/tracks.c ++++ b/src/tracks.c +@@ -174,6 +174,11 @@ mk_Track *mk_createTrack(mk_Writer *w, mk_TrackConfig *tc) + /* SamplingFrequency */ + if (mk_writeFloat(v, MATROSKA_ID_AUDIOSAMPLINGFREQ, tc->extra.audio.samplingFreq) < 0) + return NULL; ++ if (tc->extra.audio.outputSamplingFreq) { ++ /* Output SamplingFrequency */ ++ if (mk_writeFloat(v, MATROSKA_ID_AUDIOOUTSAMPLINGFREQ, tc->extra.audio.outputSamplingFreq) < 0) ++ return NULL; ++ } + /* Channels */ + if (mk_writeUInt(v, MATROSKA_ID_AUDIOCHANNELS, tc->extra.audio.channels) < 0) + return NULL; diff --git a/pkgs/development/libraries/libmkv/P00-mingw-large-file.patch b/pkgs/development/libraries/libmkv/P00-mingw-large-file.patch new file mode 100644 index 000000000000..6a83eacca83e --- /dev/null +++ b/pkgs/development/libraries/libmkv/P00-mingw-large-file.patch @@ -0,0 +1,24 @@ +--- libmkv.orig/src/matroska.c 2009-01-12 23:14:26.000000000 -0800 ++++ libmkv/src/matroska.c 2009-03-25 15:22:30.000000000 -0700 +@@ -27,6 +27,11 @@ + + #include + ++#if defined( __MINGW32__ ) ++#undef fseeko ++#define fseeko fseeko64 ++#endif ++ + #define RESERVED_SEEKHEAD 0x100 + /* 256 bytes should be enough room for our Seek entries. */ + #define RESERVED_CHAPTERS 0x800 +@@ -34,7 +39,7 @@ + + int mk_seekFile(mk_Writer *w, uint64_t pos) + { +- if (fseek(w->fp, pos, SEEK_SET)) ++ if (fseeko(w->fp, pos, SEEK_SET)) + return -1; + + w->f_pos = pos; + diff --git a/pkgs/development/libraries/libmkv/default.nix b/pkgs/development/libraries/libmkv/default.nix new file mode 100644 index 000000000000..c4b98d956bba --- /dev/null +++ b/pkgs/development/libraries/libmkv/default.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchgit, libtool, autoconf, automake }: + +stdenv.mkDerivation rec { + name = "libmkv-0.6.5.1p2"; + + src = fetchgit { + url = https://github.com/saintdev/libmkv.git; + rev = "refs/tags/0.6.5.1"; + sha256 = "1b0441x5rl5dbwrc0hq9jih111iil7ckqws3hcdj63jx2ma3s4hi"; + }; + + nativeBuildInputs = [ libtool autoconf automake ]; + + # TODO fix library version + preConfigure = "sh bootstrap.sh"; + + # From Handbrake + patches = [ + ./A01-hbmv-pgs.patch + ./A02-audio-out-sampling-freq.patch + ./P00-mingw-large-file.patch + ]; + + meta = { + homepage = https://github.com/saintdev/libmkv; + license = stdenv.lib.licenses.gpl2; + maintainers = [ stdenv.lib.maintainers.wmertens ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 54c61561da8d..5b574c1f8af7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5142,6 +5142,8 @@ let libmilter = callPackage ../development/libraries/libmilter { }; + libmkv = callPackage ../development/libraries/libmkv { }; + libmms = callPackage ../development/libraries/libmms { }; libmowgli = callPackage ../development/libraries/libmowgli { };