~martijnbraam/pyatem

c83f90b21d69db63ae4c26861dab7d8da388c91b — Martijn Braam 2 months ago 98d5ad2
Fail less hard on bad connections
1 files changed, 6 insertions(+), 0 deletions(-)

M gtk_switcher/media.py
M gtk_switcher/media.py => gtk_switcher/media.py +6 -0
@@ 94,6 94,12 @@ class MediaPage:

        width, height = self.connection.mixer.mixerstate['video-mode'].get_resolution()
        raw = atem_to_rgb(data, width, height)

        # Pad the frame to the right size instead of failing hard when the transfer is corrupted
        if len(raw) != (width * 4 * height):
            missing = (width * 4 * height) - len(raw)
            raw += b'\0' * missing

        gdk_raw = GLib.Bytes.new(raw)
        pixbuf = GdkPixbuf.Pixbuf.new_from_bytes(gdk_raw, GdkPixbuf.Colorspace.RGB, True, 8, width, height,
                                                 width * 4)