基类中的 CMediaType::IsPartiallySpecified 是否已损坏?

发布于 2024-12-13 23:27:07 字数 473 浏览 1 评论 0原文

我对 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

怀念你的温柔 2024-12-20 23:27:07

它应该按原样阅读,而不应该按照您认为它应该阅读的方式阅读。

Partial 表示故意省略主要类型和/或格式类型。

您还会感到惊讶的是,DirectShow SDK 和相关过滤器中几乎不使用 IsPartiallySpecified,即使您破坏了它,其余部分仍然可以正常工作。围绕部分指定的媒体类型的想法是能够给出过滤器功能的提示。这仍然有非常有限的用途。

该实现实际上并不测试子类型。如果有一个
指定格式类型,媒体类型不被认为是部分的,甚至
如果子类型是 GUID_NULL。

部分媒体类型类似于主要类型和子类型,输入引脚会说“嘿,我没有媒体类型可以尝试,但我想我知道它应该是什么样子”。

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.

The implementation does not actually test the subtype. If there is a
specified format type, the media type is not considered partial, even
if the subtype is GUID_NULL.

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".

月隐月明月朦胧 2024-12-20 23:27:07

正如 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.

浮世清欢 2024-12-20 23:27:07

您还遗漏了另一点。要完全定义媒体类型,您需要一个主要类型和一个格式块,但许多音频过滤器使用 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文