Skip to content

Commit

Permalink
Update to SDK version 15.9.5
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-miniailov committed Apr 16, 2024
1 parent cf0bb49 commit de5bc3a
Show file tree
Hide file tree
Showing 873 changed files with 3,241 additions and 3,249 deletions.
4 changes: 2 additions & 2 deletions Media Blocks SDK/Android/MediaPlayer/MediaPlayer net7.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="VisioForge.CrossPlatform.Core.Android" Version="1.22.5.10" />
<PackageReference Include="VisioForge.DotNet.VideoCapture" Version="15.9.4" />
<PackageReference Include="VisioForge.DotNet.Core.UI.Android" Version="15.9.4" />
<PackageReference Include="VisioForge.DotNet.VideoCapture" Version="15.9.5" />
<PackageReference Include="VisioForge.DotNet.Core.UI.Android" Version="15.9.5" />
<PackageReference Include="Xamarin.Essentials" Version="1.8.0" />
</ItemGroup>
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Media Blocks SDK/Android/MediaPlayer/MediaPlayer net8.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="VisioForge.CrossPlatform.Core.Android" Version="1.22.5.10" />
<PackageReference Include="VisioForge.DotNet.VideoCapture" Version="15.9.4" />
<PackageReference Include="VisioForge.DotNet.Core.UI.Android" Version="15.9.4" />
<PackageReference Include="VisioForge.DotNet.VideoCapture" Version="15.9.5" />
<PackageReference Include="VisioForge.DotNet.Core.UI.Android" Version="15.9.5" />
<PackageReference Include="Xamarin.Essentials" Version="1.8.0" />
</ItemGroup>
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Media Blocks SDK/Android/RTSP Client/RTSP Client net7.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="VisioForge.CrossPlatform.Core.Android" Version="1.22.5.10" />
<PackageReference Include="VisioForge.DotNet.VideoCapture" Version="15.9.4" />
<PackageReference Include="VisioForge.DotNet.Core.UI.Android" Version="15.9.4" />
<PackageReference Include="VisioForge.DotNet.VideoCapture" Version="15.9.5" />
<PackageReference Include="VisioForge.DotNet.Core.UI.Android" Version="15.9.5" />
<PackageReference Include="Xamarin.Essentials" Version="1.8.0" />
</ItemGroup>
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Media Blocks SDK/Android/RTSP Client/RTSP Client net8.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="VisioForge.CrossPlatform.Core.Android" Version="1.22.5.10" />
<PackageReference Include="VisioForge.DotNet.VideoCapture" Version="15.9.4" />
<PackageReference Include="VisioForge.DotNet.Core.UI.Android" Version="15.9.4" />
<PackageReference Include="VisioForge.DotNet.VideoCapture" Version="15.9.5" />
<PackageReference Include="VisioForge.DotNet.Core.UI.Android" Version="15.9.5" />
<PackageReference Include="Xamarin.Essentials" Version="1.8.0" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="VisioForge.CrossPlatform.Core.Android" Version="1.22.5.10" />
<PackageReference Include="VisioForge.DotNet.Core.UI.Android" Version="15.9.4" />
<PackageReference Include="VisioForge.DotNet.MediaBlocks" Version="15.9.4" />
<PackageReference Include="VisioForge.DotNet.Core.UI.Android" Version="15.9.5" />
<PackageReference Include="VisioForge.DotNet.MediaBlocks" Version="15.9.5" />
<PackageReference Include="Xamarin.Essentials" Version="1.8.0" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="VisioForge.CrossPlatform.Core.Android" Version="1.22.5.10" />
<PackageReference Include="VisioForge.DotNet.Core.UI.Android" Version="15.9.4" />
<PackageReference Include="VisioForge.DotNet.MediaBlocks" Version="15.9.4" />
<PackageReference Include="VisioForge.DotNet.Core.UI.Android" Version="15.9.5" />
<PackageReference Include="VisioForge.DotNet.MediaBlocks" Version="15.9.5" />
<PackageReference Include="Xamarin.Essentials" Version="1.8.0" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="VisioForge.DotNet.MediaBlocks" Version="15.9.4" />
<PackageReference Include="VisioForge.DotNet.Core.UI.Avalonia" Version="15.9.4" />
<PackageReference Include="VisioForge.DotNet.MediaBlocks" Version="15.9.5" />
<PackageReference Include="VisioForge.DotNet.Core.UI.Avalonia" Version="15.9.5" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Media Blocks SDK/Console/HLS Streamer/HLSStreamer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="VisioForge.DotNet.MediaBlocks" Version="15.9.4" />
<PackageReference Include="VisioForge.DotNet.MediaBlocks" Version="15.9.5" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="VisioForge.CrossPlatform.Core.Windows.x64" Version="15.9.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<AOTMode>None</AOTMode>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="VisioForge.DotNet.MediaBlocks" Version="15.9.4" />
<PackageReference Include="VisioForge.DotNet.MediaBlocks" Version="15.9.5" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::IsOsPlatform('Windows'))">
<PackageReference Include="VisioForge.CrossPlatform.Core.Windows.x64" Version="15.9.0" />
Expand Down
2 changes: 1 addition & 1 deletion Media Blocks SDK/Console/RTSPView/RTSPView.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ApplicationId>com.visioforge.rtspviewcli</ApplicationId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="VisioForge.DotNet.MediaBlocks" Version="15.9.4" />
<PackageReference Include="VisioForge.DotNet.MediaBlocks" Version="15.9.5" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::IsOsPlatform('Windows'))">
<PackageReference Include="VisioForge.CrossPlatform.Core.Windows.x64" Version="15.9.0" />
Expand Down
4 changes: 2 additions & 2 deletions Media Blocks SDK/Console/RTSPViewCV/RTSPViewCV.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<ApplicationId>com.visioforge.rtspviewcvcli</ApplicationId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="VisioForge.DotNet.MediaBlocks" Version="15.9.4" />
<PackageReference Include="VisioForge.DotNet.Core.CVD" Version="15.9.4" />
<PackageReference Include="VisioForge.DotNet.MediaBlocks" Version="15.9.5" />
<PackageReference Include="VisioForge.DotNet.Core.CVD" Version="15.9.5" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::IsOsPlatform('Windows'))">
<PackageReference Include="VisioForge.CrossPlatform.Core.Windows.x64" Version="15.9.0" />
Expand Down
18 changes: 11 additions & 7 deletions Media Blocks SDK/MAUI/SimpleCapture/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
<Grid>
<!--WidthRequest="1280" HeightRequest="720"-->
<Grid RowDefinitions="*,Auto" >

<my:VideoView Grid.Row="0"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
x:Name="videoView"
Background="Black"/>

<Grid x:Name="videoViewHost"
Grid.Row="0"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
Background="Black">
<my:VideoView
x:Name="videoView"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand" />
</Grid>

<StackLayout Grid.Row="1" x:Name="pnMain" Orientation="Vertical" HorizontalOptions="Fill" Background="#1e1e1e">

<Grid>
Expand Down
103 changes: 49 additions & 54 deletions Media Blocks SDK/MAUI/SimpleCapture/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using VisioForge.Core.Types.X.Output;
using VisioForge.Core.Types.X.Sinks;
using VisioForge.Core.Types.X.Sources;
using VisioForge.Core.UI.MAUI;

namespace SimpleCapture
{
Expand All @@ -37,9 +38,9 @@ public partial class MainPage : ContentPage, INotifyPropertyChanged

private MP4SinkBlock _mp4Sink;

private H264EncoderBlock _h264Encoder;
private H264EncoderBlock _videoEncoder;

private MP3EncoderBlock _mp3Encoder;
private OPUSEncoderBlock _audioEncoder;

private VideoCaptureDeviceInfo[] _cameras;

Expand Down Expand Up @@ -76,7 +77,13 @@ private void MainPage_Unloaded(object sender, EventArgs e)
private void CreateEngine()
{
_pipeline = new MediaBlocksPipeline(live: true);

#if __IOS__ && !__MACCATALYST__
var vv = videoView.Handler.PlatformView;
_videoRenderer = new VideoRendererBlock(_pipeline, (IVideoView)vv);
#else
_videoRenderer = new VideoRendererBlock(_pipeline, videoView);
#endif

_pipeline.OnError += Core_OnError;
}
Expand Down Expand Up @@ -198,8 +205,8 @@ private async Task StopAllAsync()
_pipeline = null;
}

_h264Encoder?.Dispose();
_h264Encoder = null;
_videoEncoder?.Dispose();
_videoEncoder = null;

_mp4Sink?.Dispose();
_mp4Sink = null;
Expand All @@ -216,8 +223,8 @@ private async Task StopAllAsync()
_audioTee?.Dispose();
_audioTee = null;

_mp3Encoder?.Dispose();
_mp3Encoder = null;
_audioEncoder?.Dispose();
_audioEncoder = null;

_videoRenderer?.Dispose();
_videoRenderer = null;
Expand All @@ -226,14 +233,6 @@ private async Task StopAllAsync()
_audioOutput = null;
}

private void slVolume_ValueChanged(object sender, ValueChangedEventArgs e)
{
if (_audioOutput != null)
{
_audioOutput.Volume = e.NewValue / 100.0;
}
}

#if __IOS__ && !__MACCATALYST__
private void AddVideoToPhotosLibrary(string filePath)
{
Expand All @@ -251,11 +250,11 @@ private void AddVideoToPhotosLibrary(string filePath)
{
if (success)
{
Console.WriteLine("Video saved to Photos library.");
Debug.WriteLine("Video saved to Photos library.");
}
else
{
Console.WriteLine($"Error saving video: {error?.LocalizedDescription}");
Debug.WriteLine($"Error saving video: {error?.LocalizedDescription}");
}
});
}
Expand All @@ -265,7 +264,7 @@ private void AddVideoToPhotosLibrary(string filePath)

private async void btStop_Clicked(object sender, EventArgs e)
{
_pipeline.Debug_SavePipeline("main");
// _pipeline.Debug_SavePipeline("main");

#if __IOS__ && !__MACCATALYST__
bool capture = _mp4Sink != null;
Expand All @@ -285,7 +284,7 @@ private async void btStop_Clicked(object sender, EventArgs e)
AddVideoToPhotosLibrary(filename);
}
#endif

btStartPreview.Text = "PREVIEW";
btStartCapture.Text = "CAPTURE";
}
Expand Down Expand Up @@ -355,15 +354,15 @@ private async Task ConfigurePreviewAsync(bool connect)
var device = (await DeviceEnumerator.Shared.VideoSourcesAsync()).FirstOrDefault(x => x.DisplayName == deviceName);
if (device != null)
{
var formatItem = device.VideoFormats.Find(x => (x.Width == 1920 && x.Height == 1080)); //device.GetHDOrAnyVideoFormatAndFrameRate(out var frameRate);
var formatItem = device.VideoFormats.Find(x => (x.Width == 1920));
if (formatItem != null)
{
videoSourceSettings = new VideoCaptureDeviceSourceSettings(device)
{
Format = formatItem.ToFormat()
};

videoSourceSettings.Format.FrameRate = new VideoFrameRate(120); //frameRate;
videoSourceSettings.Format.FrameRate = new VideoFrameRate(30); //frameRate;
}
}
}
Expand All @@ -373,25 +372,21 @@ private async Task ConfigurePreviewAsync(bool connect)
await DisplayAlert("Error", "Unable to configure camera settings", "OK");
}

#if __IOS__ && !__MACCATALYST__
videoSourceSettings.Orientation = IOSVideoSourceOrientation.Portrait;
#endif

_videoSource = new SystemVideoSourceBlock(videoSourceSettings);

// audio source
IAudioCaptureDeviceSourceSettings audioSourceSettings = null;

deviceName = btMic.Text;
if (!string.IsNullOrEmpty(deviceName))
{
var device = (await DeviceEnumerator.Shared.AudioSourcesAsync()).FirstOrDefault(x => x.DisplayName == deviceName);
if (device != null)
{
var formatItem = device.GetDefaultFormat();
audioSourceSettings = device.CreateSourceSettings(formatItem);
}
}
// audio source
IAudioCaptureDeviceSourceSettings audioSourceSettings = null;
deviceName = btMic.Text;
if (!string.IsNullOrEmpty(deviceName))
{
var device = (await DeviceEnumerator.Shared.AudioSourcesAsync()).FirstOrDefault(x => x.DisplayName == deviceName);
if (device != null)
{
var formatItem = device.GetDefaultFormat();
audioSourceSettings = device.CreateSourceSettings(formatItem);
}
}

_audioSource = new SystemAudioSourceBlock(audioSourceSettings);

Expand All @@ -416,12 +411,12 @@ private void ConfigureCapture()
_pipeline.Connect(_audioTee.Outputs[0], _audioOutput.Input);

// add video encoder
_h264Encoder = new H264EncoderBlock(H264EncoderBlock.GetDefaultSettings());
_pipeline.Connect(_videoTee.Outputs[1], _h264Encoder.Input);
_videoEncoder = new H264EncoderBlock(H264EncoderBlock.GetDefaultSettings());
_pipeline.Connect(_videoTee.Outputs[1], _videoEncoder.Input);

// add audio encoder
_mp3Encoder = new MP3EncoderBlock(new MP3EncoderSettings());
_pipeline.Connect(_audioTee.Outputs[1], _mp3Encoder.Input);
_audioEncoder = new OPUSEncoderBlock(new OPUSEncoderSettings());
_pipeline.Connect(_audioTee.Outputs[1], _audioEncoder.Input);

// add sink
var now = DateTime.Now;
Expand All @@ -437,8 +432,8 @@ private void ConfigureCapture()
var sinkSettings = new MP4SinkSettings(filename);
_mp4Sink = new MP4SinkBlock(sinkSettings);

_pipeline.Connect(_h264Encoder.Output, _mp4Sink.CreateNewInput(MediaBlockPadMediaType.Video));
_pipeline.Connect(_mp3Encoder.Output, _mp4Sink.CreateNewInput(MediaBlockPadMediaType.Audio));
_pipeline.Connect(_videoEncoder.Output, _mp4Sink.CreateNewInput(MediaBlockPadMediaType.Video));
_pipeline.Connect(_audioEncoder.Output, _mp4Sink.CreateNewInput(MediaBlockPadMediaType.Audio));
}

private async void btStartPreview_Clicked(object sender, EventArgs e)
Expand Down Expand Up @@ -489,44 +484,44 @@ private async void btStartPreview_Clicked(object sender, EventArgs e)
private async void btStartCapture_Clicked(object sender, EventArgs e)
{
await StopAllAsync();

CreateEngine();

switch (_pipeline.State)
{
case PlaybackState.Play:
{
await _pipeline.PauseAsync();

btStartCapture.Text = "CAPTURE";
}

break;
case PlaybackState.Pause:
{
await _pipeline.ResumeAsync();

btStartCapture.Text = "PAUSE";
}

break;
case PlaybackState.Free:
{
if (_pipeline.State == PlaybackState.Play || _pipeline.State == PlaybackState.Pause)
{
return;
}

await ConfigurePreviewAsync(false);

ConfigureCapture();

// start
await _pipeline.StartAsync();

btStartCapture.Text = "PAUSE";
}

break;
default:
break;
Expand Down
5 changes: 0 additions & 5 deletions Media Blocks SDK/MAUI/SimpleCapture/Platforms/iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,10 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/appicon.appiconset</string>
Expand Down
Loading

0 comments on commit de5bc3a

Please sign in to comment.