Beispiel #1
0
 public void initialize(Animations anim, iMediaEngine media)
 {
     animations  = anim;
     mediaEngine = media;
     if (null == fakeAnimation)
     {
         fakeAnimation = animations.startFake();
     }
 }
Beispiel #2
0
        /// <summary>Creates an object which holds GPU resources necessary to render video frames.</summary>
        /// <remarks>Linux and Windows versions of that thing are substantially different, but both expose same API.</remarks>
        public static iVideoRenderState createRenderer(this iMediaEngine mediaEngine, Context context, IRenderDevice device, Vector4 borderColor)
        {
            if (mediaEngine is iLinuxMediaEngine linux)
            {
                // Linux implementation is in .NET, it exposes this from the engine.
                return(linux.createRenderer(device, context.swapChainSize, context.swapChainFormats, borderColor));
            }

            Debug.Assert(RuntimeEnvironment.runningWindows);
            return(new Render.WindowsRender(device, context.swapChainSize, context.swapChainFormats, borderColor, mediaEngine));
        }
Beispiel #3
0
        /// <summary>Set URL of a media resource. Return a task which completes when it’s ready to be played, or fails if it was unable to do so.</summary>
        public static Task loadMedia(this iMediaEngine mediaEngine, string url)
        {
            if (mediaEngine is iLinuxMediaEngine linux)
            {
                // Linux implementation is in .NET, it exposes a task-based asynchronous API for loading videos
                return(linux.loadMedia(url));
            }

            // Windows implementation is in C++, needs that helper iCompletionSource object to marshal the result back to .NET
            CompletionSource cs = new CompletionSource();

            mediaEngine.loadMedia(url, cs);
            return(cs.task);
        }
Beispiel #4
0
 protected override void createResources(IRenderDevice device)
 {
     mediaEngine = context.createMediaEngine(context.swapChainFormats.color);
 }
Beispiel #5
0
 public WindowsRender(IRenderDevice device, CSize renderTargetSize, SwapChainFormats formats, Vector4 borderColor, iMediaEngine mediaEngine) :
     base(device, renderTargetSize, formats, borderColor, new sDecodedVideoSize(mediaEngine.nativeVideoSize))
 {
     this.mediaEngine = mediaEngine;
     videoTexture     = mediaEngine.createFrameTexture(device, formats.color);
 }