]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Multiplex HE-AAC with explicit SBR signalling in MKV 56/head
authorMikael Lund Jepsen <github@lundjepsen.dk>
Tue, 21 Feb 2012 21:58:56 +0000 (22:58 +0100)
committerMikael Lund Jepsen <github@lundjepsen.dk>
Tue, 21 Feb 2012 21:58:56 +0000 (22:58 +0100)
This is a possible fix for bug #858: http://www.lonelycoder.com/redmine/issues/858

Ref: ISO/IEC 14496-3, Part 3: Audio
     Section 1.6.2.1 AudioSpecificConfig, and table 1.13 in particular

src/parser_latm.c

index 52e262f6bb5a33ff5f3f1ea74fca0a8ce1a651a9..9d7369a9e9303cc25ca4a7c529dbf19d33d35b36 100644 (file)
@@ -63,19 +63,28 @@ read_audio_specific_config(elementary_stream_t *st, latm_private_t *latm,
   int aot, sr;
 
   aot = read_bits(bs, 5);
-  if(aot != 2)
-    return;
 
   latm->sample_rate_index = read_bits(bs, 4);
 
   if(latm->sample_rate_index == 0xf)
-    return;
+    sr = read_bits(bs, 24);
+  else
+    sr = sri_to_rate(latm->sample_rate_index);
 
-  sr = sri_to_rate(latm->sample_rate_index);
   st->es_frame_duration = 1024 * 90000 / sr;
 
   latm->channel_config = read_bits(bs, 4);
 
+  if (aot == 5) { // AOT_SBR
+    if (read_bits(bs, 4) == 0xf) {  // extensionSamplingFrequencyIndex
+       skip_bits(bs, 24);
+    }
+    aot = read_bits(bs, 5);    // this is the main object type (i.e. non-extended)
+  }
+
+  if(aot != 2)
+    return;
+
   skip_bits(bs, 1); //framelen_flag
   if(read_bits1(bs))  // depends_on_coder
     skip_bits(bs, 14);