How to use mediacontrol_snapshot function ?

This forum is about all development around libVLC.
FFFan64
New Cone
New Cone
Posts: 5
Joined: 27 Aug 2009 18:35

How to use mediacontrol_snapshot function ?

Postby FFFan64 » 27 Aug 2009 18:44

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 ?

FFFan64
New Cone
New Cone
Posts: 5
Joined: 27 Aug 2009 18:35

Re: How to use mediacontrol_snapshot function ?

Postby FFFan64 » 28 Aug 2009 15:47

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?

kryptonite
Blank Cone
Blank Cone
Posts: 52
Joined: 22 May 2009 12:01

Re: How to use mediacontrol_snapshot function ?

Postby kryptonite » 28 Aug 2009 15:54

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.

FFFan64
New Cone
New Cone
Posts: 5
Joined: 27 Aug 2009 18:35

Re: How to use mediacontrol_snapshot function ?

Postby FFFan64 » 28 Aug 2009 16:08

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

kryptonite
Blank Cone
Blank Cone
Posts: 52
Joined: 22 May 2009 12:01

Re: How to use mediacontrol_snapshot function ?

Postby kryptonite » 31 Aug 2009 08:49

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?

FFFan64
New Cone
New Cone
Posts: 5
Joined: 27 Aug 2009 18:35

Re: How to use mediacontrol_snapshot function ?

Postby FFFan64 » 31 Aug 2009 12:03

simply because i dont want an image on my hdd , but in memory because i am doing en opencv analysis after :)

kryptonite
Blank Cone
Blank Cone
Posts: 52
Joined: 22 May 2009 12:01

Re: How to use mediacontrol_snapshot function ?

Postby kryptonite » 31 Aug 2009 12:33

How are you creating the mediacontrol instance (_mi)?
Are you using mediacontrol_new_from_instance()?

Also, apparently the position param is currently ignored.

FFFan64
New Cone
New Cone
Posts: 5
Joined: 27 Aug 2009 18:35

Re: How to use mediacontrol_snapshot function ?

Postby FFFan64 » 31 Aug 2009 13:38

yes i am ! :(


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 44 guests