游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1880|回复: 3

求助DirectShow?

[复制链接]

3

主题

4

帖子

0

积分

新手上路

Rank: 1

积分
0
发表于 2004-10-25 15:47:00 | 显示全部楼层 |阅读模式
谁有用DirectShow放视频流和音频流的资料
或DirectShow的中文资料,

89

主题

822

帖子

847

积分

高级会员

Rank: 4

积分
847
发表于 2004-10-25 15:51:00 | 显示全部楼层

Re:求助DirectShow?

清华大学出版社《DirectShow开发指南》38.00RMB,很高深呵呵

3

主题

4

帖子

0

积分

新手上路

Rank: 1

积分
0
 楼主| 发表于 2004-10-25 19:11:00 | 显示全部楼层

Re:求助DirectShow?

有没有相关代码

24

主题

57

帖子

57

积分

注册会员

Rank: 2

积分
57
发表于 2004-10-25 20:11:00 | 显示全部楼层

Re:求助DirectShow?

#include "stdafx.h"
#include <stdio.h>
#include <dshow.h>
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
        // TODO: Place code here.

        IGraphBuilder *pGraph = NULL;
    IMediaControl *pControl = NULL;
    IMediaEvent   *pEvent = NULL;

    // Initialize the COM library.
    HRESULT hr = CoInitialize(NULL);
    if (FAILED(hr))
    {
        printf("ERROR - Could not initialize COM library");
        return 1;
    }

    // Create the filter graph manager and query for interfaces.
    hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
                        IID_IGraphBuilder, (void **)&pGraph);
    if (FAILED(hr))
    {
        printf("ERROR - Could not create the Filter Graph Manager.");
        return 1;
    }

    hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
    hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);

    // Build the graph. IMPORTANT: Change this string to a file on your system.
    hr = pGraph->RenderFile(L"D:\\movie1.avi", NULL);
        //hr = pGraph->RenderFile(L"E:\\music\\七里香\\thank.mp3", NULL);
    if (SUCCEEDED(hr))
    {
        // Run the graph.
        hr = pControl->Run();
        if (SUCCEEDED(hr))
        {
            // Wait for completion.
            long evCode;
            pEvent->WaitForCompletion(INFINITE, &evCode);

            // Note: Do not use INFINITE in a real application, because it
            // can block indefinitely.
        }
    }
    pControl->Release();
    pEvent->Release();
    pGraph->Release();
    CoUninitialize();

        return 0;
}
最简单的例子我在文档里面发现的,编译需要连接strmiids.lib
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-12-22 23:05

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表