简体   繁体   English

在SDL2应用程序中渲染视频

[英]Rendering videos in an SDL2 application

I've been looking for a way to play videos at some point in my application, I was thinking of ways to incorporate them into a texture or just plain render them but I'm literally stumped here, any suggestion? 我一直在寻找一种在我的应用程序中播放视频的方法,我在考虑将它们合并到纹理中或只是简单地渲染它们的方法,但是我真的很困惑,有什么建议吗? I'm not in a position to choose, but I'd really appreciate sample codes. 我无法选择,但是我非常感谢示例代码。

You could do it with OpenGL for example: play AVI files 例如,您可以使用OpenGL完成此操作: 播放AVI文件

I'd include the source of the link but since it's a full fledged tutorial that would be too long. 我会包含链接的来源,但由于它是完整的教程,可能会太长。

Different approach 不同的方法

Another option would be to just have the media player start. 另一个选择是仅启动媒体播放器。 Most players have start parameters that you can use. 大多数播放器都有您可以使用的开始参数。

for example: 例如:

#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;
}

You need the shell32.lib for the ShellExecute() function 您需要Shell32.lib用于ShellExecute()函数

HINSTANCE is a handle to an instance. HINSTANCE是实例的句柄。 C++ Windows Types C ++ Windows类型

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM