Beispiel #1
0
 internal AudioOutput(IntPtr pointer)
 {
     _pointer = pointer;
     if (pointer != IntPtr.Zero)
     {
         _struct =
             (Interop.MediaPlayer.AudioOutput)
             Marshal.PtrToStructure(pointer, typeof(Interop.MediaPlayer.AudioOutput));
         Name        = InteropHelper.PtrToString(_struct.Name);
         Description = InteropHelper.PtrToString(_struct.Description);
     }
 }
Beispiel #2
0
 /// <summary>
 ///     Configures an explicit audio output device. If the module paramater is NULL,
 ///     audio output will be moved to the device specified by the device identifier string immediately.
 ///     This is the recommended usage. A list of adequate potential device strings can be obtained with
 ///     <see cref="EnumAudioDeviceList" />.
 ///     However passing NULL is supported in LibVLC version 2.2.0 and later only; in earlier versions, this function would
 ///     have no effects when the module parameter was NULL.
 ///     If the module parameter is not NULL, the device parameter of the corresponding audio output, if it exists, will be
 ///     set to the specified string.
 ///     Note that some audio output modules do not have such a parameter (notably MMDevice and PulseAudio).
 ///     A list of adequate potential device strings can be obtained with <see cref="GetAudioDeviceList" />.
 /// </summary>
 public void SetAudioDevice(AudioOutput audioOutput, AudioDevice audioDevice)
 {
     var outputHandle = audioOutput == null ? null : new GCHandle?(InteropHelper.StringToPtr(audioOutput.Name));
     var deviceHandle = InteropHelper.StringToPtr(audioDevice.Device);
     _setAudioDeviceFunction.Delegate(InstancePointer,
         outputHandle == null ? IntPtr.Zero : outputHandle.Value.AddrOfPinnedObject(),
         deviceHandle.AddrOfPinnedObject());
     if (outputHandle.HasValue)
     {
         outputHandle.Value.Free();
     }
     deviceHandle.Free();
 }
Beispiel #3
0
 /// <summary>
 ///     Selects an audio output module.
 ///     Any change will take be effect only after playback is stopped and restarted. Audio output cannot be changed while
 ///     playing.
 /// </summary>
 /// <param name="audioOutput"></param>
 /// <returns></returns>
 public bool SetAudioOutput(AudioOutput audioOutput)
 {
     var handle = InteropHelper.StringToPtr(audioOutput.Name);
     var result = _setAudioOutputFunction.Delegate(InstancePointer, handle.AddrOfPinnedObject());
     handle.Free();
     return result == 0;
 }
Beispiel #4
0
 /// <summary>
 ///     Gets a list of audio output devices for a given audio output module.
 /// </summary>
 /// <param name="audioOutput"></param>
 /// <returns></returns>
 public AudioDeviceList GetAudioDeviceList(AudioOutput audioOutput)
 {
     var handle = InteropHelper.StringToPtr(audioOutput.Name);
     var result =
         new AudioDeviceList(_getAudioDeviceListFunction.Delegate(VlcInstance.InstancePointer,
             handle.AddrOfPinnedObject()));
     handle.Free();
     return result;
 }