关于IAMStreamSelect的问题(100分)

  • 主题发起人 主题发起人 sleeproom
  • 开始时间 开始时间
S

sleeproom

Unregistered / Unconfirmed
GUEST, unregistred user!
var
obj:IAMStreamSelect;
aCount:Dword;
i:integer;
begin

if Filter1.QueryInterface(IID_IAMStreamSelect, obj) = S_OK then

begin

// obj.Count(aCount);
// obj := nil;
// for i:= 1 to acountdo

// ComboBox1.Items.Add('音轨'+inttostr(i));
obj.Enable(channel, AMSTREAMSELECTENABLE_ENABLE);
obj := nil;
end;

end;

无法更改音轨
而且也得不到音轨的数量
 
这个只能改DVD的音轨哈
 
按原理只要ax,里有这个接口的话就能改啊
 
DVD才有几个音轨的,如中文语音,英文什么的。。。
 
mkv也有几条音轨的
 
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include <qedit.h>
#include <control.h>
#include <uuids.h>
#include <stdio.h>
#include <evcode.h>

//---------------------------------------------------------------------------

struct TCopyData
{
int dwData;
int cbData;
void *lpData;
} ;
typedef TCopyData *PCopyData;

//-- var, const, procedure ---------------------------------------------------


#pragma argsused

void TraceString(AnsiString Msg)
{
TCopyData *CopyData;
HWND TraceWin;
char Buf[256];

TraceWin = FindWindow(&quot;TfrmDGCTrace&quot;, &quot;DGC Trace&quot;);

if(TraceWin == 0)
exit;
// if(Strlen(Msg.Length(Msg) > 255)
// SetLength(Msg, 255);

StrPCopy(Buf, Msg);
CopyData->dwData = 0;
CopyData->cbData = Msg.Length() + 1;
CopyData->lpData = Buf;
SendMessage(TraceWin, WM_COPYDATA, 0, (long)(&CopyData));
}

int main(int argc, char* argv[])
{
HRESULT hr;
IGraphBuilder *pGraph;
IMediaControl *pMediaControl;
IMediaEventEx *pEv;
IBaseFilter *pSAMI;

CoInitialize(NULL);

// Create the filter graph manager.
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC,
IID_IGraphBuilder, (void **)&pGraph);
pGraph->QueryInterface(IID_IMediaControl, (void **)&pMediaControl);
pGraph->QueryInterface(IID_IMediaEventEx, (void**)&pEv);

// Create the graph and find the SAMI parser.
pGraph->RenderFile(L&quot;E://爱后余生.vob&quot;, NULL);
hr = pGraph->FindFilterByName(L&quot;Morgan Stream Switcher&quot;, &pSAMI);
if (SUCCEEDED(hr))
{
IAMStreamSelect *pStrm = NULL;
hr = pSAMI->QueryInterface(IID_IAMStreamSelect, (void**)&pStrm);
if (SUCCEEDED(hr))
{
DWORD dwStreams = 0;
pStrm->Count(&dwStreams);
printf(&quot;Stream count: %d/n&quot;, dwStreams);

// Select French and &quot;GreenText&quot;
hr = pStrm->Enable(1, AMSTREAMSELECTENABLE_ENABLE);
hr = pStrm->Enable(3, AMSTREAMSELECTENABLE_ENABLE);


// Print the name of each logical stream.
for (DWORD index = 0;
index < dwStreams;
index++)
{
DWORD dwFlags;
WCHAR *wszName;
hr = pStrm->Info(index, NULL, &dwFlags, NULL, NULL,
&wszName, NULL, NULL);
if (hr == S_OK)
{
wprintf(L&quot;Stream %d: %s [%s]/n&quot;, index, wszName,
(dwFlags ? L&quot;ENABLED&quot;
: L&quot;DISABLED&quot;));
CoTaskMemFree(wszName);
}
}

pStrm->Release();
}
pSAMI->Release();
}


// Run the graph and display the captions.
pMediaControl->Run();

printf(&quot;/n&quot;);


hr = pGraph->FindFilterByName(L&quot;Morgan Stream Switcher&quot;, &pSAMI);
if (SUCCEEDED(hr))
{
IAMStreamSelect *pStrm = NULL;
hr = pSAMI->QueryInterface(IID_IAMStreamSelect, (void**)&pStrm);
if (SUCCEEDED(hr))
{
DWORD dwStreams = 0;
pStrm->Count(&dwStreams);
printf(&quot;Stream count: %d/n&quot;, dwStreams);

// Select French and &quot;GreenText&quot;
hr = pStrm->Enable(1, AMSTREAMSELECTENABLE_ENABLE);
hr = pStrm->Enable(3, AMSTREAMSELECTENABLE_ENABLE);
// hr = pStrm->Enable(5, AMSTREAMSELECTENABLE_ENABLE);



// Print the name of each logical stream.
for (DWORD index = 0;
index < dwStreams;
index++)
{
DWORD dwFlags;
WCHAR *wszName;
hr = pStrm->Info(index, NULL, &dwFlags, NULL, NULL,
&wszName, NULL, NULL);
if (hr == S_OK)
{
wprintf(L&quot;Stream %d: %s [%s]/n&quot;, index, wszName,
(dwFlags ? L&quot;ENABLED&quot;
: L&quot;DISABLED&quot;));
CoTaskMemFree(wszName);
}
}

pStrm->Release();
}
pSAMI->Release();
}

while (1)
{
long evCode, lParam1, lParam2;
pEv->GetEvent(&evCode, &lParam1, &lParam2, 100);

if (evCode == EC_OLE_EVENT) {
wprintf(L&quot;%s/n&quot;, (BSTR)lParam2);
}
pEv->FreeEventParams(evCode, lParam1, lParam2);

if (evCode == EC_USERABORT || evCode == EC_COMPLETE || evCode == EC_ERRORABORT)
break;
}

// Clean up.
pMediaControl->Release();
pEv->Release();
pGraph->Release();
CoUninitialize();
return 0;
}
//---------------------------------------------------------------------------
 

Similar threads

后退
顶部