DirectShow 播放视频
来源:互联网 发布:vb.net通过opc西门子 编辑:程序博客网 时间:2024/05/17 22:45
- CComPtr<IGraphBuilder> m_pPlaybackGraph;
- // Create a graph to play the requested file
- hr = m_pPlaybackGraph.CoCreateInstance(CLSID_FilterGraph);
- ASSERT(m_pPlaybackGraph);
- // Render the media file
- hr = m_pPlaybackGraph->RenderFile(Filename,NULL);
- ASSERT(FAILED(hr));
- // Set video window to be a child window of the screen and
- // position it properly.
- CComQIPtr< IVideoWindow, &IID_IVideoWindow > pVW(m_pPlaybackGraph);
- //hWnd is window handle.
- hr = pVW->put_Owner((OAHWND)hWnd);
- ASSERT(FAILED(hr));
- // If the selected file has no video component, fail gracefully
- // and still play the audio portion
- if (SUCCEEDED(hr))
- {
- // The video window must have the WS_CHILD style
- hr = pVW->put_WindowStyle(WS_CHILD);
- // Read coordinates of video container window
- RECT rc;
- GetWindowRect(hWnd,&rc);
- long width = rc.right - rc.left;
- long height = rc.bottom - rc.top;
- // Ignore the video's original size and stretch to fit bounding rectangle
- hr = pVW->SetWindowPosition(rc.left, rc.top, width, height);
- ASSERT(FAILED(hr));
- }
- // Start running the graph
- CComQIPtr< IMediaControl, &IID_IMediaControl > m_pPlaybackControl(m_pPlaybackGraph);
- hr = m_pPlaybackControl->Run();
- ASSERT(FAILED(hr));
- // If there is no current graph, nothing needs to be done
- if (!m_pPlaybackGraph)
- return;
- // Get media control and media seeking interfaces
- CComQIPtr< IMediaControl, &IID_IMediaControl > pMediaControl(m_pPlaybackGraph);
- CComQIPtr< IMediaSeeking, &IID_IMediaSeeking > pMediaSeeking(m_pPlaybackGraph);
- // Stop the graph
- hr = pMediaControl->Stop();
- if(FAILED(hr))
- {
- AfxMessageBox(TEXT("Could not stop graph"));
- return;
- }
- // Reset to first frame of movie (if the clip supports seeking)
- LONGLONG pos=0;
- hr = pMediaSeeking->SetPositions(&pos, AM_SEEKING_AbsolutePositioning ,
- NULL, AM_SEEKING_NoPositioning);
- // Display the first frame of the movie.
- hr = pMediaControl->Pause();
- if(FAILED(hr))
- {
- AfxMessageBox(TEXT("Could not pause graph"));
- return;
- }
- DirectShow播放视频
- DirectShow 播放视频
- DirectShow播放视频流程
- windows ce directshow播放视频
- directshow获取视频播放消息
- DirectShow 播放mp4编码 视频
- DirectShow 播放mp4编码 视频
- DirectShow 播放H264视频记录(1)
- C# DirectShow 操作视频播放功能
- DirectShow播放视频图像无法正常显示
- 视频播放器制作学习(DirectDraw DirectShow)
- directshow视频播放区域响应鼠标
- 在VC中调用DirectShow播放视频
- [DirectShow] 播放一个源视频 [大三TJB_708]
- c++ DirectShow播放任意格式的视频
- 利用DirectShow播放音乐和视频
- 基于DirectShow的MFC视频播放器
- 在VC中调用DirectShow全屏播放视频
- 解决asp+access数据库占用cpu 100%的方法
- 杀HBservice病毒
- study
- Linux显卡驱动,启用3D效果
- 疯狂的程序员80
- DirectShow 播放视频
- Hibernate-1VSN关系出现的异常分析
- 疯狂的程序员81
- 用“易写易库(EXEK)”为易语言3.0开发支持库?
- 疯狂的程序员82
- 疯狂的程序员83
- 疯狂的程序员84
- comgrid1.0运行实例发布(数据库:hsqldb)
- 疯狂的程序员85