Active Topics

 


Reply
Thread Tools
Posts: 61 | Thanked: 77 times | Joined on Dec 2009 @ Lancaster
#11
I found the solution to the second problem. You do not need to use the Phonon library, as you can just pass the WinID of the QWidget in which you want to display the content of your gst pipline sink.

The post above lead me to the solution.

1.) Create your pipeline;

2.) Create the widget where you want to display the camera stream in;

3.) Define the ApplicationAttribute to Qt::AA_NativeWindows in your main function;
QCoreApplication::setAttribute(Qt::AA_NativeWindow s,true);

4.) Call:
QApplication::syncX();

5.) Set the xoverlay using the WinID of your Widget:
gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)), widget->winId());

6.) Start playing your pipline:
gst_element_set_state (pipeline, GST_STATE_PLAYING);

What I want to do now is to be able to draw over the pipeline stream. Tried to do it with QPixmap in the same widget on top of which I overlay the pipeline stream, but (as I expected) covers the QPixmap object.

Any suggestions?

I decided to open a new thread on that, as is does not link to the thread titile any more.

http://talk.maemo.org/showthread.php...748#post553748

Klen

Last edited by klen; 2010-03-03 at 11:57.
 

The Following User Says Thank You to klen For This Useful Post:
Posts: 14 | Thanked: 15 times | Joined on Feb 2010 @ bay area, us
#12
This thread has been so helpful to me! This is exactly what I was looking for - with one exception. I'm trying to show the output of the camera in a QWidget, but using python. Could anyone help me here? Thanks, this community is awesome!
 
Posts: 51 | Thanked: 15 times | Joined on Apr 2009 @ ChengDu, SiChuan, P.R.C
#13
Maybe you should search qtcartoonizer in https://garage.maemo.org/ and look at camera.cpp that's good example for how use camera with QT in Maemo.
 

The Following User Says Thank You to funpig For This Useful Post:
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#14
Originally Posted by ptterb View Post
This thread has been so helpful to me! This is exactly what I was looking for - with one exception. I'm trying to show the output of the camera in a QWidget, but using python. Could anyone help me here? Thanks, this community is awesome!
ptterb = i have examples of how to show static pictures from the camera in QT/Python in my healthcheck app - linky in my signature.
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 
Posts: 14 | Thanked: 15 times | Joined on Feb 2010 @ bay area, us
#15
Thanks, funpig and noobmonkey for the quick replies

- funpig, I'll check that out, thanks
-noobmonkey, i did see your program already, but im looking to display the video feed from the camera.

any other suggestions on implementing this in python?
 
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#16
Originally Posted by ptterb View Post
Thanks, funpig and noobmonkey for the quick replies

- funpig, I'll check that out, thanks
-noobmonkey, i did see your program already, but im looking to display the video feed from the camera.

any other suggestions on implementing this in python?
I'm going to be trying it at the weekend - so will let you know if i get any success
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 
Posts: 14 | Thanked: 15 times | Joined on Feb 2010 @ bay area, us
#17
That would be great, thanks!
 
Posts: 14 | Thanked: 15 times | Joined on Feb 2010 @ bay area, us
#18
Anybody have any progress on this? I'm really struggling to figure it out...
 
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#19
sorry the weekend came and went, and spent it trying to get healthcheck into testing - still on my list of todo's
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 
Posts: 14 | Thanked: 15 times | Joined on Feb 2010 @ bay area, us
#20
Ok, so I just spent the ENTIRE day working on this! I got a lot farther, but its just not working quite right. I was able to get the video to play in a separate window, but when i try to put it inside a QWidget on my gui, the screen goes black and starts flashing and I have to restart the phone. Here's the code I have:


class Vid:
def __init__(self, windowId):
self.player = gst.Pipeline("player")
self.source = gst.element_factory_make("v4l2src", "vsource")
self.sink = gst.element_factory_make("autovideosink", "outsink")
self.source.set_property("device", "/dev/video0")
self.scaler = gst.element_factory_make("videoscale", "vscale")
self.window_id = None
self.windowId = windowId

self.player.add(self.source, self.scaler, self.sink)
gst.element_link_many(self.source,self.scaler, self.sink)

bus = self.player.get_bus()
bus.add_signal_watch()
bus.enable_sync_message_emission()
bus.connect("message", self.on_message)
bus.connect("sync-message::element", self.on_sync_message)

def on_message(self, bus, message):
t = message.type
if t == gst.MESSAGE_EOS:
self.player.set_state(gst.STATE_NULL)
elif t == gst.MESSAGE_ERROR:
err, debug = message.parse_error()
print "Error: %s" % err, debug
self.player.set_state(gst.STATE_NULL)

def on_sync_message(self, bus, message):
if message.structure is None:
return
message_name = message.structure.get_name()
if message_name == "prepare-xwindow-id":
win_id = self.windowId
assert win_id
imagesink = message.src
imagesink.set_property("force-aspect-ratio", True)
imagesink.set_xwindow_id(win_id)
def startPrev(self):
self.player.set_state(gst.STATE_PLAYING)
print "should be playing"
vidStream = Vid(wId)
vidStream.startPrev()

where wId is the window id of the widget where I want to video displayed. Any ideas anyone? Thanks!

not sure where my indents went....

Last edited by ptterb; 2010-03-14 at 05:00. Reason: formatting
 
Reply


 
Forum Jump


All times are GMT. The time now is 22:13.