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: Writing Video Image Samples

HTVi
TV Discussion Newsgroups

Writing Video Image Samples
Kelum <kelumkps[ at ]gmail.com> 11/17/2008 6:20:07 PM
Hi All,
I followed the "Writing Video Image Samples" from Windows media
format documentation. (http://msdn.microsoft.com/en-us/library/aa392242
(VS.85).aspx)
But I was confused when developing an application to write video image
samples to a file. Can any one give me a example source code in C++
for that?

Thanks & Regards,
Kelum.
Re: Writing Video Image Samples
Jerislav <jerislav[ at ]gmail.com> 11/18/2008 9:17:47 AM
On Nov 17, 7:20 pm, Kelum <kelum...[ at ]gmail.com> wrote:
[Quoted Text]
> Hi All,
> I followed the "Writing Video Image Samples" from  Windows media
> format documentation. (http://msdn.microsoft.com/en-us/library/aa392242
> (VS.85).aspx)
> But I was confused when developing an application to write video image
> samples to a file. Can any one give me a example source code in C++
> for that?
>
> Thanks & Regards,
> Kelum.

You actually don't write samples to file, but configure Writing Sinks
for that, like File Writer Sync, of Network Sync etc...
For great samples you should start with:

Alessandro Angeli's Programming FAQ
http://www.riseoftheants.com/mmx/faq.htm

But for this simple task, maybe MSDN will be enough:
http://msdn.microsoft.com/en-us/library/aa384480(VS.85).aspx

Jerislav
(http://jerislav.blogspot.com)
Re: Writing Video Image Samples
Kelum <kelumkps[ at ]gmail.com> 11/21/2008 6:42:37 AM
On Nov 18, 3:17 pm, Jerislav <jeris...[ at ]gmail.com> wrote:
[Quoted Text]
> On Nov 17, 7:20 pm, Kelum <kelum...[ at ]gmail.com> wrote:
>
> > Hi All,
> > I followed the "Writing Video Image Samples" from  Windows media
> > format documentation. (http://msdn.microsoft.com/en-us/library/aa392242
> > (VS.85).aspx)
> > But I was confused when developing an application to write video image
> > samples to a file. Can any one give me a example source code in C++
> > for that?
>
> > Thanks & Regards,
> > Kelum.
>
> You actually don't write samples to file, but configure Writing Sinks
> for that, like File Writer Sync, of Network Sync etc...
> For great samples you should start with:
>
> Alessandro Angeli's Programming FAQhttp://www.riseoftheants.com/mmx/faq.htm
>
> But for this simple task, maybe MSDN will be enough:http://msdn.microsoft..com/en-us/library/aa384480(VS.85).aspx
>
> Jerislav
> (http://jerislav.blogspot.com)


Hi,

Thanks for the reply. I have created a simple application to write
video image samples according to the Windows Media Format 11
documentation ( http://msdn.microsoft.com/en-us/library/aa392242
(VS.85).aspx ). But when adding a stream to the profile object
( ppProfile->AddStream( pIStreamConfig ) ) the return value of HRESULT
is -1072889796. And also when setting the profile to the writer object
( pWriter->SetProfile(ppProfile) ), the return value of HRESULT is
-1072886842.
The source code of the program is attached with this.(I have noted the
error values as comments on the source code). Can any one help me to
identify the problem here?

Thanks & Regards,

Kelum


/////////////////////////////////////////////////////////////////
// source code
////////////////////////////////////////////////////////////////


#include "stdafx.h"
#include <wmsdk.h>


int _tmain(int argc, _TCHAR* argv[])
{

HRESULT hr = S_OK;
IWMProfile * ppProfile;
IWMProfileManager * pProfileMgr;
IWMCodecInfo3 * pCodecInfo;
IWMStreamConfig * pIStreamConfig;
IWMStreamConfig * pIWMStreamConfig2 = NULL;
IWMMediaProps * pImediaprops;
IWMMediaProps * pIWMMediaProps2 = NULL;
WM_MEDIA_TYPE * pMediaType;
IWMWriter *pWriter = NULL;
DWORD pcbType;
DWORD cCodecs = 0;
DWORD cFormats;
DWORD cStreams = 0;
DWORD cInputs = 0;
WCHAR* pwszCodecName = NULL;
DWORD cchCodecName = 0;
DWORD dwCodecIndex;
WORD wStreamNum = 0;
DWORD dwBitrate = 1024;

hr = CoInitialize( NULL );

hr = WMCreateProfileManager(&pProfileMgr);
// Create the empty profile.
hr = pProfileMgr->CreateEmptyProfile(WMT_VER_8_0, &ppProfile);

hr = pProfileMgr->QueryInterface( IID_IWMCodecInfo3, ( void ** )
&pCodecInfo );

hr = pCodecInfo->GetCodecInfoCount(WMMEDIATYPE_Video, &cCodecs);


// Loop through the video codecs.
for(dwCodecIndex = 0; dwCodecIndex < cCodecs; dwCodecIndex++)
{
hr = pCodecInfo->GetCodecFormatCount( WMMEDIATYPE_Video,
dwCodecIndex,
&cFormats );

pCodecInfo->GetCodecFormat(WMMEDIATYPE_Video,dwCodecIndex,0,
&pIStreamConfig);
hr = pIStreamConfig->QueryInterface(IID_IWMMediaProps, (void **)
&pImediaprops );
hr = pImediaprops->GetMediaType(0x00, &pcbType);
pMediaType = (WM_MEDIA_TYPE*) new BYTE[pcbType];
hr = pImediaprops->GetMediaType(pMediaType, &pcbType);

if(pMediaType->subtype == WMMEDIASUBTYPE_WMVP)
{
hr = ppProfile->CreateNewStream( pMediaType->subtype,
&pIWMStreamConfig2 );
hr = pIWMStreamConfig2->GetStreamNumber( &wStreamNum );
hr = pIStreamConfig->SetStreamNumber( wStreamNum );
hr = pIStreamConfig->SetStreamName( L"Video Stream" );
hr = pIStreamConfig->SetConnectionName( L"Video" );
hr = pIStreamConfig->SetBitrate( dwBitrate );
hr = pIStreamConfig->QueryInterface( IID_IWMMediaProps,
(void **)
&pIWMMediaProps2 );
hr = pIWMMediaProps2->SetMediaType(pMediaType );


hr = ppProfile->AddStream( pIStreamConfig ); // hr = -1072889796


hr = WMCreateWriter(NULL, &pWriter);

hr = pWriter->SetProfile(ppProfile); // hr = -1072886842

hr = pWriter->GetInputCount( &cInputs );

// rest of the programm
//
//

}
delete[] pMediaType;

}

CoUninitialize();
return 0;
}

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