[xiph-commits] r7309 - in trunk/oggdsf/src/lib/core/ogg:
illiminable at dactyl.lonelymoon.com
illiminable
Sat Jul 24 02:39:55 PDT 2004
libVorbisComment libVorbisCommentDotNET
Message-ID: <20040724093955.AB81E9AAAB at dactyl.lonelymoon.com>
Author: illiminable
Date: Sat Jul 24 02:39:55 2004
New Revision: 7309
Modified:
trunk/oggdsf/src/lib/core/ogg/libVorbisComment/VorbisComments.cpp
trunk/oggdsf/src/lib/core/ogg/libVorbisComment/VorbisComments.h
trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/FileComments.cpp
trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/SingleVorbisComment.cpp
trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/SingleVorbisComment.h
trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/StreamCommentInfo.cpp
trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/StreamCommentInfo.h
trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/VorbisComments.cpp
trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/VorbisComments.h
Log:
* Syncronising before changes. Giving different things the same name is bad !
Modified: trunk/oggdsf/src/lib/core/ogg/libVorbisComment/VorbisComments.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libVorbisComment/VorbisComments.cpp 2004-07-24 08:51:40 UTC (rev 7308)
+++ trunk/oggdsf/src/lib/core/ogg/libVorbisComment/VorbisComments.cpp 2004-07-24 09:39:53 UTC (rev 7309)
@@ -52,34 +52,34 @@
unsigned long VorbisComments::numUserComments() {
return mCommentList.size();
}
-SingleVorbisComment VorbisComments::getUserComment(unsigned long inIndex) {
+SingleVorbisComment* VorbisComments::getUserComment(unsigned long inIndex) {
//FIX::: Bounds checking
return mCommentList[inIndex];
}
-vector<SingleVorbisComment> VorbisComments::getCommentsByKey(string inKey) {
+vector<SingleVorbisComment*> VorbisComments::getCommentsByKey(string inKey) {
//FIX::: Probably faster not to iterate... but who cares for now.. there aren't many.
- vector<SingleVorbisComment> retComments;
- SingleVorbisComment locCurrComment;
+ vector<SingleVorbisComment*> retComments;
+ SingleVorbisComment* locCurrComment = NULL;
for (int i = 0; i < mCommentList.size(); i++) {
locCurrComment = mCommentList[i];
//FIX::: Need to upcase everything
- if (locCurrComment.key() == inKey) {
+ if (locCurrComment->key() == inKey) {
retComments.push_back(locCurrComment);
}
}
return retComments;
}
-bool VorbisComments::addComment(SingleVorbisComment inComment) {
+bool VorbisComments::addComment(SingleVorbisComment* inComment) {
mCommentList.push_back(inComment);
return true;
}
bool VorbisComments::addComment(string inKey, string inValue) {
- SingleVorbisComment locComment;
- locComment.setKey(inKey);
- locComment.setValue(inValue);
+ SingleVorbisComment* locComment = new SingleVorbisComment;
+ locComment->setKey(inKey);
+ locComment->setValue(inValue);
mCommentList.push_back(locComment);
return true;
}
@@ -95,7 +95,7 @@
char* tempBuff = NULL;
unsigned char* locPackBuff = inPacket->packetData();
unsigned long locNumComments = 0;
- vector<SingleVorbisComment> locCommentList;
+ vector<SingleVorbisComment*> locCommentList;
if (locPackSize < locUpto + 4 - 1) {
//FAILED - No vendor length
@@ -163,8 +163,8 @@
locUpto += locUserCommentLength;
- SingleVorbisComment locComment;
- if (locComment.parseComment(locUserComment)) {
+ SingleVorbisComment* locComment = new SingleVorbisComment;
+ if (locComment->parseComment(locUserComment)) {
locCommentList.push_back(locComment);
} else {
//FAILED - Comment not parsable
@@ -212,7 +212,7 @@
retStr +="USER COMMENTS\n";
retStr +="=============\n";
for (int i = 0; i < mCommentList.size(); i++) {
- retStr += mCommentList[i].toString() + "\n";
+ retStr += mCommentList[i]->toString() + "\n";
}
return retStr;
@@ -223,7 +223,7 @@
locPackSize = mVendorString.size() + 4;
for (int i = 0; i < mCommentList.size(); i++) {
- locPackSize += mCommentList[i].length() + 4;
+ locPackSize += mCommentList[i]->length() + 4;
}
//Check bit
@@ -232,6 +232,7 @@
return locPackSize;
}
OggPacket* VorbisComments::toOggPacket() {
+ //This needs prefixing data !
unsigned long locPackSize = size();
unsigned long locUpto = 0;
unsigned char* locPackData = new unsigned char[locPackSize];
@@ -246,11 +247,11 @@
locUpto += 4;
for (int i = 0; i < mCommentList.size(); i++) {
- OggMath::ULongToCharArr(mCommentList[i].length(), locPackData + locUpto);
+ OggMath::ULongToCharArr(mCommentList[i]->length(), locPackData + locUpto);
locUpto += 4;
- memcpy((void*)(locPackData + locUpto), (const void*)mCommentList[i].toString().c_str(), mCommentList[i].length());
- locUpto += mCommentList[i].length();
+ memcpy((void*)(locPackData + locUpto), (const void*)mCommentList[i]->toString().c_str(), mCommentList[i]->length());
+ locUpto += mCommentList[i]->length();
}
locPackData[locUpto] = 1;
Modified: trunk/oggdsf/src/lib/core/ogg/libVorbisComment/VorbisComments.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libVorbisComment/VorbisComments.h 2004-07-24 08:51:40 UTC (rev 7308)
+++ trunk/oggdsf/src/lib/core/ogg/libVorbisComment/VorbisComments.h 2004-07-24 09:39:53 UTC (rev 7309)
@@ -49,11 +49,11 @@
bool setVendorString(string inVendorString);
unsigned long numUserComments();
- SingleVorbisComment getUserComment(unsigned long inIndex);
+ SingleVorbisComment* getUserComment(unsigned long inIndex);
- vector<SingleVorbisComment> getCommentsByKey(string inKey);
+ vector<SingleVorbisComment*> getCommentsByKey(string inKey);
- bool addComment(SingleVorbisComment inComment);
+ bool addComment(SingleVorbisComment* inComment);
bool addComment(string inKey, string inValue);
bool parseOggPacket(OggPacket* inPacket, unsigned long inStartOffset);
@@ -63,5 +63,5 @@
unsigned long size();
protected:
string mVendorString;
- vector<SingleVorbisComment> mCommentList;
+ vector<SingleVorbisComment*> mCommentList;
};
Modified: trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/FileComments.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/FileComments.cpp 2004-07-24 08:51:40 UTC (rev 7308)
+++ trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/FileComments.cpp 2004-07-24 09:39:53 UTC (rev 7309)
@@ -40,7 +40,7 @@
//
//}
StreamCommentInfo* FileComments::getStreamComment(Int64 inIndex) {
- return new StreamCommentInfo(mNativeClass->getStreamComment(inIndex));
+ return new illiminable::Ogg::libVorbisCommentDotNET::StreamCommentInfo(mNativeClass->getStreamComment(inIndex));
}
Int64 FileComments::streamCount() {
Modified: trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/SingleVorbisComment.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/SingleVorbisComment.cpp 2004-07-24 08:51:40 UTC (rev 7308)
+++ trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/SingleVorbisComment.cpp 2004-07-24 09:39:53 UTC (rev 7309)
@@ -11,6 +11,9 @@
mNativeClass = new ::SingleVorbisComment;
}
+SingleVorbisComment::SingleVorbisComment(::SingleVorbisComment* inNativeClass) {
+ mNativeClass = inNativeClass;
+}
SingleVorbisComment::~SingleVorbisComment(void)
{
delete mNativeClass;
Modified: trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/SingleVorbisComment.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/SingleVorbisComment.h 2004-07-24 08:51:40 UTC (rev 7308)
+++ trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/SingleVorbisComment.h 2004-07-24 09:39:53 UTC (rev 7309)
@@ -42,6 +42,7 @@
{
public:
SingleVorbisComment(void);
+ SingleVorbisComment(::SingleVorbisComment* inNativeClass);
~SingleVorbisComment(void);
String* key();
Modified: trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/StreamCommentInfo.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/StreamCommentInfo.cpp 2004-07-24 08:51:40 UTC (rev 7308)
+++ trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/StreamCommentInfo.cpp 2004-07-24 09:39:53 UTC (rev 7309)
@@ -13,6 +13,10 @@
mNativeClass = new ::StreamCommentInfo;
}
+StreamCommentInfo::StreamCommentInfo(::StreamCommentInfo* inNativeClass) {
+ mNativeClass = inNativeClass;
+}
+
StreamCommentInfo::~StreamCommentInfo(void)
{
delete mNativeClass;
@@ -22,7 +26,8 @@
VorbisComments* StreamCommentInfo::comments() {
- return new VorbisComments(mNativeClass->comments());
+
+ return new illiminable::Ogg::libVorbisCommentDotNET::VorbisComments((::VorbisComments*)mNativeClass->comments());
}
//void setComments(VorbisComments* inComments);
Modified: trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/StreamCommentInfo.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/StreamCommentInfo.h 2004-07-24 08:51:40 UTC (rev 7308)
+++ trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/StreamCommentInfo.h 2004-07-24 09:39:53 UTC (rev 7309)
@@ -63,6 +63,7 @@
{
public:
StreamCommentInfo(void);
+ StreamCommentInfo(::StreamCommentInfo* inNativeClass);
~StreamCommentInfo(void);
Modified: trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/VorbisComments.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/VorbisComments.cpp 2004-07-24 08:51:40 UTC (rev 7308)
+++ trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/VorbisComments.cpp 2004-07-24 09:39:53 UTC (rev 7309)
@@ -12,6 +12,10 @@
mNativeClass = new ::VorbisComments;
}
+VorbisComments::VorbisComments(::VorbisComments* inNativeClass) {
+ mNativeClass = inNativeClass;
+}
+
VorbisComments::~VorbisComments(void)
{
delete mNativeClass;
@@ -37,7 +41,7 @@
unsigned long locIndex = inIndex;
//FIX::: Need to clone this... or bad things will happen when garbage colelcted.
- return new SingleVorbisComment(mNativeClass->getUserComment(locIndex));
+ return new illiminable::Ogg::libVorbisCommentDotNET::SingleVorbisComment((::SingleVorbisComment*)mNativeClass->getUserComment(locIndex));
}
//vector<SingleVorbisComment> getCommentsByKey(String* inKey);
Modified: trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/VorbisComments.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/VorbisComments.h 2004-07-24 08:51:40 UTC (rev 7308)
+++ trunk/oggdsf/src/lib/core/ogg/libVorbisCommentDotNET/VorbisComments.h 2004-07-24 09:39:53 UTC (rev 7309)
@@ -45,6 +45,7 @@
{
public:
VorbisComments(void);
+ VorbisComments(::VorbisComments* inNativeClass);
~VorbisComments(void);
String* vendorString();
@@ -57,7 +58,7 @@
bool addComment(SingleVorbisComment* inComment);
bool addComment(String* inKey, String* inValue);
-
+
//bool parseOggPacket(OggPacket* inPacket, unsigned long inStartOffset);
//OggPacket* toOggPacket();
String* toString();
@@ -66,6 +67,9 @@
protected:
::VorbisComments* mNativeClass;
+
+private:
+ VorbisComments(const VorbisComments&);
};
More information about the commits
mailing list