播放flv文件 [英] playing flv files

查看:88
本文介绍了播放flv文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在MFC 6.0对话框应用程序中播放flv文件.如果有用于此目的或其他任何方式的activeX控件,请通知我.

How can I play flv files in MFC 6.0 dialog application. Inform me if there is an activeX control for that purpose or any other way.

推荐答案

有一种方法.
要使用DirectShow过滤器.
DirectX SDK有一个名为Graph Edit C:\ DXSDK \ Bin \ DXUtils \ graphedt.exe的程序.
您可以使用它来了解播放电影时的情况.

这是您需要的一些类以及现有程序中的一些代码.

您所需要做的就是添加Flv过滤器,连接它们并选择窗口.

这是基础.

There is a way.
To use DirectShow filters.
DirectX SDK has one program named Graph Edit C:\DXSDK\Bin\DXUtils\graphedt.exe .
You can use it to understand, what is going on when you play movies.

Here are some classes you need and some code from existing program.

All you need is to add Flv filters, connect them and select the window.

Here is the base.

// DirectShow interfaces
IGraphBuilder *pGB = NULL;
IMediaControl *pMC = NULL;
IMediaEventEx *pME = NULL;
IVideoWindow  *pVW = NULL;
IBasicAudio   *pBA = NULL;
IBasicVideo   *pBV = NULL;
IMediaSeeking *pMS = NULL;
IMediaPosition *pMP = NULL;
IVideoFrameStep *pFS = NULL;


<pre lang="xml">// add file source
        CComPtr<IBaseFilter> pSource;
        JIF(pGB->AddSourceFilter(wFile, L"Source", &pSource));
        CComPtr<IPin> pSrcPin;
        JIF(pSource->FindPin(L"Output", &pSrcPin));

        // add my video renderer
        CComPtr<IBaseFilter> pRendererFilter;
        JIF(pRendererFilter.CoCreateInstance(CLSID_StereoRendererLR, NULL, CLSCTX_INPROC_SERVER));
        JIF(pGB->AddFilter(pRendererFilter, L"Stereo Renderer LR"));
        //CComPtr<IPin> pDestPin;
        //JIF(pRendererFilter->FindPin(L"In", &pDestPin));

        // add directsound renderer
        CComPtr<IBaseFilter> pDirectSound;
        JIF(pDirectSound.CoCreateInstance(CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER));
        JIF(pGB->AddFilter(pDirectSound, L"DirectSound"));

        // render graph without adding new renderers
        CComPtr<IFilterGraph2> pFG2;
        JIF(pGB->QueryInterface(IID_IFilterGraph2, (void **)&pFG2));
        JIF(pFG2->RenderEx(pSrcPin, AM_RENDEREX_RENDERTOEXISTINGRENDERERS, NULL));



        // ************************
        // Have the graph builder construct its the appropriate graph automatically
        //JIF(pGB->RenderFile(wFile, NULL));



        // QueryInterface for DirectShow interfaces
        JIF(pGB->QueryInterface(IID_IMediaControl, (void **)&pMC));
        JIF(pGB->QueryInterface(IID_IMediaEventEx, (void **)&pME));
        JIF(pGB->QueryInterface(IID_IMediaSeeking, (void **)&pMS));
        JIF(pGB->QueryInterface(IID_IMediaPosition, (void **)&pMP));

        // Query for video interfaces, which may not be relevant for audio files
        JIF(pGB->QueryInterface(IID_IVideoWindow, (void **)&pVW));
        JIF(pGB->QueryInterface(IID_IBasicVideo, (void **)&pBV));

        // Query for audio interfaces, which may not be relevant for video-only files
        JIF(pGB->QueryInterface(IID_IBasicAudio, (void **)&pBA));






一个简单的Google搜索"flv文件"将产生许多有用的信息.
A simple Google search for "flv files" will yield lots of useful information.


这篇关于播放flv文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆