미디어/동영상

DirectShow

jjryu 2009. 1. 15. 23:16
비주얼 C++ 6.0은 기본적으로 다이렉트쇼 5.0을 지원한다.

8.0 이전 버전에서 다이렉트쇼를 배포하려면 별도의 다이렉트X 미디어 배포 버전을 설치


WAVE 오디오 재생
PCM, ADPCM, MP3

오디오
MIDI
MP3
WMA
CD

비디오
MPEG-1
MPEG-2
AVI
VCM, DivX
WMV/ASF
비디오 CD
URL

기본적으로 그래프에디터에서 동작하는 모든 멀티미디어는 다시 파일로 저장할 수 있다.

//#define _WIN32_WINNT 0x400
#include <dshow.h>

#pragma comment(lib, "strmiids")
#pragma comment(lib, "quartz")

필터 그래프 매니저
single control point

필터 그래프 컴포넌트
오디오 장치 필터(Audio Capture Sources 범주)
비디오 캡처 필터(Video Capture Sources 범주)
소스 필터
파일 소스 필터
윈도우 미디어 소스 필터
오디오 CD 소스(WMP CD) 필터(DirectShow Filters 범주)    // push 모드
DVD 네비게이터 필터

변환 필터(?)
파서 필터
웨이브 파서 필터
미디 파서 필터
MPEG-1 파서(MPEG-I Stream Splitter) 필터
MPEG-2 파서(MPEG-2 Stream Splitter) 필터
AVI 파서(AVI Splitter) 필터

디코더 필터
ACM Wrapper 필터(DirectShow Filters 범주)
MP3 디코더(MPEG Layer-3 Decoder)
MPEG-1 오디오 디코더 필터
색상 공간 변환기(Color Space Converter) 필터
AVI 디코더(AVI Decompressor) 필터(DirectShow Filters 범주)
MPEG-1 비디오 디코더 필터(비디오 CD)
MPEG-4 디코더(MPEG-4 Decoder DMO) 필터

인코더 필터
Divx 인코더(Divix Codec)(Video Compressors 범주)
MP3 ACM(MPEG Layer-3)(Audio Compressors 범주)
MPEG 비디오 인코더
MPEG 오디오 인코더

오디오 장치 필터
PCM 오디오 믹서 필터

오버레이 믹서 필터(DirectShow Filters 범주)
VMR(Video Mixing Renderer) 필터

AVI Mux 필터(DirectShow Filters 범주)
MPEG 먹스 필터
WAV 생성 필터
MP3 생성 필터

렌더 필터
비디오 렌더 필터(DirectShow Filters 범주)
오디오 렌더 필터(Audio Renders 범주)
Null Renderer(DirectShow Filters 범주)

File writer 필터(DirectShow Filters 범주)

필터 렌더링
필터(소스 필터 포함)를 추가 후 해당 필터의 '핀 렌더링'

connection(연결하기)
필터를 추가 후 핀과 핀사이를 마우스로 연결한다.

자동 연결하기
[Graph | Connect Intelligent]
[Options | AutoArrange filters]

연결 시 중간에 필터가 자동 추가
수동 연결하기

PID(plug-in distributor) 인터페이스
간결성
안정성

반드시 필터 그래프 매니저에 인터페이스 요청
애플리케이션 개발자가 힘들게 필터를 검색하지 않고 필터 그래프 매니저에만 인터페이스 요청

IGraphBuilder
.RenderFile()    // 널 렌더링
그래프 에디터에서 [File|Render Media File...]
.AddFilter()
.AddSourceFilter()    // 소스 필터 자동 추가
.Render()    // 핀 렌더링(?)
.Connect()    // 자동 연결하기

IMediaEventEx
.SetNotifyWindow()

IMediaControl
.Run()
.Stop()
.Pause()
.GetState()
.StopWhenReady()

IMediaSeeking
.GetCapabilities()
.CheckCapabilities()
.GetCurrentPosition()
.GetPositions()
.SetPositions()
.GetDuration()
.SetRate()


IMediaEvent
.WaitForCompletion()

IVideoWindow
.put_Owner()
.put_WindowStyle()
.SetWindowPosition()
.get_Visible()
.put_Visible()
OAFALSE
.get_FullScreenMode()
.put_FullScreenMode()
.get_MessageDrain()
.put_MessageDrain()
.SetWindowForeground()

IBasicVideo
.GetVideoSize()

IMediaPosition
.get_Rate()
.put_Rate()

IVideoFrameStep
.CanStep()