Re[2]: BITMAPINFOHEADER (ffmpeg - ищу единомышлиников)
От: Folks Россия  
Дата: 25.01.07 15:31
Оценка:
Здравствуйте, seafresh, Вы писали:

S>Здравствуйте, Folks, Вы писали:


F>>подскажите пожлуйста какое значение biCompression структуры BITMAPINFOHEADER должно

F>>быть для RGB565.

S>BI_BITFIELDS


S>и далее


S>If the biCompression member of the BITMAPINFOHEADER is BI_BITFIELDS, the bmiColors member contains three DWORD color masks that specify the red, green, and blue components, respectively, of each pixel. Each WORD in the bitmap array represents a single pixel.


S>Windows NT/Windows 2000/XP: When the biCompression member is BI_BITFIELDS, bits set in each DWORD mask must be contiguous and should not overlap the bits of another mask. All the bits in the pixel do not have to be used.


S>Windows 95/98/Me: When the biCompression member is BI_BITFIELDS, the system supports only the following 16bpp color masks: A 5-5-5 16-bit image, where the blue mask is 0x001F, the green mask is 0x03E0, and the red mask is 0x7C00; and a 5-6-5 16-bit image, where the blue mask is 0x001F, the green mask is 0x07E0, and the red mask is 0xF800.


Спасибо! Прошу меня простить за хреново поставленный вопрос, обещаю исправиться.
про BI_BITFIELDS я в курсе и её использую. Коннект фильтров проходит по норме, проверка видеотипов проходит тоже нормально, однако при
активации пина на конечном фильтре это Video Renderer происходит падение. Расчет размера буфера для видео сэмпла я вычисляю так:

m_dwStride = ((sHeader.biWidth * sHeader.biBitCount) + 7) / 8;
m_dwStride = (m_dwStride + 3) & ~3;

и DecideBufferSize тоже не ругается. В выходном и входном пине соотвтествующих фильтрах я уверен, так как при 32 битном режиме дисплея коннект проходит нормально.

вот так я выдаю свой медиа тип:
BITMAPINFOHEADER sHeader;

memset(&sHeader, 0, sizeof(sHeader));
sHeader.biSize = sizeof(sHeader);
sHeader.biPlanes = 1;
sHeader.biWidth = m_pVideoCodecCtx->width;
sHeader.biHeight = m_pVideoCodecCtx->height;
sHeader.biBitCount = g_nFormatBits[g_cSupportedTypesFFMPEG[i].eType];//здесь передаются корректные данные при 16 битном сюда попадает 16
sHeader.biCompression = g_cSupportedTypesFFMPEG[i].FOURCC; а сюда BI_BITFIELDS

m_dwStride = ((sHeader.biWidth * sHeader.biBitCount) + 7) / 8;
m_dwStride = (m_dwStride + 3) & ~3;

sHeader.biSizeImage = m_dwStride * sHeader.biHeight;

CMediaType pType;
//Initialize media type structure
pType.SetType(&MEDIATYPE_Video);
pType.SetSubtype(&M&g_cSupportedTypesFFMPEG[i].guidSubType);// сюда заходит MEDIASUBTYPE_RGB565
pType.SetSampleSize(sHeader.biSizeImage);
pType.SetTemporalCompression(FALSE);
pType.SetFormatType(&FORMAT_VideoInfo2);

// Allocate enough room for the VIDEOINFOHEADER and the color tables
VIDEOINFOHEADER2 *pvi = (VIDEOINFOHEADER2*)
pType.AllocFormatBuffer(FIELD_OFFSET(VIDEOINFOHEADER2, bmiHeader) +
sizeof(BITMAPINFOHEADER));
if (pvi == 0)
{
return E_OUTOFMEMORY;
}

ZeroMemory(pvi, pType.cbFormat);

// Clear source and target rectangles
SetRectEmpty(&(pvi->rcSource)); // we want the whole image area rendered
SetRectEmpty(&(pvi->rcTarget)); // no particular destination rectangle
pvi->rcSource.right = pvi->rcTarget.right = m_pVideoCodecCtx->width;
pvi->rcSource.bottom = pvi->rcTarget.bottom = m_pVideoCodecCtx->height;

//Set properties
pvi->AvgTimePerFrame = m_tVideoTimestampStep;
pvi->dwPictAspectRatioX = m_pVideoCodecCtx->width;
pvi->dwPictAspectRatioY = m_pVideoCodecCtx->height;
pvi->dwControlFlags = 0;
pvi->dwInterlaceFlags = 0;
pvi->dwBitRate = 0;

CopyMemory(&pvi->bmiHeader, &sHeader, sizeof(sHeader));


Подскажите пожалуйста в чем может быть ошибка.
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.