libmkv: from Handbrake project

Libmkv was started from Handbrake but is now unmaintained upstream.

Patches:
- A01: add constant to header file
- A02: Breaks API: Allow changing output sampling frequency
- P00: Fix accessing large files on Mingw32
This commit is contained in:
Wout Mertens 2014-05-04 01:52:45 +02:00
parent d1ebc1a2b3
commit 3a7b7a8499
5 changed files with 95 additions and 0 deletions

View File

@ -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"

View File

@ -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;

View File

@ -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 <sys/time.h>
+#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;

View File

@ -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 ];
};
}

View File

@ -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 { };