IltmmWMProfile::GetStream Example for C++
For complete code, refer to the CNVWM demo.
void GetStreamInfo(IltmmWMProfile *pProfile)
{
USES_CONVERSION;
IltmmWMStreamConfig *pStreamConfig = NULL;
BSTR bstrString;
long lStreamCount;
int i;
long lValue;
double fValue;
char temp[50];
// Show all the information regarding the streams
pProfile->get_StreamCount (&lStreamCount);
for(i=0; i<lStreamCount; i++)
{
pProfile->GetStream (i, &pStreamConfig);
sprintf(temp, "[[ Stream %d ]]\n", i);
printf(temp);
// Get the major type of the stream
pStreamConfig->get_StreamType(&bstrString);
printf("Stream type : ");
printf(OLE2A(bstrString));
printf("\n");
SysFreeString(bstrString);
// Get Stream number
pStreamConfig->get_StreamNumber (&lValue);
printf("Stream number : ");
printf(ltoa(lValue, temp, 10));
printf("\n");
// Get Stream name
pStreamConfig->get_StreamName (&bstrString);
printf("Stream name : ");
printf(OLE2A(bstrString));
printf("\n");
SysFreeString(bstrString);
// Get Connection name
pStreamConfig->get_ConnectionName (&bstrString);
printf("Stream connection name : ");
printf(OLE2A(bstrString));
printf("\n");
SysFreeString(bstrString);
// Get Bitrate
pStreamConfig->get_Bitrate (&lValue);
printf("Stream bitrate : ");
printf(ltoa(lValue, temp, 10));
printf("\n");
// Get the maximum latency (time in milliseconds) between stream reception and display
pStreamConfig->get_BufferWindow (&lValue);
printf("Stream buffer window : ");
printf(ltoa(lValue, temp, 10));
printf("\n");
// Get the major type of the media in the stream
pStreamConfig->get_Type (&bstrString);
printf("Major type of the stream media : ");
printf(OLE2A(bstrString));
printf("\n");
SysFreeString(bstrString);
// Get the maximum key frame time interval (in 100-nano seconds)
pStreamConfig->get_MaxKeyFrameSpacing (&fValue);
printf("Maximum key frame time interval : ");
sprintf(temp, "%.Ef", fValue);
printf(temp);
printf("\n");
// Get the Quality, range from 0 to 100
// where zero denotes maximum frame rate and 100 denotes maximum quality.
pStreamConfig->get_Quality (&lValue);
printf("Stream quality : ");
printf(ltoa(lValue, temp, 10));
if(lValue == -1)
printf(" ...(Unknown)");
printf("\n\n");
pStreamConfig->Release();
}
pProfile->Release();
}