Frédéric Yhuel avatar Frédéric Yhuel committed f049f01

add build_esds() fun

Comments (0)

Files changed (1)

build_moov_box.py

     moov_size = 8 + len(mvhd) + len(atrak) + len(mtrak) + len(mvex)
     moov_header = pack(">L4s", moov_size, "moov")
 
-    moov = moov_header + mvhd + atrak + mtrak + mvex
+    moov = moov_header + mvhd
+    moov += atrak
+    moov += mtrak
+    moov += mvex
     init = ftyp + moov
     output.write(init)
 
             res[("WaveFormatEx", Index)] = b16decode(CodecPrivateData)
 
         elif FourCC == "AACL":
-            res[("AACL", Index)] = ""
+            res[("AACL", Index)] = b16decode(CodecPrivateData)
 
 
     pprint(res)
     elif track_type == "audio":
         if params["acodec"] == "AACL":
             audio_fmt = "mp4a"
-            audio_extra = pack(">H31LHB", 0x0000, 0x00816573, 0x64730000, 0x00000380,\
-                    0x80807000, 0x00000480, 0x80806240, 0x15003000, 0x0001f400,\
-                    0x0001f400, 0x05808080, 0x50121008, 0xc4000020, 0x00000000,\
-                    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,\
-                    0x00000000, 0x01000000, 0,0,0,0,0,0,0,0,0,0, 0x00068080,\
-                    0x8001, 0x02)
+            #audio_extra = pack(">H31LHB", 0x0000, 0x00816573, 0x64730000, 0x00000380,\
+            #        0x80807000, 0x00000480, 0x80806240, 0x15003000, 0x0001f400,\
+            #        0x0001f400, 0x05808080, 0x50121008, 0xc4000020, 0x00000000,\
+            #        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,\
+            #        0x00000000, 0x01000000, 0,0,0,0,0,0,0,0,0,0, 0x00068080,\
+            #        0x8001, 0x02)
+            audio_extra = build_esds(params)
 
         elif params["acodec"] == "WMAP":
             audio_fmt = "wma "
     stbl = stbl_header + stts + ctts + stsc + stco + stsz + stsd
     return stbl
 
+def build_esds(params):
+
+    const = pack(">H3L", 0x0380, 0x80807000, 0x00000480, 0x80806240)
+    const += pack(">4LB", 0x15003000, 0x0001f400, 0x0001f400, 0x05808080, 0x50)
+    CodecPrivateData = params[("AACL", 0)]
+    end = pack(">3H", 0x0680, 0x8080, 0x0102)
+    esds_size = 12 + len(const) + len(CodecPrivateData) + len(end)
+    esds_header = pack(">L4sL", esds_size, "esds", 0)
+    esds = esds_header + const + CodecPrivateData + end
+
+    return esds
+
 def build_wfex(params):
     const = pack(">4LH", 0x62010200, 0x44ac0000, 0xe32e0000, 0x6b111000, 0x1200)
     WaveFormatEx = params[("WaveFormatEx", 0)]
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.