WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

why avi file I write can not play?!!!!

 
   Home -> Windows Other -> Multimedia RSS
Next:  Unable to play MPEG  
Author Message
hdzhang264

External


Since: Apr 06, 2005
Posts: 1



(Msg. 1) Posted: Wed Apr 06, 2005 10:23 am
Post subject: why avi file I write can not play?!!!!
Archived from groups: microsoft>public>windowsme>multimedia (more info?)

the source codec as following:
(After I compressed a avi file using cinepak codec, I found it can not be
open by player or vitrulDub. When I use my own player , the function
"AVIFileOpen" returns error code 0x80044066)

why?

//'m_pStreamIn' is a stream which has been opened.

void CAviEdit::WriteAviFile1(CString fileName) //come frome zxh
{
PAVIFILE pf; //PAVISTREAM ps,
PAVISTREAM psSmall=NULL;
PAVISTREAM psCompressed;
AVISTREAMINFO strhdr;
BITMAPINFOHEADER bi;
HRESULT hr;

LONG mmm=sizeof(bi);
hr=AVIStreamReadFormat(m_pStreamIn, 0, &bi, &mmm); // Read format
if (hr != AVIERR_OK) AfxMessageBox("AVIStreamReadFormat");
hr=AVIStreamInfo(m_pStreamIn, &strhdr, sizeof(strhdr));
if (hr != AVIERR_OK) AfxMessageBox("AVIStreamInfo");

hr=AVIFileOpen(&pf, fileName, OF_CREATE|OF_WRITE , NULL);
if (hr != AVIERR_OK) AfxMessageBox("AVIFileOpen");
ZeroMemory(&strhdr,sizeof(strhdr));
strhdr.fccType =streamtypeVIDEO;//
m_asiStreamInfoIn.fccType;//
strhdr.fccHandler= 0;//m_asiStreamInfoIn.fccHandler;
strhdr.dwScale=m_asiStreamInfoIn.dwScale;
strhdr.dwRate=m_asiStreamInfoIn.dwRate;
strhdr.dwSuggestedBufferSize=720*576*3;
strhdr.rcFrame=m_asiStreamInfoIn.rcFrame;
/*
strhdr.dwFlags=m_asiStreamInfoIn.dwFlags;
strhdr.wPriority=m_asiStreamInfoIn.wPriority;
strhdr.wLanguage=m_asiStreamInfoIn.wLanguage;
strhdr.dwStart=m_asiStreamInfoIn.dwStart;

strhdr.dwLength=m_asiStreamInfoIn.dwLength;//m_nEditLastFrame-m_nEditFirstFr
ame+1;
strhdr.dwInitialFrames=m_asiStreamInfoIn.dwInitialFrames;
strhdr.dwQuality=m_asiStreamInfoIn.dwQuality;
strhdr.dwSampleSize=m_asiStreamInfoIn.dwSampleSize;
strhdr.dwFormatChangeCount=m_asiStreamInfoIn.dwFormatChangeCount;
strcpy(strhdr.szName,m_asiStreamInfoIn.szName);
*/
hr=AVIFileCreateStream(pf, &psSmall, &strhdr); //ÓÐʱ»áÓöµ½ÎÊÌâ
if (hr != AVIERR_OK) AfxMessageBox("AVIFileCreateStream");

AVICOMPRESSOPTIONS opts;
AVICOMPRESSOPTIONS FAR * aopts[1] = {&opts};
memset(&opts, 0, sizeof(opts));
//LPAVICOMPRESSOPTIONS opts;
//opts=new AVICOMPRESSOPTIONS;//memset(&opts, 0, sizeof(opts));
aopts[0]->fccType=streamtypeVIDEO;
//// opts.fccHandler:=mmioFOURCC('d','i','v','x');
if(!AVISaveOptions(NULL, 0, 1, &psSmall,(LPAVICOMPRESSOPTIONS FAR *)
&aopts/*&opts*/))
AfxMessageBox("AVISaveOptions");
hr=AVIMakeCompressedStream(&psCompressed, psSmall, &opts, NULL);
if (hr != AVIERR_OK)
AfxMessageBox("AVIMakeCompressedStream");



hr=AVIStreamSetFormat(psCompressed, 0, &bi, sizeof(bi));
if (hr != AVIERR_OK)
AfxMessageBox("AVIStreamSetFormat");

//PGETFRAME pgf;
BYTE *lpbuff;
//pgf=AVIStreamGetFrameOpen(m_pStreamIn,&bi);
int leng=m_nEditLastFrame-m_nEditFirstFrame+1;
for(int i=AVIStreamStart(m_pStreamIn);i<AVIStreamEnd(m_pStreamIn); i++)
{
lpbuff=(BYTE *)AVIStreamGetFrame(m_pFrame,m_nEditFirstFrame+i);
//hr = AVIStreamRead(m_pStreamIn, i, 1, lpbuff,
m_bmihStreamIn.biSizeImage,NULL, NULL);
hr=AVIStreamWrite(psCompressed, i, 1,
lpbuff+sizeof(BITMAPINFOHEADER),
bi.biSizeImage, AVIIF_KEYFRAME, NULL, NULL);
if (hr != AVIERR_OK) AfxMessageBox("AVIStreamWrite");
}

//hr=AVIStreamGetFrameClose(pgf);
//if (hr != AVIERR_OK) AfxMessageBox("AVIStreamGetFrameClose");
while(AVIStreamRelease(psSmall)!=0)
{};
while(AVIStreamRelease(psCompressed)!=0)
{};
while(AVIFileRelease(pf)!=0)
{};

}
Back to top
Login to vote
Display posts from previous:   
       Home -> Windows Other -> Multimedia All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
  Windows Other
 Office
 Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET