苹果6s使用技巧大全:Using IAMStreamSelect To Select a Specific Au...
来源:百度文库 编辑:九乡新闻网 时间:2024/04/28 16:15:25
Using IAMStreamSelect To Select a SpecificAudio Stream The portion of the file holding the audio data. The audio data might be compressed to save disk space. The data has to be decompressed using an audio decompressor before you can play (hear) it.audio decompressor oftware component which decompresses audio. It must be designed to work with ACM orDirectShow . Note that different compression methods require different decompressors. There is no universal decompressor capable of decoding all compressed streams. before you can play (hear) it.From an MPEG File With Multiple Audio Streams
The IAMStreamSelect is a Direct Show interface for selecting which streams are played and retrieving information about them. An example of logical stream selection would be selecting a particular language (English, German, or French for example) from a set of audio streams that encode different national languages.
To use IAMStreamSelect to select a specific audio stream from an MPEG file with multiple audio streams, perform the following steps:
1.
Create an instance of ltmmPlay class:
C Source
IltmmPlay* pPlay;
CoCreateInstance(&CLSID_ltmmPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IltmmPlay, (void**) &pPlay);
C++ Source
IltmmPlay* pPlay;
CoCreateInstance(&CLSID_ltmmPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IltmmPlay, (void**) &pPlay);
2.
Set the source file:
C Source
BSTR bstr;
// create a string containing the source file path
bstr = SysAllocString(L"C:\\MultipleAudio.mpg");
// assign the source file path to the play object
IltmmPlay__put_SourceFile(pPlay, bstr);
// free the string
SysFreeString(bstr);
C++ Source
BSTR bstr;
// create a string containing the source file path
bstr = SysAllocString(L"C:\\MultipleAudio.mpg");
// assign the source file path to the play object
pPlay->put_SourceFile(bstr);
// free the string
SysFreeString(bstr);
3.
The IAMStreamSelect is usually exposed by the file splitter (Demultiplexer), so you need to get a pointer to the splitter object:
C Source
IUnknown* pSplitter;
IltmmPlay_GetSubObject (pPlay ,ltmmPlay_Object_Splitter, & pSplitter);
C++ Source
IUnknown* pSplitter;
pPlay->GetSubObject (ltmmPlay_Object_Splitter, & pSplitter);
4.
Query for the IAMStreamSelect interface:
C Source
IAMStreamSelect *pStreamSel = NULL;
IUnknown_QueryInterface(pSplitter, &IID_IAMStreamSelect, (void**)& pStreamSel);
IUnknown_Release(pSplitter);
C++ Source
IAMStreamSelect *pStreamSel = NULL;
pSplitter->QueryInterface(&IID_IAMStreamSelect, (void**)&pStreamSel);
pSplitter->Release();
5.
Use the IAMStreamSelect interface to select one of the available audio streams in the file:
C Source
// retrieve the number of available streams in the file
DWORD dwCount;
int nIndex;
BOOL bAudio = FALSE;
BOOL bEnable = FALSE;
AM_MEDIA_TYPE *pmt;
DWORD dwFlags;
LCID lcid;
DWORD dwGroup;
WCHAR *pszName;
IUnknown *pObject;
IUnknown *pUnk;
IAMStreamSelect_Count(pStreamSel , &dwCount);
for( nIndex = 0; nIndex{
// get information about the stream, and decide if this is an audio stream and you want to enable it:
IAMStreamSelect_Info(pStreamSel , nIndex, &pmt, &dwFlags, &lcid, &dwGroup, &pzsName, &pObject, &pUnk);
// based on your selection criterion
if( bAudio && bEnable )
IAMStreamSelect_Enable(pStreamSel, nIndex, AMSTREAMSELECTENABLE_ENABLE);
}
IUnknown_Release(pStreamSel);
C++ Source
// retrieve the number of available streams in the file
DWORD dwCount;
int nIndex;
BOOL bAudio = FALSE;
BOOL bEnable = FALSE;
AM_MEDIA_TYPE *pmt;
DWORD dwFlags;
LCID lcid;
DWORD dwGroup;
WCHAR *pszName;
IUnknown *pObject;
IUnknown *pUnk;
pStreamSel->Count(&dwCount);
for( nIndex = 0; nIndex{
// get information about the stream, and decide if this is an audio stream and you want to enable it:
pStreamSel->Info(nIndex, &pmt, &dwFlags, &lcid, &dwGroup, &pzsName, &pObject, &pUnk);
// based on your selection criterion
if( bAudio && bEnable )
pStreamSel->Enable(nIndex, AMSTREAMSELECTENABLE_ENABLE);
}
pStreamSel->Release();
6.
Play the file:
C Source
IltmmPlay_Run (pPlay);
C++ Source
pPlay->Run ();
The IAMStreamSelect is a Direct Show interface for selecting which streams are played and retrieving information about them. An example of logical stream selection would be selecting a particular language (English, German, or French for example) from a set of audio streams that encode different national languages.
To use IAMStreamSelect to select a specific audio stream from an MPEG file with multiple audio streams, perform the following steps:
1.
Create an instance of ltmmPlay class:
C Source
IltmmPlay* pPlay;
CoCreateInstance(&CLSID_ltmmPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IltmmPlay, (void**) &pPlay);
C++ Source
IltmmPlay* pPlay;
CoCreateInstance(&CLSID_ltmmPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IltmmPlay, (void**) &pPlay);
2.
Set the source file:
C Source
BSTR bstr;
// create a string containing the source file path
bstr = SysAllocString(L"C:\\MultipleAudio.mpg");
// assign the source file path to the play object
IltmmPlay__put_SourceFile(pPlay, bstr);
// free the string
SysFreeString(bstr);
C++ Source
BSTR bstr;
// create a string containing the source file path
bstr = SysAllocString(L"C:\\MultipleAudio.mpg");
// assign the source file path to the play object
pPlay->put_SourceFile(bstr);
// free the string
SysFreeString(bstr);
3.
The IAMStreamSelect is usually exposed by the file splitter (Demultiplexer), so you need to get a pointer to the splitter object:
C Source
IUnknown* pSplitter;
IltmmPlay_GetSubObject (pPlay ,ltmmPlay_Object_Splitter, & pSplitter);
C++ Source
IUnknown* pSplitter;
pPlay->GetSubObject (ltmmPlay_Object_Splitter, & pSplitter);
4.
Query for the IAMStreamSelect interface:
C Source
IAMStreamSelect *pStreamSel = NULL;
IUnknown_QueryInterface(pSplitter, &IID_IAMStreamSelect, (void**)& pStreamSel);
IUnknown_Release(pSplitter);
C++ Source
IAMStreamSelect *pStreamSel = NULL;
pSplitter->QueryInterface(&IID_IAMStreamSelect, (void**)&pStreamSel);
pSplitter->Release();
5.
Use the IAMStreamSelect interface to select one of the available audio streams in the file:
C Source
// retrieve the number of available streams in the file
DWORD dwCount;
int nIndex;
BOOL bAudio = FALSE;
BOOL bEnable = FALSE;
AM_MEDIA_TYPE *pmt;
DWORD dwFlags;
LCID lcid;
DWORD dwGroup;
WCHAR *pszName;
IUnknown *pObject;
IUnknown *pUnk;
IAMStreamSelect_Count(pStreamSel , &dwCount);
for( nIndex = 0; nIndex
// get information about the stream, and decide if this is an audio stream and you want to enable it:
IAMStreamSelect_Info(pStreamSel , nIndex, &pmt, &dwFlags, &lcid, &dwGroup, &pzsName, &pObject, &pUnk);
// based on your selection criterion
if( bAudio && bEnable )
IAMStreamSelect_Enable(pStreamSel, nIndex, AMSTREAMSELECTENABLE_ENABLE);
}
IUnknown_Release(pStreamSel);
C++ Source
// retrieve the number of available streams in the file
DWORD dwCount;
int nIndex;
BOOL bAudio = FALSE;
BOOL bEnable = FALSE;
AM_MEDIA_TYPE *pmt;
DWORD dwFlags;
LCID lcid;
DWORD dwGroup;
WCHAR *pszName;
IUnknown *pObject;
IUnknown *pUnk;
pStreamSel->Count(&dwCount);
for( nIndex = 0; nIndex
// get information about the stream, and decide if this is an audio stream and you want to enable it:
pStreamSel->Info(nIndex, &pmt, &dwFlags, &lcid, &dwGroup, &pzsName, &pObject, &pUnk);
// based on your selection criterion
if( bAudio && bEnable )
pStreamSel->Enable(nIndex, AMSTREAMSELECTENABLE_ENABLE);
}
pStreamSel->Release();
6.
Play the file:
C Source
IltmmPlay_Run (pPlay);
C++ Source
pPlay->Run ();
Using IAMStreamSelect To Select a Specific Au...
How to Select a Company or Product Name
Using SNMP to Find a Port Number from a MAC Addres
Singapore to hold presidential election on Au...
Guide to Using TCAD with Examples
How To Build an Add-in (XLL) for Excel Using ...
Trying to register the VirtualBox kernel modules using DKMS[失败]
Gene Therapy: In vivo delivery of a microRNA-regulated transgene induces antigen-specific regulatory T cells and promotes immunologic tolerance
To name a shoe
To find a girlfriend
A-Z to woman
A blow to Sino
a letter to Franktian
How to Find the FSMO Role Owners Using ADSI and WSH
How to complicate a deal
How to Write a Rebuttal
Whats time to a pig?
ASEAN rises to a challenge
To build a better nation
How to read a book!!!
How To Become A Hacker
Using Com0com
Select语句
select标签