Ejemplo n.º 1
0
        private VideoInputConfigBase RebuildInputSource_Image(string id, SceneItemSourceImage image, StreamerRebuildContext rebuildContext)
        {
            if (_coreData.Root.Resources.TryGetValue(image.ResourceId, out var resource))
            {
                var data = _resourceService.GetResource(image.ResourceId);
                if (data == null || data.Length == 0)
                {
                    return(GetFailedInputSource(id, rebuildContext, InputIssueDesc.ImageNotFound, $"Resource {image.ResourceId} has no data"));
                }

                SingleFrameType type = SingleFrameType.Cube;
                if (resource.Info.Type == ResourceType.ImageJpeg)
                {
                    type = SingleFrameType.Jpg;
                }
                else if (resource.Info.Type == ResourceType.ImagePng)
                {
                    type = SingleFrameType.Png;
                }
                else
                {
                    return(GetFailedInputSource(id, rebuildContext, InputIssueDesc.ImageUnknownFormat, $"Resource {image.ResourceId} has Unknown format {resource.Info.Type}"));
                }

                return(new VideoInputConfigSingleFrame(new FixedFrameData(resource.Info.DataHash, data, type)));
            }
            else
            {
                return(GetFailedInputSource(id, rebuildContext, InputIssueDesc.ImageNotFound, $"Resource {image.ResourceId} not found"));
            }
        }
Ejemplo n.º 2
0
 public static IDirectXFilterStage Create(DirectXContext dx, byte[] buffer, SingleFrameType type, double amount)
 {
     if (type == SingleFrameType.Cube)
     {
         var cube = CubeParser.Read(buffer);
         if (cube != null)
         {
             var texture1 = cube.Is3D ? null : CreateTexture1D(dx, cube);
             var texture3 = cube.Is3D ? CreateTexture3D(dx, cube) : null;
             return(new DirectXFilterStageLUT(dx, texture1, texture3, amount, cube.Size, CreateConfig(cube.Is3D), cube.DomainMin, cube.DomainMax));
         }
     }
     else if (type == SingleFrameType.Png)
     {
         var texture = CreateTexture3D(dx, buffer);
         return(new DirectXFilterStageLUT(dx, null, texture, amount, 64, CreateConfig(true), new Vector3(0, 0, 0), new Vector3(1, 1, 1)));
     }
     return(null);
 }
Ejemplo n.º 3
0
        public static IDirectXFilterStage Create(DirectXContext dx, string resource, SingleFrameType type = SingleFrameType.Png, double amount = 1.0)
        {
            var content = DirectXHelper.ReadResourceAsBytes(resource);

            return(Create(dx, content, type, amount));
        }
Ejemplo n.º 4
0
 public FixedFrameData(string dataId, byte[] buffer, SingleFrameType type)
 {
     DataId = dataId;
     Buffer = buffer;
     Type   = type;
 }