12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using fis.media.Library.Media.Players;
- using fis.media.Library.Media.Publisher;
- using fis.media.Library.Players;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace fis.media.Helpers
- {
- public class ImageClipHelper
- {
- private static TerminalLiveDataBytes _termialliveDataBytes = new TerminalLiveDataBytes();
- public static bool ClippedChannelData(List<PlayerChannel> playerChannels, VideoFrameData videoFrameData)
- {
- var isClipped = false;
- foreach (var c in playerChannels)
- {
- UpdateChannels(c, videoFrameData, ref isClipped);
- }
-
- return true;
- }
- private static void UpdateChannels(PlayerChannel c, VideoFrameData videoFrameData, ref bool isClipped)
- {
- var layerType = c.MemberLayerConfig.LayerType;
- if (layerType == LayerType.Single)
- {
- c.UpdateFrame(videoFrameData.Data,videoFrameData.Width, videoFrameData.Height);
- return;
- }
- if (layerType == LayerType.WithOneCamera)
- {
-
- var deskTopWidth = c.MemberLayerConfig.RegionInfo.MainRegion.Width;
- var deskTopHeight = c.MemberLayerConfig.RegionInfo.MainRegion.Height;
- var cameraWidth = c.MemberLayerConfig.RegionInfo.SideRegionOne.Width;
- var cameraHeight= c.MemberLayerConfig.RegionInfo.SideRegionOne.Height;
- var terminalBytesSize = deskTopWidth * deskTopHeight * 4;
- var cameraBytesSize = cameraWidth * cameraHeight * 4;
- if (isClipped)
- {
- if (c.ChannelName == ChannelNameEnum.Main)
- {
- c.UpdateFrame(_termialliveDataBytes.TerminalData, deskTopWidth, deskTopHeight);
- }
- if (c.ChannelName == ChannelNameEnum.SideOne)
- {
- c.UpdateFrame(_termialliveDataBytes.CameraData, cameraWidth,cameraHeight);
- }
- return;
- }
- _termialliveDataBytes.Update(videoFrameData.Data, terminalBytesSize, cameraBytesSize,
- deskTopWidth, deskTopHeight, c.MemberLayerConfig.RegionInfo.Width);
- isClipped = true;
- if (c.ChannelName == ChannelNameEnum.Main)
- {
- c.UpdateFrame(_termialliveDataBytes.TerminalData, deskTopWidth, deskTopHeight);
- }
- if (c.ChannelName == ChannelNameEnum.SideOne)
- {
- c.UpdateFrame(_termialliveDataBytes.CameraData, cameraWidth, cameraHeight);
- }
- }
- }
- }
- }
|