[xiph-commits] r8543 - in trunk/oggdsf/src:
lib/codecs/cmml/libWinCMMLParse lib/core/ogg/libOOOgg
tests/testlibOOOggSpeed1 tools/AnxCutter tools/OOOggDump
tools/OOOggPageInfo tools/OOOggStat tools/oggChainSplitter
ozone at motherfish-iii.xiph.org
ozone at motherfish-iii.xiph.org
Tue Dec 28 17:05:58 PST 2004
Author: ozone
Date: 2004-12-28 17:05:58 -0800 (Tue, 28 Dec 2004)
New Revision: 8543
Modified:
trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.cpp
trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.h
trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.cpp
trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.h
trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggTypeDefs.h
trunk/oggdsf/src/tests/testlibOOOggSpeed1/testlibOOOggSpeed1.cpp
trunk/oggdsf/src/tools/AnxCutter/AnxCutter.cpp
trunk/oggdsf/src/tools/OOOggDump/OOOggDump.cpp
trunk/oggdsf/src/tools/OOOggPageInfo/OOOggPageInfo.cpp
trunk/oggdsf/src/tools/OOOggStat/OOOggStat.cpp
trunk/oggdsf/src/tools/oggChainSplitter/oggChainSplitter.cpp
Log:
oggdsf:
* Changed OggDataBuffer::registerStaticCallback so that the user can pass it a handle to their own custom data
Modified: trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.cpp 2004-12-28 23:00:40 UTC (rev 8542)
+++ trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.cpp 2004-12-29 01:05:58 UTC (rev 8543)
@@ -46,9 +46,12 @@
+/** Note that you do not need to create create the MSXML2 document with COM's CoCreateInstance()
+ function; we will do that for you.
+ */
+bool CMMLParser::setupXMLHandles(wstring inText, MSXML2::IXMLDOMDocument** outDoc)
+{
-bool CMMLParser::setupXMLHandles(wstring inText, MSXML2::IXMLDOMDocument** outDoc) {
-
HRESULT locHR = S_FALSE;
// Check the return value, hr...
locHR = CoCreateInstance(__uuidof(DOMDocument30), NULL, CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument, (void**)outDoc);
Modified: trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.h 2004-12-28 23:00:40 UTC (rev 8542)
+++ trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.h 2004-12-29 01:05:58 UTC (rev 8543)
@@ -33,18 +33,23 @@
//===========================================================================
#pragma once
+
#include <string>
#include "libCMMLTags.h"
+
#import <msxml3.dll> raw_interfaces_only
using namespace MSXML2;
#include <msxml.h>
+
using namespace std;
+
class LIBWINCMMLPARSE_API CMMLParser
{
public:
CMMLParser(void);
~CMMLParser(void);
+ /// Parses the given string at inText and places the result in outDoc.
bool setupXMLHandles(wstring inText, MSXML2::IXMLDOMDocument** outDoc);
//C_CMMLTag* genericParseTag(string inCMMLText);
//bool parseCMMLDoc(string inCMMLDocText, C_CMMLDoc* outDoc);
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.cpp 2004-12-28 23:00:40 UTC (rev 8542)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.cpp 2004-12-29 01:05:58 UTC (rev 8543)
@@ -68,9 +68,14 @@
}
-bool OggDataBuffer::registerStaticCallback(fPageCallback inPageCallback) {
+/** The inUserData parameter is a pointer of any type. This pointer is passed to the callback when it
+ is called, enabling the user to save any custom information in its callback.
+ */
+bool OggDataBuffer::registerStaticCallback(fPageCallback inPageCallback, void* inUserData)
+{
//Holds the static callback and nulls the virtual one.
mStaticCallback = inPageCallback;
+ mStaticCallbackUserData = (void *) inUserData;
mVirtualCallback = NULL;
return true;
@@ -120,7 +125,7 @@
return DISPATCH_FALSE;
}
} else if (mStaticCallback != NULL) {
- if (mStaticCallback(inOggPage) == true) {
+ if (mStaticCallback(inOggPage, mStaticCallbackUserData) == true) {
return DISPATCH_OK;
} else {
return DISPATCH_FALSE;
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.h 2004-12-28 23:00:40 UTC (rev 8542)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.h 2004-12-29 01:05:58 UTC (rev 8543)
@@ -89,11 +89,13 @@
OggDataBuffer(void);
virtual ~OggDataBuffer(void);
- //Setting callbacks
- bool registerStaticCallback(fPageCallback inPageCallback);
+ /// Register a as a callback, which gets called when data is received via our feed() method.
+ bool registerStaticCallback(fPageCallback inPageCallback, void* inUserData);
+
+ /// Register an IOggCallback object, which gets called when data is received via our feed() method.
bool registerVirtualCallback(IOggCallback* inPageCallback);
- //Buffer Control
+ /// Puts in data into this buffer, which triggers the callback registered with registerStaticCallback() or registerVirtualCallback().
eFeedResult feed(const unsigned char* inData, unsigned long inNumBytes);
void clearData();
@@ -114,6 +116,7 @@
//Callback pointers
IOggCallback* mVirtualCallback;
fPageCallback mStaticCallback;
+ void* mStaticCallbackUserData;
//Internal processing
eProcessResult processBuffer();
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggTypeDefs.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggTypeDefs.h 2004-12-28 23:00:40 UTC (rev 8542)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggTypeDefs.h 2004-12-29 01:05:58 UTC (rev 8543)
@@ -32,4 +32,4 @@
//Callback function for oggpages.
#pragma once
#include <libOOOgg/OggPage.h>
-typedef bool (*fPageCallback) (OggPage* inOggPage);
\ No newline at end of file
+typedef bool (*fPageCallback) (OggPage* inOggPage, void* inUserData);
\ No newline at end of file
Modified: trunk/oggdsf/src/tests/testlibOOOggSpeed1/testlibOOOggSpeed1.cpp
===================================================================
--- trunk/oggdsf/src/tests/testlibOOOggSpeed1/testlibOOOggSpeed1.cpp 2004-12-28 23:00:40 UTC (rev 8542)
+++ trunk/oggdsf/src/tests/testlibOOOggSpeed1/testlibOOOggSpeed1.cpp 2004-12-29 01:05:58 UTC (rev 8543)
@@ -44,7 +44,7 @@
unsigned long pageCount;
unsigned long packetCount;
//This will be called by the callback
-bool pageCB(OggPage* inOggPage) {
+bool pageCB(OggPage* inOggPage, void* inUserData /* ignored */) {
pageCount++;
packetCount += inOggPage->numPackets();
return true;
@@ -69,7 +69,7 @@
QueryPerformanceCounter(&perfStart);
OggDataBuffer testOggBuff;
- testOggBuff.registerStaticCallback(&pageCB);
+ testOggBuff.registerStaticCallback(&pageCB, NULL);
fstream testFile;
testFile.open(argv[1], ios_base::in | ios_base::binary);
Modified: trunk/oggdsf/src/tools/AnxCutter/AnxCutter.cpp
===================================================================
--- trunk/oggdsf/src/tools/AnxCutter/AnxCutter.cpp 2004-12-28 23:00:40 UTC (rev 8542)
+++ trunk/oggdsf/src/tools/AnxCutter/AnxCutter.cpp 2004-12-29 01:05:58 UTC (rev 8543)
@@ -77,7 +77,7 @@
}
//This will be called by the callback
-bool pageCB(OggPage* inOggPage) {
+bool pageCB(OggPage* inOggPage, void* inUserData /* ignored */) {
bool allEmpty = true;
@@ -194,7 +194,7 @@
} else {
OggDataBuffer testOggBuff;
- testOggBuff.registerStaticCallback(&pageCB);
+ testOggBuff.registerStaticCallback(&pageCB, NULL);
fstream inputFile;
Modified: trunk/oggdsf/src/tools/OOOggDump/OOOggDump.cpp
===================================================================
--- trunk/oggdsf/src/tools/OOOggDump/OOOggDump.cpp 2004-12-28 23:00:40 UTC (rev 8542)
+++ trunk/oggdsf/src/tools/OOOggDump/OOOggDump.cpp 2004-12-29 01:05:58 UTC (rev 8543)
@@ -42,7 +42,7 @@
unsigned long bytePos;
//This will be called by the callback
-bool pageCB(OggPage* inOggPage) {
+bool pageCB(OggPage* inOggPage, void *inUserData /* ignored */) {
cout<<"Page Location : "<<bytePos;
bytePos += inOggPage->pageSize();
cout<<" to "<<bytePos<<endl;
@@ -85,7 +85,7 @@
} else {
OggDataBuffer testOggBuff;
- testOggBuff.registerStaticCallback(&pageCB);
+ testOggBuff.registerStaticCallback(&pageCB, NULL);
fstream testFile;
testFile.open(argv[1], ios_base::in | ios_base::binary);
Modified: trunk/oggdsf/src/tools/OOOggPageInfo/OOOggPageInfo.cpp
===================================================================
--- trunk/oggdsf/src/tools/OOOggPageInfo/OOOggPageInfo.cpp 2004-12-28 23:00:40 UTC (rev 8542)
+++ trunk/oggdsf/src/tools/OOOggPageInfo/OOOggPageInfo.cpp 2004-12-29 01:05:58 UTC (rev 8543)
@@ -43,7 +43,7 @@
vector<unsigned long> streamSerials;
vector<unsigned long*> maxPacks;
//This will be called by the callback
-bool pageCB(OggPage* inOggPage) {
+bool pageCB(OggPage* inOggPage, void* inUserData /* ignored */) {
bool locFoundStream = false;
size_t locFoundPos = 0;
@@ -135,7 +135,7 @@
} else {
OggDataBuffer testOggBuff;
- testOggBuff.registerStaticCallback(&pageCB);
+ testOggBuff.registerStaticCallback(&pageCB, NULL);
fstream testFile;
testFile.open(argv[1], ios_base::in | ios_base::binary);
Modified: trunk/oggdsf/src/tools/OOOggStat/OOOggStat.cpp
===================================================================
--- trunk/oggdsf/src/tools/OOOggStat/OOOggStat.cpp 2004-12-28 23:00:40 UTC (rev 8542)
+++ trunk/oggdsf/src/tools/OOOggStat/OOOggStat.cpp 2004-12-29 01:05:58 UTC (rev 8543)
@@ -45,7 +45,8 @@
unsigned long streamNo;
-bool pageCB(OggPage* inOggPage) {
+bool pageCB(OggPage* inOggPage, void *inUserData /* ignored */)
+{
if ((inOggPage->numPackets() > 0) && (inOggPage->header()->isBOS())) {
streamNo++;
OggPacket* locFirstPack = inOggPage->getPacket(0);
@@ -107,7 +108,7 @@
OggDataBuffer testOggBuff;
//OggCallbackRego* locCBRego = new OggCallbackRego(&pageCB);
const int BUFF_SIZE = 8092;
- testOggBuff.registerStaticCallback(&pageCB);
+ testOggBuff.registerStaticCallback(&pageCB, NULL);
fstream testFile;
testFile.open(argv[1], ios_base::in | ios_base::binary);
Modified: trunk/oggdsf/src/tools/oggChainSplitter/oggChainSplitter.cpp
===================================================================
--- trunk/oggdsf/src/tools/oggChainSplitter/oggChainSplitter.cpp 2004-12-28 23:00:40 UTC (rev 8542)
+++ trunk/oggdsf/src/tools/oggChainSplitter/oggChainSplitter.cpp 2004-12-29 01:05:58 UTC (rev 8543)
@@ -101,7 +101,7 @@
return true;
}
//This will be called by the callback
-bool pageCB(OggPage* inOggPage) {
+bool pageCB(OggPage* inOggPage, void *inUserData /* ignored */) {
bool retVal = false;
if (inStream == false) {
//Not in the middle of a stream
@@ -172,7 +172,7 @@
cout << "Starting..."<<endl;
OggDataBuffer testOggBuff;
- testOggBuff.registerStaticCallback(&pageCB);
+ testOggBuff.registerStaticCallback(&pageCB, NULL);
fstream testFile;
inFileName = argv[1];
More information about the commits
mailing list