[vlc] Problem in switching audio between 2 VLC instances.

Mauro.carosso mauro.carosso at email.it
Wed Apr 16 16:16:03 CEST 2008


Hallo,

I'm trying to build a win32 application that launches 2 instances of
VLC, and then select only one audio track by muting the unwanted one.To do
this I write this small sample that loads in memory libvlc.dll, creates 2
vlc_t structures, puts them on playing (the same file video.mpg),wait for
ten seconds and then mutes the first instance.I expect to hear only one
audio source(the one coming from the second instance), but this does not
happen : in fact, after muting the first audio source, also the second audio
source has been muted too (!), I don't hear nothing anymore.How can I do
? What I'm doing wrong ?This is my sample compiled with mingw#include
"windows.h"#include "stdio.h"#include
"conio.h"#include "string.h"HMODULE p_libvlc;typedef
char const *(*P_VLC_COMPILER)();typedef int (*P_VLC_CREATE)();typedef int
(*P_VLC_DESTROY)( int id);typedef int (*P_VLC_CLEANUP)( int id);typedef int
(*P_VLC_INIT)( int id, int n_comm, char **p_block);typedef int
(*P_VLC_ADDINTF)( int id, char const *str, int parm1, int parm2);typedef int
(*P_VLC_PLAY)( int id);typedef int (*P_VLC_STOP)( int id);typedef int
(*P_VLC_PAUSE)( int id);typedef int (*P_VLC_VOLUMESET)(int, int);#define
MAX_N_REG 10P_VLC_CREATE VLC_Create;P_VLC_INIT VLC_Init;P_VLC_PLAY
VLC_Play;P_VLC_STOP VLC_Stop;P_VLC_DESTROY VLC_Destroy;P_VLC_CLEANUP
VLC_Cleanup;P_VLC_VOLUMESET VLC_VolumeSet;P_VLC_PAUSE VLC_Pause;#define
N_ARG 7int main( int i_argc, char *ppsz_argv[] ){    int id_vlc1;    int
id_vlc2;	int esito=0;	char ch;    char *argomenti[N_ARG];    char
arg1[]="a.exe";    char arg2[]="file://video.mpg";   
char arg3[]=":width=352";    char arg4[]=":height=288"; 
  char arg5[80]=":video-x=0";    char
arg6[80]=":video-y=0";    char arg7[]="-R";   
argomenti[0]=arg1;    argomenti[1]=arg2;    argomenti[2]=arg3;   
argomenti[3]=arg4;    argomenti[4]=arg5;    argomenti[5]=arg6;   
argomenti[6]=arg7;    p_libvlc = LoadLibrary("libvlc.dll");    if
(p_libvlc == NULL) {        printf("\r\nlibvlc not
found");		return(0);	}    VLC_Create=( P_VLC_CREATE)GetProcAddress(
p_libvlc,"VLC_Create");    VLC_Init=( P_VLC_INIT)GetProcAddress(
p_libvlc,"VLC_Init");    VLC_Destroy=(
P_VLC_DESTROY)GetProcAddress( p_libvlc,"VLC_Destroy");   
VLC_Play=( P_VLC_PLAY)GetProcAddress( p_libvlc,"VLC_Play");   
VLC_Stop=( P_VLC_STOP)GetProcAddress( p_libvlc,"VLC_Stop");   
VLC_Cleanup=( P_VLC_CLEANUP)GetProcAddress(
p_libvlc,"VLC_CleanUp");    VLC_VolumeSet=(
P_VLC_VOLUMESET)GetProcAddress( p_libvlc,"VLC_VolumeSet");   
VLC_Pause=( P_VLC_PAUSE)GetProcAddress( p_libvlc,"VLC_Pause");   
id_vlc1=(VLC_Create());    esito=(VLC_Init( id_vlc1, N_ARG,argomenti));   
if (esito<0){		printf("\r\nVLC_Init ERROR");       
VLC_Destroy( id_vlc1);		return(0);	}    (VLC_Play( id_vlc1));   
id_vlc2=(VLC_Create());    sprintf( arg5,":video-x=370");   
sprintf( arg6,":video-y=0");    esito=(VLC_Init( id_vlc2,
N_ARG,argomenti));    if (esito<0){        printf("\r\nVLC_Init
ERROR");        VLC_Destroy( id_vlc2);        return(0);    }   
(VLC_Play( id_vlc2));    Sleep(10000);// NOW I MUTE THE FIRST INSTANCE BUT
AFTER ALSO THE SECOND AUDIO INSTANCE IS MUTED     VLC_VolumeSet( id_vlc1,
0);    Sleep(10000);    VLC_Pause( id_vlc1);    VLC_Stop( id_vlc1);   
Sleep(1000);    VLC_Pause( id_vlc2);    VLC_Stop( id_vlc2);    Sleep(1000); 
  VLC_Cleanup( id_vlc1);    VLC_Destroy( id_vlc1);    VLC_Cleanup( id_vlc2);
   VLC_Destroy( id_vlc2);    FreeLibrary( p_libvlc);    Sleep(5000);	return
0;}  
 --
 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 
 Sponsor:
 Offerta SKY a 15€ al mese: vedi tutto quello che vuoi tra Mondo, Cinema,
Sport e Calcio per una programmazione sempre di altissima qualità
direttamente a casa tua!

 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7781&d=20080416

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc/attachments/20080416/4bc22b6b/attachment.html>


More information about the vlc mailing list