LoginSignup
0
0

cscの作法 その393

Posted at

概要

cscの作法、調べてみた。
練習問題、やってみた。

練習問題

directshowlibでwmvファイルを再生せよ。

サンプルコード

using System;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using DirectShowLib;

namespace App
{
	class Program {
		static void Main(string[] args) {
			Console.WriteLine("start");
			IGraphBuilder pGraphBuilder = (DirectShowLib.IGraphBuilder) new FilterGraph();
			IMediaControl pMediaControl = (DirectShowLib.IMediaControl) pGraphBuilder;
			IMediaEvent pMediaEvent = (DirectShowLib.IMediaEvent) pGraphBuilder;
			pMediaControl.RenderFile(@"test1.wmv");
			IVideoWindow pVideoWindow = (DirectShowLib.IVideoWindow) pGraphBuilder;
			pVideoWindow.put_FullScreenMode(OABool.True);
			pMediaControl.Run();
			EventCode code;
			pMediaEvent.WaitForCompletion(1000, out code);
			pVideoWindow.put_FullScreenMode(OABool.False);
			Marshal.ReleaseComObject(pGraphBuilder);
			pGraphBuilder = null;
			Marshal.ReleaseComObject(pMediaControl);
			pMediaControl = null;
			Marshal.ReleaseComObject(pMediaEvent);
			pMediaEvent = null;
			Console.WriteLine("end");
		}
	}
}

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0