set raw data buffer to QMediaPlayer
I want to get a screen shot of the widget application and then set its raw data buffer to QMeidaPlayer with setMedia(). If anyone tried this before, I would thank if you tell me how to do that:
Code:
buffer.setBuffer(&ba);
image->save(&buffer); // writes image into ba in PNG format
image->save("/home/saman/Desktop/myImage", "PNG");
mediaPlayer.
setMedia(QUrl::fromLocalFile("/home/saman/Desktop/png/images08.jpeg"));
//I want this to read from raw data
mediaPlayer.play();
I note again, what i have done is to receive the image, SAVE it, and then read from it. However, I would like to ask you how to read raw data directly without saving it into media player.
Code:
// saving
counter = 1;
image.save("/home/saman/image", "JPG");
counter = 0;
somewhere else, reading
Code:
if(counter == 0)
{
mediaPlayer.
setMedia(QUrl::fromLocalFile("/home/saman/image"));
mediaPlayer.play();
}
Re: set raw data buffer to QMediaPlayer
Quote:
Originally Posted by
saman_artorious
I want to get a screen shot of the widget application and then set its raw data buffer to QMeidaPlayer with setMedia(). If anyone tried this before, I would thank if you tell me how to do that:
Code:
buffer.setBuffer(&ba);
image->save(&buffer); // writes image into ba in PNG format
image->save("/home/saman/Desktop/myImage", "PNG");
mediaPlayer.
setMedia(QUrl::fromLocalFile("/home/saman/Desktop/png/images08.jpeg"));
//I want this to read from raw data
mediaPlayer.play();
I note again, what i have done is to receive the image, SAVE it, and then read from it. However, I would like to ask you how to read raw data directly without saving it into media player.
Code:
// saving
counter = 1;
image.save("/home/saman/image", "JPG");
counter = 0;
somewhere else, reading
Code:
if(counter == 0)
{
mediaPlayer.
setMedia(QUrl::fromLocalFile("/home/saman/image"));
mediaPlayer.play();
}
What I did is to use:
Code:
QMediaResource rsrc
(QUrl::fromUserInput(image.
text()));
QMediaContent ctnt(rsrc);
mediaPlayer.setMedia(ctnt);
mediaPlayer.play();
but this, does not show anything. I need help over here, give me advice please.