if (!g_thread_supported ())
g_thread_init (NULL);
gst_init (NULL, NULL);
//QApplication app(NULL, NULL);
//a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit ()));
// prepare the pipeline
GstElement *pipeline = gst_pipeline_new ("xvoverlay");
GstElement *src = gst_element_factory_make ("souphttpsrc",NULL);
GstElement *sink = gst_element_factory_make ("xvimagesink", NULL);
GstElement *jpegdec = gst_element_factory_make("jpegdec",NULL);
gst_bin_add_many (GST_BIN (pipeline), src,jpegdec, sink, NULL);
gst_element_link_many(src,jpegdec, sink);
g_object_set (src, "location", "http://169.254.75.39/video2.mjpg", NULL);
// prepare the ui
window.setWindowFlags(Qt::Window|Qt::FramelessWindowHint);
window.move(1000,480);
window.setFixedSize(320, 200);
window.show();
WId xwinid = window.winId();
gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), xwinid);
// run the pipeline
GstStateChangeReturn sret = gst_element_set_state (pipeline,
GST_STATE_PLAYING);
if (sret == GST_STATE_CHANGE_FAILURE) {
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
// Exit application
//QTimer::singleShot(0, QApplication::activeWindow(), SLOT(quit()));
}
//int ret = a.exec();
window.hide();
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
if (!g_thread_supported ())
g_thread_init (NULL);
gst_init (NULL, NULL);
//QApplication app(NULL, NULL);
//a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit ()));
// prepare the pipeline
GstElement *pipeline = gst_pipeline_new ("xvoverlay");
GstElement *src = gst_element_factory_make ("souphttpsrc",NULL);
GstElement *sink = gst_element_factory_make ("xvimagesink", NULL);
GstElement *jpegdec = gst_element_factory_make("jpegdec",NULL);
gst_bin_add_many (GST_BIN (pipeline), src,jpegdec, sink, NULL);
gst_element_link_many(src,jpegdec, sink);
g_object_set (src, "location", "http://169.254.75.39/video2.mjpg", NULL);
// prepare the ui
QWidget window;
window.setWindowFlags(Qt::Window|Qt::FramelessWindowHint);
window.move(1000,480);
window.setFixedSize(320, 200);
window.show();
WId xwinid = window.winId();
gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), xwinid);
// run the pipeline
GstStateChangeReturn sret = gst_element_set_state (pipeline,
GST_STATE_PLAYING);
if (sret == GST_STATE_CHANGE_FAILURE) {
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
// Exit application
//QTimer::singleShot(0, QApplication::activeWindow(), SLOT(quit()));
}
//int ret = a.exec();
window.hide();
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
To copy to clipboard, switch view to plain text mode
Bookmarks