Skip to content
Snippets Groups Projects

remove allow unsafe blocks

1 unresolved thread
  • Refactor into safe interop AudioOutputDescription, AudioOutputDevice and ModuleDescription,
  • Disallow unsafe code
  • Move interop helpers in Helpers folder/namespace

Fix #32 (closed)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
6
7 [StructLayout(LayoutKind.Sequential)]
8 internal struct AudioOutputDescriptionStructure
9 {
10 public IntPtr Name;
11 public IntPtr Description;
12 public IntPtr NextAudioOutputDescription;
13 }
14
7 15 /// <summary>
8 /// <para>Description for audio output. It contains</para>
9 /// <para>name, description and pointer to next record.</para>
16 /// Description for audio output.
10 17 /// </summary>
11 public unsafe partial class AudioOutputDescription : IDisposable
18 public class AudioOutputDescription
  • LGTM otherwise

  • Martin Finkel added 10 commits

    added 10 commits

    • cabf7c3e...83fc0ec9 - 5 commits from branch videolan:master
    • 3d5e98ed - Refactor AudioOutputDescription interop
    • 493ae7c8 - Refactor AudioOutputDevice and create Helpers folder
    • 1ffbfe63 - Refactor ModuleDescription
    • 01be5bef - Disable AllowUnsafeBlocks
    • ab19c049 - Set to use C# 7.3 and use readonly structs

    Compare with previous version

  • Author Maintainer

    Using readonly struct now.

    Found a marshalling issue. This unit test:

    [Test]
    public void AudioOutputDevices()
    {
        var libVLC = new LibVLC();
        var outputs = libVLC.AudioOutputs;
        var name = outputs.Last().Name;
        var audioOutputDevices = libVLC.AudioOutputDevices(name);
    
        foreach (var audioOutputDevice in audioOutputDevices)
        {
            Debug.WriteLine(audioOutputDevice.Description);
            Debug.WriteLine(audioOutputDevice.DeviceIdentifier);
        }
    }

    Gives me

    Microsoft Soundmapper
    wavemapper
    Speakers (Realtek High Definiti ($1,$64)
    Speakers (Realtek High Definiti ($1,$64)
    VZ249 (NVIDIA High Definition A ($1,$64)
    VZ249 (NVIDIA High Definition A ($1,$64)
  • Martin Finkel added 1 commit

    added 1 commit

    • 5f6cd9fa - Explicitly look for mmdevice audio output in unit test

    Compare with previous version

  • Author Maintainer

    Nope, just my unit test that was wrong. Ready to merge.

  • merged

  • Please register or sign in to reply
    Loading