Deseo poder contactar a xmanuel, ya que deseo hacerle unas preguntas, con relación a objetos en el api de C.
creo que talvez tenga la experiencia o por donde van los tiros.
a grandes rasgos la consulta es esta:
en una clase que he realizado llamada TVLC la cual estoy haciendo para manejar un player con el VLC, me es necesarao manejar Eventos,
vlc tiene una función en c para crear un manejador de eventos, lo caules se disparan por ejemplo cuando se hace Play, Stop, End, Mute, etc.
- Code: Select all Expand view RUN
METHOD New( hWnd ) CLASS TVLC
::hWnd := hWnd
::hVLC := myvlc_new()
IF !Empty( ::hVLC )
::hMediaPlayer := myvlc_media_player_new( ::hVLC )
IF !Empty( ::hWnd ) .and. !Empty( ::hMediaPlayer )
::hEventManager := myvlc_media_player_event_manager( ::hMediaPlayer )
IF !empty( ::hEventManager )
myvlc_media_player_event_attach( ::hEventManager, QSelf() ) //aca envio el objeto a c
ENDIF
en c
- Code: Select all Expand view RUN
HB_FUNC( MYVLC_MEDIA_PLAYER_EVENT_MANAGER )
{
libvlc_media_player_t *hMediaPlayer = (libvlc_media_player_t *) hb_parptr( 1 );
if( hMediaPlayer )
{
libvlc_event_manager_t * hEventManager;
hEventManager = libvlc_media_player_event_manager( hMediaPlayer );
hb_retptr( (void *) hEventManager );
}
}
/*---------------------------------------------------------------------------------------------*/
HB_FUNC( MYVLC_MEDIA_PLAYER_EVENT_ATTACH )
{
libvlc_event_manager_t *hEventManager = (libvlc_event_manager_t *) hb_parptr( 1 );
//PHB_ITEM pSelf = ACA NECESITO RECIVIR EL OBJETO SELF DE TVLC
if( hEventManager )
{
libvlc_event_attach( hEventManager, libvlc_MediaPlayerPlaying , vlc_mycallback, pSelf ); //ACA ENVIARLO A LA FUNCION CALLBACK
/*
libvlc_event_attach( hEventManager, libvlc_MediaPlayerMediaChanged , vlc_mycallback, NULL );
libvlc_event_attach( hEventManager, libvlc_MediaPlayerOpening , vlc_mycallback, NULL );
libvlc_event_attach( hEventManager, libvlc_MediaPlayerPlaying , vlc_mycallback, NULL );
libvlc_event_attach( hEventManager, libvlc_MediaPlayerPaused , vlc_mycallback, NULL );
libvlc_event_attach( hEventManager, libvlc_MediaPlayerStopped , vlc_mycallback, NULL );
libvlc_event_attach( hEventManager, libvlc_MediaPlayerEndReached , vlc_mycallback, NULL );
libvlc_event_attach( hEventManager, libvlc_MediaPlayerPositionChanged, vlc_mycallback, NULL );
*/
}
}
- Code: Select all Expand view RUN
void vlc_mycallback( const libvlc_event_t *event, void *param )
{
switch ( event->type )
{
case libvlc_MediaPlayerMediaChanged:
OutStr("--------------->MEDIA CHANGED");
break;
case libvlc_MediaPlayerNothingSpecial:
OutStr("--------------->NOTHING");
break;
case libvlc_MediaPlayerOpening:
OutStr("--------------->OPENING");
break;
case libvlc_MediaPlayerPlaying:
//ACA EJECUTAR UN METODO DEL OBJETO VLC
OutStr("--------------->PLAYING");
break;
case libvlc_MediaPlayerPaused:
OutStr("--------------->PAUSED");
break;
case libvlc_MediaPlayerStopped:
OutStr("--------------->STOPPED");
break;
case libvlc_MediaPlayerEndReached:
OutStr("--------------->END REACH");
break;
case libvlc_MediaPlayerTimeChanged:
OutStr("--------------->TIME CHANGED");
break;
case libvlc_MediaPlayerPositionChanged:
OutStr("--------------->POSITION CHANGED");
break;
case libvlc_MediaPlayerMuted:
OutStr("--------------->MUTED");
break;
case libvlc_MediaPlayerUnmuted:
OutStr("--------------->UNMUTED");
break;
case libvlc_MediaPlayerAudioVolume:
OutStr("--------------->VOLUME");
break;
}
}