Click here to Skip to main content
15,886,422 members
Articles / Multimedia / DirectX

Streaming Server using Direct Show and Windows Media Format

Rate me:
Please Sign up or sign in to vote.
4.92/5 (31 votes)
13 May 2010CPOL3 min read 357.3K   5.8K   79  
A simple streaming server using Direct Show and Windows Media Format SDK
// ServerDlg.h : header file
//

#if !defined(AFX_SERVERDLG_H__E8CA8A80_BBF1_4E7F_9AE4_8119DF6EE94E__INCLUDED_)
#define AFX_SERVERDLG_H__E8CA8A80_BBF1_4E7F_9AE4_8119DF6EE94E__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/////////////////////////////////////////////////////////////////////////////
// CServerDlg dialog

class CServerDlg : public CDialog
{

	IGraphBuilder  *m_pGraph ;
	IBaseFilter *m_pVidDeviceFilter;
	IBaseFilter *m_pAudDeviceFilter;
	IMediaControl *m_pMediaControl;
	IMediaEvent *m_pEvent ; //Media Event interface for capture the media events
	IBaseFilter *m_pWMASFWritter ; //IBase Filter for WMASFWritter 
	IFileSinkFilter* m_pFileSinkFilter;
	IWMWriterAdvanced2 *m_pWriter2 ; //Windows media writer advanced from WMF
	IWMWriterNetworkSink *m_pNetSink;
	IServiceProvider *m_pProvider ;
	
// Construction
public:
	GetAudeoDevices(CString strDevName,IBaseFilter **pFilter);
	HRESULT ConnectFilters(IGraphBuilder *pGraph,IBaseFilter *pFirst, IBaseFilter *pSecond,CString strAsfFilterPin);
	IPin* GetPinByName(IBaseFilter *pFilter, LPCOLESTR pinname);
	BOOL StartStreaming();
	HRESULT GetPin(IBaseFilter *pFilter, PIN_DIRECTION PinDir, IPin **ppPin);
	HRESULT ConnectFilters(IGraphBuilder *pGraph, IBaseFilter *pFirst, IBaseFilter *pSecond);
	GetVideoDevices(CString strDevName,IBaseFilter **pFilter);
	CServerDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CServerDlg)
	enum { IDD = IDD_SERVER_DIALOG };
	CStatic	m_StaticUrl;
	CEdit	m_EditPort;
	CButton	m_btnStop;
	CButton	m_btnPause;
	CButton	m_btnStart;
	CComboBox	m_CboAudioDevices;
	CComboBox	m_CboVideoDevices;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CServerDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CServerDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnButtonStart();
	afx_msg void OnButtonPause();
	afx_msg void OnButtonStop();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SERVERDLG_H__E8CA8A80_BBF1_4E7F_9AE4_8119DF6EE94E__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Architect
India India
I am an iOS\VC++\.net programmer. I am currently employed as an Architect in a software development company. The main technologies I used are
Objective C, Swift,VC++,MFC,C#.NET,DirectShow,COM,Windows media Format etc...

I'm looking to advance my career by learning new technologies and extending my programming experience.

EMail : rajeevkr.asr@gmail.com
Skype : rajeevkr_asr

Comments and Discussions