Page 1 of 1

How to display wait cursor

Posted: 01 Feb 2012 22:11
by lordawe
I would like to display an hourglass cursor while the media player seeks to a new position via SetPos() and have no joy with the code below as both SetPos and Play return immediately - any ideas?

Code: Select all

AfxGetApp()->BeginWaitCursor(); m_Player.SetPos(fPos); m_Player.Play(); AfxGetApp()->EndWaitCursor();


Thanks.

Re: How to display wait cursor

Posted: 02 Feb 2012 19:35
by mirswith
See if there are some callbacks you can use to trigger your wait/un-wait logic.

SOLVED: How to display wait cursor

Posted: 08 Feb 2012 19:19
by lordawe
Well, no help from the gurus on this one so here's the hack I ended up using:

1) Save the position sent to SetPos() as "seekposition"
2) Set the hourglass cursor
3) Start a timer function that periodically checks the video position with GetPos()
4) When return from GetPos() > "seekposition" the video is playing again (Unset the hourglass cursor)

Hope this helps someone else.

Re: SOLVED: How to display wait cursor

Posted: 09 Feb 2012 22:18
by mangokm40
Well, no help from the gurus on this one so here's the hack I ended up using:

1) Save the position sent to SetPos() as "seekposition"
2) Set the hourglass cursor
3) Start a timer function that periodically checks the video position with GetPos()
4) When return from GetPos() > "seekposition" the video is playing again (Unset the hourglass cursor)

Hope this helps someone else.

Isn't there an event that tells you when the position changes? Would that be better than timer/polling?

Re: How to display wait cursor

Posted: 14 Feb 2012 21:16
by lordawe
You are absolutely correct mangokm40. The libvlc_MediaPlayerTimeChanged event is the better place for this logic (I have changed mine - thanks). However as the video is stalled at this point any clock ticks saved cant really be used anyway.

An even better solution would be to have a libvlc_MediaPlayerSeekStarted and libvlc_MediaPlayerSeekEnded event triggered.

Re: How to display wait cursor

Posted: 22 Feb 2012 03:34
by Vaselinessa
Can you advise me as to how to run a timer on this project? I've tried to use vlc_timer_create time and again in an interface module as well as in a video filter module, but always segfault when the code tries to execute. e.g.:

Code: Select all

struct intf_sys_t { vlc_timer_t timer; }; int Open(vlc_object_t *obj) { intf_thread_t * p_intf = ( intf_thread_t * ) obj; intf_sys_t * p_sys = p_intf->p_sys; ... if ( vlc_timer_create( &p_sys->timer, TimerFired, p_intf ) ) msg_Err( p_intf, "Failed to create timer\n" ); return VLC_SUCCESS; }

Re: How to display wait cursor

Posted: 29 Feb 2012 19:48
by RĂ©mi Denis-Courmont
Refer to the Doxygen documentation or comments.