CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
【经验总结】不能实施并行处理的情况 浅谈并行编程中的任务分解模式
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  基础类

directshow RenderFile 问题

楼主ljlyun()2006-07-20 11:42:26 在 VC/MFC / 基础类 提问

#include   <windows.h>  
  #include   <streams.h>  
  #include   <stdio.h>  
  #include   <urlmon.h>  
  #include   <commctrl.h>  
  #include   <string.h>  
  #include   "dshow_play.h"  
   
   
  int   main()  
  {  
  WCHAR   file[255]={0};  
   
  HRESULT   hr;  
   
  CoInitialize(NULL);  
   
  printf("enter   the   Path\n");  
   
  scanf("%s",file);  
   
  //   DirectShow   interfaces  
   
  //   Get   the   interface   for   DirectShow's   GraphBuilder  
  CoCreateInstance(CLSID_FilterGraph,   NULL,   CLSCTX_INPROC_SERVER,    
  IID_IGraphBuilder,   (void   **)&pGB);  
  //   QueryInterface   for   DirectShow   interfaces  
  pGB->QueryInterface(IID_IMediaControl,   (void   **)&pMC);  
  pGB->QueryInterface(IID_IMediaEventEx,   (void   **)&pME);  
  pGB->QueryInterface(IID_IMediaSeeking,   (void   **)&pMS);  
  pGB->QueryInterface(IID_IMediaPosition,   (void   **)&pMP);  
  //   Query   for   video   interfaces,   which   may   not   be   relevant   for   audio   files  
  pGB->QueryInterface(IID_IVideoWindow,   (void   **)&pVW);  
  pGB->QueryInterface(IID_IBasicVideo,   (void   **)&pBV);  
  //   Query   for   audio   interfaces,   which   may   not   be   relevant   for   video-only   files  
  pGB->QueryInterface(IID_IBasicAudio,   (void   **)&pBA);  
   
   
  //   Have   the   graph   builder   construct   its   the   appropriate   graph   automatically  
  hr=pGB->RenderFile(file,   0);  
   
  //   Run   the   graph   to   play   the   media   file  
  hr=pMC->Run();  
   
  long   m_lCurrentVolume;  
  m_lCurrentVolume=100;  
  hr=pBA->put_Volume(-m_lCurrentVolume);  
   
  hr=pBA->get_Volume(&m_lCurrentVolume);  
   
  LONG evcode;  
   
   
  hr=pME->WaitForCompletion(INFINITE,&evcode);  
   
  if(pMC)pMC->Release;  
  if(pGB)pGB->Release;  
  if(pME)pME->Release;  
   
  return   0;  
  }  
   
  定义了wchar   file,用来得到文件的路径,但是似乎不对,每次renderfile都失败。 问题点数:50、回复次数:3Top

1 楼madmanahong(疯子阿虹)回复于 2006-07-20 11:46:58 得分 50

这怎么查?  
  错误码多少?  
   
  修改为scanf("%ws",file);看看Top

2 楼rageliu(天气好了就去长白山看水怪去了,嘿嘿...)回复于 2006-07-20 11:52:54 得分 0

先直接写路径看看能行不??  
   
  播放的多媒体文件格式有对应的解码filter吗?Top

3 楼ljlyun()回复于 2006-07-20 12:40:58 得分 0

多谢madmanahong(疯子阿虹)~~Top

相关问题

关键词

得分解答快速导航

  • 帖主:ljlyun
  • madmanahong

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
惹火投票。。火热进行中...
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
CSDN网站24小时值班电话:13552009689
Copyright © 2000-2009, CSDN.NET, All Rights Reserved
GongshangLogo