The simple code I've attached to this mail is supposed to open a video stream 
from an avi-file and read a single frame to save it as a bitmap-file. The 
file is written but does not have a valid image format. Could someone please 
tell me the mistake made in this code. Thank you very very much!



#include <stdio.h>
#include <avifile.h>

int main(int argc, char *argv[])
{
    IAviReadFile *file = CreateIAviReadFile(argv[1]);
    IAviReadStream *stream = file->GetStream(0, AviStream::Video);

        if(stream->StartStreaming() != 0)
            fprintf(stderr, "IVideoStream::StartStreaming() failed.");

    if(stream->Seek(stream->GetNextKeyFrame()) != 0)
        fprintf(stderr, "IVideoStream::Seek() failed.");

        CImage *image = stream->GetFrame(true);

        if(image == NULL)
        fprintf(stderr, "IVideoStream::GetFrame() failed.");


        if(stream->StopStreaming() != 0)
        fprintf(stderr, "IVideoStream::StopStreaming() failed.");

    image->Dump(argv[2]);
}


_______________________________________________
Avifile mailing list
[EMAIL PROTECTED]
http://prak.org/mailman/listinfo/avifile

Reply via email to