| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 647 人关注过本帖
标题:[求助]编写WMP-Plugin程序中error:local function definitions are illegal
只看楼主 加入收藏
icelofy
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-5-8
收藏
 问题点数:0 回复次数:0 
[求助]编写WMP-Plugin程序中error:local function definitions are illegal

我在用VC++编写 windows media player 的 plug in
run 这个 code 的时候
有一个 错误不知道怎么解决
error 是 local function definitions are illegal

下面是 我编写的code

错误指向
error C2601: 'CEcho::ValidateMediaType' : local function definitions are illegal c:\documents and settings\--\my documents\visual studio 2005\projects\echo\echo\echo.cpp 1166

/////////////////////////////////////////////////////////////////////////////
// CEcho::ValidateMediaType
//
// Validate that the media type is acceptable
/////////////////////////////////////////////////////////////////////////////

HRESULT CEcho::ValidateMediaType(const DMO_MEDIA_TYPE *pmtTarget, const DMO_MEDIA_TYPE *pmtPartner)
{
// make sure the target media type has the fields we require
if( ( MEDIATYPE_Audio != pmtTarget->majortype ) ||
( FORMAT_WaveFormatEx != pmtTarget->formattype ) ||
( pmtTarget->cbFormat < sizeof( WAVEFORMATEX )) ||
( NULL == pmtTarget->pbFormat) )
{
return DMO_E_TYPE_NOT_ACCEPTED;
}

// make sure the wave header has the fields we require
WAVEFORMATEX *pWave = (WAVEFORMATEX *) pmtTarget->pbFormat;

if ((0 == pWave->nChannels) ||
(0 == pWave->nSamplesPerSec) ||
(0 == pWave->nAvgBytesPerSec) ||
(0 == pWave->nBlockAlign) ||
(0 == pWave->wBitsPerSample))
{
return DMO_E_TYPE_NOT_ACCEPTED;
}

// make sure this is a supported container size
if ((8 != pWave->wBitsPerSample) &&
(16 != pWave->wBitsPerSample))
{
return DMO_E_TYPE_NOT_ACCEPTED;
}

// make sure the wave format is acceptable
switch (pWave->wFormatTag)
{
case WAVE_FORMAT_PCM:

// make sure sample size is 8 or 16-bit
if ((8 != pWave->wBitsPerSample) &&
(16 != pWave->wBitsPerSample))
{
return DMO_E_TYPE_NOT_ACCEPTED;
}
break;

case WAVE_FORMAT_IEEE_FLOAT:

// make sure the input is sane
if (32 != pWave->wBitsPerSample)
{
return DMO_E_TYPE_NOT_ACCEPTED;
}
break;

case WAVE_FORMAT_EXTENSIBLE:
{
// Sample size is greater than 16-bit or is multichannel.
WAVEFORMATEXTENSIBLE *pWaveXT = (WAVEFORMATEXTENSIBLE *) pWave;

if (KSDATAFORMAT_SUBTYPE_PCM != pWaveXT->SubFormat)
{
return DMO_E_TYPE_NOT_ACCEPTED;
}
}
break;

default:
return DMO_E_TYPE_NOT_ACCEPTED;
break;
}

// if the partner media type is configured, make sure it matches the target.
// this is done because this plug-in requires the same input and output types
if (GUID_NULL != pmtPartner->majortype)
{
if ((pmtTarget->majortype != pmtPartner->majortype) ||
(pmtTarget->subtype != pmtPartner->subtype))
{
return DMO_E_TYPE_NOT_ACCEPTED;
}

// make sure the wave headers for the target and the partner match
WAVEFORMATEX *pPartnerWave = (WAVEFORMATEX *) pmtPartner->pbFormat;

if ((pWave->nChannels != pPartnerWave->nChannels) ||
(pWave->nSamplesPerSec != pPartnerWave->nSamplesPerSec) ||
(pWave->nAvgBytesPerSec != pPartnerWave->nAvgBytesPerSec) ||
(pWave->nBlockAlign != pPartnerWave->nBlockAlign) ||
(pWave->wBitsPerSample != pPartnerWave->wBitsPerSample) ||
(pWave->wFormatTag != pPartnerWave->wFormatTag))
{
return DMO_E_TYPE_NOT_ACCEPTED;
}

// make sure the waveformatextensible types are the same
if (pWave->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
{
WAVEFORMATEXTENSIBLE *pWaveXT = (WAVEFORMATEXTENSIBLE *) pWave;
WAVEFORMATEXTENSIBLE *pPartnerWaveXT = (WAVEFORMATEXTENSIBLE *) pPartnerWave;
if (pWaveXT->SubFormat != pPartnerWaveXT->SubFormat)
{
return DMO_E_TYPE_NOT_ACCEPTED;
}
}
}

// media type is valid
return S_OK;
}

[此贴子已经被作者于2007-5-8 9:37:35编辑过]

搜索更多相关主题的帖子: local illegal definitions function local illegal definitions function 
2007-05-08 09:36
快速回复:[求助]编写WMP-Plugin程序中error:local function definitions are il ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015235 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved