[prev in list] [next in list] [prev in thread] [next in thread]
List: ms-wmtalk
Subject: Re: A little question
From: Iain <idowns () DIRCON ! CO ! UK>
Date: 2004-08-28 13:49:11
Message-ID: 20040828134643.XCHY11492.mta05-svc.ntlworld.com () idcserver
[Download RAW message or body]
Here's a snippet of C. You should be able to work out how to do it In
VB.NET from this
Iain
CComPtr<IWMMetadataEditor> pEditor;
hr = WMCreateEditor( &pEditor );
hr = pEditor->Open( A2W(FilePath)) ;
CComQIPtr<IWMHeaderInfo, &IID_IWMHeaderInfo> pInfo = pEditor;
hr = GetASFDuration(pInfo, DurationMS);
HRESULT GetASFDuration(IWMHeaderInfo *pHeaderInfo, long &DurationMS)
{
HRESULT hr = S_OK;
WMT_ATTR_DATATYPE Type;
WORD DataSize = sizeof(long);
WORD StreamNo = 0;
hr = pHeaderInfo->GetAttributeByName( &StreamNo,
g_wszWMDuration,
&Type,
NULL,
&DataSize);
if( FAILED( hr ))
{
printf("Failed to get value for Duration (first time) with
%lx", hr);
return hr;
}
if (Type != WMT_TYPE_QWORD || DataSize != sizeof(QWORD))
{
printf("Duration is NOT a QWORD ...");
return E_FAIL;
}
QWORD qwDuration = 0;
hr = pHeaderInfo->GetAttributeByName( &StreamNo,
g_wszWMDuration,
&Type,
(BYTE *) &qwDuration,
&DataSize);
if( FAILED( hr ))
{
printf("Failed to get value for Duration with %lx", hr);
return hr;
}
DurationMS = (long) (qwDuration / 10000);
return S_OK;
}
-----Original Message-----
From: WMTalk [mailto:WMTalk@DISCUSS.MICROSOFT.COM] On Behalf Of Stan
Sainte-Rose
Sent: 28 August 2004 03:17
To: WMTalk@DISCUSS.MICROSOFT.COM
Subject: A little question
Hi,
How to know the duration of a wma file ?
I need to read each wma file and get its duration.
I would like to do it with vb.net
I don't have problems to read each file from a directory,
I just want to know how and/or get the duration.
Any help ?
Stan
----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.html
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:WMTalk-signoff-request@DISCUSS.MICROSOFT.COM
----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.html
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:WMTalk-signoff-request@DISCUSS.MICROSOFT.COM
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic