[英]Rendering videos in an SDL2 application
我一直在尋找一種在我的應用程序中播放視頻的方法,我在考慮將它們合並到紋理中或只是簡單地渲染它們的方法,但是我真的很困惑,有什么建議嗎? 我無法選擇,但是我非常感謝示例代碼。
例如,您可以使用OpenGL完成此操作: 播放AVI文件
我會包含鏈接的來源,但由於它是完整的教程,可能會太長。
另一個選擇是僅啟動媒體播放器。 大多數播放器都有您可以使用的開始參數。
例如:
#include <windows.h>
int main()
{
HINSTANCE hRet = ShellExecuteA(
HWND_DESKTOP, // Parent
"open", // Operation
"C:\\yourMovieDirectory\\yourMovie.avi", // Path to file
NULL, // Parameters
NULL, // Default dir.
SW_SHOW); // Opening option
if( (LONG)hRet <= 32 )
{
MessageBox( HWND_DESKTOP , "Error detected while attempting to start the movie!") , "Error" , MB_OK );
}
return 0;
}
您需要Shell32.lib用於ShellExecute()函數
HINSTANCE是實例的句柄。 C ++ Windows類型
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.