On May 3, 3:48 pm, vishy <vishwanath.kine...[ at ]gmail.com> wrote:
[Quoted Text] > Hi All, > > Before this i posted "Access Violation Error from > SetProfileByID(....) ", but that is not working so far. So i thought > of creating own profile( making video from set of images(.bmp). I gone > through the SDK help to configure image stream. As per SDK > > BITMAPINFOHEADER.biSizeImage = ((x * y * c) / 8), where x is the width > of the image, y is the height of the image, and c is the color depth > of the image. > > Whenever i set this value, the AddStream is getting failed with error > "NS_E_INVALID_STREAM". when i set the same variable with value 0 it > perfectly returning S_OK but then WriteSample method is getting failed > with same error "NS_E_NOT_CONFIGURED". > > following is the code sample for image configuration that i used > > WM_MEDIA_TYPE *wmtMediaType = new WM_MEDIA_TYPE; > ZeroMemory( wmtMediaType, sizeof( wmtMediaType ) ); > WMVIDEOINFOHEADER vihVideoInfo; > > IWMMediaProps* pMediaProps = NULL; > > hr = pConfig->QueryInterface( IID_IWMMediaProps, (void**) > &pMediaProps ); > if ( FAILED( hr ) ) > { > return 1; > } > // Set up the WMVIDEOINFOHEADER structure > ZeroMemory( &vihVideoInfo, sizeof( vihVideoInfo ) ); > vihVideoInfo.rcSource.left = 0; > vihVideoInfo.rcSource.top = 0; > vihVideoInfo.rcSource.bottom = pBmiHdr->biHeight; > vihVideoInfo.rcSource.right = pBmiHdr->biWidth; > > vihVideoInfo.rcTarget = vihVideoInfo.rcSource; > vihVideoInfo.dwBitRate=100; > vihVideoInfo.dwBitErrorRate = 0; > vihVideoInfo.AvgTimePerFrame = 0; > vihVideoInfo.dwBitErrorRate = 0; > > vihVideoInfo.bmiHeader.biSize = sizeof( BITMAPINFOHEADER ); > vihVideoInfo.bmiHeader.biWidth = pBmiHdr->biWidth; > vihVideoInfo.bmiHeader.biHeight = pBmiHdr->biHeight; > vihVideoInfo.bmiHeader.biPlanes = 1; > vihVideoInfo.bmiHeader.biBitCount = pBmiHdr->biBitCount; > > vihVideoInfo.bmiHeader.biCompression = BI_RGB; > vihVideoInfo.bmiHeader.biSizeImage = (pBmiHdr->biHeight * pBmiHdr->biWidth * pBmiHdr->biBitCount) / 8; > > vihVideoInfo.bmiHeader.biXPelsPerMeter = 0; > vihVideoInfo.bmiHeader.biYPelsPerMeter = 0; > vihVideoInfo.bmiHeader.biClrUsed = 0; > vihVideoInfo.bmiHeader.biClrImportant = 0; > > // Set up the WM_MEDIA_TYPE structure > wmtMediaType->majortype = WMMEDIATYPE_Image; > wmtMediaType->subtype = > WMMEDIASUBTYPE_RGB24; > wmtMediaType->bFixedSizeSamples = FALSE; > wmtMediaType->bTemporalCompression = FALSE; > wmtMediaType->lSampleSize = 0; > wmtMediaType->formattype = WMFORMAT_VideoInfo; > wmtMediaType->pUnk = NULL; > wmtMediaType->cbFormat = > sizeof( WMVIDEOINFOHEADER ); > wmtMediaType->pbFormat = (unsigned char > *)new WMVIDEOINFOHEADER; > wmtMediaType->pbFormat = (unsigned char *) > &vihVideoInfo; > > // set media type > hr = pMediaProps->SetMediaType( wmtMediaType );
|