summaryrefslogtreecommitdiffstats
path: root/contrib/libmkv/A02-audio-out-sampling-freq.patch
blob: 12c05dda75034a086822f537f3400cabf859a32f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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/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;