This repository has been archived by the owner on Jan 21, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 414
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
87027ee
commit d3f1a77
Showing
5 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/Vlc.DotNet.Core.Interops/Signatures/libvlc.h/libvlc_set_app_id.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Vlc.DotNet.Core.Interops.Signatures | ||
{ | ||
/// <summary> | ||
/// Sets some meta-information about the application. | ||
/// </summary> | ||
/// <seealso cref="SetUserAgent" /> | ||
/// <param name="instance">LibVLC instance</param> | ||
/// <param name="id">Java-style application identifier, e.g. "com.acme.foobar"</param> | ||
/// <param name="version">application version numbers, e.g. "1.2.3"</param> | ||
/// <param name="icon">application icon name, e.g. "foobar"</param> | ||
[LibVlcFunction("libvlc_set_app_id")] | ||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
internal delegate void SetAppId(IntPtr instance, Utf8StringHandle id, Utf8StringHandle version, Utf8StringHandle icon); | ||
} |
16 changes: 16 additions & 0 deletions
16
src/Vlc.DotNet.Core.Interops/Signatures/libvlc.h/libvlc_set_user_agent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Vlc.DotNet.Core.Interops.Signatures | ||
{ | ||
/// <summary> | ||
/// Sets the application name. | ||
/// LibVLC passes this as the user agent string when a protocol requires it. | ||
/// </summary> | ||
/// <param name="instance">LibVLC instance</param> | ||
/// <param name="name">human-readable application name, e.g. "FooBar player 1.2.3"</param> | ||
/// <param name="http">HTTP User Agent, e.g. "FooBar/1.2.3 Python/2.6.0"</param> | ||
[LibVlcFunction("libvlc_set_user_agent")] | ||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
internal delegate void SetUserAgent(IntPtr instance, Utf8StringHandle name, Utf8StringHandle http); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Vlc.DotNet.Core.Interops.Signatures; | ||
|
||
namespace Vlc.DotNet.Core.Interops | ||
{ | ||
public sealed partial class VlcManager | ||
{ | ||
/// <summary> | ||
/// Sets some meta-information about the application. | ||
/// </summary> | ||
/// <seealso cref="SetUserAgent" /> | ||
/// <param name="id">Java-style application identifier, e.g. "com.acme.foobar"</param> | ||
/// <param name="version">application version numbers, e.g. "1.2.3"</param> | ||
/// <param name="icon">application icon name, e.g. "foobar"</param> | ||
public void SetAppId(string id, string version, string icon) | ||
{ | ||
using (var idInterop = Utf8InteropStringConverter.ToUtf8StringHandle(id)) | ||
using (var versionInterop = Utf8InteropStringConverter.ToUtf8StringHandle(version)) | ||
using (var iconInterop = Utf8InteropStringConverter.ToUtf8StringHandle(icon)) | ||
{ | ||
GetInteropDelegate<SetAppId>().Invoke(this.myVlcInstance, idInterop, versionInterop, iconInterop); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Vlc.DotNet.Core.Interops.Signatures; | ||
|
||
namespace Vlc.DotNet.Core.Interops | ||
{ | ||
public sealed partial class VlcManager | ||
{ | ||
/// <summary> | ||
/// Sets the application name. | ||
/// LibVLC passes this as the user agent string when a protocol requires it. | ||
/// </summary> | ||
/// <param name="name">human-readable application name, e.g. "FooBar player 1.2.3"</param> | ||
/// <param name="http">HTTP User Agent, e.g. "FooBar/1.2.3 Python/2.6.0"</param> | ||
public void SetUserAgent(string name, string http) | ||
{ | ||
using (var nameInterop = Utf8InteropStringConverter.ToUtf8StringHandle(name)) | ||
using (var httpInterop = Utf8InteropStringConverter.ToUtf8StringHandle(http)) | ||
{ | ||
GetInteropDelegate<SetUserAgent>().Invoke(this.myVlcInstance, nameInterop, httpInterop); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters