コード例 #1
0
        public Subclipping(CloudMediaContext context, MediaServiceContextForDynManifest contextdynmanifest, List<IAsset> assetlist, Mainform mainform)
        {
            InitializeComponent();
            buttonJobOptions.Initialize(context);
            this.Icon = Bitmaps.Azure_Explorer_ico;
            _context = context;
            _contextdynmanifest = contextdynmanifest;
            _parentassetmanifestdata = new ManifestTimingData();
            _selectedAssets = assetlist;
            _mainform = mainform;

            if (_selectedAssets.Count == 1 && _selectedAssets.FirstOrDefault() != null)  // one asset only
            {
                var myAsset = assetlist.FirstOrDefault();
                textBoxAssetName.Text = myAsset.Name;

                // let's try to read asset timing
                _parentassetmanifestdata = AssetInfo.GetManifestTimingData(myAsset);

                if (!_parentassetmanifestdata.Error)  // we were able to read asset timings and not live
                {
                    _timescale = timeControlStart.TimeScale = timeControlEnd.TimeScale = _parentassetmanifestdata.TimeScale;
                    timeControlStart.ScaledFirstTimestampOffset = timeControlEnd.ScaledFirstTimestampOffset = _parentassetmanifestdata.TimestampOffset;

                    textBoxOffset.Text = _parentassetmanifestdata.TimestampOffset.ToString();
                    labelOffset.Visible = textBoxOffset.Visible = true;

                    textBoxFilterTimeScale.Text = _timescale.ToString();
                    textBoxFilterTimeScale.Visible = labelAssetTimescale.Visible = true;

                    timeControlStart.Max = timeControlEnd.Max = new TimeSpan(AssetInfo.ReturnTimestampInTicks(_parentassetmanifestdata.AssetDuration, _parentassetmanifestdata.TimeScale));

                    labelassetduration.Visible = textBoxAssetDuration.Visible = true;
                    textBoxAssetDuration.Text = timeControlStart.Max.ToString(@"d\.hh\:mm\:ss") + (_parentassetmanifestdata.IsLive ? " (LIVE)" : "");
                    // let set duration and active track bat
                    timeControlStart.ScaledTotalDuration = timeControlEnd.ScaledTotalDuration = _parentassetmanifestdata.AssetDuration;
                    timeControlStart.DisplayTrackBar = true;
                    timeControlEnd.DisplayTrackBar = true;
                    timeControlEnd.SetTimeStamp(timeControlEnd.Max);

                }

                else // one asset but not able to read asset timings
                {
                    timeControlStart.DisplayTrackBar = timeControlEnd.DisplayTrackBar = false;
                    timeControlStart.TimeScale = timeControlEnd.TimeScale = _timescale;
                    timeControlStart.Max = timeControlEnd.Max = TimeSpan.MaxValue;
                    //timeControlEnd.SetTimeStamp(timeControlEnd.Max);
                }
            }
            else // several assets
            {
                groupBoxTrimming.Enabled = panelAssetInfo.Visible = false; // no trimming and no asset info
                radioButtonAssetFilter.Enabled = false; // no asset filter option
                timeControlStart.DisplayTrackBar = timeControlEnd.DisplayTrackBar = false;
                timeControlStart.TimeScale = timeControlEnd.TimeScale = _timescale;
                timeControlStart.Max = timeControlEnd.Max = TimeSpan.MaxValue;
                //timeControlEnd.SetTimeStamp(timeControlEnd.Max);
            }
        }
コード例 #2
0
        private void DisplayAssetFilters()
        {
            // let's refresh the asset
            myAsset = myContext.Assets.Where(a => a.Id == myAsset.Id).FirstOrDefault();
            if (myAsset == null) return; // Error!

            dataGridViewFilters.ColumnCount = 7;
            dataGridViewFilters.Columns[0].HeaderText = "Name";
            dataGridViewFilters.Columns[0].Name = "Name";
            dataGridViewFilters.Columns[1].HeaderText = "Id";
            dataGridViewFilters.Columns[1].Name = "Id";
            dataGridViewFilters.Columns[2].HeaderText = "Track Rules";
            dataGridViewFilters.Columns[2].Name = "Rules";
            dataGridViewFilters.Columns[3].HeaderText = "Start (d.h:m:s)";
            dataGridViewFilters.Columns[3].Name = "Start";
            dataGridViewFilters.Columns[4].HeaderText = "End (d.h:m:s)";
            dataGridViewFilters.Columns[4].Name = "End";
            dataGridViewFilters.Columns[5].HeaderText = "DVR (d.h:m:s)";
            dataGridViewFilters.Columns[5].Name = "DVR";
            dataGridViewFilters.Columns[6].HeaderText = "Live backoff (d.h:m:s)";
            dataGridViewFilters.Columns[6].Name = "LiveBackoff";

            dataGridViewFilters.Rows.Clear();
            comboBoxLocatorsFilters.Items.Clear(); //drop list in locator tab
            comboBoxLocatorsFilters.BeginUpdate();
            comboBoxLocatorsFilters.Items.Add(new Item(string.Empty, null));

            //List<AssetFilter> filters = myDynManifestContext.ListAssetFilters(myAsset);
            //var filters = myAsset.AssetFilters;

            if (myAsset.AssetFilters.Count() > 0 && myassetmanifesttimingdata == null)
            {
                myassetmanifesttimingdata = AssetInfo.GetManifestTimingData(myAsset);
            }

            foreach (var filter in myAsset.AssetFilters)
            {
                string s = null;
                string e = null;
                string d = null;
                string l = null;

                if (filter.PresentationTimeRange != null)
                {
                    ulong? start = filter.PresentationTimeRange.StartTimestamp;
                    ulong? end = filter.PresentationTimeRange.EndTimestamp;
                    TimeSpan? dvr = filter.PresentationTimeRange.PresentationWindowDuration;
                    TimeSpan? live = filter.PresentationTimeRange.LiveBackoffDuration;

                    double dscale = (filter.PresentationTimeRange.Timescale != null) ?
                        (double)filter.PresentationTimeRange.Timescale
                        : (double)TimeSpan.TicksPerSecond;

                    double dscaleoffset = (myassetmanifesttimingdata.TimeScale != null) ?
                        (double)myassetmanifesttimingdata.TimeScale
                        : (double)TimeSpan.TicksPerSecond;


                    //double scale = Convert.ToDouble(filter.PresentationTimeRange.Timescale) / 10000000d;
                    s = ReturnFilterTextWithOffSet(start, dscale, myassetmanifesttimingdata.TimestampOffset, dscaleoffset, "min");
                    e = ReturnFilterTextWithOffSet(end, dscale, myassetmanifesttimingdata.TimestampOffset, dscaleoffset, "max");
                    d = ReturnFilterText(dvr, "max");
                    l = ReturnFilterText(live, "min");
                }
                int rowi = dataGridViewFilters.Rows.Add(filter.Name, filter.Id, filter.Tracks.Count, s, e, d, l);

                // droplist
                comboBoxLocatorsFilters.Items.Add(new Item("Asset filter  : " + filter.Name, filter.Name));
            }


            myContext.Filters.ToList().ForEach(g => comboBoxLocatorsFilters.Items.Add(new Item("Global filter : " + g.Name, g.Name)));
            comboBoxLocatorsFilters.SelectedIndex = 0;
            comboBoxLocatorsFilters.EndUpdate();
        }
コード例 #3
0
        // Parse the manifest and get data from it
        public static ManifestTimingData GetManifestTimingData(IAsset asset)
        {
            ManifestTimingData response = new ManifestTimingData() { IsLive = false, Error = false, TimestampOffset = 0 };

            try
            {
                ILocator mytemplocator = null;
                Uri myuri = AssetInfo.GetValidOnDemandURI(asset);
                if (myuri == null)
                {
                    mytemplocator = AssetInfo.CreatedTemporaryOnDemandLocator(asset);
                    myuri = AssetInfo.GetValidOnDemandURI(asset);
                }
                if (myuri != null)
                {
                    XDocument manifest = XDocument.Load(myuri.ToString());
                    var smoothmedia = manifest.Element("SmoothStreamingMedia");
                    var videotrack = smoothmedia.Elements("StreamIndex").Where(a => a.Attribute("Type").Value == "video");

                    // TIMESCALE
                    string timescalefrommanifest = smoothmedia.Attribute("TimeScale").Value;
                    if (videotrack.FirstOrDefault().Attribute("TimeScale") != null) // there is timescale value in the video track. Let's take this one.
                    {
                        timescalefrommanifest = videotrack.FirstOrDefault().Attribute("TimeScale").Value;
                    }
                    ulong timescale = ulong.Parse(timescalefrommanifest);
                    response.TimeScale = (timescale == TimeSpan.TicksPerSecond) ? null : (ulong?)timescale; // if 10000000 then null (default)

                    // Timestamp offset
                    if (videotrack.FirstOrDefault().Element("c").Attribute("t") != null)
                    {
                        response.TimestampOffset = ulong.Parse(videotrack.FirstOrDefault().Element("c").Attribute("t").Value);
                    }
                    else
                    {
                        response.TimestampOffset = 0; // no timestamp, so it should be 0
                    }

                    if (smoothmedia.Attribute("IsLive") != null && smoothmedia.Attribute("IsLive").Value == "TRUE")
                    { // Live asset.... No duration to read (but we can read scaling and compute duration if no gap)
                        response.IsLive = true;

                        long duration = 0;
                        long r, d;
                        foreach (var chunk in videotrack.Elements("c"))
                        {
                            if (chunk.Attribute("t") != null)
                            {
                                duration = long.Parse(chunk.Attribute("t").Value) - (long)response.TimestampOffset; // new timestamp, perhaps gap in live stream....
                            }
                            d = chunk.Attribute("d") != null ? long.Parse(chunk.Attribute("d").Value) : 0;
                            r = chunk.Attribute("r") != null ? long.Parse(chunk.Attribute("r").Value) : 1;
                            duration += d * r;
                        }
                        response.AssetDuration = TimeSpan.FromSeconds((double)duration / ((double)timescale));
                    }
                    else
                    {
                        ulong duration = ulong.Parse(smoothmedia.Attribute("Duration").Value);
                        response.AssetDuration = TimeSpan.FromSeconds((double)duration / ((double)timescale));
                    }
                }
                else
                {
                    response.Error = true;
                }
                if (mytemplocator != null) mytemplocator.Delete();
            }
            catch
            {
                response.Error = true;
            }
            return response;
        }
コード例 #4
0
        private void DynManifestFilter_Load(object sender, EventArgs e)
        {
            _parentassetmanifestdata = new ManifestTimingData();
            tabControl1.TabPages.Remove(tabPageTRRaw);
            FillComboBoxImportFilters(_parentAsset);

            /////////////////////////////////////////////
            // New Global Filter
            /////////////////////////////////////////////
            if (_filterToDisplay == null && _parentAsset == null)
            {
                newfilter = true;
                isGlobalFilter = true;
                _filter = new Filter();
                _filter.SetContext(_contextdynman);
                _filter.PresentationTimeRange = new IFilterPresentationTimeRange();
                _filter.Tracks = new List<IFilterTrackSelect>();
                timeControlStart.DisplayTrackBar = timeControlEnd.DisplayTrackBar = timeControlDVR.DisplayTrackBar = false;

                timeControlStart.TimeScale = timeControlEnd.TimeScale = timeControlDVR.TimeScale = _timescale;
                textBoxFilterTimeScale.Text = _filter.PresentationTimeRange.Timescale;
            }

            /////////////////////////////////////////////
            // Existing Global Filter
            /////////////////////////////////////////////
            else if (_filterToDisplay != null && _parentAsset == null)
            {
                newfilter = false;
                isGlobalFilter = true;
                _filter = _filterToDisplay;
                _timescale = long.Parse(_filter.PresentationTimeRange.Timescale);
                timeControlStart.TimeScale = timeControlEnd.TimeScale = timeControlDVR.TimeScale = _timescale;
                buttonOk.Text = "Update Filter";
                buttonOk.Enabled = true; // we can enable the button
                toolTip1.SetToolTip(this.buttonOk, "It can take up to 2 minutes for streaming endpoint to refresh the rules");

                textBoxFilterName.Enabled = false; // no way to change the filter name
                textBoxFilterName.Text = _filter.Name;
                textBoxFilterTimeScale.Text = _filter.PresentationTimeRange.Timescale;

                timeControlStart.DisplayTrackBar = timeControlEnd.DisplayTrackBar = timeControlDVR.DisplayTrackBar = false;

                checkBoxStartTime.Checked = !IsMin(_filter.PresentationTimeRange.StartTimestamp);
                checkBoxEndTime.Checked = !IsMax(_filter.PresentationTimeRange.EndTimestamp);
                checkBoxDVRWindow.Checked = !IsMax(_filter.PresentationTimeRange.PresentationWindowDuration);
                checkBoxLiveBackoff.Checked = !IsMin(_filter.PresentationTimeRange.LiveBackoffDuration);

                timeControlStart.SetScaledTimeStamp(_filter.PresentationTimeRange.StartTimestamp);
                timeControlEnd.SetScaledTimeStamp(IsMax(_filter.PresentationTimeRange.EndTimestamp) ? "0" : _filter.PresentationTimeRange.EndTimestamp);  // we don't want to pass the max value to the control (overflow)
                timeControlDVR.SetScaledTimeStamp(IsMax(_filter.PresentationTimeRange.PresentationWindowDuration) ? "0" : _filter.PresentationTimeRange.PresentationWindowDuration);  // we don't want to pass the max value to the control (overflow)
                numericUpDownBackoffSeconds.Value = (decimal)((double)(long.Parse(_filter.PresentationTimeRange.LiveBackoffDuration)) / (double)_timescale);
            }

            /////////////////////////////////////////////
            // New Asset Filter
            /////////////////////////////////////////////
            else if (_filterToDisplay == null && _parentAsset != null)
            {
                newfilter = true;
                isGlobalFilter = false;
                _filter = new Filter();
                _filter.SetContext(_contextdynman);
                _filter.PresentationTimeRange = new IFilterPresentationTimeRange();
                _filter.Tracks = new List<IFilterTrackSelect>();
                labelFilterTitle.Text = "Asset Filter";
                textBoxAssetName.Visible = true;
                labelassetname.Visible = true;
                textBoxAssetName.Text = _parentAsset != null ? _parentAsset.Name : string.Empty;

                // let's try to read asset timing
                _parentassetmanifestdata = AssetInfo.GetManifestTimingData(_parentAsset);

                if (!_parentassetmanifestdata.Error)  // we were able to read asset timings and not live
                {
                    // timescale
                    _timescale = timeControlStart.TimeScale = timeControlEnd.TimeScale = timeControlDVR.TimeScale = _parentassetmanifestdata.TimeScale;
                    timeControlStart.ScaledFirstTimestampOffset = timeControlEnd.ScaledFirstTimestampOffset = _parentassetmanifestdata.TimestampOffset;

                    textBoxOffset.Text = _parentassetmanifestdata.TimestampOffset.ToString();
                    labelOffset.Visible = textBoxOffset.Visible = true;

                    // let's disable trackbars if this is live (duration is not fixed)
                    timeControlStart.DisplayTrackBar = timeControlEnd.DisplayTrackBar = timeControlDVR.DisplayTrackBar = !_parentassetmanifestdata.IsLive;

                    TimeSpan duration = new TimeSpan(AssetInfo.ReturnTimestampInTicks(_parentassetmanifestdata.AssetDuration, _parentassetmanifestdata.TimeScale));
                    textBoxAssetDuration.Text = duration.ToString(@"d\.hh\:mm\:ss");
                    labelassetduration.Visible = textBoxAssetDuration.Visible = true;
                    textBoxFilterName.Text = "filter" + new Random().Next(9999).ToString();

                    if (!_parentassetmanifestdata.IsLive)  // Not a live content
                    {
                        // let set duration and active track bat
                        timeControlStart.ScaledTotalDuration = timeControlEnd.ScaledTotalDuration = timeControlDVR.ScaledTotalDuration = _parentassetmanifestdata.AssetDuration;

                        timeControlStart.Max = timeControlEnd.Max = timeControlDVR.Max = duration;
                        timeControlEnd.SetTimeStamp(timeControlEnd.Max);

                        }
                    else
                    {
                        textBoxAssetDuration.Text += " (LIVE)";
                    }

                    if (_subclipconfig != null && _subclipconfig.Trimming) // user used the subclip UI before and timings are passed
                    {
                        timeControlStart.SetTimeStamp(_subclipconfig.StartTimeForAssetFilter - timeControlStart.GetOffSetAsTimeSpan());
                        timeControlEnd.SetTimeStamp(_subclipconfig.EndTimeForAssetFilter - timeControlStart.GetOffSetAsTimeSpan());
                        checkBoxStartTime.Checked = checkBoxEndTime.Checked = true;
                        textBoxFilterName.Text = "subclip" + new Random().Next(9999).ToString();
                    }

                }

                else // not able to read asset timings
                {
                    timeControlStart.DisplayTrackBar = timeControlEnd.DisplayTrackBar = timeControlDVR.DisplayTrackBar = false;
                    timeControlStart.TimeScale = timeControlEnd.TimeScale = timeControlDVR.TimeScale = _timescale;
                    timeControlStart.Max = timeControlEnd.Max = timeControlDVR.Max = TimeSpan.MaxValue;
                    timeControlEnd.SetTimeStamp(timeControlEnd.Max);
                    labelassetduration.Visible = textBoxAssetDuration.Visible = false;
                }
            }

            /////////////////////////////////////////////
            // Existing Asset Filter
            /////////////////////////////////////////////
            else if (_filterToDisplay != null && _parentAsset != null)
            {
                newfilter = false;
                isGlobalFilter = false;
                _filter = _filterToDisplay;
                _timescale = long.Parse(_filter.PresentationTimeRange.Timescale);
                buttonOk.Text = "Update Filter";
                buttonOk.Enabled = true; // we can enable the button
                toolTip1.SetToolTip(this.buttonOk, "It can take up to 2 minutes for streaming endpoint to refresh the rules");

                labelFilterTitle.Text = "Asset Filter";
                textBoxAssetName.Visible = true;
                labelassetname.Visible = true;
                textBoxAssetName.Text = _parentAsset != null ? _parentAsset.Name : string.Empty;

                textBoxFilterName.Enabled = false; // no way to change the filter name
                textBoxFilterName.Text = _filter.Name;

                // let's try to read asset timing
                _parentassetmanifestdata = AssetInfo.GetManifestTimingData(_parentAsset);

                _timescale = timeControlStart.TimeScale = timeControlEnd.TimeScale = timeControlDVR.TimeScale = long.Parse(_filter.PresentationTimeRange.Timescale);

                if (!_parentassetmanifestdata.Error && _timescale == _parentassetmanifestdata.TimeScale)  // we were able to read asset timings and timescale between manifest and existing asset match
                {
                    // let's disable trackbars if this is live (duration is not fixed)
                    timeControlStart.DisplayTrackBar = timeControlEnd.DisplayTrackBar = timeControlDVR.DisplayTrackBar = !_parentassetmanifestdata.IsLive;

                    timeControlStart.ScaledFirstTimestampOffset = timeControlEnd.ScaledFirstTimestampOffset = _parentassetmanifestdata.TimestampOffset;

                    textBoxOffset.Text = _parentassetmanifestdata.TimestampOffset.ToString();
                    labelOffset.Visible = textBoxOffset.Visible = true;

                    TimeSpan duration = new TimeSpan(AssetInfo.ReturnTimestampInTicks(_parentassetmanifestdata.AssetDuration, _parentassetmanifestdata.TimeScale));
                    textBoxAssetDuration.Text = duration.ToString(@"d\.hh\:mm\:ss");
                    labelassetduration.Visible = textBoxAssetDuration.Visible = true;

                    if (!_parentassetmanifestdata.IsLive)
                    {
                        timeControlStart.Max = timeControlEnd.Max = timeControlDVR.Max = duration;
                        // let set duration and active track bat
                        timeControlStart.ScaledTotalDuration = timeControlEnd.ScaledTotalDuration = timeControlDVR.ScaledTotalDuration = _parentassetmanifestdata.AssetDuration;
                    }
                    else
                    {
                        textBoxAssetDuration.Text += " (LIVE)";
                    }
                }

                else // not able to read asset timings or mismatch in timescale
                {
                    timeControlStart.DisplayTrackBar = timeControlEnd.DisplayTrackBar = timeControlDVR.DisplayTrackBar = false;
                    timeControlStart.Max = timeControlEnd.Max = timeControlDVR.Max = TimeSpan.MaxValue;
                    timeControlEnd.SetTimeStamp(timeControlEnd.Max);
                    labelassetduration.Visible = textBoxAssetDuration.Visible = false;
                }

                checkBoxStartTime.Checked = !IsMin(_filter.PresentationTimeRange.StartTimestamp);
                checkBoxEndTime.Checked = !IsMax(_filter.PresentationTimeRange.EndTimestamp);
                checkBoxDVRWindow.Checked = !IsMax(_filter.PresentationTimeRange.PresentationWindowDuration);
                checkBoxLiveBackoff.Checked = !IsMin(_filter.PresentationTimeRange.LiveBackoffDuration);

                timeControlStart.SetScaledTimeStamp(_filter.PresentationTimeRange.StartTimestamp);
                timeControlEnd.SetScaledTimeStamp(IsMax(_filter.PresentationTimeRange.EndTimestamp) ? "0" : _filter.PresentationTimeRange.EndTimestamp);  // we don't want to pass the max value to the control (overflow)
                timeControlDVR.SetScaledTimeStamp(IsMax(_filter.PresentationTimeRange.PresentationWindowDuration) ? "0" : _filter.PresentationTimeRange.PresentationWindowDuration);  // we don't want to pass the max value to the control (overflow)
                numericUpDownBackoffSeconds.Value = (decimal)((double)(long.Parse(_filter.PresentationTimeRange.LiveBackoffDuration)) / (double)_timescale);
            }

            // Common code
            textBoxFilterTimeScale.Text = _timescale.ToString();

            // dataPropertyType
            dataPropertyType = new DataTable();
            dataPropertyType.Columns.Add(new DataColumn("Value", typeof(string)));
            dataPropertyType.Columns.Add(new DataColumn("Description", typeof(string)));

            dataPropertyType.Rows.Add(FilterPropertyTypeValue.audio, FilterPropertyTypeValue.audio);
            dataPropertyType.Rows.Add(FilterPropertyTypeValue.video, FilterPropertyTypeValue.video);
            dataPropertyType.Rows.Add(FilterPropertyTypeValue.text, FilterPropertyTypeValue.text);

            // FilterPropertyFourCCValue

            dataPropertyFourCC = new DataTable();
            dataPropertyFourCC.Columns.Add(new DataColumn("Value", typeof(string)));
            dataPropertyFourCC.Columns.Add(new DataColumn("Description", typeof(string)));

            dataPropertyFourCC.Rows.Add(FilterPropertyFourCCValue.avc1, FilterPropertyFourCCValue.avc1);
            dataPropertyFourCC.Rows.Add(FilterPropertyFourCCValue.ec3, FilterPropertyFourCCValue.ec3);
            dataPropertyFourCC.Rows.Add(FilterPropertyFourCCValue.mp4a, FilterPropertyFourCCValue.mp4a);
            dataPropertyFourCC.Rows.Add(FilterPropertyFourCCValue.mp4v, FilterPropertyFourCCValue.mp4v);

            // dataProperty dataOperator
            dataProperty = new DataTable();
            dataOperator = new DataTable();

            dataProperty.Columns.Add(new DataColumn("Property", typeof(string)));
            dataProperty.Columns.Add(new DataColumn("Description", typeof(string)));

            dataOperator.Columns.Add(new DataColumn("Operator", typeof(string)));
            dataOperator.Columns.Add(new DataColumn("Description", typeof(string)));

            dataProperty.Rows.Add(FilterProperty.Type, FilterProperty.Type);
            dataProperty.Rows.Add(FilterProperty.Bitrate, FilterProperty.Bitrate);
            dataProperty.Rows.Add(FilterProperty.FourCC, FilterProperty.FourCC);
            dataProperty.Rows.Add(FilterProperty.Language, FilterProperty.Language);
            dataProperty.Rows.Add(FilterProperty.Name, FilterProperty.Name);

            dataOperator.Rows.Add(IOperator.Equal, IOperator.Equal);
            dataOperator.Rows.Add(IOperator.notEqual, IOperator.notEqual);

            var columnProperty = new DataGridViewComboBoxColumn();
            columnProperty.DataSource = dataProperty;
            columnProperty.ValueMember = "Property";
            columnProperty.DisplayMember = "Description";
            dataGridViewTracks.Columns.Add(columnProperty);

            var columnOperator = new DataGridViewComboBoxColumn();
            columnOperator.DataSource = dataOperator;
            columnOperator.ValueMember = "Operator";
            columnOperator.DisplayMember = "Description";
            dataGridViewTracks.Columns.Add(columnOperator);

            var columnValue = new DataGridViewTextBoxColumn();

            dataGridViewTracks.Columns.Add(columnValue);

            moreinfoprofilelink.Links.Add(new LinkLabel.Link(0, moreinfoprofilelink.Text.Length, Constants.LinkHowIMoreInfoDynamicManifest));

            RefreshTracks();

            CheckIfErrorTimeControls();
        }
コード例 #5
0
        public static ManifestTimingData GetManifestTimingData(IAsset asset)
        {
            ManifestTimingData response = new ManifestTimingData() { IsLive = false, Error = false, TimestampOffset = 0 };

            try
            {
                ILocator mytemplocator = null;
                Uri myuri = AssetInfo.GetValidOnDemandURI(asset);
                if (myuri == null)
                {
                    mytemplocator = AssetInfo.CreatedTemporaryOnDemandLocator(asset);
                    myuri = AssetInfo.GetValidOnDemandURI(asset);
                }
                if (myuri != null)
                {
                    XDocument manifest = XDocument.Load(myuri.ToString());
                    var smoothmedia = manifest.Element("SmoothStreamingMedia");
                    string timescalefrommanifest = smoothmedia.Attribute("TimeScale").Value;
                    response.TimeScale = long.Parse(timescalefrommanifest);

                    var videotrack = smoothmedia.Elements("StreamIndex").Where(a => a.Attribute("Type").Value == "video");
                    response.TimestampOffset = long.Parse(videotrack.FirstOrDefault().Element("c").Attribute("t").Value);

                    if (smoothmedia.Attribute("IsLive") != null && smoothmedia.Attribute("IsLive").Value == "TRUE")
                    { // Live asset.... No duration to read (but we can read scaling)
                        response.IsLive = true;
                    }
                    else
                    {
                        response.AssetDuration = long.Parse(smoothmedia.Attribute("Duration").Value);
                    }
                }
                else
                {
                    response.Error = true;
                }
                if (mytemplocator != null) mytemplocator.Delete();
            }
            catch (Exception ex)
            {
                response.Error = true;
            }
            return response;
        }
コード例 #6
0
        private void DisplayAssetFilters()
        {

            dataGridViewFilters.ColumnCount = 7;
            dataGridViewFilters.Columns[0].HeaderText = "Name";
            dataGridViewFilters.Columns[0].Name = "Name";
            dataGridViewFilters.Columns[1].HeaderText = "Id";
            dataGridViewFilters.Columns[1].Name = "Id";
            dataGridViewFilters.Columns[2].HeaderText = "Track Rules";
            dataGridViewFilters.Columns[2].Name = "Rules";
            dataGridViewFilters.Columns[3].HeaderText = "Start (d.h:m:s)";
            dataGridViewFilters.Columns[3].Name = "Start";
            dataGridViewFilters.Columns[4].HeaderText = "End (d.h:m:s)";
            dataGridViewFilters.Columns[4].Name = "End";
            dataGridViewFilters.Columns[5].HeaderText = "DVR (d.h:m:s)";
            dataGridViewFilters.Columns[5].Name = "DVR";
            dataGridViewFilters.Columns[6].HeaderText = "Live backoff (d.h:m:s)";
            dataGridViewFilters.Columns[6].Name = "LiveBackoff";

            dataGridViewFilters.Rows.Clear();
            comboBoxLocatorsFilters.Items.Clear(); //drop list in locator tab
            comboBoxLocatorsFilters.BeginUpdate();
            comboBoxLocatorsFilters.Items.Add(new Item(string.Empty, null));

            List<AssetFilter> filters = _contextdynmanifest.ListAssetFilters(myAsset);

            if (filters.Count > 0 && myassetmanifesttimingdata == null)
            {
                myassetmanifesttimingdata = AssetInfo.GetManifestTimingData(myAsset);
            }



            foreach (var filter in filters)
            {
                string s = null;
                string e = null;
                string d = null;
                string l = null;

                if (filter.PresentationTimeRange != null)
                {
                    long start = Int64.Parse(filter.PresentationTimeRange.StartTimestamp) - myassetmanifesttimingdata.TimestampOffset;
                    long end = Int64.Parse(filter.PresentationTimeRange.EndTimestamp) - myassetmanifesttimingdata.TimestampOffset;
                    long dvr = Int64.Parse(filter.PresentationTimeRange.PresentationWindowDuration);
                    long live = Int64.Parse(filter.PresentationTimeRange.LiveBackoffDuration);

                    double scale = Convert.ToDouble(filter.PresentationTimeRange.Timescale) / 10000000;
                    e = (end == long.MaxValue) ? "max" : TimeSpan.FromTicks((long)(end / scale)).ToString(@"d\.hh\:mm\:ss");
                    s = (start == long.MaxValue) ? "max" : TimeSpan.FromTicks((long)(start / scale)).ToString(@"d\.hh\:mm\:ss");
                    d = (dvr == long.MaxValue) ? "max" : TimeSpan.FromTicks((long)(dvr / scale)).ToString(@"d\.hh\:mm\:ss");
                    l = (live == long.MaxValue) ? "max" : TimeSpan.FromTicks((long)(live / scale)).ToString(@"d\.hh\:mm\:ss");
                }
                int rowi = dataGridViewFilters.Rows.Add(filter.Name, filter.Id, filter.Tracks.Count, s, e, d, l);

                // droplist
                comboBoxLocatorsFilters.Items.Add(new Item("Asset filter  : " + filter.Name, filter.Name));
            }

            globalFilters.ForEach(g => comboBoxLocatorsFilters.Items.Add(new Item("Global filter : " + g.Name, g.Name)));
            comboBoxLocatorsFilters.SelectedIndex = 0;
            comboBoxLocatorsFilters.EndUpdate();
        }
コード例 #7
0
        private void DisplayAssetFilters()
        {

            dataGridViewFilters.ColumnCount = 7;
            dataGridViewFilters.Columns[0].HeaderText = "Name";
            dataGridViewFilters.Columns[0].Name = "Name";
            dataGridViewFilters.Columns[1].HeaderText = "Id";
            dataGridViewFilters.Columns[1].Name = "Id";
            dataGridViewFilters.Columns[2].HeaderText = "Track Rules";
            dataGridViewFilters.Columns[2].Name = "Rules";
            dataGridViewFilters.Columns[3].HeaderText = "Start (d.h:m:s)";
            dataGridViewFilters.Columns[3].Name = "Start";
            dataGridViewFilters.Columns[4].HeaderText = "End (d.h:m:s)";
            dataGridViewFilters.Columns[4].Name = "End";
            dataGridViewFilters.Columns[5].HeaderText = "DVR (d.h:m:s)";
            dataGridViewFilters.Columns[5].Name = "DVR";
            dataGridViewFilters.Columns[6].HeaderText = "Live backoff (d.h:m:s)";
            dataGridViewFilters.Columns[6].Name = "LiveBackoff";

            dataGridViewFilters.Rows.Clear();
            comboBoxLocatorsFilters.Items.Clear(); //drop list in locator tab
            comboBoxLocatorsFilters.BeginUpdate();
            comboBoxLocatorsFilters.Items.Add(new Item(string.Empty, null));

            List<AssetFilter> filters = myDynManifestContext.ListAssetFilters(myAsset);

            if (filters.Count > 0 && myassetmanifesttimingdata == null)
            {
                myassetmanifesttimingdata = AssetInfo.GetManifestTimingData(myAsset);
            }

            foreach (var filter in filters)
            {
                string s = null;
                string e = null;
                string d = null;
                string l = null;
                
                if (filter.PresentationTimeRange != null)
                {
                    double scale = Convert.ToDouble(filter.PresentationTimeRange.Timescale) / 10000000d;
                    s = ReturnFilterTextWithOffSet(filter.PresentationTimeRange.StartTimestamp, myassetmanifesttimingdata.TimestampOffset, scale);
                    e = ReturnFilterTextWithOffSet(filter.PresentationTimeRange.EndTimestamp, myassetmanifesttimingdata.TimestampOffset, scale);
                    d = ReturnFilterTextWithOffSet(filter.PresentationTimeRange.PresentationWindowDuration, 0, scale);
                    l = ReturnFilterTextWithOffSet(filter.PresentationTimeRange.LiveBackoffDuration, 0, scale);
                }
                int rowi = dataGridViewFilters.Rows.Add(filter.Name, filter.Id, filter.Tracks.Count, s, e, d, l);

                // droplist
                comboBoxLocatorsFilters.Items.Add(new Item("Asset filter  : " + filter.Name, filter.Name));
            }
            globalFilters.ForEach(g => comboBoxLocatorsFilters.Items.Add(new Item("Global filter : " + g.Name, g.Name)));
            comboBoxLocatorsFilters.SelectedIndex = 0;
            comboBoxLocatorsFilters.EndUpdate();
        }