1 // 2 // Copyright (c) 2010-2018 Antmicro 3 // Copyright (c) 2011-2015 Realtime Embedded 4 // 5 // This file is licensed under the MIT License. 6 // Full license text is available in 'licenses/MIT.txt'. 7 // 8 using Antmicro.Renode.Peripherals; 9 using Antmicro.Renode.Peripherals.Video; 10 using Antmicro.Renode.Backends.Display; 11 using ELFSharp.ELF; 12 13 namespace Antmicro.Renode.Backends.Video 14 { 15 public class VideoBackend : IAnalyzableBackend<IVideo> 16 { Attach(IVideo peripheral)17 public void Attach(IVideo peripheral) 18 { 19 Video = peripheral; 20 Video.FrameRendered += HandleFrameRendered; 21 Video.ConfigurationChanged += HandleConfigurationChanged; 22 } 23 HandleFrameRendered(byte[] frame)24 private void HandleFrameRendered(byte[] frame) 25 { 26 if(frame != null) 27 { 28 Frame = frame; 29 } 30 } 31 HandleConfigurationChanged(int width, int height, PixelFormat format, Endianess endianess)32 private void HandleConfigurationChanged(int width, int height, PixelFormat format, Endianess endianess) 33 { 34 Width = width; 35 Height = height; 36 Format = format; 37 Endianess = endianess; 38 } 39 40 public int Width { get; private set; } 41 public int Height { get; private set; } 42 public PixelFormat Format { get; private set; } 43 public Endianess Endianess { get; private set; } 44 45 public byte[] Frame { get; private set; } 46 47 public IVideo Video { get; private set; } 48 public IAnalyzable AnalyzableElement { get { return Video; } } 49 } 50 } 51 52