MSDN索引AVIfile samples (DIB sequence file handler),是个com,里面的函数可以实现,用mmio函数,你可以看看怎么做的。

解决方案 »

  1.   

    BMP是图片 AVI是视频,转换是没有什么意义的
    如果就一些图片的话,还不如合成成GIFmmio函数也没有处理这种东西的
      

  2.   

    发表意见之前最好先看看,这是它的其中一个func:
    HRESULT NEAR PASCAL CAVIFile::LoadFrame(
    LONG lPos)
    {
            char            ach[_MAX_PATH];
            HMMIO           hmmio;
            BITMAPFILEHEADER        bfh;
            BITMAPINFOHEADER        bih;
            SCODE           sc = 0;
            UINT            ui;        //
            // Check if we've already loaded this frame...
            //
            if (lPos == lCurFrame)
            return 0;        //
            // Build the filename by printing using our template
            //
            wsprintf(ach, achFilenameTemplate, dwFirstFrame + lPos);        // No system error box, please.
            ui = SetErrorMode(SEM_NOOPENFILEERRORBOX);        //
            // Go try to read the frame... Because of SHARE we have to try
            // opening it two different ways.
            //
            hmmio = mmioOpen(ach, NULL, MMIO_READ | OF_SHARE_DENY_WRITE);
            if (!hmmio) {
                    hmmio = mmioOpen(ach, NULL, MMIO_READ);
            if (!hmmio)
                    return ResultFromScode(AVIERR_FILEOPEN);
            }        SetErrorMode(ui);        //
            // Read the BitmapFileHeader...
            //
            if (mmioRead(hmmio, (LPSTR) &bfh, sizeof(bfh)) != sizeof(bfh)) {
            sc = AVIERR_FILEREAD;
            goto error;
            }        if (bfh.bfType != BFT_BITMAP) {
            sc = AVIERR_BADFORMAT;
            goto error;
            }        //
            // Read the BitmapInfoHeader...
            //
            if (mmioRead(hmmio, (LPSTR) &bih, sizeof(bih)) != sizeof(bih)) {
            sc = AVIERR_FILEREAD;
            goto error;
            }        if (bih.biSize < sizeof(bih)) {
            sc = AVIERR_BADFORMAT;
            goto error;
            }        // Check that the width and height match....
            if ((finfo.dwWidth && finfo.dwWidth != (DWORD) bih.biWidth) ||
            (finfo.dwHeight && finfo.dwHeight != (DWORD) bih.biHeight)) {
            sc = AVIERR_BADFORMAT;
            goto error;
            }        // Fix up some fields in the header...
            if (bih.biSizeImage == 0) {
            bih.biSizeImage = DIBWIDTHBYTES(bih) * bih.biHeight;
            }        if (bih.biClrUsed == 0 && bih.biBitCount <= 8 && bih.biCompression <= BI_RLE8)
            bih.biClrUsed = 1 << bih.biBitCount;        cbFormat = bih.biSize + bih.biClrUsed * sizeof(RGBQUAD);        // Allocate space for the format
            if (cbFormat > cbFormatBuffer) {
            if (lpFormat) {
                    GlobalFreePtr(lpFormat);
                    lpFormat = 0;
                    cbFormatBuffer = 0;
            }        lpFormat = GlobalAllocPtr(GMEM_MOVEABLE | GMEM_DDESHARE, cbFormat);
            if (!lpFormat) {
                    sc = AVIERR_MEMORY;
                    goto error;
            }        cbFormatBuffer = cbFormat;
            }        *((LPBITMAPINFOHEADER) lpFormat) = bih;        // If the format is bigger than a BITMAPINFOHEADER, read the rest....
            if (cbFormat > sizeof(bih)) {
            if (mmioRead(hmmio, (LPSTR) lpFormat + sizeof(bih),
                    cbFormat - (LONG)sizeof(bih))
                    != cbFormat - (LONG)sizeof(bih))
            {
                    sc = AVIERR_FILEREAD;
                    goto error;
            }
            }        //
            // Allocate enough space to read the frame in...
            //
            if (bih.biSizeImage > (DWORD) cbFrameBuffer) {
            if (lpFrame) {
                    GlobalFreePtr(lpFrame);
                    lpFrame = 0;
                    cbFrameBuffer = 0;
            }        lpFrame = GlobalAllocPtr(GMEM_MOVEABLE | GMEM_DDESHARE, bih.biSizeImage);
            if (!lpFrame) {
                    sc = AVIERR_MEMORY;
                    goto error;
            }        cbFrameBuffer = bih.biSizeImage;
            }        cbFrame = bih.biSizeImage;        //
            // and actually read the frame....
            //
            if (mmioRead(hmmio, (LPSTR) lpFrame, cbFrame) != cbFrame) {
            sc = AVIERR_FILEREAD;
            goto error;
            }        lCurFrame = lPos;error:
            mmioClose(hmmio, 0);        return ResultFromScode(sc);
    }当然实现不只这一个func,转换为什么没有意义?只要有目的就有意义,使用mmio并不是说mmio直接支持,如果是AVI->BMP直接用AVI func就可以实现,我有改MSDN AVIEdit sample实现这个功能。
      

  3.   

    你要看格式可以看MSDN中的AVI RIFF File Reference,AVI是RIFF(资源交互文件格式)和WAV是一类,也可以到wotsit.org找找,有AVI和RIFF的介绍。
      

  4.   

    那只有对一帧的处理,对于编辑AVI有很大用处。
    但是如果我给你10幅图片,让你转换成AVI,你怎么个想法呢。
    我不是说这个函数没有意思,我是说单单是转换几个图片是没
    有意义的。你看他的问题,想把BMP转换成AVI,如果AVI只有
    几帧的话,还能称为AVI么。