DES problem: updating start/stop times and removing sources
- From: "Scale" <rangifer@xxxxxxxxx>
- Date: 11 Jan 2007 02:50:46 -0800
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
.
- Follow-Ups:
- RE: DES problem: updating start/stop times and removing sources
- From: Joe Flynn
- RE: DES problem: updating start/stop times and removing sources
- Prev by Date: Re: How to seek to nearest previous keyframe in transform filter?
- Next by Date: Re: Opening the new application in Extended Desktop
- Previous by thread: Re: Opening the new application in Extended Desktop
- Next by thread: RE: DES problem: updating start/stop times and removing sources
- Index(es):
Relevant Pages
|