[vlc-devel] MediaPlayer crash or deadlock (only) if mouse moves	over video after libvlc_MediaPlayerEndReached
    Hugo Beauzee-Luyssen 
    beauze.h at gmail.com
       
    Thu Mar 18 10:20:50 CET 2010
    
    
  
Basically the only thing you'd need is something like that :
void                            MediaPlayer::callbacks( const
libvlc_event_t* event, void* ptr )
{
     MediaPlayer* self = reinterpret_cast<MediaPlayer*>(ptr);
     switch ( event->type )
     {
      case libvlc_MediaPlayerEndReached:
           self->emit endReached();
      //....
     }
}
[...]
libvlc_event_attach( p_eventManager, libvlc_MediaPlayerEndReached,
callbacks, p_mediaPlayer );
[...]
connect( p_mediaPlayer, SIGNAL( endReached() ),
whatever_stops_the_playback_instance, SLOT( stop() ),
Qt::QueudConnection );
If you omit the last parameter, you'll more likely hang in
libvlc_media_player_stop()
About the cursor causing a crash, I'm not aware of anything that could
watch the cursor movements and cause a crash, but again, a backtrace
would help ;)
On Thu, Mar 18, 2010 at 10:06 AM, Christian Gallant
<christian at masterkitchen.de> wrote:
> Hi,
>
> I just tested a version without the libvlc_MediaPlayerEndReached event and just stop the video near the end.
> ( libvlc_media_player_get_time(_mp, &_vlcexcep) >= libvlc_media_player_get_length(_mp, &_vlcexcep)-750 )...
>
> With a QTimer::singleshot() it gets closed 3 seconds after stopping. The same error occurs in the destructor if the cursor moves over the video at this time. This does not happen while moving ahead the other QWigets so I guess it has to with vlc?
>
> Maybe there is some mousemoveevent which has to be catched?
>
>
> Regards
> Chris
>
>
>
>>
>> Hi,
>>
>> we discovered a strange error at the end of our movies playing in a QT-
>> Framework with libvlc (1.0.3 or 1.0.5).
>>
>> After the libvlc_MediaPlayerEndReached comes to the callback, we do
>> something with the movie (reset, go back to main menu, or loop...). The
>> libvlc_media_player seems to be deleted after the event so we delete
>> the holder-widget as well an create a new one.
>>
>>
>> It has to be said, that I don´t call the methods directly  from the
>> callback, but instead (as I read here) use a QCustomEvent which is
>> fired with postEvent() at this point.
>> ( Couldn´t find the libvlc_event_attach_async so it did it with QT)
>>
>> So far everything works fine with one exception. If the user moves the
>> mouse (cursor) over the video the app hangs at the destructor of our
>> VLCPlayer Widget. This will not happen if we move the mouse over the
>> VideoController- Widget or move the main Window...
>>
>> Here Some code to see where it will hang. I commented the locations
>> where the app will crash.
>>
>> // Desctructor
>> VLCPlayer::~VLCPlayer()
>> {
>>         /* Stop playing if the user pressed the close button.
>>
>>         libvlc_media_player_stop(_mp, &_vlcexcep);
>>         vlcraise (&_vlcexcep);
>>
>>         NOTE: 1. It will crash here if the mouse was moved over the
>> video.
>>
>>         ...
>>         libvlc_event_detach(em_mp, libvlc_MediaPlayerEndReached,
>> callbacks, this, &_vlcexcep);
>>         ...
>>
>>
>>         if (_mp) {
>>                 libvlc_media_player_release(_mp);
>>                 _mp = NULL;
>>         }
>>         vlcraise (&_vlcexcep);
>>
>>         NOTE: 2. It will crash here as well if the mouse was moved over
>> the video.
>>
>>         if (_m) {
>>                 libvlc_media_release(_m);
>>                 _m = NULL;
>>         }
>>
>>         vlcraise (&_vlcexcep);
>>         qDebug("~VLCPlayer released _m");
>>
>>       libvlc_release(_vlcinstance);
>>         qDebug("~VLCPlayer released _vlcinstance");
>>
>>     vlcraise (&_vlcexcep);
>> }
>>
>>
>> Once again: Everything works fine if we don´t move the cursor over the
>> video. To have the cursor over it without moving is no problem.
>>
>>
>> Thanks for some hints.
>>
>> Regards
>> Chris
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> http://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
>
-- 
Hugo Beauzée-Luyssen
    
    
More information about the vlc-devel
mailing list