久久久久久久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 ()?環形?)
主站蜘蛛池模板: 日韩精品久久一区二区三区 | 亚洲视频在线看 | 成年女人免费v片 | 日日操网站 | 一区二区在线不卡 | 国产美女在线精品免费 | 欧美精品久久久 | 日韩1区| 夜夜爽99久久国产综合精品女不卡 | 国产精品国色综合久久 | 久草免费在线视频 | 黄a在线播放| 三级黄色片在线 | 红桃成人在线 | 视频一区二区在线观看 | 成人性生交大片免费看中文带字幕 | 99精品99久久久久久宅男 | 精品国产伦一区二区三区观看说明 | 日韩不卡视频在线 | 99reav| 日韩一区二区三区视频在线观看 | 国产精品国产精品国产专区不卡 | 亚洲精品视频在线观看视频 | 欧美mv日韩mv国产网站91进入 | 久久大陆 | 欧美三级电影在线播放 | 欧美在线观看免费观看视频 | 日韩视频一区二区 | 国产精品久久久久久久久久免费看 | 日韩国产免费观看 | 一区二区国产在线观看 | 欧美日本亚洲 | 国产精品久久久久久久免费大片 | 日韩欧美精品一区 | 久久久资源 | 亚洲一区二区三区桃乃木香奈 | 午夜一区二区三区视频 | 亚州精品天堂中文字幕 | 久久久www成人免费无遮挡大片 | 日韩在线观看中文字幕 | 农夫在线精品视频免费观看 |