-
Notifications
You must be signed in to change notification settings - Fork 454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IAMStreamConfig::GetStreamCaps get wrong SubType when enum twice because CPushPinDesktop::GetMediaType has a bug #162
Comments
this is a bug in GetMediaType?
…On Tue, Jan 31, 2023 at 7:51 PM yin kaisheng ***@***.***> wrote:
the following code outputs:
Camera capability 0, VideoInfo1, size:2560 x 1440, fps:30, video sub type:kRGB32, rateControl:0
Camera capability 1, VideoInfo1, size:2560 x 1440, fps:30, video sub type:kRGB32, rateControl:0
Camera capability 2, VideoInfo1, size:2560 x 1440, fps:30, video sub type:kRGB32, rateControl:0
Camera capability 3, VideoInfo1, size:2560 x 1440, fps:30, video sub type:kRGB32, rateControl:0
Camera capability 4, VideoInfo1, size:2560 x 1440, fps:30, video sub type:kRGB32, rateControl:0
Camera capability 5, VideoInfo1, size:2560 x 1440, fps:30, video sub type:kRGB32, rateControl:0
Camera capability 6, VideoInfo1, size:2560 x 1440, fps:30, video sub type:kI420, rateControl:0
----
Camera capability 0, VideoInfo1, size:2560 x 1440, fps:30, video sub type:kI420, rateControl:0
Camera capability 1, VideoInfo1, size:2560 x 1440, fps:30, video sub type:kI420, rateControl:0
Camera capability 2, VideoInfo1, size:2560 x 1440, fps:30, video sub type:kI420, rateControl:0
Camera capability 3, VideoInfo1, size:2560 x 1440, fps:30, video sub type:kI420, rateControl:0
Camera capability 4, VideoInfo1, size:2560 x 1440, fps:30, video sub type:kI420, rateControl:0
Camera capability 5, VideoInfo1, size:2560 x 1440, fps:30, video sub type:kI420, rateControl:0
Camera capability 6, VideoInfo1, size:2560 x 1440, fps:30, video sub type:kI420, rateControl:0
ComPtr<IAMStreamConfig> streamConfig;
hr = outputPin->QueryInterface(IID_IAMStreamConfig, (void**)&streamConfig);
AM_MEDIA_TYPE* pmt = nullptr;
VIDEO_STREAM_CONFIG_CAPS caps;int count = 0;int size = 0;
hr = streamConfig->GetNumberOfCapabilities(&count, &size);
int enumTimes = 2;for (int n = 0; n < enumTimes; ++n)
{
for (int index = 0; index < count; ++index)
{
hr = streamConfig->GetStreamCaps(index, &pmt, reinterpret_cast<BYTE*>(&caps));
//print pmt properties;
}
printf("\n----\n");
}
In CPushPinDesktop::GetMediaType, pmt->Subtype() is always I420
(!=GUID_NULL) after enumerating once, pmt->SetSubType is never called.
HRESULT CPushPinDesktop::GetMediaType(int iPosition, CMediaType *pmt) // AM_MEDIA_TYPE basically == CMediaType
{
//...
if (*pmt->Subtype() == GUID_NULL) {
const GUID SubTypeGUID = GetBitmapSubtype(&pvi->bmiHeader);
pmt->SetSubtype(&SubTypeGUID);
}
}
if I change the code to the following, then IAMStreamConfig::GetStreamCaps
will get correct result when enumerating twice.
HRESULT CPushPinDesktop::GetMediaType(int iPosition, CMediaType *pmt) // AM_MEDIA_TYPE basically == CMediaType
{
//...
if (iPosition < 6) {
const GUID SubTypeGUID = GetBitmapSubtype(&pvi->bmiHeader);
pmt->SetSubtype(&SubTypeGUID);
}
}
—
Reply to this email directly, view it on GitHub
<#162>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAADBUC2C6ABGYUF5OT4NVTWVHFSVANCNFSM6AAAAAAUNFPJM4>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***
com>
|
Yes, when app calls streamConfig->GetStreamCaps with index 0,... 6, CPushPinDesktop::GetStreamCaps will be called.
|
Check it, see if it works for you... |
the following code outputs:
In CPushPinDesktop::GetMediaType, pmt->Subtype() is always I420 (!=GUID_NULL) after enumerating once, pmt->SetSubType is never called when enumerating the second time.
if I change the code to the following, then IAMStreamConfig::GetStreamCaps will get correct result when enumerating twice.
The text was updated successfully, but these errors were encountered: