libvlc_log_open example
Posted: 25 Mar 2010 16:51
by morz
Hi, I'm using libVLC in my QT application. Everything works great. I just one to know, how to display output message (log) in my application (e.g: textEdit) instead of displaying on console(default)?
I just read the libVLC api and found libvlc_log_open function. How to use it?
To summarize, I want to:
1) Display message log in widget
2) Trigger an event when got new message log
Thanks.
Re: libvlc_log_open example
Posted: 26 Mar 2010 11:02
by morz
I figured out my self :
This code for QT :
1)
Code: Select all
libvlc_event_attach( em, libvlc_MediaPlayerPositionChanged,callback, this, &_vlcexcep );
2)
Code: Select all
void MainWindow::callback( const libvlc_event_t *ev, void *param )
{
MainWindow* self = reinterpret_cast<MainWindow*>( param );
switch(ev->type){
case libvlc_MediaPlayerPositionChanged :
self->emit changeMediaPlayerPosition();
break;
}
}
3)
Code: Select all
void MainWindow::mediaPlayerPositionChanged(){
libvlc_log_iterator_t * _logt_iter = libvlc_log_get_iterator (_logt, &_vlcexcep);
raise (&_vlcexcep);
libvlc_log_message_t p_buffer;
while(libvlc_log_iterator_has_next(_logt_iter, &_vlcexcep)){
libvlc_log_iterator_next( _logt_iter ,&p_buffer, &_vlcexcep);
QByteArray message(p_buffer.psz_message);
qDebug() << message;
}
}