Preload an AVI file

Posted on 2008-11-06
Last Modified: 2013-11-20
I have a CD with data and an application to view the data.  The application uses an MCIWnd to play an AVI file as a splash screen while data loads.  My problem is that after inserting the CD and executing the application, the video often is very jumpy.  If the application is executed a second time, the video plays smoothly.

Before the splash screen is displayed, a login screen appears.  I've already go the splash screen running in a secondary thread.  What I'd like to do to keep the video from jumping is to utilize the time the user is on the login screen to begin preloading the video.  What do I need to do to accomplish this.

So far, the two things I've tried are...
1. Hope to get the video file in the CD buffer by simply openning the AVI file and reading through it as a binary file.  Seems to work... sometimes.
2. Call the function...
    MCIWndSendString( m_hAVIWnd, "cue" );
...thinking that the "cue" command would possibly being preloading the video into MCIWnd memory.  But again, this is meeting with limited success.

Question by:HooKooDooKu
    LVL 49

    Accepted Solution

    One easy-to-program option would be to copy the file to the user's temp directory, then play it from there.  First, it could be read quickly from there and secondly, much of it would be in the filesystem cache for even more-rapid access.  
    Of course, you would need to delete the file later...
    Also, you would need to verify that the copy operation did not take so much time that it would make this scenario impractical.
    LVL 16

    Author Comment

    Sorry, I've gotten side tracked from this issue and not quit ready to jump back to it.

    DanRollins, I like the premis of the idea.  Bascially try to find a way to Cache the file on the hard drive and run it from the hard drive.  There are several ways that could possibly be implemented, especially since on second and subsequent times the program is run, I could store something in the registry that could possibly leave the file in the Temp folder and only replace it when the something like the date of the file on the CD is different from the cached date of the file in the TEMP folder.  Surely running things from the hard drive should be faster than from the CD.

    But of course the idea does require cleanup and additional maintenence.

    However, I wonder if there isn't a way I could effectively load the file into memory and run it from there?   OK, lets assign the points for this question an start that one in a new question:'play'-and-AVI-file-from-memory.html

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Suggested Solutions

    Title # Comments Views Activity
    Synchronized Accessible Media Interchange - SAMI Files 6 43
    sum28 challenge 31 82
    EvenOdd challenge 10 67
    mapAB Challlenge 35 46
    In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
    Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
    The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
    The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now