ese codeblock necesito pasarlo a c y que se evalue su contenido.
estoy muy confundido con esto ya que supera mis pocos conocimientos en c.
esto es lo que tengo el api de vlc, tiene un event manager, al cual se le debe indicar que
hacer bajo ciertas condiciones.
/*---------------------------------------------------------------------------------------------*/
CLASS TVlc
聽 聽/*hidden datas and methods*/
聽 聽HIDDEN:
聽 聽DATA bOnEvent
聽 聽DATA hContainer
聽 聽DATA pInstance, pMedia, pMediaPlayer, pEventManager, nStatus
聽 聽DATA nVolumeStep INIT 5
聽 聽DATA nVolume 聽 聽 INIT 50
聽 聽DATA nLen 聽 聽 聽 聽INIT 0
聽 聽DATA nPos 聽 聽 聽 聽INIT 0
聽 聽DATA nTime 聽 聽 聽 INIT 0
聽 聽DATA cMediaFile 聽INIT ""
聽 聽DATA aMetaInfo
...
/*Play mediafile*/
METHOD Play() CLASS TVlc
聽 聽/*If paused, resume*/
聽 聽IF ::Status() == VLC_INPUT_STATE_PAUSED
聽 聽 聽 ::Pause()
聽 聽ELSE
聽 聽 聽 /*Is playing, exit*/
聽 聽 聽 IF ::Status() == VLC_INPUT_STATE_PLAYING
聽 聽 聽 聽 聽RETURN NIL
聽 聽 聽 ELSE
聽 聽 聽 聽 聽/*If defines mediafile*/
聽 聽 聽 聽 聽IF !Empty( ::cMediaFile )
聽 聽 聽 聽 聽 聽 /*Init info value*/
聽 聽 聽 聽 聽 聽 ::nLen 聽:= 0
聽 聽 聽 聽 聽 聽 ::nPos 聽:= 0
聽 聽 聽 聽 聽 聽 ::nTime := 0
聽 聽 聽 聽 聽 聽 /*clear metainfo*/
聽 聽 聽 聽 聽 聽 ::aMetaInfo := NIL
聽 聽 聽 聽 聽 聽 /*Exist vlc instance*/
聽 聽 聽 聽 聽 聽 IF !Empty( ::pInstance )
聽 聽 聽 聽 聽 聽 聽 聽/*Create media instance*/
聽 聽 聽 聽 聽 聽 聽 聽::pMedia := VLC_CreateMedia( ::pInstance, ::cMediaFile )
聽 聽 聽 聽 聽 聽 聽 聽IF !Empty( ::pMedia )
聽 聽 聽 聽 聽 聽 聽 聽 聽
聽 聽 聽 聽 聽 聽 聽 聽 聽 /*if metainfo parse medifile and get metainfo*/
聽 聽 聽 聽 聽 聽 聽 聽 聽 IF ::lMetaInfo
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽VLC_MediaParse( ::pMedia )
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽::aMetaInfo := VLC_MediaGetMeta( ::pMedia )
聽 聽 聽 聽 聽 聽 聽 聽 聽 ENDIF
聽 聽 聽 聽 聽 聽 聽 聽 聽 /*Create mediaplayer instance*/
聽 聽 聽 聽 聽 聽 聽 聽 聽 ::pMediaPlayer := VLC_CreateMediaPlayer( ::pMedia )
聽 聽 聽 聽 聽 聽 聽 聽 聽 /*Exist mediaplayer instance*/
聽 聽 聽 聽 聽 聽 聽 聽 聽 IF !Empty( ::pMediaPlayer )
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽/*Relase media handle, not need*/
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽VLC_MediaRelease( ::pMedia )
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽::pMedia := NIL
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽/*create event mediamanager*/
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽::pEventManager := VLC_EventManager( ::pMediaPlayer )
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽/*Define windows container for mediaplayer*/
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽VLC_SetWindow( ::pMediaPlayer, ::hContainer )
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽/*Apply volume*/
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽::Volume( ::nVolume )
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽/*Play media*/
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽::nStatus := VLC_Play( ::pMediaPlayer )/*---------------------------------------------------------------------*/
/*
Get the Event Manager from which the media player send event.
return the event manager associated with p_mi (mediaplayer)
LIBVLC_API libvlc_event_manager_t * libvlc_media_player_event_manager ( libvlc_media_player_t *p_mi );
*/
HB_FUNC( VLC_EVENTMANAGER )
{
聽 聽libvlc_media_player_t *mediaplayer = (libvlc_media_player_t *) hb_parptr( 1 );
聽 聽if( mediaplayer )
聽 聽{
聽 聽 聽 hb_retptr( (void *) libvlc_media_player_event_manager( mediaplayer ) );
聽 聽}
聽 聽else
聽 聽{
聽 聽 聽 hb_errRT_BASE( EG_ARG, 2020, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
聽 聽}
}
/*---------------------------------------------------------------------*/
HB_FUNC( VLC_EVENTATTACH )
{
聽 聽libvlc_event_manager_t *eventmanager = (libvlc_event_manager_t *) hb_parptr( 1 );
聽 聽if( eventmanager )
聽 聽{
聽 聽 聽 libvlc_event_attach( eventmanager, libvlc_MediaPlayerMediaChanged 聽 , vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_attach( eventmanager, libvlc_MediaPlayerNothingSpecial , vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_attach( eventmanager, libvlc_MediaPlayerOpening 聽 聽 聽 聽, vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_attach( eventmanager, libvlc_MediaPlayerPlaying 聽 聽 聽 聽, vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_attach( eventmanager, libvlc_MediaPlayerPaused 聽 聽 聽 聽 , vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_attach( eventmanager, libvlc_MediaPlayerStopped 聽 聽 聽 聽, vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_attach( eventmanager, libvlc_MediaPlayerEndReached 聽 聽 , vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_attach( eventmanager, libvlc_MediaPlayerTimeChanged 聽 聽, vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_attach( eventmanager, libvlc_MediaPlayerPositionChanged, vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_attach( eventmanager, libvlc_MediaPlayerPausableChanged, vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_attach( eventmanager, libvlc_MediaPlayerMuted 聽 聽 聽 聽 聽, vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_attach( eventmanager, libvlc_MediaPlayerUnmuted 聽 聽 聽 聽, vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_attach( eventmanager, libvlc_MediaPlayerAudioVolume 聽 聽, vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_attach( eventmanager, libvlc_MediaPlayerLengthChanged 聽, vlc_mycallback, NULL );
聽 聽}
}
/*---------------------------------------------------------------------*/
HB_FUNC( VLC_EVENTDETCH )
{
聽 聽libvlc_event_manager_t *eventmanager = (libvlc_event_manager_t *) hb_parptr( 1 );
聽 聽if( eventmanager )
聽 聽{
聽 聽 聽 libvlc_event_detach( eventmanager, libvlc_MediaPlayerMediaChanged 聽 , vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_detach( eventmanager, libvlc_MediaPlayerNothingSpecial , vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_detach( eventmanager, libvlc_MediaPlayerOpening 聽 聽 聽 聽, vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_detach( eventmanager, libvlc_MediaPlayerPlaying 聽 聽 聽 聽, vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_detach( eventmanager, libvlc_MediaPlayerPaused 聽 聽 聽 聽 , vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_detach( eventmanager, libvlc_MediaPlayerStopped 聽 聽 聽 聽, vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_detach( eventmanager, libvlc_MediaPlayerEndReached 聽 聽 , vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_detach( eventmanager, libvlc_MediaPlayerTimeChanged 聽 聽, vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_detach( eventmanager, libvlc_MediaPlayerPositionChanged, vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_detach( eventmanager, libvlc_MediaPlayerPausableChanged, vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_detach( eventmanager, libvlc_MediaPlayerMuted 聽 聽 聽 聽 聽, vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_detach( eventmanager, libvlc_MediaPlayerUnmuted 聽 聽 聽 聽, vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_detach( eventmanager, libvlc_MediaPlayerAudioVolume 聽 聽, vlc_mycallback, NULL );
聽 聽 聽 libvlc_event_detach( eventmanager, libvlc_MediaPlayerLengthChanged 聽, vlc_mycallback, NULL );
聽 聽}
}
/*---------------------------------------------------------------------*/
void vlc_mycallback( const libvlc_event_t *event, void *param )
{
聽 聽switch ( event->type )
聽 聽{
聽 聽 聽 case libvlc_MediaPlayerMediaChanged:
聽 聽 聽 case libvlc_MediaPlayerNothingSpecial:
聽 聽 聽 case libvlc_MediaPlayerOpening:
聽 聽 聽 case libvlc_MediaPlayerPlaying:
聽 聽 聽 case libvlc_MediaPlayerPaused:
聽 聽 聽 case libvlc_MediaPlayerStopped:
聽 聽 聽 case libvlc_MediaPlayerEndReached:
聽 聽 聽 case libvlc_MediaPlayerTimeChanged:
聽 聽 聽 case libvlc_MediaPlayerPositionChanged:
聽 聽 聽 case libvlc_MediaPlayerPausableChanged:
聽 聽 聽 case libvlc_MediaPlayerMuted:
聽 聽 聽 case libvlc_MediaPlayerUnmuted:
聽 聽 聽 case libvlc_MediaPlayerAudioVolume:
聽 聽 聽 聽 聽break;
聽 聽}
}Carlos Vargas
Desde Managua, Nicaragua (CA)
