public FilterTrackSelectStatementData(FilterTrackSelectStatement track)
 {
     if (track != null)
     {
         PropertyConditions =
             track.PropertyConditions.Select(c => new FilterTrackPropertyConditionData(c)).ToList();
     }
 }
示例#2
0
 public FilterTrackSelectStatementData(FilterTrackSelectStatement track)
 {
     if (track != null)
     {
         PropertyConditions =
             track.PropertyConditions.Select(c => new FilterTrackPropertyConditionData(c)).ToList();
     }
 }
        // use internal list to create filter tracks
        private List<FilterTrackSelectStatement> CreateFilterTracks()
        {
            List<FilterTrackSelectStatement> filterTrackSelectStatements = new List<FilterTrackSelectStatement>();

            foreach (var track in filtertracks)
            {
                FilterTrackSelectStatement filterTrackSelectStatement = new FilterTrackSelectStatement();
                filterTrackSelectStatement.PropertyConditions = new List<IFilterTrackPropertyCondition>();

                foreach (var condition in track.conditions)
                {
                    FilterTrackCompareOperator oper = (FilterTrackCompareOperator)Enum.Parse(typeof(FilterTrackCompareOperator), condition.oper);

                    switch (condition.property)
                    {
                        case (FilterProperty.Bitrate):
                            filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackBitrateRangeCondition(ReturnFilterTrackBitrateRangeFromString(condition.value), oper));
                            break;

                        case (FilterProperty.FourCC):
                            filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackFourCCCondition(condition.value, oper));
                            break;
                        case (FilterProperty.Language):
                            filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackLanguageCondition(condition.value, oper));
                            break;

                        case (FilterProperty.Name):
                            filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackNameCondition(condition.value, oper));
                            break;

                        case (FilterProperty.Type):
                            var mytype = (FilterTrackType)Enum.Parse(typeof(FilterTrackType), condition.value);
                            filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackTypeCondition(mytype, oper));
                            break;
                    }
                }
                filterTrackSelectStatements.Add(filterTrackSelectStatement);
            }

            return filterTrackSelectStatements;
        }
        private void buttonInsertSample_Click(object sender, EventArgs e)
        {
            // Filter sample
            // _filter.PresentationTimeRange = new IFilterPresentationTimeRange() { LiveBackoffDuration = string.Empty, StartTimestamp = string.Empty, PresentationWindowDuration = string.Empty, EndTimestamp = "300000000", Timescale = "10000000" };

            List<FilterTrackSelectStatement> filterTrackSelectStatements = new List<FilterTrackSelectStatement>();
            FilterTrackSelectStatement filterTrackSelectStatement = new FilterTrackSelectStatement();

            filterTrackSelectStatement.PropertyConditions = new List<IFilterTrackPropertyCondition>();
            filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackTypeCondition(FilterTrackType.Video, FilterTrackCompareOperator.Equal));
            filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackBitrateRangeCondition(new FilterTrackBitrateRange(0, 1048576), FilterTrackCompareOperator.Equal));
            filterTrackSelectStatements.Add(filterTrackSelectStatement);

            filterTrackSelectStatement = new FilterTrackSelectStatement();
            filterTrackSelectStatement.PropertyConditions = new List<IFilterTrackPropertyCondition>();
            filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackTypeCondition(FilterTrackType.Audio, FilterTrackCompareOperator.Equal));
            filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackFourCCCondition(FilterPropertyFourCCValue.mp4a, FilterTrackCompareOperator.Equal));
            filterTrackSelectStatements.Add(filterTrackSelectStatement);

            filterTrackSelectStatement = new FilterTrackSelectStatement();
            filterTrackSelectStatement.PropertyConditions = new List<IFilterTrackPropertyCondition>();
            filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackTypeCondition(FilterTrackType.Text, FilterTrackCompareOperator.Equal));
            filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackLanguageCondition("en", FilterTrackCompareOperator.Equal));
            filterTrackSelectStatements.Add(filterTrackSelectStatement);

            filtertracks = ConvertFilterTracksToInternalVar(filterTrackSelectStatements);

            RefreshTracks();
            RefreshTracksConditions();
        }