Jason
Guest
|
Posted:
Wed Sep 29, 2004 10:32 pm Post subject:
Hint Regarding Copying ASF Files |
|
|
In the format SDK, the section "Copying Streams Without Decompressing the
Data" details how you can copy an ASF stream without uncompressing the
samples. I adapted this to extract an audio stream from an A/V stream. The
audio stream played properly in Windows Media Player but its length was off
(3 min instead of 2 hr). It turned out the file wasn't getting indexed. At
first, I tried creating a new index, but this took forever. It turns out
that AutoIndexing was off in the Writer (maybe because I wasn't including
the video information). I turned it on and my extracted audio files work
fine.
To turn on autoindexing, do something like the following before calling
BeginWriting.
// Make sure autoindexing is on
if(SUCCEEDED(m_pWriterAdvanced->GetSinkCount(& dwCount))) {
for(DWORD dw = 0; dw < dwCount; dw++) {
CComPtr<IWMWriterSink> pSink;
if(SUCCEEDED(m_pWriterAdvanced->GetSink(dw, & pSink))) {
CComPtr<IWMWriterFileSink3> pFileSink;
if(SUCCEEDED(pSink.QueryInterface(& pFileSink))) {
pFileSink->SetAutoIndexing(true);
pFileSink.Release();
}
pSink.Release();
}
}
}
|
|