Hi,
This week was productive again, I accomplished three basic tasks, I added a simple waveform display to the audio tracks. Then I attached the audio data of each video track to iself, therefore if you add a video file and play the project, the audio will play back automagically as well.
And I implemented a basic XML project file format. At the moment it stores everything that has been done on exit, and it’s restored on startup. This is a little simple, but very convinient for testing.
BTW. I implemented some Heisenbugs unintentionally while hacking audio/video, that were particularly tricky to find.
However, I love hunting down these, it’s much more fun than tracking zombies in dooms dungeons.
For your viewing pleasure I prepared a screenshot of the current state of affairs, notice the fine tick-marks.
I also outlined a quick overview about how I might implement some threads to make the Open Movie Editor a little more responsive.
On the left is the audio thread, it’s created by the portaudio API, and driven by the hardware. It dictates the playback speed. This means that it also triggers the flip to the next video frame. This goes through a pipe, because it’ll be handled by the GUI thread, which due to the capabilitys of FLTK can wake up when being notified by a file descriptor.
The GUI thread will then notify the video decoding thread through a condition variable. Why not send a message directly to the video-thread? Because the video thread might be busy decoding the last frame. And if the machine is too slow, we might as well skip a frame, and this works well with condition variables, because unhandled signals are dropped.
The video thread writes it’s frame to a buffer protected through a semaphore, or something similar and notifies the GUI thread through a pipe that it’s ready. Right now it should propably wait for another condition variable, to make sure the GUI thread actually fetched from the buffer to the OpenGL Canvas, however we’d have to make sure that no deadlock happens. Then it could go back waiting for the next frame to decode.
Maybe this concept can be adjusted to decode the next frame in advance instead of on demand.
Have fun
-Richard.
PS.: I’ll propably want to get this book because I’m afraid I don’t really grok this threads-stuff to the extend I’d want to.
Tags Open Movie Editor