Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Entertainment » microsoft.public.windowsmedia.sdk
Thread: Configuring Image Stream

HTVi
TV Discussion Newsgroups

Configuring Image Stream
vishy <vishwanath.kinekar[ at ]gmail.com> 5/3/2007 10:48:21 AM

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-
[Quoted Text]
>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 );

Error in Configuring Image Stream
vishy <vishwanath.kinekar[ at ]gmail.com> 5/4/2007 3:51:22 AM
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 );


Re: Configuring Image Stream
sasha <abc[ at ]fox.net> 5/4/2007 4:58:51 PM
vishy 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.
>
>> following is the code sample for image configuration that i used
>
> vihVideoInfo.bmiHeader.biSizeImage = (pBmiHdr-
>> biHeight * pBmiHdr->biWidth * pBmiHdr->biBitCount) / 8;


This is not quite correct. The scan line has to be DWORD-aligned.

> wmtMediaType->pbFormat = (unsigned char
> *)new WMVIDEOINFOHEADER;
> wmtMediaType->pbFormat = (unsigned char *)
> &vihVideoInfo;

Is that correct?

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen