© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market
conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
株式会社アキタ電子システムズ
ソフトウェア開発部 第一ソフトウェア開発
Gr
主任技師
伊藤 優(
ito-yu@akita-elec.co.jp
)
SH-MobileR と CE で作る携帯端末
~
DirectShow でのフィルター実装手法 ~
Agenda
Windows Embedded 製品
Filter Graph Manager
DMO:DirectX Media Object
デモ
– SH-MobileR ミドルウェアの実装
Windows Embedded 製品
.NET Micro
Framework
Windows
Embedded CE
Windows XP
Embedded
Windows
XP
高機能
高性能
携帯デバイスに求められる機能
.NET Micro
Framework
Windows
Embedded CE
Windows XP
Embedded
Windows
XP
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market
conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
機能への要求と回答
要求項目
マルチメディア機能:
WMV、 WMA, 、 MP3、1SEG、etc.
処理能力の高さ
低消費電力
低コスト
LSI としての回答:SoC による要求実現
コーデック内蔵:
CPU 負荷の低減
動作クロックを下げることによる低消費電力化
マルチメディア機能を内蔵
IP が処理することによる CPU リソー
スの有効活用
CPU Core
DirectShow Playback App
Applications
DS Filter Graph Manager
Source
Renderer
Codec IP
SoC による性能向上
CPU
DirectShow Playback App
Applications
DS Filter Graph Manager
Source
Codec
Renderer
Codec
DirectShow とは?
DirectShow:マルチメディアデータを処理するためのミド
ルウェアの総称
マルチメディアデータはデータ処理を行うフィルターから
構成されるパイプラインにて処理される
パイプラインは
Filter Graph Manager により生成される
ため、ユーザーは意識する必要は無い
Windows Media API でのアプリケーション開発が容易
多くのコーデックやフォーマットが標準でサポートされる
標準のコーデックとフォーマットのサポート
Advanced Streaming Format (ASF)
Motion Picture Experts Group (MPEG)
Audio-Video Interleaved (AVI)
MPEG Audio Layer-3 (MP3)
Waveform Audio (WAV)
Windows Media Audio (WMA)
Windows Media Video (WMV)
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market
conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
WinCE マルチメディアアーキテクチャ
Network, File system, Graphics, Audio, Video, Camera Drivers
WMP ActiveX
Control
Sample Player
App, IE 6
DirectDraw, GDI, WaveDev
Hardware
Network,
File System
DS Filter Graph Manager
Source
Codec
DirectShow
Playback App
File System
DirectShow Capture Application
DS Filter Graph Manager
Capture
Preview
Codec
Muxer
Renderer
DirectShow Framework 概要
Application
DirectShow
Filter Graph Manager
Source
filters
Transfom
filters
Rendering
filters
Kernel Streaming
Architecture
WDM Capture
Devices
Legacy
VFW
Capture
Devices
Hardware
Decoders
File System
Internet
Legacy VCM/ACM
Codecs
File System
Wave
API
DirectDraw
Sound
Card
Graphic Card
Video
フィルターグラフの要素
フィルターグラフ
フィルター
ピン
メディアサンプル
アロケーター
クロック
サポートされる
DirectShow 再生フィルター
Source
Filters
Transform Filters
Renderers
Generic
streamer
File
Source
Filter
AVI
Splitter
MPEG1
Parser/splitter
Video
Renderer
Audio
Renderer
Windows
Media Source
Filter
Wave
parser
Color
converter
MP3
filter
DMO wrapper filter
(WMA
and WMV)
ACM
wrapper
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market
conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Filter Graph Manager(FGM)
Filter Graph Manager は自動的にデータ処理用のパイ
プラインを構築
Intelligent Connect
フィルターはデータ入出力用のピンを持ち、受付可能な
データをフィルター自身が判断する
パイプラインを任意に生成することも可能
高速起動、
フィルターの切り替え
DirectShow(Windows Media Technology)
Input
Filter Graph Manager
Transform
Filter
Render Filter
Source Filter
Output
DirectShow のフィルター
Source Filter
ローカルストレージ、ネットワークストリーミングなど、入
力データを取り込む
Transform Filter
デコード、エンコードなどのデータ処理を行う
Render Filter
オーディオやビデオへの出力処理を行う
サポートされているフィルター
ACM Wrapper
Video/Image Compression Manager
AVI Filter
DMO Wrapper Filter
File Source Filter (Async / URL)
MPEG-1 Parser / Spliter
Overlay Mixer
Direct Show Video Render
WAVE/AIFF/au/snd File Parser
Generic File Streamer
Audio Lip-Sync Filter
MPEG-2 Program Stream Multiplexer Filter
MPEG-2 Program Stream Demultiplex Filter
DVR Sink Filter
DVR Source Filter
VBI Render Filter
DirectShow アプリケーションの記述
アプリケーションの記述は簡単な
3 ステップ
Step 1:FGM のインスタンスを生成する
Application
Filter Graph
Manager
CoCreateInstance
(
CLSID_FilterGraph
,
NULL,
CLSCTX_INPROC_SERVER,
IID_IGraphBuilder,
void **)&pGraph );
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market
conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
DirectShow アプリケーションの記述
Step 2:フィルターグラフを構築するために FGM を使用
する
Application
FGM
pGraph->RenderFile
(
lpwstrFile,
NULL );
DirectShow アプリケーションの記述
Step 3:フィルターグラフとイベント応答を制御する
Application
FGM
Method
calls
Events
pGraph->QueryInterface
(
IID_IMediaControl,
(void **)&pControl );
pGraph->QueryInterface
(
IID_IMediaEvent,
(void **)&pEvent );
pControl->Run();
Run
Complete
pEvent-> WaitForCompletion
(
INFINITE,
&evCode );
簡単な再生プログラム
#include <streams.h>
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInst,
LPWSTR lpszCmdLine, int nCmdShow )
{
IGraphBuilder *pGraph = NULL;
IMediaControl *pMediaControl = NULL;
IMediaEvent *pMediaEvent = NULL;
CoInitializeEx(NULL, COINIT_MULTITHREADED);
// Step1: Create the filter graph manager.
CoCreateInstance(CLSID_FilterGraph, NULL,
CLSCTX_INPROC,
IID_IGraphBuilder,
(void **)&pGraph);
pGraph->QueryInterface(IID_IMediaControl,
(void **)&pMediaControl);
pGraph->QueryInterface(IID_IMediaEvent,
(void **)&pMediaEvent);
簡単な再生プログラム(続き)
// Step2: Build the graph.
pGraph->RenderFile(L"¥¥Hello_World.avi",NULL);
// Step3: Run the graph and respond to events.
pMediaControl->Run();
long evCode;
pMediaEvent->WaitForCompletion(INFINITE,evCode);
// Clean up.
pMediaControl->Release();
pMediaEvent->Release();
pGraph->Release();
CoUninitialize();
}
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market
conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Intelligent Connect
FGM での IGraphBuilder インターフェイス
FGM
IGra
phBu
ild
er
RenderFile
AddSourceFilter
Render
Connect
Intelligent Connect
AddSourceFilter によるソースフィルターの追加
FGM
RenderFile
Check the protocol
Check the file
extension
Check the check bytes
Add
So
urc
eF
ilte
r
Intelligent Connect
フィルターグラフの登録を構築するために
IGraphBuilder::Renderを使用する
FGM
Upper
stream
filter
IPin::IStreamBuilder
Intelligent Connect のまとめ
AddSourceFilter メソッドを呼び出してソースフィルター
を追加する
グラフの残りを構築するためにレンダーを使用する
有効であれば
IStreamBuilder で出力ピンを使用する
以前の接続からキャッシュフィルターを試みる
フィルターグラフ内のフィルタの接続解除を試みる
FGM は IFilterMapper::EnumMatchingFilters を使ってレジス
トリからフィルタを検索する
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market
conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Manual Connect
グラフにフィルターを生成して追加する
ソースフィルターの出力ピンを順に接続解除する
IBaseFilter::EnumPins( IEnumPins **ppEnum )
デスティネーションフィルターの入力ピンを順に接続解
除する
IFilterGraph::ConnectDirect で二つのピンを直接接続
する
DirectX Media Object(DMO)
DMO :メディアデータ処理用オブジェクト
DirectShow フィルタと比べ I/F が少なく開発が容易
DMO Wrapper Filter を介して DirectShow フィルタとし
て利用可能
WinCE 標準の WMA、WMV、MP3 は DMO フィルタ
DirectShow(Windows Media Technology)
Input
Filter Graph Manager
Transform
Filter
Render Filter
Source Filter
Output
DMO Wrapper
Filter
DMO Filter のデータ処理
Step 1. Query the DMO
GetStreamCount
GetInputType
GetOutputType
Step 2. Set Media Type
SetInputType
SetOutputType
Step 3. Allocate Buffer
GetInputSizeInfo
GetOutputSizeInfo
DMO Filter のデータ処理
Step 4. Process Input
ProcessInput
GetInputStatus
Step 5. Process Output
ProcessOutput
Step 6. Signal a Discontinuity
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market
conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
使用プラットフォーム:ソリューションエンジン
(日立超
LSIシステムズ製)
CPU:Renesas SH-MobileR(SH7722)
コーデック:ルネサステクノロジ製
WMA
DMO による音楽再生
Reference
DirectShow
http://msdn2.microsoft.com/en-us/library/aa930379.aspx
Demo application source is available on CodePlex
Test source is available in Shared Source
private¥test¥multimedia¥directx¥dshow¥playback
Newsgroup
Microsoft.public.windowsce.app.development
Microsoft.public.windowsce.embedded
Microsoft.public.windowsce.embedded.vc
Microsoft.public.windowsce.platbuilder
Microsoft.public.windowsce.targeted.device
Microsoft.public.windowsce.testtools
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.