久久久久久久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 ()?環形?)
主站蜘蛛池模板: 精品欧美一区二区精品久久久 | 国产丝袜人妖cd露出 | 亚洲二区在线观看 | 97视频成人| 在线不卡视频 | 风间由美一区二区三区在线观看 | 中文字幕在线不卡 | 国产9999精品 | 日韩一区精品 | 日韩免费1区二区电影 | 精品国产精品三级精品av网址 | 91精品国产综合久久香蕉922 | 国产一区二区在线免费视频 | 国产国语精品 | 免费在线观看一级毛片 | 91免费视频观看 | 欧美激情视频一区二区三区在线播放 | 国产精品久久久久一区二区三区 | 久久久毛片| 黄色一级免费 | 欧美 日韩 国产 成人 | 99草免费视频 | 亚洲a视频 | 日韩精品一区二区三区 | 国产一区二区在线观看视频 | 免费一级黄 | 国产精品久久久乱弄 | 国产免费视频 | 精品国产青草久久久久福利 | 欧美日本韩国一区二区三区 | 福利av在线| 国产91丝袜在线熟 | 91亚洲国产成人久久精品网站 | 久久久久久久久久毛片 | 激情欧美一区二区三区中文字幕 | 色综合天天网 | 久久6视频 | h片免费在线观看 | av大全在线 | 三级成人片| 久久成人午夜 |