基类中的 CMediaType::IsPartiallySpecified 是否已损坏?
我对 directshow 过滤器还是有点陌生,正在仔细研究基类。几乎立即出现的一件事是 CMediaType::IsPartiallySpecified 的基本实现。
它写着:
if ((majortype == GUID_NULL) ||
(formattype == GUID_NULL)) {
return TRUE;
} else {
return FALSE;
}
但它肯定应该写成:
if ((majortype == GUID_NULL) ||
(subtype == GUID_NULL) ||
(formattype == GUID_NULL)) {
return TRUE;
} else {
return FALSE;
}
它不会激发对其他班级的信心。是否有某个地方发布了勘误表?
I'm still a bit new to directshow filters and am studying the base classes closely. One thing that has come up almost immediately is the base implementation of CMediaType::IsPartiallySpecified.
It reads:
if ((majortype == GUID_NULL) ||
(formattype == GUID_NULL)) {
return TRUE;
} else {
return FALSE;
}
but surely it should read:
if ((majortype == GUID_NULL) ||
(subtype == GUID_NULL) ||
(formattype == GUID_NULL)) {
return TRUE;
} else {
return FALSE;
}
It doesn't inspire confidence in the rest of the classes. Is there an errata published somewhere?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
它应该按原样阅读,而不应该按照您认为它应该阅读的方式阅读。
Partial
表示故意省略主要类型和/或格式类型。您还会感到惊讶的是,DirectShow SDK 和相关过滤器中几乎不使用
IsPartiallySpecified
,即使您破坏了它,其余部分仍然可以正常工作。围绕部分指定的媒体类型的想法是能够给出过滤器功能的提示。这仍然有非常有限的用途。部分媒体类型类似于主要类型和子类型,输入引脚会说“嘿,我没有媒体类型可以尝试,但我想我知道它应该是什么样子”。
It should read the way it is, and it should not read the way you think it surely should read.
Partial
means that major type and/or format type are intentionally omitted.You will also be surprised that
IsPartiallySpecified
is almost not used within DirectShow SDK and dependent filter, and even if you break it the rest will still work rock solid. The idea around partially specified media types is to be able give a hint on filter capabilities. This still has a very limited use.Partial media type is something like major type and subtype only, for the input pin to say "Hey, I don't have media type to try but I think I have an idea what it should approximately look like".
正如 Roman R. 所说,DirectShow 框架运行坚如磐石。它是 Microsoft 提供的较为复杂的 API 集之一。你应该根据它的性能来判断它。 Windows SDK 中提供的 DirectShow 示例经过精心挑选并且可以正常工作。
DirectShow framework, as Roman R. put it, works rock solid. It is one of the more complicated API sets by Microsoft. You should judge it on its performance. The DirectShow samples provided in the Windows SDK are well-chosen and work.
您还遗漏了另一点。要完全定义媒体类型,您需要一个主要类型和一个格式块,但许多音频过滤器使用 FORMAT_WaveFormatEx 并依赖波形格式标记来定义子类型,在这些情况下,子类型有效 GUID_NULL,但媒体类型完全定义的。
一般来说,格式块完全定义了媒体,并且是充分的也是必要的。主要类型和子类型旨在允许一定程度的通用数据处理。
G
There's another point that you're missing. To fully define a media type, you need a major type and a format block, but many audio filters use FORMAT_WaveFormatEx and rely on the wave format tag to define the subtype, and in these cases the subtype is validly GUID_NULL but the media type is fully defined.
Generally speaking, the format block fully defines the media, and is both sufficient and necessary. The major type and subtype were intended to allow a degree of generic handling of data.
G