Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion arib/mpeg/ts.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,13 @@ def next_packet(filename, memorymap=True):
# memory map the file if necessary (prob requires 64 bit systems)
_file = f
if memorymap:
_file = mmap.mmap(f.fileno(), 0, prot=mmap.PROT_READ)
# --- START OF MODIFICATION ---
# This block checks the operating system to use the correct mmap parameter.
if os.name == "nt": # 'nt' is the name for Windows
_file = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
else: # For other systems like Linux or macOS
_file = mmap.mmap(f.fileno(), 0, prot=mmap.PROT_READ)
# --- END OF MODIFICATION ---

while True:
packet = _file.read(TS.PACKET_SIZE)
Expand Down