DES problem: updating start/stop times and removing sources

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I'm currently work on a video editing application which uses DES to
provide a playlist tool with basic length/speed editing options (based
on changing SetStartStopTimes/SetMediaTimes). I'm fairly new to Editing
Services. In the timeline I am using two groups, one for audio and one
for video, for now each one has 1 composition with 1 track in it. Audio
and video come from the same AVI file.
I managed to load, set start/stop/media times and render clips
properly, but my timeline object believes in a very weird way when I
try to change the playing order of the sources. I'm doing this by
rearranging the start/stop time of sources. When a source is swapped
place with another I recalculate the times for all the source objects
(so they don't overlap) and then assign all the new times to sources
(no rendering graph exists at the time of time reassignment).
However the timeline seems to throw away some audio sources when
reassigning times. For example, this is a starting timeline:

<timeline>
<group type="video">
<track>
<clip start="0" stop="10.1600000" src="C:\take000001.avi"/>
<clip start="10.1600000" stop="23.6000000"
src="C:\take000002.avi"/>
<clip start="23.6000000" stop="32.7600000"
src="C:\take000003.avi"/>
<clip start="32.7600000" stop="41.9200000"
src="C:\take000004.avi"/>
</track>
</group>
<group type="audio">
<track>
<clip start="0" stop="10.1600000" src="C:\take000001.avi"/>
<clip start="10.1600000" stop="23.6000000"
src="C:\take000002.avi"/>
<clip start="23.6000000" stop="32.7600000"
src="C:\take000003.avi"/>
<clip start="32.7600000" stop="41.9200000"
src="C:\take000004.avi"/>
</track>
</group>
</timeline>

Here are the following states as the time are reassinged - they are
reassigned in order 2-3-4-1 but I have tried following the original
order too and the behaviour is the same:

<timeline>
<group type="video">
<track>
<clip start="0" stop="10.1600000" src="C:\take000001.avi"/>
<clip start="0" stop="13.4000000" src="C:\take000002.avi"
mstart="0" mstop="13.4400000"/>
<clip start="23.6000000" stop="32.7600000"
src="C:\take000003.avi"/>
<clip start="32.7600000" stop="41.9200000"
src="C:\take000004.avi"/>
</track>
</group>
<group type="audio">
<track>
<clip start="0" stop="10.1600000" src="C:\take000001.avi"/>
<clip start="0" stop="13.4000000" src="C:\take000002.avi"
mstart="0" mstop="13.4400000"/>
<clip start="23.6000000" stop="32.7600000"
src="C:\take000003.avi"/>
<clip start="32.7600000" stop="41.9200000"
src="C:\take000004.avi"/>
</track>
</group>
</timeline>

<timeline>
<group type="video">
<track>
<clip start="0" stop="10.1600000" src="C:\take000001.avi"/>
<clip start="0" stop="13.4000000" src="C:\take000002.avi"
mstart="0" mstop="13.4400000"/>
<clip start="13.4000000" stop="22.6000000"
src="C:\take000003.avi" mstart="0" mstop="9.1600000"/>
<clip start="32.7600000" stop="41.9200000"
src="C:\take000004.avi"/>
</track>
</group>
<group type="audio">
<track>
<clip start="0" stop="10.1600000" src="C:\take000001.avi"/>
<clip start="0" stop="13.4000000" src="C:\take000002.avi"
mstart="0" mstop="13.4400000"/>
<clip start="13.4000000" stop="22.6000000"
src="C:\take000003.avi" mstart="0" mstop="9.1600000"/>
<clip start="32.7600000" stop="41.9200000"
src="C:\take000004.avi"/>
</track>
</group>
</timeline>

<timeline>
<group type="video">
<track>
<clip start="0" stop="13.4000000" src="C:\take000002.avi"
mstart="0" mstop="13.4400000"/>
<clip start="13.4000000" stop="22.6000000"
src="C:\take000003.avi" mstart="0" mstop="9.1600000"/>
<clip start="22.6000000" stop="32.7333333"
src="C:\take000001.avi"/>
<clip start="32.7600000" stop="41.9200000"
src="C:\take000004.avi"/>
</track>
</group>
<group type="audio">
<track>
<clip start="22.6000000" stop="32.7333333"
src="C:\take000001.avi"/>
<clip start="32.7600000" stop="41.9200000"
src="C:\take000004.avi"/>
</track>
</group>
</timeline>

<timeline>
<group type="video">
<track>
<clip start="0" stop="13.4000000" src="C:\take000002.avi"
mstart="0" mstop="13.4400000"/>
<clip start="13.4000000" stop="22.6000000"
src="C:\take000003.avi" mstart="0" mstop="9.1600000"/>
<clip start="22.6000000" stop="32.7333333"
src="C:\take000001.avi" mstart="0" mstop="10.1600000"/>
<clip start="32.7333333" stop="41.8666667"
src="C:\take000004.avi"/>
</track>
</group>
<group type="audio">
<track>
<clip start="22.6000000" stop="32.7333333"
src="C:\take000001.avi" mstart="0" mstop="10.1600000"/>
<clip start="32.7333333" stop="41.8666667"
src="C:\take000004.avi"/>
</track>
</group>
</timeline>

In all tests is throws away all audio clips before the one which was
first inserted into the timeline, regardless of its new times/position,
but videos are always reordered correctly. This is the code which
assigns source times, the problem is when setting start/stop times:

bool Timeline::SetPlaybackTimes(int nSource, REFTIME nStartSec, REFTIME
nStopSec)
{
// this is a std::vector where I keep the source objects
CComPtr<IAMTimelineObj> pSourceObj =
m_listVideoSourceObjects[nSource].m_T;

REFTIME nStart = nStartSec;
REFTIME nStop = nStopSec;
HR( pSourceObj->FixTimes2(&nStart, &nStop) );
HR( pSourceObj->SetStartStop2(nStart, nStop) );
}

Is this way of reordering correct or I am missing something? Should the
start/stop time *never* overlap at any time, not even when there's no
graph and you are just setting times? Maybe objects should detached and
reattached?

Also the timeline doesn't remove the last audio source when I remove
individual source objects. I call RemoveAll() on each source object
(and also remove it from the std::vector) and yet it ends up like this
even though the last call to RemoveAll() returned S_OK:

<timeline>
<group type="video">
<track/>
</group>
<group type="audio">
<track>
<clip start="0" stop="10.1600000" src="C:\take000001.avi"/>
</track>
</group>
</timeline>

The previous calls removed one audio and one video source each,
correctly (?) since they came from the same file. But the last call
only removes the video source.

Any help is appreciated, thank you.
Scale

.



Relevant Pages

  • Re: Newbie questions
    ... things with audio .WAV tracts such as make Pan and Gain envelopes. ... drag the mouse over the section I want and play the loop but how do I ... of the material on a timeline and copy it as many times as you wish. ... including having separate audio and video tracks. ...
    (rec.video.desktop)
  • Re: Music not jumping with timeline slider
    ... > Im making a movie with both audio and vidoe clips but whenever i move the ... > slider along the timeline, while it is paused, it replays the whole audio ... > syncronization of the video and music I have to listen to the whole piece. ...
    (microsoft.public.windowsxp.moviemaker)
  • Re: Ripping audio from clip
    ... Drag it back to the timeline and NOW you can ... If you try to drag a clip with audio and video to the "Audio" ... >>> Capture the video and drag it to the timeline but drag it to the AUDIO ...
    (microsoft.public.windowsxp.moviemaker)
  • Re: Ripping audio from clip
    ... Sorry, that's my fault, try the Audio/Music part of the timeline. ... >> Capture the video and drag it to the timeline but drag it to the AUDIO ...
    (microsoft.public.windowsxp.moviemaker)
  • Re: Sony Vegas ... how do you trim?
    ... Then use 'S' to split at the timeline cursor position, select the segments you want to discard and delete. ... You can also add video layers to the timeline to add titling, add audio layers to the timeline to add background music or voice-overs, and/or add audio/video layers use as a 'scratchpad'. ... Finally, render video stream for Architect in the appropriate PAL/NTSC and 4:3/Widescreen, and AC3 with the same filename. ...
    (uk.rec.video.digital)