mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-24 13:45:37 +03:00
Video
This commit is contained in:
parent
9cf553a786
commit
ca96362a5f
69
Facepunch.Steamworks/Generated/Interfaces/ISteamVideo.cs
Normal file
69
Facepunch.Steamworks/Generated/Interfaces/ISteamVideo.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SteamNative;
|
||||
|
||||
|
||||
namespace Steamworks.Internal
|
||||
{
|
||||
public class ISteamVideo : BaseSteamInterface
|
||||
{
|
||||
public override string InterfaceName => "STEAMVIDEO_INTERFACE_V002";
|
||||
|
||||
public override void InitInternals()
|
||||
{
|
||||
GetVideoURLDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetVideoURLDelegate>( Marshal.ReadIntPtr( VTable, 0) );
|
||||
IsBroadcastingDelegatePointer = Marshal.GetDelegateForFunctionPointer<IsBroadcastingDelegate>( Marshal.ReadIntPtr( VTable, 8) );
|
||||
GetOPFSettingsDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetOPFSettingsDelegate>( Marshal.ReadIntPtr( VTable, 16) );
|
||||
GetOPFStringForAppDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetOPFStringForAppDelegate>( Marshal.ReadIntPtr( VTable, 24) );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||
public delegate void GetVideoURLDelegate( IntPtr self, AppId_t unVideoAppID );
|
||||
private GetVideoURLDelegate GetVideoURLDelegatePointer;
|
||||
|
||||
#endregion
|
||||
public void GetVideoURL( AppId_t unVideoAppID )
|
||||
{
|
||||
GetVideoURLDelegatePointer( Self, unVideoAppID );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
public delegate bool IsBroadcastingDelegate( IntPtr self, ref int pnNumViewers );
|
||||
private IsBroadcastingDelegate IsBroadcastingDelegatePointer;
|
||||
|
||||
#endregion
|
||||
public bool IsBroadcasting( ref int pnNumViewers )
|
||||
{
|
||||
return IsBroadcastingDelegatePointer( Self, ref pnNumViewers );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||
public delegate void GetOPFSettingsDelegate( IntPtr self, AppId_t unVideoAppID );
|
||||
private GetOPFSettingsDelegate GetOPFSettingsDelegatePointer;
|
||||
|
||||
#endregion
|
||||
public void GetOPFSettings( AppId_t unVideoAppID )
|
||||
{
|
||||
GetOPFSettingsDelegatePointer( Self, unVideoAppID );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
public delegate bool GetOPFStringForAppDelegate( IntPtr self, AppId_t unVideoAppID, StringBuilder pchBuffer, ref int pnBufferSize );
|
||||
private GetOPFStringForAppDelegate GetOPFStringForAppDelegatePointer;
|
||||
|
||||
#endregion
|
||||
public bool GetOPFStringForApp( AppId_t unVideoAppID, StringBuilder pchBuffer, ref int pnBufferSize )
|
||||
{
|
||||
return GetOPFStringForAppDelegatePointer( Self, unVideoAppID, pchBuffer, ref pnBufferSize );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -34,6 +34,8 @@ public static void Init( uint appid )
|
||||
Apps.InstallEvents();
|
||||
Utils.InstallEvents();
|
||||
Parental.InstallEvents();
|
||||
Music.InstallEvents();
|
||||
Video.InstallEvents();
|
||||
}
|
||||
|
||||
internal static void RegisterCallback( IntPtr intPtr, int callbackId )
|
||||
|
64
Facepunch.Steamworks/Redux/Video.cs
Normal file
64
Facepunch.Steamworks/Redux/Video.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SteamNative;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
/// <summary>
|
||||
/// Undocumented Parental Settings
|
||||
/// </summary>
|
||||
public static class Video
|
||||
{
|
||||
static Internal.ISteamVideo _internal;
|
||||
internal static Internal.ISteamVideo Internal
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _internal == null )
|
||||
_internal = new Internal.ISteamVideo();
|
||||
|
||||
return _internal;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void InstallEvents()
|
||||
{
|
||||
new Event<BroadcastUploadStart_t>( x => OnBroadcastStarted?.Invoke() );
|
||||
new Event<BroadcastUploadStop_t>( x => OnBroadcastStopped?.Invoke( x.Result ) );
|
||||
}
|
||||
|
||||
public static event Action OnBroadcastStarted;
|
||||
public static event Action<BroadcastUploadResult> OnBroadcastStopped;
|
||||
|
||||
/// <summary>
|
||||
/// Return true if currently using Steam's live broadcasting
|
||||
/// </summary>
|
||||
public static bool IsBroadcasting
|
||||
{
|
||||
get
|
||||
{
|
||||
int viewers = 0;
|
||||
return Internal.IsBroadcasting( ref viewers );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If we're broadcasting, will return the number of live viewers
|
||||
/// </summary>
|
||||
public static int NumViewers
|
||||
{
|
||||
get
|
||||
{
|
||||
int viewers = 0;
|
||||
|
||||
if ( !Internal.IsBroadcasting( ref viewers ) )
|
||||
return 0;
|
||||
|
||||
return viewers;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -6841,6 +6841,31 @@ public struct Pack8
|
||||
#endregion
|
||||
}
|
||||
|
||||
public struct BroadcastUploadStart_t : Steamworks.ISteamCallback
|
||||
{
|
||||
|
||||
#region ISteamCallback
|
||||
public int GetCallbackId() => CallbackIdentifiers.ClientVideo + 4;
|
||||
public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Platform.PackSmall ? typeof(Pack4) : typeof(Pack8) );
|
||||
public Steamworks.ISteamCallback Fill( IntPtr p ) => Platform.PackSmall ? ((BroadcastUploadStart_t)(Pack4) Marshal.PtrToStructure( p, typeof(Pack4) )) : ((BroadcastUploadStart_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
|
||||
#endregion
|
||||
#region Packed Versions
|
||||
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
|
||||
public struct Pack4
|
||||
{
|
||||
|
||||
public static implicit operator BroadcastUploadStart_t ( BroadcastUploadStart_t.Pack4 d ) => new BroadcastUploadStart_t{ };
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential, Pack = 8 )]
|
||||
public struct Pack8
|
||||
{
|
||||
|
||||
public static implicit operator BroadcastUploadStart_t ( BroadcastUploadStart_t.Pack8 d ) => new BroadcastUploadStart_t{ };
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public struct NewUrlLaunchParameters_t : Steamworks.ISteamCallback
|
||||
{
|
||||
|
||||
@ -7484,6 +7509,7 @@ internal static void RegisterCallbacks( Facepunch.Steamworks.BaseSteamworks stea
|
||||
new CallbackHandle<GSStatsStored_t>( steamworks );
|
||||
new CallbackHandle<GSStatsUnloaded_t>( steamworks );
|
||||
new CallbackHandle<PlaybackStatusHasChanged_t>( steamworks );
|
||||
new CallbackHandle<BroadcastUploadStart_t>( steamworks );
|
||||
new CallbackHandle<NewUrlLaunchParameters_t>( steamworks );
|
||||
new CallbackHandle<ItemInstalled_t>( steamworks );
|
||||
new CallbackHandle<SteamInventoryDefinitionUpdate_t>( steamworks );
|
||||
|
@ -96,6 +96,7 @@ public void ToFolder( string folder )
|
||||
GenerateVTableClass( "ISteamUtils", $"{folder}../Generated/Interfaces/ISteamUtils.cs" );
|
||||
GenerateVTableClass( "ISteamParentalSettings", $"{folder}../Generated/Interfaces/ISteamParentalSettings.cs" );
|
||||
GenerateVTableClass( "ISteamMusic", $"{folder}../Generated/Interfaces/ISteamMusic.cs" );
|
||||
GenerateVTableClass( "ISteamVideo", $"{folder}../Generated/Interfaces/ISteamVideo.cs" );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,11 @@
|
||||
"struct": "PlaybackStatusHasChanged_t",
|
||||
"fields": [ ]
|
||||
},
|
||||
|
||||
{
|
||||
"struct": "BroadcastUploadStart_t",
|
||||
"fields": [ ]
|
||||
},
|
||||
|
||||
{
|
||||
"struct": "NewUrlLaunchParameters_t",
|
||||
|
Loading…
Reference in New Issue
Block a user