Exemple #1
0
        public IEnumerable <AudioOutputDeviceInfo> GetAudioOutputDevicesEx(AudioOutputModuleInfo audioOutputModule)
        {
            var pList = LibVlcMethods.libvlc_audio_output_device_list_get(m_hMediaLib, audioOutputModule.Name.ToUtf8());

            if (pList == IntPtr.Zero)
            {
                yield break;
            }

            libvlc_audio_output_device_t pDevice = (libvlc_audio_output_device_t)Marshal.PtrToStructure(pList, typeof(libvlc_audio_output_device_t));

            do
            {
                AudioOutputDeviceInfo info = new AudioOutputDeviceInfo()
                {
                    Id       = Marshal.PtrToStringAnsi(pDevice.psz_device),
                    Longname = Marshal.PtrToStringAnsi(pDevice.psz_description)
                };

                yield return(info);

                if (pDevice.p_next != IntPtr.Zero)
                {
                    pDevice = (libvlc_audio_output_device_t)Marshal.PtrToStructure(pDevice.p_next, typeof(libvlc_audio_output_device_t));
                }
                else
                {
                    break;
                }
            }while (true);

            LibVlcMethods.libvlc_audio_output_device_list_release(pList);
        }
Exemple #2
0
        /// <summary>
        /// Gets list of available audio output devices
        /// </summary>
        public IEnumerable <AudioOutputDeviceInfo> GetAudioOutputDevices(AudioOutputModuleInfo audioOutputModule)
        {
            int i = LibVlcMethods.libvlc_audio_output_device_count(m_hMediaLib, audioOutputModule.Name.ToUtf8());

            for (int j = 0; j < i; j++)
            {
                AudioOutputDeviceInfo d = new AudioOutputDeviceInfo();
                d.Longname = LibVlcMethods.libvlc_audio_output_device_longname(m_hMediaLib, audioOutputModule.Name.ToUtf8(), j);
                d.Id       = LibVlcMethods.libvlc_audio_output_device_id(m_hMediaLib, audioOutputModule.Name.ToUtf8(), j);

                yield return(d);
            }
        }
Exemple #3
0
        /// <summary>
        /// Gets list of available audio output devices
        /// </summary>
        public IEnumerable <AudioOutputDeviceInfo> GetAudioOutputDevices(AudioOutputModuleInfo audioOutputModule)
        {
            int i = NativeMethods.libvlc_audio_output_device_count(m_hMediaLib, audioOutputModule.Name.ToUtf8());

            for (int j = 0; j < i; j++)
            {
                AudioOutputDeviceInfo d = new AudioOutputDeviceInfo();
                IntPtr pName            = NativeMethods.libvlc_audio_output_device_longname(m_hMediaLib, audioOutputModule.Name.ToUtf8(), j);
                d.Longname = Marshal.PtrToStringAnsi(pName);
                IntPtr pId = NativeMethods.libvlc_audio_output_device_id(m_hMediaLib, audioOutputModule.Name.ToUtf8(), j);
                d.Id = Marshal.PtrToStringAnsi(pId);

                yield return(d);
            }
        }
Exemple #4
0
        public void SetAudioOutputModuleAndDevice(AudioOutputModuleInfo module, AudioOutputDeviceInfo device)
        {
            if (module == null)
            {
                throw new ArgumentNullException("module");
            }

            if (device != null)
            {
                LibVlcMethods.libvlc_audio_output_device_set(m_hMediaPlayer, module.Name.ToUtf8(), device.Id.ToUtf8());
            }

            int res = LibVlcMethods.libvlc_audio_output_set(m_hMediaPlayer, module.Name.ToUtf8());

            if (res < 0)
            {
                throw new LibVlcException();
            }
        }