<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div class="moz-cite-prefix">On 03/09/2013 03:01 AM, Mcnv [via
GStreamer-devel] wrote:<br>
</div>
<blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' cite="mid:1362794488272-4659016.post@n4.nabble.com"
type="cite"> Hi,
<br>
I have written a small application for playing a audio/video file
in Gstreamer.
<br>
now i want to display or redirect video/audio content to a
specific window of Qt instead of launching a player window.
<br>
<br>
request help on this.
<br>
<br>
<br>
<br>
<hr noshade="noshade" size="1" color="#cccccc">
<div style="color:#444; font: 12px
tahoma,geneva,helvetica,arial,sans-serif;">
<div style="font-weight:bold">If you reply to this email, your
message will be added to the discussion below:</div>
<a moz-do-not-send="true"
href="http://gstreamer-devel.966125.n4.nabble.com/gstreamer-and-qt-interaction-tp4659016.html" target="_top" rel="nofollow" link="external">http://gstreamer-devel.966125.n4.nabble.com/gstreamer-and-qt-interaction-tp4659016.html</a>
</div>
<div style="color:#666; font: 11px
tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
To start a new topic under GStreamer-devel, email
<a href="/user/SendEmail.jtp?type=node&node=4659017&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a> <br>
To unsubscribe from GStreamer-devel, <a moz-do-not-send="true"
href="" target="_top" rel="nofollow" link="external">click
here</a>.<br>
<a moz-do-not-send="true"
href="http://gstreamer-devel.966125.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_top" link="external">NAML</a> </div>
</blockquote>
You can use QtGStreamer
(<a class="moz-txt-link-freetext" href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/qt-gstreamer/html/" target="_top" rel="nofollow" link="external">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/qt-gstreamer/html/</a>).
<br>
For another way there is an example in the gstvideooverlay
documentation
(<a class="moz-txt-link-freetext" href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideooverlay.html" target="_top" rel="nofollow" link="external">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideooverlay.html</a>)<br>
Or you can use gst_app_sink. With gstreamer-1.0 and Linux:<br>
If you have a Capture class with a pipeline with an appsink a
callback can be registered<br>
<br>
GstElement* sink;<br>
sink = gst_bin_get_by_name(GST_BIN(m_pipeline), "sink");<br>
gst_app_sink_set_emit_signals(GST_APP_SINK(sink), TRUE);<br>
g_signal_connect(sink, "new-sample", G_CALLBACK(newSample),
(gpointer)this);<br>
gst_element_set_state(m_pipeline, GST_STATE_PLAYING);<br>
<br>
This callback may look like this:<br>
<br>
GstFlowReturn Capture::newSample(GstAppSink* sink, gpointer gSelf)<br>
{<br>
GstSample* sample = NULL;<br>
GstBuffer* sampleBuffer = NULL;<br>
GstMapInfo bufferInfo;<br>
<br>
Capture* self = static_cast<Capture* >(gSelf);<br>
sample = gst_app_sink_pull_sample(GST_APP_SINK(sink));<br>
if(sample != NULL)<br>
{<br>
sampleBuffer = gst_sample_get_buffer(sample);<br>
if(sampleBuffer != NULL)<br>
{<br>
gst_buffer_map(sampleBuffer, &bufferInfo,
GST_MAP_READ);<br>
self->m_mutex.lock();<br>
self->m_image = QImage(bufferInfo.data, 320, 180,
QImage::Format_RGB888);<br>
self->m_mutex.unlock();<br>
gst_buffer_unmap(sampleBuffer, &bufferInfo);<br>
}<br>
gst_sample_unref(sample);<br>
}<br>
return GST_FLOW_OK;<br>
}<br>
<br>
The m_imgae can be returned with:<br>
<br>
QImage Capture::getFrame()<br>
{<br>
QMutexLocker locker(&m_mutex);<br>
return m_image;<br>
}<br>
<br>
With the private member variables of Capture<br>
QImage m_image;<br>
QMutex m_mutex;<br>
<br>
The image can be displayed with e.g. a QLabel. With a subclassed
QLabel the image from the Capture can be continuously retrieved:<br>
<br>
Display::Display(QWidget* parent) :<br>
QLabel(parent),<br>
m_capture(new Capture(this))<br>
{<br>
}<br>
<br>
void Display::paintEvent(QPaintEvent* paintEvent)<br>
{<br>
setPixmap(QPixmap::fromImage(m_capture->getFrame()));<br>
QLabel::paintEvent(paintEvent);<br>
}<br>
<br/><hr align="left" width="300" />
View this message in context: <a href="http://gstreamer-devel.966125.n4.nabble.com/gstreamer-and-qt-interaction-tp4659016p4659017.html">Re: gstreamer and qt interaction</a><br/>
Sent from the <a href="http://gstreamer-devel.966125.n4.nabble.com/">GStreamer-devel mailing list archive</a> at Nabble.com.<br/>