public static bool IsAvailable(this VideoSource src, DeviceProfile profile, params InternalPortType[] ignorePortTypes)
        {
            if (!src.IsValid())
            {
                return(false);
            }

            VideoSourceTypeAttribute props = src.GetAttribute <VideoSource, VideoSourceTypeAttribute>();

            if (ignorePortTypes.Contains(props.PortType))
            {
                return(false);
            }

            switch (props.PortType)
            {
            case InternalPortType.Auxiliary:
                return(props.Me1Index <= profile.Auxiliaries);

            case InternalPortType.Black:
            case InternalPortType.ColorBars:
                return(true);

            case InternalPortType.ColorGenerator:
                return(props.Me1Index <= profile.ColorGenerators);

            case InternalPortType.External:
                return(props.Me1Index <= profile.Sources.Count);

            case InternalPortType.MEOutput:
                return(props.Me1Index <= profile.MixEffectBlocks);

            case InternalPortType.Mask:
                if (profile.MixEffectBlocks > 1)
                {
                    return(props.Me2Index <= profile.UpstreamKeys);
                }
                return(props.Me1Index <= profile.UpstreamKeys);

            case InternalPortType.MediaPlayerFill:
            case InternalPortType.MediaPlayerKey:
                return(props.Me1Index <= profile.MediaPlayers);

            case InternalPortType.SuperSource:
                return(props.Me1Index <= profile.SuperSource);

            default:
                Debug.Fail(String.Format("Invalid source type:{0}", props.PortType));
                return(false);
            }
        }
예제 #2
0
        public static Tuple <string, string> GetDefaultName(this VideoSource src, DeviceProfile profile)
        {
            switch (profile.Model)
            {
            case ModelId.TwoME:
            case ModelId.TwoMe4K:
            case ModelId.TwoMEBS4K:
                switch (src)
                {
                case VideoSource.ME1Prev:
                    return(Tuple.Create("ME 1 PVW", "Pvw1"));

                case VideoSource.ME1Prog:
                    return(Tuple.Create("ME 1 PGM", "Pgm1"));

                case VideoSource.ME2Prev:
                    return(Tuple.Create("ME 2 PVW", "Pvw2"));

                case VideoSource.ME2Prog:
                    return(Tuple.Create("ME 2 PGM", "Pgm2"));
                }
                break;

            case ModelId.OneME:
            case ModelId.OneME4K:
            case ModelId.TVStudio:
            case ModelId.TVStudioHD:
                switch (src)
                {
                case VideoSource.ME1Prev:
                    return(Tuple.Create("Preview", "Pvw"));

                case VideoSource.ME1Prog:
                    return(Tuple.Create("Program", "Pgm"));
                }
                break;
            }

            if (profile.MixEffectBlocks > 1)
            {
                switch (src)
                {
                case VideoSource.Key1Mask:
                    return(Tuple.Create("ME 1 Key 1 Mask", "M1K1"));

                case VideoSource.Key2Mask:
                    return(Tuple.Create("ME 1 Key 2 Mask", "M1K2"));

                case VideoSource.Key3Mask:
                    return(Tuple.Create("ME 2 Key 1 Mask", "M2K1"));

                case VideoSource.Key4Mask:
                    return(Tuple.Create("ME 2 Key 2 Mask", "M2K2"));
                }
            }
            else
            {
                switch (src)
                {
                case VideoSource.Key1Mask:
                    return(Tuple.Create("Key 1 Mask", "M1K1"));

                case VideoSource.Key2Mask:
                    return(Tuple.Create("Key 2 Mask", "M1K2"));

                case VideoSource.Key3Mask:
                    return(Tuple.Create("Key 3 Mask", "M1K3"));

                case VideoSource.Key4Mask:
                    return(Tuple.Create("Key 4 Mask", "M1K4"));
                }
            }

            var nameAttr = src.GetAttribute <VideoSource, VideoSourceDefaultsAttribute>();

            return(Tuple.Create(nameAttr.LongName, nameAttr.ShortName));
        }
예제 #3
0
        public static bool IsAvailable(this VideoSource src, DeviceProfile profile, params InternalPortType[] ignorePortTypes)
        {
            if (!src.IsValid())
            {
                return(false);
            }

            VideoSourceTypeAttribute props = src.GetAttribute <VideoSource, VideoSourceTypeAttribute>();

            if (ignorePortTypes.Contains(props.PortType))
            {
                return(false);
            }

            switch (props.PortType)
            {
            case InternalPortType.Auxiliary:
                return(props.Me1Index <= profile.Auxiliaries);

            case InternalPortType.Black:
            case InternalPortType.ColorBars:
                return(true);

            case InternalPortType.ColorGenerator:
                return(props.Me1Index <= 2);    // profile.ColorGenerators; TODO - should this be dynamic?

            case InternalPortType.External:
                return(props.Me1Index <= profile.Sources.Count);

            case InternalPortType.MEOutput:
                if (!(props.Me1Index <= profile.MixEffectBlocks))
                {
                    return(false);
                }

                // TODO - should cleanfeed be its own type?
                if (props.Me1Index == 0 && src >= VideoSource.CleanFeed1 && src < VideoSource.Auxilary1)
                {
                    long cleanFeedId = src - VideoSource.CleanFeed1;
                    return(cleanFeedId < profile.DownstreamKeys);
                }

                return(true);

            case InternalPortType.Mask:
                if (profile.MixEffectBlocks > 1)
                {
                    return(props.Me2Index <= profile.UpstreamKeys);
                }
                return(props.Me1Index <= profile.UpstreamKeys);

            case InternalPortType.MediaPlayerFill:
            case InternalPortType.MediaPlayerKey:
                return(props.Me1Index <= profile.MediaPlayers);

            case InternalPortType.SuperSource:
                long id = src - VideoSource.SuperSource;
                return(props.Me1Index <= profile.SuperSource && id < profile.SuperSource);

            default:
                Debug.Fail(String.Format("Invalid source type:{0}", props.PortType));
                return(false);
            }
        }
예제 #4
0
 public static InternalPortType GetPortType(this VideoSource src)
 {
     return(src.GetAttribute <VideoSource, VideoSourceTypeAttribute>().PortType);
 }