Click here to Skip to main content
15,881,559 members
Articles / Desktop Programming / MFC
Article

DShow based player

Rate me:
Please Sign up or sign in to vote.
2.19/5 (16 votes)
15 Jul 2008CPOL2 min read 155.3K   609   23   15
a media file player based on DShow

Introduction

It's simple player, don't expect much.
DirectShow is the ideal media engine, if that the only thing you required is playback. Here is a sample player built on DShow.

Background

DShow consist of core engine and optional components, all exist as DLLs. They are exposed via COM interfaces. Thus COM technology is required. As well as that DirectX9.0c SDK is required to compile the code. Note: 9.0c is the newest and best version for VC6. You can try other version of DXSDK if you don't use VC6. (But no warranty that it would work.)
The core engine uses suplies the control all through. The optinal components classified by purpose. Those used to read media file/source are Parsers. Similarly, Decoders used to restore audio/video back to it's orignal form. Renderers show video picture or play sound for audio.
Normally, all you need for playing a given media file is that: the decoder(s). Other else have already installed on Windows system.
Follow the rule of DShow, media types are registered into Registry as GUIDs. Find out the appropriate parse the decoder for the media file, push the media data into the renderer, that all for the game of playing. It sounds easy, isn't it?

Using the code

The core engine has been capsulated(wrapped) as a single class: CPlayer. Render a media file by create DShow engine, then you're ready to play!
For nicer looking, we have embed the video window into the main dialog window. Current play position is synchronized with progress bar, and displayed as text in left to movie duration.

Points of Interest

The first goal of this project is prefer for preview and take snapshot, so it's named so. If you press Ctrl+Print Screen key when it playing, you'll notice that the video can be paste into mspaint. While Windows Media Player(WMP) can't do this. For WMP use video renderer in overlay mode.

History

Initial release

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
China China
programmer

Comments and Discussions

 
Questionno src Pin
Member 99941715-Jul-15 3:38
Member 99941715-Jul-15 3:38 
AnswerRe: no src Pin
DoItFreely6-Sep-15 16:11
DoItFreely6-Sep-15 16:11 
GeneralRe: no src Pin
Member 99941716-Sep-15 19:02
Member 99941716-Sep-15 19:02 
GeneralRe: no src Pin
DoItFreely7-Sep-15 0:03
DoItFreely7-Sep-15 0:03 
BugCan not download the Project Pin
majer6273-Apr-13 2:29
majer6273-Apr-13 2:29 
GeneralRe: Can not download the Project Pin
hello dearbaby14-Mar-15 21:40
hello dearbaby14-Mar-15 21:40 
GeneralRe: Can not download the Project Pin
DoItFreely7-Sep-15 0:06
DoItFreely7-Sep-15 0:06 
GeneralMy vote is 5 Pin
StNickolay26-Oct-10 4:26
StNickolay26-Oct-10 4:26 
GeneralMy vote of 1 Pin
Joe Woodbury21-Dec-09 11:57
professionalJoe Woodbury21-Dec-09 11:57 
General接受我的谢意 Pin
Member 66848413-Nov-09 21:27
Member 66848413-Nov-09 21:27 
谢谢你的无私奉献,非常感谢你提供了这么好的资源
GeneralMy vote of 1 Pin
Jerry Jiang11-Aug-09 9:38
Jerry Jiang11-Aug-09 9:38 
Generalre: snapshot problem Pin
DoItFreely8-Aug-08 19:24
DoItFreely8-Aug-08 19:24 
GeneralSnspshot Probelm Pin
ananduk766-Aug-08 6:21
ananduk766-Aug-08 6:21 
General你好! Pin
zxb8888888816-Jul-08 15:30
zxb8888888816-Jul-08 15:30 
GeneralRe: 你好! Pin
YCJ4188-May-11 10:30
YCJ4188-May-11 10:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.