Page 1 of 1
How to use mediacontrol_snapshot function ?
Posted: 27 Aug 2009 18:44
by FFFan64
Hi,
I try to get a mediacontrol_RGBPicture from the mediacontrol_snapshot function but I don't really understand the mediacontrol_Position parameter, how to use it ?
I want to retrieve in memory a frame from a stream.
Code: Select all
mediacontrol_PositionOrigin an_origin;
mediacontrol_PositionKey a_key;
mediacontrol_Position* mc_pos = mediacontrol_get_media_position( _mi, an_origin,a_key, &exception);
mediacontrol_RGBPicture * mc_rgb = mediacontrol_snapshot(_mi,mc_pos,&exception);
my mc_rgb is always NULL , any idea ?
Re: How to use mediacontrol_snapshot function ?
Posted: 28 Aug 2009 15:47
by FFFan64
why if i put
Code: Select all
mediacontrol_RGBPicture * mc_rgb = mediacontrol_snapshot(_mi,NULL,&exception);
my mc_rgb is always null and exception is filled by : exception = {code=5 message=0x03f51ca0 "No input" }
how should i use this function please?
Re: How to use mediacontrol_snapshot function ?
Posted: 28 Aug 2009 15:54
by kryptonite
If the exception message reads "No input", it's expecting something.
You should have calls to:
Code: Select all
libvlc_media_player_set_media()
libvlc_media_player_set_drawable()
and probably libvlc_media_player_play()
before using your methods.
Re: How to use mediacontrol_snapshot function ?
Posted: 28 Aug 2009 16:08
by FFFan64
thx for the reply.
I can see the stream on my screen.
Here is the code that play the stream, all i want to do is grabe a frame in memory.
Code: Select all
void Player::playFile(QString file)
{
//the file has to be in one of the following formats /perhaps a little bit outdated)
/*
[file://]filename Plain media file
http://ip:port/file HTTP URL
ftp://ip:port/file FTP URL
mms://ip:port/file MMS URL
screen:// Screen capture
[dvd://][device][@raw_device] DVD device
[vcd://][device] VCD device
[cdda://][device] Audio CD device
udp:[[<source address>]@[<bind address>][:<bind port>]]
*/
/* Create a new LibVLC media descriptor */
_m = libvlc_media_new (_vlcinstance, file.toAscii(), &_vlcexcep);
raise(&_vlcexcep);
libvlc_media_player_set_media (_mp, _m, &_vlcexcep);
raise(&_vlcexcep);
// /!\ Please note /!\
//
// passing the widget to the lib shows vlc at which position it should show up
// vlc automatically resizes the video to the ´given size of the widget
// and it even resizes it, if the size changes at the playing
/* Get our media instance to use our window */
#if defined(Q_OS_WIN)
libvlc_media_player_set_drawable(_mp, reinterpret_cast<unsigned int>(_videoWidget->winId()), &_vlcexcep );
//libvlc_media_player_set_hwnd(_mp, _videoWidget->winId(), &_vlcexcep ); // for vlc 1.0
#elif defined(Q_OS_MAC)
libvlc_media_player_set_drawable(_mp, _videoWidget->winId(), &_vlcexcep );
//libvlc_media_player_set_agl (_mp, _videoWidget->winId(), &_vlcexcep); // for vlc 1.0
#else //Linux
libvlc_media_player_set_drawable(_mp, _videoWidget->winId(), &_vlcexcep );
//libvlc_media_player_set_xwindow(_mp, _videoWidget->winId(), &_vlcexcep ); // for vlc 1.0
#endif
raise(&_vlcexcep);
/* Play */
libvlc_media_player_play (_mp, &_vlcexcep );
raise(&_vlcexcep);
_isPlaying=true;
}
Re: How to use mediacontrol_snapshot function ?
Posted: 31 Aug 2009 08:49
by kryptonite
I haven't tried using mediacontrol_snapshot(), but I implemented the snapshot feature in my app using libvlc_video_take_snapshot() which works perfectly.
Why don't you try using this method instead?
Re: How to use mediacontrol_snapshot function ?
Posted: 31 Aug 2009 12:03
by FFFan64
simply because i dont want an image on my hdd , but in memory because i am doing en opencv analysis after
Re: How to use mediacontrol_snapshot function ?
Posted: 31 Aug 2009 12:33
by kryptonite
How are you creating the mediacontrol instance (_mi)?
Are you using mediacontrol_new_from_instance()?
Also, apparently the position param is currently ignored.
Re: How to use mediacontrol_snapshot function ?
Posted: 31 Aug 2009 13:38
by FFFan64
yes i am !