that codeblock I need to pass it to c and evaluate its content.
I am very confused with this since it exceeds my little knowledge in c.
this is what I have the api de vlc, has an event manager, which should be indicated that
do under certain conditions.
- Code: Select all Expand view RUN
- /*---------------------------------------------------------------------------------------------*/
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 )
- Code: Select all Expand view RUN
/*---------------------------------------------------------------------*/
/*
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;
}
}