X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.Multimedia%2FCommon%2FDisplay.cs;h=3424027fcbcf4ff5b83e60e279bd82994e237b17;hb=22d0e7e9bc48be39e82330147bbf4e562caf7889;hp=d300c57dacd61df1eb154de9b09bf7ff6524f38c;hpb=d186aa476f615112bd84fa4340a95bcaad9ad664;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.Multimedia/Common/Display.cs b/src/Tizen.Multimedia/Common/Display.cs index d300c57d..3424027 100644 --- a/src/Tizen.Multimedia/Common/Display.cs +++ b/src/Tizen.Multimedia/Common/Display.cs @@ -21,65 +21,129 @@ namespace Tizen.Multimedia internal enum DisplayType { /// - /// Overlay surface display + /// Overlay surface display. /// Overlay, /// - /// Evas image object surface display + /// Evas image object surface display. /// Surface, /// - /// This disposes off buffers + /// This disposes off buffers. /// None, } - internal interface IDisplayable + internal interface IDisplayable { - ErrorType ApplyEvasDisplay(DisplayType type, EvasObject evasObject); + TError ApplyEvasDisplay(DisplayType type, EvasObject evasObject); + TError ApplyEcoreWindow(IntPtr windowHandle); + } + + internal interface IDisplaySetter + { + TError SetDisplay(IDisplayable target); + } + + internal class EvasDisplaySetter : IDisplaySetter + { + private readonly DisplayType _type; + private readonly EvasObject _target; + + internal EvasDisplaySetter(DisplayType type, EvasObject target) + { + if (target == IntPtr.Zero) + { + throw new ArgumentException("The evas object is not realized."); + } + + _type = type; + _target = target; + } + + public TError SetDisplay(IDisplayable target) + { + return target.ApplyEvasDisplay(_type, _target); + } + } + + internal class EcoreDisplaySetter : IDisplaySetter + { + private readonly IntPtr _windowHandle; + + internal EcoreDisplaySetter(IntPtr windowHandle) + { + _windowHandle = windowHandle; + } + + public TError SetDisplay(IDisplayable target) + { + return target.ApplyEcoreWindow(_windowHandle); + } } /// /// Provides a means to wrap various display types. /// - /// - /// - /// + /// + /// + /// + /// 3 public class Display { - private Display(DisplayType type, EvasObject target) + private readonly IDisplaySetter _setter; + + /// + /// Initializes a new instance of the class with a class. + /// + /// A to display. + /// 3 + public Display(MediaView mediaView) { - if (target == null) + if (mediaView == null) { - throw new ArgumentNullException(nameof(target)); + throw new ArgumentNullException(nameof(mediaView)); } - if (target == IntPtr.Zero) - { - throw new ArgumentException("The evas object is not realized."); - } + _setter = new EvasDisplaySetter(DisplayType.Surface, mediaView); - Type = type; - EvasObject = target; + HasMediaView = true; } /// - /// Initializes a new instance of the class with a class. + /// Initializes a new instance of the class with a class. /// - /// http://tizen.org/feature/multimedia.raw_video - /// The required feature is not supported. - public Display(MediaView mediaView) : this(DisplayType.Surface, mediaView) + /// A to display. + /// 3 + public Display(Window window) { - ValidationUtil.ValidateFeatureSupported(Features.RawVideo); + if (window == null) + { + throw new ArgumentNullException(nameof(window)); + } + + _setter = new EvasDisplaySetter(DisplayType.Overlay, window); } /// - /// Initializes a new instance of the class with a class. + /// Initializes a new instance of the class with a class. /// - public Display(Window window) : this(DisplayType.Overlay, window) + /// A to display. + /// + /// The must be + /// for the to be rendered correctly. + /// + /// 3 + public Display(NUI.Window window) { + if (window == null) + { + throw new ArgumentNullException(nameof(window)); + } + + _setter = new EcoreDisplaySetter(window.GetNativeWindowHandler()); } private EvasObject EvasObject { get; } @@ -88,6 +152,8 @@ namespace Tizen.Multimedia private object _owner; + internal bool HasMediaView { get; } = false; + internal object Owner => _owner; internal void SetOwner(object newOwner) @@ -100,9 +166,9 @@ namespace Tizen.Multimedia _owner = newOwner; } - internal ErrorType ApplyTo(IDisplayable target) + internal TError ApplyTo(IDisplayable target) { - return target.ApplyEvasDisplay(Type, EvasObject); + return _setter.SetDisplay(target); } } }