Commits

Anonymous committed a5bcbae

Add PID description

Comments (0)

Files changed (1)

hachoir-parser/hachoir_parser/video/mpeg_ts.py

 
 from hachoir_parser import Parser
 from hachoir_core.field import (FieldSet, ParserError,
-    UInt8, Bit, Bits, RawBytes)
+    UInt8, Enum, Bit, Bits, RawBytes)
 from hachoir_core.endian import BIG_ENDIAN
 from hachoir_core.text_handler import hexadecimal
 
         else:
             self._size = 188*8
 
+    PID = {
+        0x44: "video",
+        0x45: "audio",
+    }
+
     def createFields(self):
         yield UInt8(self, "sync", 8, text_handler=hexadecimal)
         if self["sync"].value != 0x47:
         yield Bit(self, "has_error")
         yield Bit(self, "payload_unit_start")
         yield Bit(self, "priority")
-        yield Bits(self, "pid", 13, text_handler=hexadecimal)
+        yield Enum(Bits(self, "pid", 13, text_handler=hexadecimal), self.PID)
         yield Bits(self, "scrambling_control", 2)
 
         yield Bit(self, "has_adaptation")