How to display wait cursor

This forum is about all development around libVLC.
lordawe
New Cone
New Cone
Posts: 8
Joined: 25 Jan 2012 04:45

How to display wait cursor

Postby lordawe » 01 Feb 2012 22:11

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.

mirswith
Blank Cone
Blank Cone
Posts: 49
Joined: 15 Dec 2011 01:15

Re: How to display wait cursor

Postby mirswith » 02 Feb 2012 19:35

See if there are some callbacks you can use to trigger your wait/un-wait logic.

lordawe
New Cone
New Cone
Posts: 8
Joined: 25 Jan 2012 04:45

SOLVED: How to display wait cursor

Postby lordawe » 08 Feb 2012 19:19

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.

mangokm40
Cone that earned his stripes
Cone that earned his stripes
Posts: 130
Joined: 20 May 2010 20:00

Re: SOLVED: How to display wait cursor

Postby mangokm40 » 09 Feb 2012 22:18

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?

lordawe
New Cone
New Cone
Posts: 8
Joined: 25 Jan 2012 04:45

Re: How to display wait cursor

Postby lordawe » 14 Feb 2012 21:16

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.

Vaselinessa
Blank Cone
Blank Cone
Posts: 48
Joined: 03 Apr 2011 02:26
Location: Sacramento, CA

Re: How to display wait cursor

Postby Vaselinessa » 22 Feb 2012 03:34

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; }

Rémi Denis-Courmont
Developer
Developer
Posts: 15267
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: How to display wait cursor

Postby Rémi Denis-Courmont » 29 Feb 2012 19:48

Refer to the Doxygen documentation or comments.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 11 guests