久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何在基于 GStreamer 的 Qt 中實現視頻小部件?

How to implement a video widget in Qt that builds upon GStreamer?(如何在基于 GStreamer 的 Qt 中實現視頻小部件?)
本文介紹了如何在基于 GStreamer 的 Qt 中實現視頻小部件?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我想用 Qt 創建一個簡單的 GUI 應用程序,可以播放本地視頻文件.我可以使用 Phonon 來完成幕后的所有工作,但我需要更多的控制權.我已經成功地使用 decodebin 和 autovideosink 元素實現了 GStreamer 管道.現在我想使用 Qt 小部件將輸出引導至.

I want to use Qt to create a simple GUI application that can play a local video file. I could use Phonon which does all the work behind the scenes, but I need to have a little more control. I have already succeeded in implementing an GStreamer pipeline using the decodebin and autovideosink elements. Now I want to use a Qt widget to channel the output to.

有沒有人成功地做到了這一點?(我想是的,因為有基于 GStreamer 的基于 Qt 的視頻播放器.)有人能指出我正確的方向嗎?

Has anyone ever succeeded in doing this? (I suppose so since there are Qt-based video players that build upon GStreamer.) Can someone point me in the right direction on how to do it?

注意:這個問題類似于我之前發布的關于如何將 Qt 與傳入的 RTP 流連接的問題.這似乎很有挑戰性.我想這個問題會更容易回答.

Note: This question is similar to my previous posted question on how to connect Qt with an incoming RTP stream. This seemed to be quite challenging. This question will be easier to answer I think.

Patrice 的使用 libVLC 的建議已經很有幫助了.這是在 VLC 網站上找到的代碼的更清晰版本:Qt + libVLC 示例.但是,我最初的問題仍然是:如何將 GStreamer 連接到 Qt 小部件?

Patrice's suggestion to use libVLC is very helpful already. Here's a somewhat cleaner version of the code found on VLC's website: Sample for Qt + libVLC. However, my original question remains: How do I connect GStreamer to a Qt widget?

經過一些實驗,我最終得到了這個工作示例.這取決于 GstWidget.h 和 GstWidget.cpp來自我自己的小 GstSupport 庫.但是,請注意,目前僅在 Mac 版本的 Qt 上進行了測試.

After some experimentation I ended up with this working sample. It depends on GstWidget.h and GstWidget.cpp from my own little GstSupport library. However, take note that is is currently only tested on the Mac version of Qt.

推薦答案

要將 Gstreamer 與您的 QWidget 連接,您需要使用 QWidget::winId() 獲取窗口句柄并將其傳遞給gst_x_overlay_set_xwindow_id();

To connect Gstreamer with your QWidget, you need to get the window handle using QWidget::winId() and you pass it to gst_x_overlay_set_xwindow_id();

粗略示例代碼:

    sink = gst_element_factory_make("xvimagesink", "sink");
    gst_element_set_state(sink, GST_STATE_READY);

    QApplication::syncX();
    gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(sink), widget->winId());

此外,您還希望您的小部件由本機窗口支持,這是通過在應用程序級別設置 Qt::AA_NativeWindows 屬性或 Qt::WA_NativeWindow 來實現的code> 小部件級別的屬性.

Also, you will want your widget to be backed by a native window which is achieved by setting the Qt::AA_NativeWindows attribute at the application level or the Qt::WA_NativeWindow attribute at the widget level.

這篇關于如何在基于 GStreamer 的 Qt 中實現視頻小部件?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How can I read and manipulate CSV file data in C++?(如何在 C++ 中讀取和操作 CSV 文件數據?)
In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,為什么我不能像這樣編寫 for() 循環: for( int i = 1, double i2 = 0;)
How does OpenMP handle nested loops?(OpenMP 如何處理嵌套循環?)
Reusing thread in loop c++(在循環 C++ 中重用線程)
Precise thread sleep needed. Max 1ms error(需要精確的線程睡眠.最大 1ms 誤差)
Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?環形?)
主站蜘蛛池模板: 永久免费精品视频 | 成人国产精品一区二区 | 久久久久婷婷 | 精品在线看 | av黄色在线 | 可以看毛片的网站 | 日韩三级精品 | 欧美激情精品 | 中文字幕不卡在线观看 | 日日夜夜精品 | 在线观看网址你懂的 | 欧美日韩黄色片 | 国产成人黄色 | 欧洲精品一区二区 | 色天天综合 | 久草青青草 | 国产精品国产精品国产专区不片 | 黄色片视频免费 | 国产黄在线观看 | 日韩毛片在线播放 | 成人毛片网 | 亚洲色欲色欲www在线观看 | 免费中文字幕日韩欧美 | www.欧美精品 | 在线视频a | 三级视频网 | 放几个免费的毛片出来看 | 天天干天天弄 | 中文在线观看免费高清 | 欧美a视频 | 欧美视频亚洲视频 | 福利影院在线观看 | 亚洲一区二区精品视频 | 国语对白永久免费 | 亚洲成人欧美 | 久久久一区二区 | 精品国产区 | 日韩在线免费观看视频 | 黄色在线免费 | 综合久久久久 | 一区二区三区在线看 |