• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ AVIFileOpen函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中AVIFileOpen函数的典型用法代码示例。如果您正苦于以下问题:C++ AVIFileOpen函数的具体用法?C++ AVIFileOpen怎么用?C++ AVIFileOpen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了AVIFileOpen函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: close

bool CvCaptureAVI_VFW::open( const char* filename )
{
    close();
    icvInitCapture_VFW();

    if( !filename )
        return false;

    HRESULT hr = AVIFileOpen( &avifile, filename, OF_READ, NULL );
    if( SUCCEEDED(hr))
    {
        hr = AVIFileGetStream( avifile, &avistream, streamtypeVIDEO, 0 );
        if( SUCCEEDED(hr))
        {
            hr = AVIStreamInfo( avistream, &aviinfo, sizeof(aviinfo));
            if( SUCCEEDED(hr))
            {
                size.width = aviinfo.rcFrame.right - aviinfo.rcFrame.left;
                size.height = aviinfo.rcFrame.bottom - aviinfo.rcFrame.top;
                BITMAPINFOHEADER bmihdr = icvBitmapHeader( size.width, size.height, 24 );

                film_range.start_index = (int)aviinfo.dwStart;
                film_range.end_index = film_range.start_index + (int)aviinfo.dwLength;
                fps = (double)aviinfo.dwRate/aviinfo.dwScale;
                pos = film_range.start_index;
                getframe = AVIStreamGetFrameOpen( avistream, &bmihdr );
                if( getframe != 0 )
                    return true;
            }
        }
    }

    close();
    return false;
}
开发者ID:MasaMune692,项目名称:alcexamples,代码行数:35,代码来源:cap_vfw.cpp


示例2: test_ash1_corruption2

static void test_ash1_corruption2(void)
{
    COMMON_AVI_HEADERS cah;
    char filename[MAX_PATH];
    PAVIFILE pFile;
    int res;
    PAVISTREAM pStream1;
    AVISTREAMINFO asi1;

    GetTempPath(MAX_PATH, filename);
    strcpy(filename+strlen(filename), testfilename);

    /* Corrupt the block alignment in the audio format header */
    init_test_struct(&cah);
    cah.pcmwf.wf.nBlockAlign = 0xdead;

    create_avi_file(&cah, filename);

    res = AVIFileOpen(&pFile, filename, OF_SHARE_DENY_WRITE, 0L);
    ok(res == 0, "Unable to open file: error=%u\n", res);

    res = AVIFileGetStream(pFile, &pStream1, 0, 1);
    ok(res == 0, "Unable to open audio stream: error=%u\n", res);

    ok(AVIStreamInfo(pStream1, &asi1, sizeof(AVISTREAMINFO)) == 0, "Unable to read stream info\n");

    /* The result will also be the corrupt value, as explained above. */
    ok(asi1.dwSampleSize == 0xdead, "got 0x%x (expected 0xdead)\n", asi1.dwSampleSize);

    AVIStreamRelease(pStream1);
    AVIFileRelease(pFile);
    ok(DeleteFile(filename) !=0, "Deleting file %s failed\n", filename);
}
开发者ID:austin987,项目名称:wine,代码行数:33,代码来源:api.c


示例3: test_ash1_corruption

static void test_ash1_corruption(void)
{
    COMMON_AVI_HEADERS cah;
    char filename[MAX_PATH];
    PAVIFILE pFile;
    int res;
    PAVISTREAM pStream1;
    AVISTREAMINFO asi1;

    GetTempPath(MAX_PATH, filename);
    strcpy(filename+strlen(filename), testfilename);

    /* Corrupt the sample size in the audio stream header */
    init_test_struct(&cah);
    cah.ash1.dwSampleSize = 0xdeadbeef;

    create_avi_file(&cah, filename);

    res = AVIFileOpen(&pFile, filename, OF_SHARE_DENY_WRITE, 0L);
    ok(res == 0, "Unable to open file: error=%u\n", res);

    res = AVIFileGetStream(pFile, &pStream1, 0, 1);
    ok(res == 0, "Unable to open audio stream: error=%u\n", res);

    res = AVIStreamInfo(pStream1, &asi1, sizeof(AVISTREAMINFO));
    ok(res == 0, "Unable to read stream info: error=%u\n", res);

    /* The result will still be 2, because the value is dynamically replaced with the nBlockAlign
       value from the stream format header. The next test will prove this */
    ok(asi1.dwSampleSize == 2, "got %u (expected 2)\n", asi1.dwSampleSize);

    AVIStreamRelease(pStream1);
    AVIFileRelease(pFile);
    ok(DeleteFile(filename) !=0, "Deleting file %s failed\n", filename);
}
开发者ID:austin987,项目名称:wine,代码行数:35,代码来源:api.c


示例4: CreateAvi

HAVI CreateAvi (const TCHAR *filename, int frameperiod, const WAVEFORMATEX *wfx)
{
	PAVIFILE pfile;
	HRESULT hr;
	TAviUtil *au;

	AVIFileInit();
	hr = AVIFileOpen(&pfile, filename, OF_WRITE | OF_CREATE, NULL);
	if (hr)
	{
		AVIFileExit();
		return NULL;
	}
	au = (TAviUtil *)malloc(sizeof(TAviUtil));
	au->pfile = pfile;
	if (wfx)
		CopyMemory(&au->wfx, wfx, sizeof(WAVEFORMATEX));
	else	ZeroMemory(&au->wfx, sizeof(WAVEFORMATEX));
	au->period = frameperiod;
	au->audStream = NULL;
	au->vidStream = NULL;
	au->vidStreamComp = NULL;
	au->nframe = 0;
	au->nsamp = 0;
	au->iserr = FALSE;
	return (HAVI)au;
}
开发者ID:MounikaArkala,项目名称:txstateprojects,代码行数:27,代码来源:AVI.cpp


示例5: FileDlg

void CMainFrame::InitAVIWriteOpt()
{
	CString filename;
	CFileDialog FileDlg(FALSE,_T("avi"));
	if (FileDlg.DoModal()==IDOK)
	{
		filename = FileDlg.GetPathName();
		//capGetVideoFormat(m_hWndCap,&m_InInfo,sizeof(m_InInfo));
		m_Frame = 0 ;
		//AVI文件初始化
		AVIFileInit() ;
		bSaveAVI = TRUE;
		
		//打开文件
		AVIFileOpen(&m_pFile,filename,OF_WRITE | OF_CREATE,NULL);
		memset(&strhdr, 0, sizeof(strhdr)) ;
		strhdr.fccType    = streamtypeVIDEO; 
		strhdr.fccHandler = 0  ;
		strhdr.dwScale    = 1  ;
		strhdr.dwRate     = 25 ; 
		strhdr.dwSuggestedBufferSize = lpbiIn->bmiHeader.biSizeImage;
		SetRect(&strhdr.rcFrame, 0, 0, lpbiIn->bmiHeader.biWidth, lpbiIn->bmiHeader.biHeight);
		ps = NULL;
		//文件文件流
		AVIFileCreateStream(m_pFile,&ps,&strhdr); 
		
		//开始捕捉
		capCaptureSequenceNoFile(m_hWndCap);
	}
}
开发者ID:hiccupzhu,项目名称:misc_starting,代码行数:30,代码来源:MainFrm.cpp


示例6: AVIFileInit

int imFileFormatAVI::New(const char* file_name)
{
  /* initializes avi file library, can be called many times */
  AVIFileInit();

  /* creates a new file */
  HRESULT hr = AVIFileOpen(&file, file_name, OF_WRITE | OF_CREATE, NULL);
  if (hr != 0)
  {
    AVIFileExit();

    if (hr == AVIERR_FILEOPEN)
      return IM_ERR_OPEN;
    else if (hr == AVIERR_BADFORMAT || hr == REGDB_E_CLASSNOTREG)
      return IM_ERR_FORMAT;
    else
      return IM_ERR_ACCESS;
  }

  this->frame = 0;
  this->stream = 0;
  this->use_compressor = 0;
  this->dib = 0;

  return IM_ERR_NONE;
}
开发者ID:gcfavorites,项目名称:tastools,代码行数:26,代码来源:im_format_avi.cpp


示例7: Open

bool CBmpToAvi::Open( LPCTSTR szFile, LPBITMAPINFO lpbmi )
{
	if (szFile == NULL)
		return false;
	m_nFrames = 0;

	if (AVIFileOpen(&m_pfile, szFile, OF_WRITE | OF_CREATE, NULL))
		return false;

	m_si.fccType = streamtypeVIDEO;
	m_si.fccHandler = BI_RGB;
	m_si.dwScale = 1;
	m_si.dwRate = 5; // 每秒5帧
	SetRect(&m_si.rcFrame, 0, 0, lpbmi->bmiHeader.biWidth, lpbmi->bmiHeader.biHeight);
	m_si.dwSuggestedBufferSize = lpbmi->bmiHeader.biSizeImage;


	if (AVIFileCreateStream(m_pfile, &m_pavi, &m_si))
		return false;


	if (AVIStreamSetFormat(m_pavi, 0, lpbmi, sizeof(BITMAPINFO)) != AVIERR_OK)
		return false;

	return true;
}
开发者ID:26597925,项目名称:Remote,代码行数:26,代码来源:VideoDlg.cpp


示例8: AVIFileInit

bool CAviHelper::AVI_resolution(const wstring& strAviFileName, int& width, int& height)
{
	AVIFileInit();
	PAVIFILE avi;
	int res = AVIFileOpen(&avi, WS2S(strAviFileName).c_str(), OF_READ, NULL);
	int n = GetLastError();
	if (res!=AVIERR_OK)
	{
		//an error occures
		if (avi!=NULL)
			AVIFileRelease(avi);
		return false;
	}

	AVIFILEINFO avi_info;
	memset(&avi_info, 0, sizeof(AVIFILEINFO));

	res = AVIFileInfo(avi, &avi_info, sizeof(AVIFILEINFO));
	if( res != AVIERR_OK)
	{
		AVIFileExit();
		return false;
	}
	width = avi_info.dwWidth;
	height = avi_info.dwHeight;

	AVIFileExit();
	return true;
}
开发者ID:killbug2004,项目名称:DvrWorkstation,代码行数:29,代码来源:AviHelper.cpp


示例9: AVIFileOpen

bool CAVIFile::Open(const char *filename)
{
  HRESULT hr = AVIFileOpen(&pfile,		    // returned file pointer
                           filename,							// file name
                           OF_WRITE | OF_CREATE,		    // mode to open file with
                           NULL);							// use handler determined
  // from file extension....
  if (hr != AVIERR_OK) {
    bOK = false;
    return false;
  }
  memset(&strhdr, 0, sizeof(strhdr));
  strhdr.fccType                = streamtypeVIDEO;// stream type
  strhdr.fccHandler             = 0;
  strhdr.dwScale                = 1;
  strhdr.dwRate                 = rate;
  strhdr.dwSuggestedBufferSize  = bitmap.biSizeImage;
  SetRect(&strhdr.rcFrame,
          0,
          0,		    // rectangle for stream
          (int) bitmap.biWidth,
          (int) bitmap.biHeight);
      
  // And create the stream;
  hr = AVIFileCreateStream(pfile,		    // file pointer
                           &ps,		    // returned stream pointer
                           &strhdr);	    // stream header
  if (hr != AVIERR_OK) {
    bOK = false;
    return false;
  }
      
  memset(&opts, 0, sizeof(opts));
  
  if(!AVISaveOptions(hWindow, 0, 1, &ps, aopts)) {
    bOK = false;
    return false;
  }
      
  hr = AVIMakeCompressedStream(&psCompressed, ps, &opts, NULL);
  if (hr != AVIERR_OK) {
    bOK = false;
    return false;
  }
      
  hr = AVIStreamSetFormat(psCompressed, 0,
                          &bitmap,	    // stream format
                          bitmap.biSize +   // format size
                          bitmap.biClrUsed * sizeof(RGBQUAD));
  if (hr != AVIERR_OK) {
    bOK = false;
    return false;
  }

  return true;
}
开发者ID:BackupTheBerlios,项目名称:vbastep-svn,代码行数:56,代码来源:WriteAVI.cpp


示例10: OpenSoundFile

BOOL OpenSoundFile(HWND hWnd,PAVISTREAM *pavi)
	{
#ifndef INTERIM_64_BIT	// CCJ
	OPENFILENAME ofn;
	char filter[256];

	AVIBuildFilter(filter,sizeof(filter),FALSE);

	ofn.lStructSize       = sizeof(OPENFILENAME);
	ofn.hwndOwner         = hWnd;
	ofn.hInstance         = NULL;	
	ofn.lpstrTitle        = GetResString(IDS_RB_OPENSOUND);
	ofn.lpstrFilter       = filter;
	ofn.lpstrCustomFilter = NULL;
	ofn.nMaxCustFilter    = 0;
	ofn.nFilterIndex      = 0;
	ofn.lpstrFile         = fileName;
	ofn.nMaxFile          = sizeof(fileName);
	ofn.lpstrFileTitle    = NULL;
	ofn.nMaxFileTitle     = 0;
	ofn.lpstrInitialDir   = NULL;
	ofn.Flags             = OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY;
	ofn.nFileOffset       = 0;
	ofn.nFileExtension    = 0;
	ofn.lpstrDefExt       = NULL;
	ofn.lCustData         = 0;
	ofn.lpfnHook          = NULL;
	ofn.lpTemplateName    = NULL;

	if (GetOpenFileNamePreview(&ofn)) {
		HRESULT		hr;
    	PAVIFILE	pfile;
		PAVISTREAM	pstream;
		BOOL res = TRUE;

   	 	hr = AVIFileOpen(&pfile,fileName,OF_READ,NULL);
    	if (hr) return FALSE;

		if (AVIFileGetStream(
				pfile,&pstream,streamtypeAUDIO,0) != AVIERR_OK) {			
			res = FALSE;
			goto done;
			}
		
		*pavi = pstream;

	done:
		AVIFileRelease(pfile);
		return res;
	} else {
		return FALSE;
		}
#else	// INTERIM_64_BIT
	return FALSE;
#endif	// INTERIM_64_BIT
	}
开发者ID:2asoft,项目名称:xray,代码行数:56,代码来源:sound.cpp


示例11: _Open

		bool AviFrameGraber::_Open(void){
			//thread_handle_ !=NULL means it is already opened
			if (thread_handle_!=NULL)	return false;

			int res=AVIFileOpen(&avi_file_, file_path_.c_str(), OF_READ, NULL);
			if (res!=AVIERR_OK){
				woodychang0611::diagnostics::SendError(_T("AviFrameGraber Open File Fail"));
				_Close();
				return false;
			}
			res=AVIFileGetStream(avi_file_, &stream_, streamtypeVIDEO, 0/*first stream*/);
			if (res!=AVIERR_OK){
				woodychang0611::diagnostics::SendError(_T("AviFrameGraber Get Stream Fail"));
				_Close();
				return false;
			}
			if (AVIStreamStart(stream_)==-1 || AVIStreamLength(stream_)==-1){
				woodychang0611::diagnostics::SendError(_T("AviFrameGraber Stream Start or Length no correct"));
				_Close();
				return false;								
			}
			AVIFileInfo(avi_file_, &avi_info_, sizeof(AVIFILEINFO));
			BITMAPINFOHEADER bih;
			bih.biSize = sizeof(BITMAPINFOHEADER);
			bih.biWidth = avi_info_.dwWidth;
			bih.biHeight = avi_info_.dwHeight;
			bih.biPlanes = 1;
			bih.biBitCount = 24;
			bih.biCompression = BI_RGB;
			bih.biSizeImage = 0;
			bih.biXPelsPerMeter = 0;
			bih.biYPelsPerMeter = 0;
			bih.biClrUsed = 0;
			bih.biClrImportant = 0;
			frame_=AVIStreamGetFrameOpen(stream_, (LPBITMAPINFOHEADER) &bih);
			if (frame_ !=NULL){
				start_frame_ = AVIStreamStart(stream_);
				frame_length_ = AVIStreamLength(stream_);
				current_frame_ = start_frame_;

				//Set Frame info
				frame_info_.start_frame_=start_frame_;
				frame_info_.frame_length_ =frame_length_; 
				frame_info_.frame_per_second_=(FLOAT32)avi_info_.dwRate/avi_info_.dwScale;
				frame_info_.frame_width_=(UINT16) avi_info_.dwWidth;
				frame_info_.frame_height_=(UINT16)  avi_info_.dwHeight;
				_status = FRAME_SUBJECT_PAUSE;
				thread_handle_ =CreateThread(NULL ,0,this->_ThreadFunc,this,0,NULL);
				return true;
			}else{
				woodychang0611::diagnostics::SendError(_T("AviFrameGraber Get Frame Failed"));
			}
			return false;
		}
开发者ID:woodychang0611,项目名称:CLRImageDemo,代码行数:54,代码来源:avi_frame_graber.cpp


示例12: Open

bool AVIWrite::Open(const char *filename)
{
  // create the AVI file
  if(FAILED(AVIFileOpen(&m_file,
                        filename,
                        OF_WRITE | OF_CREATE,
                        NULL))) {
    m_failed = true;
    return false;
  }
  // setup the video stream information
  ZeroMemory(&m_header, sizeof(AVISTREAMINFO));
  m_header.fccType = streamtypeVIDEO;
  m_header.dwScale = 1;
  m_header.dwRate = m_fps;
  m_header.dwSuggestedBufferSize  = m_bitmap.biSizeImage;

  // create the video stream
  if(FAILED(AVIFileCreateStream(m_file,
                                &m_stream,
                                &m_header))) {
    m_failed = true;
    return false;
  }
      
  ZeroMemory(&m_options, sizeof(AVICOMPRESSOPTIONS));
  m_arrayOptions[0] = &m_options;

  // call the dialog to setup the compress options to be used
  if(!AVISaveOptions(AfxGetApp()->m_pMainWnd->GetSafeHwnd(), 0, 1, &m_stream, m_arrayOptions)) {
    m_failed = true;
    return false;
  }
  
  // create the compressed stream
  if(FAILED(AVIMakeCompressedStream(&m_streamCompressed, m_stream, &m_options, NULL))) {
    m_failed = true;
    return false;
  }
  
  // setup the video stream format
  if(FAILED( AVIStreamSetFormat(m_streamCompressed, 0,
                                &m_bitmap,
                                m_bitmap.biSize +
                                m_bitmap.biClrUsed * sizeof(RGBQUAD)))) {
    m_failed = true;
    return false;
  }

  return true;
}
开发者ID:Brukwa,项目名称:VisualBoyAdvance,代码行数:51,代码来源:AVIWrite.cpp


示例13: CreateAvi

HAVI CreateAvi(const char *fn, int frameperiod, const WAVEFORMATEX *wfx)
{ IAVIFile *pfile;
  AVIFileInit();
  HRESULT hr = AVIFileOpen(&pfile, fn, OF_WRITE|OF_CREATE, NULL);
  if (hr!=AVIERR_OK) {AVIFileExit(); return NULL;}
  TAviUtil *au = new TAviUtil;
  au->pfile = pfile;
  if (wfx==NULL) ZeroMemory(&au->wfx,sizeof(WAVEFORMATEX)); else CopyMemory(&au->wfx,wfx,sizeof(WAVEFORMATEX));
  au->period = frameperiod;
  au->as=0; au->ps=0; au->psCompressed=0;
  au->nframe=0; au->nsamp=0;
  au->iserr=false;
  return (HAVI)au;
}
开发者ID:QuinntyneBrown,项目名称:blog,代码行数:14,代码来源:avi_utils.cpp


示例14: AVIFileInit

void VideoReader::Open(CString strFilePath)
{    
    AVIFileInit();

    LONG hr;  
    hr = AVIStreamOpenFromFile(&m_pAviStream, strFilePath, streamtypeVIDEO, 0, OF_READ, NULL);
    if (hr != 0){ 
        // Handle failure.
        AfxMessageBox(L"Failed to open file, file must be an uncompressed video."); 
    }
    else
    {
        HRESULT          hr; 
        AVISTREAMINFO    strhdr; 
        LONG             lStreamSize; 
 

        // Determine the size of the format data using 
        // AVIStreamFormatSize. 
        AVIStreamFormatSize(m_pAviStream, 0, &lStreamSize); 
        if (lStreamSize > sizeof(m_bi)) // Format too large? 
            return; 

        lStreamSize = sizeof(m_bi); 
        hr = AVIStreamReadFormat(m_pAviStream, 0, &m_bi, &lStreamSize); // Read format 
        if (m_bi.biCompression != BI_RGB) // Wrong compression format? 
            return; 

        hr = AVIStreamInfo(m_pAviStream, &strhdr, sizeof(strhdr)); 

        // Create new AVI file using AVIFileOpen. 
        hr = AVIFileOpen(&m_pf, strFilePath + L".Processed.avi", OF_WRITE | OF_CREATE, NULL); 
        if (hr != 0) 
            return; 

        m_currentSize = AVIStreamStart(m_pAviStream);

        // Allocate memory for the bitmaps. 
        m_lpBuffer = (BYTE *)malloc(m_bi.biSizeImage); 
    }

}
开发者ID:bryan610,项目名称:concrtextras,代码行数:42,代码来源:VideoAgent.cpp


示例15: test_amh_corruption

static void test_amh_corruption(void)
{
    COMMON_AVI_HEADERS cah;
    char filename[MAX_PATH];
    PAVIFILE pFile;
    int res;

    GetTempPath(MAX_PATH, filename);
    strcpy(filename+strlen(filename), testfilename);

    /* Make sure only AVI files with the proper headers will be loaded */
    init_test_struct(&cah);
    cah.fh[3] = mmioFOURCC('A', 'V', 'i', ' ');

    create_avi_file(&cah, filename);
    res = AVIFileOpen(&pFile, filename, OF_SHARE_DENY_WRITE, 0L);
    ok(res != 0, "Able to open file: error=%u\n", res);

    ok(DeleteFile(filename) !=0, "Deleting file %s failed\n", filename);
}
开发者ID:austin987,项目名称:wine,代码行数:20,代码来源:api.c


示例16: AVIFileInit

BOOL FMPlayerDShow::GetAVIInfo(const tchar* pFileName)
{
	AVIFileInit();

	PAVIFILE pfile;
	BOOL bOK = FALSE; 
	if(AVIFileOpen(&pfile, pFileName, OF_SHARE_DENY_NONE, 0L) == 0)
	{
		AVIFILEINFO afi;
		memset(&afi, 0, sizeof(afi));
		AVIFileInfo(pfile, &afi, sizeof(AVIFILEINFO));

		CComPtr<IAVIStream> pavi;
		if(AVIFileGetStream(pfile, &pavi, streamtypeVIDEO, 0) == AVIERR_OK)
		{
			AVISTREAMINFO si;
			AVIStreamInfo(pavi, &si, sizeof(si));
			m_FourCC = FormatFourCC(si.fccHandler);
			m_FrameRate = (double)si.dwRate / (double)si.dwScale; 

			LONG lFormat; 
			if (0 == AVIStreamFormatSize(pavi, 0, &lFormat))
			{
				char* pBuf = new char[lFormat];
				if (0 == AVIStreamReadFormat(pavi, 0, pBuf, &lFormat))
				{
					BITMAPINFOHEADER* pHeader = (BITMAPINFOHEADER*)pBuf; 
					m_StreamFormat = FormatFourCC(pHeader->biCompression);
				}
				delete[] pBuf; 
			}

			bOK = TRUE; 
		}

		AVIFileRelease(pfile);
	}

	AVIFileExit();
	return bOK; 
}
开发者ID:codeboost,项目名称:libertv,代码行数:41,代码来源:FMPlayerDShow.cpp


示例17: close

bool CAviLoader::open( const char* filename )
{
    close();
    icvInitCapture_VFW();

    if( !filename )
        return false;

    HRESULT hr = AVIFileOpen( &avifile, filename, OF_READ, NULL );
    if( SUCCEEDED(hr))
    {
        hr = AVIFileGetStream( avifile, &avistream, streamtypeVIDEO, 0 );
        if( SUCCEEDED(hr))
        {
            hr = AVIStreamInfo( avistream, &aviinfo, sizeof(aviinfo));
            if( SUCCEEDED(hr))
            {
                //int fcc = aviinfo.fccHandler;
                data_offset = 0;
                size.width = aviinfo.rcFrame.right - aviinfo.rcFrame.left;
                size.height = aviinfo.rcFrame.bottom - aviinfo.rcFrame.top;
                BITMAPINFOHEADER bmih = icvBitmapHeader( size.width, size.height, 24 );

				if(frame)
					delete []frame;
				frame = new unsigned char[size.width*size.height*3];
                
                film_range.start_index = (int)aviinfo.dwStart;
                film_range.end_index = film_range.start_index + (int)aviinfo.dwLength;
                fps = (double)aviinfo.dwRate/aviinfo.dwScale;
                pos = film_range.start_index;
                getframe = AVIStreamGetFrameOpen( avistream, &bmih );
                if( getframe != 0 )
                    return true;
            }
        }
    }

    close();
    return false;
}
开发者ID:dlsyaim,项目名称:sm-eye-app,代码行数:41,代码来源:AviLoader.cpp


示例18: Close

bool CAviToBmp::Open(LPCTSTR Path)
{
	Close();
	if (FAILED(m_hr = AVIFileOpen(&m_pFile, Path, OF_READ, NULL)))
		return(FALSE);
	if (FAILED(m_hr = AVIFileGetStream(m_pFile, &m_pStream, streamtypeVIDEO, 0)))
		return(FALSE);
	m_FrameCount = AVIStreamLength(m_pStream);
	long	Start = AVIStreamStart(m_pStream);
	if (Start < 0)
		return(FALSE);
	long	FmtSize;
 	if (FAILED(m_hr = AVIStreamReadFormat(m_pStream, Start, NULL, &FmtSize)))
		return(FALSE);
	m_pBmpInfo = (LPBITMAPINFO)new BYTE[FmtSize];
	if (FAILED(m_hr = AVIStreamReadFormat(m_pStream, Start, m_pBmpInfo, &FmtSize)))
		return(FALSE);
	m_pGetFrame = AVIStreamGetFrameOpen(m_pStream, (LPBITMAPINFOHEADER)AVIGETFRAMEF_BESTDISPLAYFMT);
	if (m_pGetFrame == NULL)
		return(FALSE);
	return(TRUE);
}
开发者ID:fdiskcn,项目名称:Whorld,代码行数:22,代码来源:AviToBmp.cpp


示例19: sprintf

 void AVIExporter::open() {
    frameIdx = 0;
    fileSize = 0;

    // generate output file name depending on video file index
    std::string fileName = outputFileName;
    if (fileIdx++ > 0) {
        char insertion[32];
        sprintf(insertion, ".part%02d", fileIdx);
        size_t dotLPos = fileName.rfind('.');
        if (dotLPos != std::string::npos) {
            fileName.insert(dotLPos, insertion);
        } else {
            fileName += insertion;
        }
    }

    AVIFileInit();

    HRESULT aviOpenResult = AVIFileOpen(&outputFile, fileName.c_str(), OF_WRITE | OF_CREATE, NULL);
    if (aviOpenResult != AVIERR_OK) {
        debugLog("Failed to open avi file: %s - %08x\n", fileName.c_str(), aviOpenResult);
        close();
        throw ExporterException(fileName);
    }

    if (!CreateVideoStream(frameRate, display.width, display.height, &outputFile, &videoStream)) {
        debugLog("Failed to create video stream for avi file: %s\n", fileName.c_str());
        close();
        throw ExporterException(fileName);
    }

    if (!MakeCompressedVideoStream(display.width, display.height, &videoOptions, videoStream, &compressedVideoStream)) {
        debugLog("Failed to create compressed video stream for avi file: %s\n", fileName.c_str());
        close();
        throw ExporterException(fileName);
    }
}
开发者ID:Rageous,项目名称:Core,代码行数:38,代码来源:ppm.cpp


示例20: HIWORD

HRESULT CAVIGenerator::InitEngine()
{
	AVISTREAMINFO strHdr; // information for a single stream 
	static AVICOMPRESSOPTIONS opts;
	static AVICOMPRESSOPTIONS FAR * aopts[1] = {&opts};
	static bool first = true;

	TCHAR szBuffer[1024];
	HRESULT hr;

	m_sError=_T("Ok");

	// Step 0 : Let's make sure we are running on 1.1 
	DWORD wVer = HIWORD(VideoForWindowsVersion());
	if (wVer < 0x010a)
	{
		 // oops, we are too old, blow out of here 
		m_sError=_T("Version of Video for Windows too old. Come on, join the 21th century!");
		return S_FALSE;
	}

	// Step 1 : initialize AVI engine
	AVIFileInit();

	// Step 2 : Open the movie file for writing....
	hr = AVIFileOpen(&m_pAVIFile,			// Address to contain the new file interface pointer
		       (LPCSTR)m_sFile,				// Null-terminated string containing the name of the file to open
		       OF_WRITE | OF_CREATE,	    // Access mode to use when opening the file. 
		       NULL);						// use handler determined from file extension.
											// Name your file .avi -> very important

	if (hr != AVIERR_OK)
	{
//		sprintf(szBuffer,_T("AVI Engine failed to initialize. Check filename %s."),m_sFile);
		m_sError=szBuffer;
		// Check it succeded.
		switch(hr)
		{
		case AVIERR_BADFORMAT: 
			m_sError+=_T("The file couldn't be read, indicating a corrupt file or an unrecognized format.");
			break;
		case AVIERR_MEMORY:		
			m_sError+=_T("The file could not be opened because of insufficient memory."); 
			break;
		case AVIERR_FILEREAD:
			m_sError+=_T("A disk error occurred while reading the file."); 
			break;
		case AVIERR_FILEOPEN:		
			m_sError+=_T("A disk error occurred while opening the file.");
			break;
		case REGDB_E_CLASSNOTREG:		
			m_sError+=_T("According to the registry, the type of file specified in AVIFileOpen does not have a handler to process it");
			break;
		}

		return hr;
	}

	// Fill in the header for the video stream....
	memset(&strHdr, 0, sizeof(strHdr));
	strHdr.fccType                = streamtypeVIDEO;	// video stream type
	strHdr.fccHandler             = 0;
	strHdr.dwScale                = 1;					// should be one for video
	strHdr.dwRate                 = m_dwRate;		    // fps
	strHdr.dwSuggestedBufferSize  = m_bih.biSizeImage;	// Recommended buffer size, in bytes, for the stream.
	SetRect(&strHdr.rcFrame, 0, 0,		    // rectangle for stream
	    (int) m_bih.biWidth,
	    (int) m_bih.biHeight);

	// Step 3 : Create the stream;
	hr = AVIFileCreateStream(m_pAVIFile,		    // file pointer
			         &m_pStream,		    // returned stream pointer
			         &strHdr);	    // stream header

	// Check it succeded.
	if (hr != AVIERR_OK)
	{
		m_sError=_T("AVI Stream creation failed. Check Bitmap info.");
		if (hr==AVIERR_READONLY)
		{
			m_sError+=_T(" Read only file.");
		}
		return hr;
	}

//	if (first)
	{
		// Step 4: Get codec and infos about codec
		memset(&opts, 0, sizeof(opts));
		// Poping codec dialog
		if (!AVISaveOptions(NULL, 0, 1, &m_pStream, (LPAVICOMPRESSOPTIONS FAR *) &aopts))
		{
			AVISaveOptionsFree(1,(LPAVICOMPRESSOPTIONS FAR *) &aopts);
			return S_FALSE;
		}
//		first = false;
	}
	
	// Step 5:  Create a compressed stream using codec options.
	hr = AVIMakeCompressedStream(&m_pStreamCompressed, 
//.........这里部分代码省略.........
开发者ID:bestdpf,项目名称:xface-error,代码行数:101,代码来源:AVIGenerator.cpp



注:本文中的AVIFileOpen函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AVIFileRelease函数代码示例发布时间:2022-05-30
下一篇:
C++ AVIFileExit函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap