[xiph-commits] r8672 - in trunk/oggdsf: sln/oggdsf_all src/lib/codecs/cmml/libWinCMMLParse src/lib/helper/libOOOggChef src/lib/helper/libTemporalURI

ozone at motherfish-iii.xiph.org ozone at motherfish-iii.xiph.org
Sat Jan 8 00:27:55 PST 2005


Author: ozone
Date: 2005-01-08 00:27:55 -0800 (Sat, 08 Jan 2005)
New Revision: 8672

Added:
   trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLTagUtils.cpp
   trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLTagUtils.h
Modified:
   trunk/oggdsf/sln/oggdsf_all/oggdsf_all.sln
   trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.h
   trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/libWinCMMLParse.vcproj
   trunk/oggdsf/src/lib/helper/libOOOggChef/CMMLRecomposer.cpp
   trunk/oggdsf/src/lib/helper/libOOOggChef/libOOOggChef.vcproj
   trunk/oggdsf/src/lib/helper/libTemporalURI/C_TimeStamp.h
Log:
oggdsf:
 * Added CMMLTagsUtils namespace (a.k.a. class with 100% static methods) to libWinCMMLParse library
 * Added getClipsFrom to new CMMLTagsUtil class (previously in the libCMMLTag's C_ClipTagList class)
 * Unbroke libOOOggChef compilation


Modified: trunk/oggdsf/sln/oggdsf_all/oggdsf_all.sln
===================================================================
--- trunk/oggdsf/sln/oggdsf_all/oggdsf_all.sln	2005-01-08 07:48:23 UTC (rev 8671)
+++ trunk/oggdsf/sln/oggdsf_all/oggdsf_all.sln	2005-01-08 08:27:55 UTC (rev 8672)
@@ -856,7 +856,9 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libWinCMMLParse", "..\..\src\lib\codecs\cmml\libWinCMMLParse\libWinCMMLParse.vcproj", "{23BAAF7B-AEC3-4812-AA91-7E5061E83A39}"
 	ProjectSection(ProjectDependencies) = postProject
+		{37CA269C-45DF-4DF7-9C12-3FE3B651D6FC} = {37CA269C-45DF-4DF7-9C12-3FE3B651D6FC}
 		{AD38DCC6-B431-4B32-8569-74F3376EF2DA} = {AD38DCC6-B431-4B32-8569-74F3376EF2DA}
+		{2DA569EC-3E22-4BC9-A242-C7A56EB9C6F4} = {2DA569EC-3E22-4BC9-A242-C7A56EB9C6F4}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsfCMMLDecoder", "..\..\src\lib\codecs\cmml\dsfCMMLDecoder\dsfCMMLDecoder.vcproj", "{6B269BA6-6A18-41EF-A82C-03B6B5D4BCA7}"

Modified: trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.h	2005-01-08 07:48:23 UTC (rev 8671)
+++ trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.h	2005-01-08 08:27:55 UTC (rev 8672)
@@ -57,8 +57,6 @@
 	bool parseClipTag(wstring inClipText, C_ClipTag* outClip);
 	bool parseHeadTag(wstring inHeadText, C_HeadTag* outHead);
 	bool parseCMMLRootTag(wstring inCMMLRootText, C_CMMLRootTag* outCMMLRoot);
-
-	
 	bool parseDocFromFile(wstring inFilename, C_CMMLDoc* outCMMLDoc);
 
 

Added: trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLTagUtils.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLTagUtils.cpp	2005-01-08 07:48:23 UTC (rev 8671)
+++ trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLTagUtils.cpp	2005-01-08 08:27:55 UTC (rev 8672)
@@ -0,0 +1,89 @@
+//===========================================================================
+//Copyright (C) 2005 Zentaro Kavanagh
+//
+//Copyright (C) 2005 Commonwealth Scientific and Industrial Research
+//   Organisation (CSIRO) Australia
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+//  notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+//  notice, this list of conditions and the following disclaimer in the
+//  documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors 
+//  may be used to endorse or promote products derived from this software 
+//  without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
+
+#include "stdafx.h"
+
+#include <libWinCMMLParse/CMMLTagUtils.h>
+#include <libTemporalURI/C_TimeStamp.h>
+
+/** Note that the returned C_ClipTagList must be deleted by you.
+  */
+C_ClipTagList *CMMLTagUtils::getClipsFrom(C_ClipTagList *inClipTagList, LOOG_INT64 inTimeInDirectShowUnits)
+{
+	C_ClipTagList *locClipTagList = new C_ClipTagList;
+
+	bool locAlreadyEncounteredClipInTimeRange = false;
+
+	for (unsigned long i = 0; i < inClipTagList->numTags(); i++) {
+		C_ClipTag *locTag = inClipTagList->getTag(i);
+		
+		// Convert the time stamp from a string to time in DirectSeconds(TM)
+		wstring locStart = locTag->start();
+		C_TimeStamp locTimeStamp;
+		if (!locTimeStamp.parseTimeStamp(StringHelper::toNarrowStr(locStart))) {
+			// Mmm, couldn't parse the time stamp for this clip ... so, err,
+			// let's just skip it.  Yeah, that's a grreeeeat idea ...
+			continue;
+		}
+		LOOG_INT64 locStartTime = locTimeStamp.toHunNanos();
+
+		if (locStartTime >= inTimeInDirectShowUnits) {
+			if (!locAlreadyEncounteredClipInTimeRange) {
+				// Only add the previous clip to the clip list if its end time
+				// is beyond the requested time
+				{
+					wstring locEnd = locTag->end();
+					C_TimeStamp locEndTimeStamp;
+					if (locEndTimeStamp.parseTimeStamp(StringHelper::toNarrowStr(locEnd))) {
+						// Clip has an end time: check if it's before the requested time
+						LOOG_INT64 locEndTime = locEndTimeStamp.toHunNanos();
+						if (locEndTime < inTimeInDirectShowUnits) {
+							continue;
+						}
+					}
+				}
+
+				// If we're not the very first clip ...
+				if (i > 0) {
+					C_ClipTag *locClipInTimeRange = inClipTagList->getTag(i - 1);
+					locClipTagList->addTag(locClipInTimeRange->clone());
+				}
+				locAlreadyEncounteredClipInTimeRange = true;
+			}
+			locClipTagList->addTag(locTag->clone());
+		}
+	}
+
+	return locClipTagList;
+}


Property changes on: trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLTagUtils.cpp
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLTagUtils.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLTagUtils.h	2005-01-08 07:48:23 UTC (rev 8671)
+++ trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLTagUtils.h	2005-01-08 08:27:55 UTC (rev 8672)
@@ -0,0 +1,46 @@
+//===========================================================================
+//Copyright (C) 2005 Zentaro Kavanagh
+//
+//Copyright (C) 2005 Commonwealth Scientific and Industrial Research
+//   Organisation (CSIRO) Australia
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+//  notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+//  notice, this list of conditions and the following disclaimer in the
+//  documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors 
+//  may be used to endorse or promote products derived from this software 
+//  without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
+
+#pragma once
+
+
+#include <libCMMLTags/libCMMLTags.h>
+#include <libilliCore/illicoreconfig.h>
+
+class LIBWINCMMLPARSE_API CMMLTagUtils
+{
+public:
+	/// Returns a new C_ClipTagList, which contains clips occuring in inClipTagList, during or after the time given via inTimeInDirectShowUnits
+	static C_ClipTagList *getClipsFrom(C_ClipTagList *inClipTagList, LOOG_INT64 inTimeInDirectShowUnits);
+};


Property changes on: trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLTagUtils.h
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/libWinCMMLParse.vcproj
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/libWinCMMLParse.vcproj	2005-01-08 07:48:23 UTC (rev 8671)
+++ trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/libWinCMMLParse.vcproj	2005-01-08 08:27:55 UTC (rev 8672)
@@ -258,6 +258,9 @@
 				RelativePath="CMMLParser.cpp">
 			</File>
 			<File
+				RelativePath=".\CMMLTagUtils.cpp">
+			</File>
+			<File
 				RelativePath="libWinCMMLParse.cpp">
 			</File>
 			<File
@@ -295,6 +298,9 @@
 				RelativePath="CMMLParser.h">
 			</File>
 			<File
+				RelativePath=".\CMMLTagUtils.h">
+			</File>
+			<File
 				RelativePath="libWinCMMLParse.h">
 			</File>
 			<File

Modified: trunk/oggdsf/src/lib/helper/libOOOggChef/CMMLRecomposer.cpp
===================================================================
--- trunk/oggdsf/src/lib/helper/libOOOggChef/CMMLRecomposer.cpp	2005-01-08 07:48:23 UTC (rev 8671)
+++ trunk/oggdsf/src/lib/helper/libOOOggChef/CMMLRecomposer.cpp	2005-01-08 08:27:55 UTC (rev 8672)
@@ -43,9 +43,8 @@
 #include <libCMMLTags/libCMMLTags.h>
 #include <libTemporalURI/C_TimeStamp.h>
 #include <libWinCMMLParse/CMMLParser.h>
+#include <libWinCMMLParse/CMMLTagUtils.h>
 
-#include <assert.h>
-
 #include <fstream>
 #include <iostream>
 #include <string>
@@ -142,7 +141,7 @@
 
 			// Get the clip tags during or after the wanted time
 			C_ClipTagList *locRequestedClips =
-				locCMMLDoc->root()->clipList()->getClipsFrom(locTime);
+				CMMLTagUtils::getClipsFrom(locCMMLDoc->root()->clipList(), locTime);
 
 			// Replace the clip list in our new CMML document.  We don't need to
 			// delete the old clip list before doing this, since the setClipList()

Modified: trunk/oggdsf/src/lib/helper/libOOOggChef/libOOOggChef.vcproj
===================================================================
--- trunk/oggdsf/src/lib/helper/libOOOggChef/libOOOggChef.vcproj	2005-01-08 07:48:23 UTC (rev 8671)
+++ trunk/oggdsf/src/lib/helper/libOOOggChef/libOOOggChef.vcproj	2005-01-08 08:27:55 UTC (rev 8672)
@@ -19,7 +19,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\codecs\cmml;..\..\core\ogg;.."
+				AdditionalIncludeDirectories="..\..\codecs\cmml;..\..\helper;..\..\core\ogg;.."
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBOOOGGCHEF_EXPORTS"
 				MinimalRebuild="TRUE"
 				BasicRuntimeChecks="3"
@@ -68,7 +68,7 @@
 			CharacterSet="2">
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\codecs\cmml;..\..\core\ogg;.."
+				AdditionalIncludeDirectories="..\..\codecs\cmml;..\..\helper;..\..\core\ogg;.."
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBOOOGGCHEF_EXPORTS"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="3"

Modified: trunk/oggdsf/src/lib/helper/libTemporalURI/C_TimeStamp.h
===================================================================
--- trunk/oggdsf/src/lib/helper/libTemporalURI/C_TimeStamp.h	2005-01-08 07:48:23 UTC (rev 8671)
+++ trunk/oggdsf/src/lib/helper/libTemporalURI/C_TimeStamp.h	2005-01-08 08:27:55 UTC (rev 8672)
@@ -1,10 +1,12 @@
 #pragma once
 
-#include "libTemporalURI.h"
+#include <libilliCore/StringHelper.h>
+#include <libTemporalURI/libTemporalURI.h>
+
 #include <string>
+
 using namespace std;
 
-#include "libilliCore/StringHelper.h"
 class LIBTEMPORALURI_API C_TimeStamp
 {
 public:



More information about the commits mailing list