public void CreateUpdateDeleteFilterWithAllSelectStatements() { string filterName = "CreateUpdateDeleteFilter_" + Guid.NewGuid().ToString(); List <FilterTrackSelectStatement> filterTrackSelectStatements = new List <FilterTrackSelectStatement>(); FilterTrackSelectStatement filterTrackSelectStatement = new FilterTrackSelectStatement(); filterTrackSelectStatement.PropertyConditions = new List <IFilterTrackPropertyCondition>(); filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackNameCondition("Track Name", FilterTrackCompareOperator.NotEqual)); filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackFourCCCondition("AACL", FilterTrackCompareOperator.NotEqual)); filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackBitrateRangeCondition(new FilterTrackBitrateRange(0, 1), FilterTrackCompareOperator.NotEqual)); filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackLanguageCondition("ru", FilterTrackCompareOperator.NotEqual)); filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackTypeCondition(FilterTrackType.Text, FilterTrackCompareOperator.NotEqual)); filterTrackSelectStatements.Add(filterTrackSelectStatement); IStreamingFilter filter = _mediaContext.Filters.Create(filterName, new PresentationTimeRange(), filterTrackSelectStatements); Assert.IsNotNull(filter); Assert.AreEqual(1, _mediaContext.Filters.Where(c => c.Name == filter.Name).Count()); Assert.AreNotEqual(0, _mediaContext.Filters.Count()); Assert.AreEqual(5, _mediaContext.Filters.Where(c => c.Name == filter.Name).First().Tracks.First().PropertyConditions.Count); filter.PresentationTimeRange = new PresentationTimeRange(timescale: 500); filter.Update(); Assert.AreEqual(5, _mediaContext.Filters.Where(c => c.Name == filter.Name).First().Tracks.First().PropertyConditions.Count); Assert.IsNotNull(_mediaContext.Filters.Where(c => c.Name == filter.Name).FirstOrDefault()); filter.Delete(); Assert.IsNull(_mediaContext.Filters.Where(c => c.Name == filter.Name).FirstOrDefault()); }
public DynManifestFilter(CloudMediaContext context, IStreamingFilter filterToDisplay = null, IAsset parentAsset = null, SubClipConfiguration subclipconfig = null) { InitializeComponent(); this.Icon = Bitmaps.Azure_Explorer_ico; _context = context; _filterToDisplay = filterToDisplay; _parentAsset = parentAsset; _subclipconfig = subclipconfig; }
public void AssetFilterCRUD() { IStreamingFilter filter = _mediaContext.Filters.Create("UniTest", new PresentationTimeRange(), new List <FilterTrackSelectStatement>()); Assert.IsNotNull(filter); Assert.IsNotNull(filter.Tracks); filter.Delete(); Assert.IsNull(_mediaContext.Assets.Where(c => c.Name == filter.Name).FirstOrDefault()); }
public DynManifestFilter(CloudMediaContext context, IStreamingFilter filterToDisplay = null, IAsset parentAsset = null, SubClipConfiguration subclipconfig = null) { InitializeComponent(); this.Icon = Bitmaps.Azure_Explorer_ico; _context = context; _filterToDisplay = filterToDisplay; _parentAsset = parentAsset; _subclipconfig = subclipconfig; }
public void InvalidFourCCConditionShouldThrow() { string filterName = "InvalidFourCCConditionShouldThrow_" + Guid.NewGuid().ToString(); List <FilterTrackSelectStatement> filterTrackSelectStatements = new List <FilterTrackSelectStatement>(); FilterTrackSelectStatement filterTrackSelectStatement = new FilterTrackSelectStatement(); filterTrackSelectStatement.PropertyConditions = new List <IFilterTrackPropertyCondition>(); filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackFourCCCondition("FourCCCondition validation here", FilterTrackCompareOperator.NotEqual)); filterTrackSelectStatements.Add(filterTrackSelectStatement); IStreamingFilter filter = _mediaContext.Filters.Create(filterName, new PresentationTimeRange(), filterTrackSelectStatements); }
public void CreateUpdateDeleteFilterWithDefaultPresentationTimeRangeAndEmptyFilterTrackSelectStatement() { string filterName = "CreateUpdateDeleteFilter_" + Guid.NewGuid().ToString(); IStreamingFilter filter = _mediaContext.Filters.Create(filterName, new PresentationTimeRange(), new List <FilterTrackSelectStatement>()); Assert.IsNotNull(filter); Assert.AreEqual(1, _mediaContext.Filters.Where(c => c.Name == filter.Name).Count()); Assert.AreNotEqual(0, _mediaContext.Filters.Count()); filter.PresentationTimeRange = new PresentationTimeRange(timescale: 500); filter.Update(); Assert.IsNotNull(_mediaContext.Filters.Where(c => c.Name == filter.Name).FirstOrDefault()); filter.Delete(); Assert.IsNull(_mediaContext.Filters.Where(c => c.Name == filter.Name).FirstOrDefault()); }
public void ShouldNotValidateNameand4CTracksOnClientSide() { StringBuilder bld = new StringBuilder(); bld.Append("treasure island"); bld.Append("остров сокровищ"); bld.Append("金银岛"); bld.Append("Schatzinsel"); bld.Append("कोष द्विप"); bld.Append("جزيرة الكنز"); bld.Append("!@#$%^&&**()_+?>"); //Generating long string for (int i = 0; i < 10; i++) { bld.Append(Guid.NewGuid()); } List <FilterTrackSelectStatement> filterTrackSelectStatements = new List <FilterTrackSelectStatement>(); filterTrackSelectStatements.Add(new FilterTrackSelectStatement() { PropertyConditions = new List <IFilterTrackPropertyCondition>() { new FilterTrackNameCondition(trackName: bld.ToString()) } }); filterTrackSelectStatements.Add(new FilterTrackSelectStatement() { PropertyConditions = new List <IFilterTrackPropertyCondition>() { new FilterTrackFourCCCondition(Guid.NewGuid().ToString()) } }); filterTrackSelectStatements.Add(new FilterTrackSelectStatement() { PropertyConditions = new List <IFilterTrackPropertyCondition>() { new FilterTrackLanguageCondition(Guid.NewGuid().ToString()) } }); filterTrackSelectStatements.Add(new FilterTrackSelectStatement() { PropertyConditions = new List <IFilterTrackPropertyCondition>() { new FilterTrackBitrateRangeCondition(new FilterTrackBitrateRange()) } }); IStreamingFilter filter = _mediaContext.Filters.Create(bld.ToString(), new PresentationTimeRange(), filterTrackSelectStatements); }
public void ShouldNotValidateNonEmptyName() { StringBuilder bld = new StringBuilder(); //Generating long string for (int i = 0; i < 10; i++) { bld.Append(Guid.NewGuid()); } IStreamingFilter filter = _mediaContext.Filters.Create(bld.ToString(), new PresentationTimeRange(), new List <FilterTrackSelectStatement>()); bld.Clear(); bld.Append("treasure island"); bld.Append("остров сокровищ"); bld.Append("金银岛"); bld.Append("Schatzinsel"); bld.Append("कोष द्विप"); bld.Append("جزيرة الكنز"); bld.Append("!@#$%^&&**()_+?>"); filter = _mediaContext.Filters.Create(bld.ToString(), new PresentationTimeRange(), new List <FilterTrackSelectStatement>()); }
private void comboBoxLocatorsFilters_SelectedIndexChanged(object sender, EventArgs e) { string filtername = ((Item)comboBoxLocatorsFilters.SelectedItem).Value; if (filtername != null) { IStreamingFilter importfilter = null; if (filtername.StartsWith(Constants.AssetIdPrefix)) // asset filter { importfilter = _parentAsset.AssetFilters.Where(f => f.Id == filtername).FirstOrDefault(); } else // global filter { importfilter = _context.Filters.Where(f => f.Name == filtername).FirstOrDefault(); } if (importfilter != null) { filtertracks = ConvertFilterTracksToInternalVar(importfilter.Tracks); RefreshTracks(); RefreshTracksConditions(); } } }
public void ApplyDynamicManifestFilter() { const string typeAudio = "Type=\"audio\""; const string typeVideo = "Type=\"video\""; string configuration = File.ReadAllText(WindowsAzureMediaServicesTestConfiguration.DefaultMp4ToSmoothConfig); IAsset inputAsset = AssetTests.CreateAsset(_mediaContext, WindowsAzureMediaServicesTestConfiguration.SmallMp41, AssetCreationOptions.None); IMediaProcessor mediaProcessor = JobTests.GetMediaProcessor(_mediaContext, WindowsAzureMediaServicesTestConfiguration.MpPackagerName); IJob job = JobTests.CreateAndSubmitOneTaskJob(_mediaContext, "ApplyDynamicManifestFilter" + Guid.NewGuid().ToString().Substring(0, 5), mediaProcessor, configuration, inputAsset, TaskOptions.None); JobTests.WaitForJob(job.Id, JobState.Finished, JobTests.VerifyAllTasksFinished); var outputAsset = job.OutputMediaAssets.FirstOrDefault(); outputAsset = _mediaContext.Assets.Where(c => c.Id == outputAsset.Id).FirstOrDefault(); var assetFile = outputAsset.AssetFiles.Where(c => c.Name.EndsWith(".ism")).First(); IAccessPolicy policy = _mediaContext.AccessPolicies.Create("ApplyDynamicManifestFilter" + Guid.NewGuid().ToString().Substring(0, 5), TimeSpan.FromDays(30), AccessPermissions.Read); ILocator originLocator = _mediaContext.Locators.CreateLocator(LocatorType.OnDemandOrigin, outputAsset, policy, DateTime.UtcNow.AddMinutes(-5)); string urlForClientStreaming = originLocator.Path + assetFile.Name + "/manifest"; HttpClient client = new HttpClient(); var message = client.GetAsync(urlForClientStreaming).Result; var content = message.Content; var result = content.ReadAsStringAsync().Result; Assert.AreEqual(message.StatusCode, HttpStatusCode.OK); Assert.IsTrue(result.Length > 0); Assert.IsTrue(result.Contains(typeAudio)); Assert.IsTrue(result.Contains(typeVideo)); var manifestLength = result.Length; // string filterName = "ApplyDynamicManifestFilter_" + DateTime.Now; string filterName = "ApplyDynamicManifestFilter_" + Guid.NewGuid().ToString().Substring(0, 5); List <FilterTrackSelectStatement> filterTrackSelectStatements = new List <FilterTrackSelectStatement>(); FilterTrackSelectStatement filterTrackSelectStatement = new FilterTrackSelectStatement(); filterTrackSelectStatement.PropertyConditions = new List <IFilterTrackPropertyCondition>(); filterTrackSelectStatement.PropertyConditions.Add(new FilterTrackTypeCondition(FilterTrackType.Video, FilterTrackCompareOperator.NotEqual)); filterTrackSelectStatements.Add(filterTrackSelectStatement); IStreamingFilter filter = _mediaContext.Filters.Create(filterName, new PresentationTimeRange(), filterTrackSelectStatements); Assert.IsNotNull(filter); var filterUrlForClientStreaming = originLocator.Path + assetFile.Name + String.Format("/manifest(filter={0})", filterName); HttpClient filterclient = new HttpClient(); var filtermessage = filterclient.GetAsync(filterUrlForClientStreaming).Result; Assert.AreEqual(filtermessage.StatusCode, HttpStatusCode.OK); var filtercontent = filtermessage.Content; var filterresult = filtercontent.ReadAsStringAsync().Result; Assert.IsTrue(filterresult.Length > 0); Assert.AreNotEqual(manifestLength, filterresult); Assert.IsTrue(filterresult.Contains(typeAudio)); Assert.IsFalse(filterresult.Contains(typeVideo)); outputAsset.DeleteAsync(); inputAsset.DeleteAsync(); job.DeleteAsync(); filter.DeleteAsync(); }
public void ShouldFailForEmptyName() { IStreamingFilter filter = _mediaContext.Filters.Create(String.Empty, new PresentationTimeRange(), new List <FilterTrackSelectStatement>()); }