Skip to content

Commit

Permalink
Verify if video file exists. Fix #53
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Ruiz committed Jan 18, 2022
1 parent 1b5eb7a commit e1ea8f4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pynq_composable/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ def __init__(self, ol: Overlay, filename: str,
raise ValueError("filename ({}) is not an string or integer"
.format(filename))

if isinstance(filename, str) and not os.path.exists(filename):
raise RuntimeError("File {} does not exists".format(filename))

self._file = filename
self._hdmi_out = ol.video.hdmi_out
self._videoIn = None
Expand Down Expand Up @@ -431,6 +434,13 @@ def __init__(self, ol: Overlay, filename: str,
Xilinx VideoDMA IP core
"""

if not isinstance(filename, str) and not isinstance(filename, int):
raise ValueError("filename ({}) is not an string or integer"
.format(filename))

if isinstance(filename, str) and not os.path.exists(filename):
raise RuntimeError("File {} does not exists".format(filename))

self._file = filename
self.vdma = ol.video.axi_vdma
self.mode = mode
Expand Down

0 comments on commit e1ea8f4

Please sign in to comment.