Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Preload an AVI file

Posted on 2008-11-06
Medium Priority
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

DanRollins earned 2000 total points
ID: 22902094
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

ID: 22953573
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:

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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 how to clear a vector as well as how to detect empty vectors in C++.

564 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