how to select audio output device ?

This forum is about all development around libVLC.
Fleurette_51
Blank Cone
Blank Cone
Posts: 10
Joined: 04 Jun 2009 01:57

how to select audio output device ?

Postby Fleurette_51 » 09 Oct 2009 00:10

hi all !

I'm using libvlc in my java application (a "media center") by using my own binding base on jvlc. I would like to know how to choose the audio output device (i have 2 sound cards on my computer : one for my computer, and i would like to use the other for films or anything else i watch on TV ). By this way i need to select the sound output device when i create my libvlc instance.
It seems in older versions of libvlc their was a function call : libvlc_audio_output_list_get(...) but jna can t find it anymore ...

I didn t find any thing in the libvlc documentation ... which is not very helpfull

I searched on all the net ... and i didn't find any help or example to do it by another way .... (3 days i m searching ...:shock: )

thanks for any help !

Fleurette_51
Blank Cone
Blank Cone
Posts: 10
Joined: 04 Jun 2009 01:57

Re: how to select audio output device ?

Postby Fleurette_51 » 09 Oct 2009 12:05

hi all !

I fixed my probleme : i upgrade to vlc 1.0.2 and i could now call the libvlc_audio_output_list_get() function !

But now my new probleme is how to use a libvlc_audio_output_t object in my java program.
I m using JNA in my own vlc binding, i know how to call native functions like "play", "pause", ... which not return anything but i don't exactly understand how JNA brings me back native's return object.

My java code :

Code: Select all

public class libvlc_audio_output_t extends PointerType { public String psz_name; public String psz_description; public libvlc_audio_output_t p_next; }

Code: Select all

public interface LibVlc extends Library { ... libvlc_audio_output_t libvlc_audio_output_list_get(LibVlcInstance instance, libvlc_exception_t exception); }

Code: Select all

public class MediaPlayer { private List<MediaPlayerEventListener> eventListenerList = new ArrayList<MediaPlayerEventListener>(); private final LibVlc libvlc = LibVlc.SYNC_INSTANCE; private final ExecutorService listenersService = Executors.newSingleThreadExecutor(); private final String[] args; private LibVlcInstance instance; private LibVlcMediaInstance mediaPlayerInstance; private LibVlcEventManager mediaPlayerEventManager; private LibVlcCallback callback; private Canvas videoSurface; .... public void libvlcAudioOutputListGet()// it s a void type at this time for my tests { if(mediaPlayerInstance == null) { throw new IllegalStateException("No media player instance"); } libvlc_exception_t exception = new libvlc_exception_t(); System.out.println(libvlc.libvlc_audio_output_list_get(instance, exception).psz_name);//here i would like to have the name of the first audio output device checkException(exception); }

I read the JNA mappings "rules" in order to create my libvlc_audio_output_t class but i'm not sure to have understood exactly how it works ...


thanks for any help

davdat
New Cone
New Cone
Posts: 3
Joined: 06 Oct 2009 20:58

Re: how to select audio output device ?

Postby davdat » 16 Oct 2009 16:10

I am also interested in knowing how to do this. Has anyone got an example of using libvlc_audio_output_list_get from any language?

-Dave

djshultz
New Cone
New Cone
Posts: 3
Joined: 08 Sep 2010 01:26

Re: how to select audio output device ?

Postby djshultz » 12 Sep 2010 01:24

have the function return an IntPtr and then marshal it as ptrtostructure to your class, works like a charm


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 6 guests