0
我想在directshow中創建一個過濾器,將o/p視頻剪裁到某個感興趣的區域。 [GetMediaType(int iPosition,CMediaType * pMediaType)「]我通過使用[DIBSIZE]更改[biWidth,biHeight和biSizeImage]指定指針指向pMediatype的視頻標題,詳情如下:directshow視頻裁剪過濾器
// pvih is a pointer to pMediaType->pbFormat of type videoheader
//pInVh is a pointer to CurrentMediaType().pbFormat of the i/p of type videoheader
pvih->rcSource = pInVh->rcSource;
pvih->rcTarget = pInVh->rcTarget;
//bitmap settings
pvih->bmiHeader.biWidth = _Width;//width of region of interest
pvih->bmiHeader.biHeight = _Height;// height of region of interest
m_Width=pInVh->bmiHeader.biWidth;
m_Height=pInVh->bmiHeader.biHeight;
pvih->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
pvih->bmiHeader.biPlanes = 1; //1 image plane
pvih->bmiHeader.biBitCount = 24; //24bit
pvih->bmiHeader.biCompression = BI_RGB; //simply three values
pvih->bmiHeader.biSizeImage = DIBSIZE(pvih->bmiHeader);
//mediatype settings
pMediaType->majortype = MEDIATYPE_Video; //a video stream
pMediaType->subtype = MEDIASUBTYPE_RGB24; //24bit rgb samples
pMediaType->bFixedSizeSamples = true; //no varying size
pMediaType->bTemporalCompression = false; //no compression
pMediaType->formattype = FORMAT_VideoInfo; //VIDEOINFOHEADER
pMediaType->lSampleSize = pvih->bmiHeader.biWidth * pvih->bmiHeader.biHeight * pvih- >bmiHeader.biBitCount/8; //size of one sample in bytes
pMediaType->cbFormat = sizeof(VIDEOINFOHEADER); //additiona format setting
但是當我用原始幀的樣本填充裁剪框架時,o/p視頻是垃圾,我也試着用常量顏色填充它,o/p不正確,不知道如何解決這個問題?
我已經下載了那個,沒有源代碼,它只有dll文件。我不能在濾鏡中使用它。 – Karam 2012-04-27 14:21:11
抱歉,認爲它說有SVN訪問 – Pete 2012-04-27 20:37:41