[xiph-commits] r8567 -
trunk/oggdsf/src/lib/codecs/cmml/dsfCMMLRawSource
illiminable at motherfish-iii.xiph.org
illiminable at motherfish-iii.xiph.org
Fri Dec 31 19:34:36 PST 2004
Author: illiminable
Date: 2004-12-31 19:34:35 -0800 (Fri, 31 Dec 2004)
New Revision: 8567
Modified:
trunk/oggdsf/src/lib/codecs/cmml/dsfCMMLRawSource/CMMLRawSourceFilter.cpp
trunk/oggdsf/src/lib/codecs/cmml/dsfCMMLRawSource/CMMLRawSourceFilter.h
Log:
* CMML Raw source filter, inserts empty clips at end times.
Modified: trunk/oggdsf/src/lib/codecs/cmml/dsfCMMLRawSource/CMMLRawSourceFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/dsfCMMLRawSource/CMMLRawSourceFilter.cpp 2004-12-31 17:40:25 UTC (rev 8566)
+++ trunk/oggdsf/src/lib/codecs/cmml/dsfCMMLRawSource/CMMLRawSourceFilter.cpp 2005-01-01 03:34:35 UTC (rev 8567)
@@ -134,6 +134,7 @@
HRESULT CMMLRawSourceFilter::DataProcessLoop()
{
+ C_ClipTag* locClip = NULL;
DWORD locCommand = 0;
while(true) {
if(CheckRequest(&locCommand) == TRUE) {
@@ -142,9 +143,51 @@
}
if (mUptoTag == -1) {
+ //Deliver the head tag
mCMMLSourcePin->deliverTag(mCMMLDoc->root()->head());
} else if (mUptoTag < mCMMLDoc->root()->clipList()->numTags()) {
- mCMMLSourcePin->deliverTag(mCMMLDoc->root()->clipList()->getTag(mUptoTag));
+
+ locClip = mCMMLDoc->root()->clipList()->getTag(mUptoTag);
+
+ wstring locTrackName = locClip->track();
+
+ if (locTrackName == L"") {
+ locTrackName = L"default";
+ }
+
+ //Check if we have a pending end time in this track.
+ tTrackMap::iterator locIt = mTrackMap.find(locTrackName);
+ if (locIt != mTrackMap.end()) {
+ //There's an entry for this track in the map.
+ __int64 locStartTime = StringHelper::stringToNum(StringHelper::toNarrowStr(locClip->start()));
+
+ if (locStartTime <= locIt->second) {
+ //The start time of this clip is before the potential end time we saved.
+ // This means the end time means nothing, and we can ignore it and remove from the map.
+ mTrackMap.erase(locIt);
+
+ } else {
+ //The start time of this clip is after the saved end time...
+ // We send an empty clip marked with the end time.
+ C_ClipTag* locEndTag = new C_ClipTag;
+ locEndTag->setStart(StringHelper::toWStr(StringHelper::numToString(locIt->second)));
+ locEndTag->setTrack(locTrackName);
+ mCMMLSourcePin->deliverTag(locEndTag);
+
+ //Now remove it from the map.
+ mTrackMap.erase(locIt);
+ }
+ }
+
+
+ //If this clip has an end time we can add it's end time to the map
+ if (locClip->end() != L"") {
+ //There's a specified end time on this clip, so hold on to it
+ __int64 locEndTime = StringHelper::stringToNum(StringHelper::toNarrowStr(locClip->end()));
+ mTrackMap.insert(tTrackMap::value_type(locTrackName, locEndTime));
+ }
+
+ mCMMLSourcePin->deliverTag(locClip);
} else {
mCMMLSourcePin->DeliverEndOfStream();
return S_OK;
Modified: trunk/oggdsf/src/lib/codecs/cmml/dsfCMMLRawSource/CMMLRawSourceFilter.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/dsfCMMLRawSource/CMMLRawSourceFilter.h 2004-12-31 17:40:25 UTC (rev 8566)
+++ trunk/oggdsf/src/lib/codecs/cmml/dsfCMMLRawSource/CMMLRawSourceFilter.h 2005-01-01 03:34:35 UTC (rev 8567)
@@ -1,6 +1,7 @@
#pragma once
#include <string>
+#include <map>
#include <libWinCMMLParse/libWinCMMLParse.h>
#include <libWinCMMLParse/CMMLParser.h>
#include "CMMLRawSourcePin.h"
@@ -23,6 +24,7 @@
THREAD_PAUSE = 1,
THREAD_RUN = 2
};
+
DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
@@ -54,11 +56,17 @@
protected:
virtual HRESULT DataProcessLoop();
+
CMMLRawSourcePin* mCMMLSourcePin;
CMMLParser mCMMLParser;
C_CMMLDoc* mCMMLDoc;
wstring mFileName;
+
+ typedef map<wstring, __int64> tTrackMap;
+
+ tTrackMap mTrackMap;
+
long mUptoTag;
};
More information about the commits
mailing list