[xiph-commits] r7303 - in trunk/oggdsf/src:
illiminable at dactyl.lonelymoon.com
illiminable
Sat Jul 24 00:03:11 PDT 2004
lib/core/ogg/libVorbisComment tools/OOOggCommentDump
Message-ID: <20040724070311.6B6CB9AAAB at dactyl.lonelymoon.com>
Author: illiminable
Date: Sat Jul 24 00:03:11 2004
New Revision: 7303
Modified:
trunk/oggdsf/src/lib/core/ogg/libVorbisComment/FileComments.cpp
trunk/oggdsf/src/lib/core/ogg/libVorbisComment/FileComments.h
trunk/oggdsf/src/lib/core/ogg/libVorbisComment/StreamCommentInfo.cpp
trunk/oggdsf/src/lib/core/ogg/libVorbisComment/StreamCommentInfo.h
trunk/oggdsf/src/tools/OOOggCommentDump/OOOggCommentDump.cpp
Log:
* Updated comment dump utility to use new comments api.
* Few more fixes to comments api.
Modified: trunk/oggdsf/src/lib/core/ogg/libVorbisComment/FileComments.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libVorbisComment/FileComments.cpp 2004-07-24 06:50:52 UTC (rev 7302)
+++ trunk/oggdsf/src/lib/core/ogg/libVorbisComment/FileComments.cpp 2004-07-24 07:03:10 UTC (rev 7303)
@@ -1,3 +1,34 @@
+//===========================================================================
+//Copyright (C) 2004 Zentaro Kavanagh
+//
+//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 ".\filecomments.h"
@@ -92,3 +123,7 @@
return NULL;
}
}
+
+unsigned long FileComments::streamCount() {
+ return mStreams.size();
+}
\ No newline at end of file
Modified: trunk/oggdsf/src/lib/core/ogg/libVorbisComment/FileComments.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libVorbisComment/FileComments.h 2004-07-24 06:50:52 UTC (rev 7302)
+++ trunk/oggdsf/src/lib/core/ogg/libVorbisComment/FileComments.h 2004-07-24 07:03:10 UTC (rev 7303)
@@ -1,3 +1,34 @@
+//===========================================================================
+//Copyright (C) 2004 Zentaro Kavanagh
+//
+//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 "IOggCallback.h"
#include "StreamCommentInfo.h"
@@ -8,7 +39,7 @@
using namespace std;
-class FileComments
+class LIBVORBISCOMMENT_API FileComments
: public IOggCallback
{
public:
@@ -26,6 +57,8 @@
bool addStreamComment(StreamCommentInfo* inStreamComment);
StreamCommentInfo* getStreamComment(unsigned long inIndex);
+ unsigned long streamCount();
+
//IOggCallback implementation
virtual bool acceptOggPage(OggPage* inOggPage);
protected:
Modified: trunk/oggdsf/src/lib/core/ogg/libVorbisComment/StreamCommentInfo.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libVorbisComment/StreamCommentInfo.cpp 2004-07-24 06:50:52 UTC (rev 7302)
+++ trunk/oggdsf/src/lib/core/ogg/libVorbisComment/StreamCommentInfo.cpp 2004-07-24 07:03:10 UTC (rev 7303)
@@ -1,3 +1,34 @@
+//===========================================================================
+//Copyright (C) 2004 Zentaro Kavanagh
+//
+//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 ".\streamcommentinfo.h"
Modified: trunk/oggdsf/src/lib/core/ogg/libVorbisComment/StreamCommentInfo.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libVorbisComment/StreamCommentInfo.h 2004-07-24 06:50:52 UTC (rev 7302)
+++ trunk/oggdsf/src/lib/core/ogg/libVorbisComment/StreamCommentInfo.h 2004-07-24 07:03:10 UTC (rev 7303)
@@ -1,6 +1,37 @@
+//===========================================================================
+//Copyright (C) 2004 Zentaro Kavanagh
+//
+//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 "VorbisComments.h"
-class StreamCommentInfo
+class LIBVORBISCOMMENT_API StreamCommentInfo
{
public:
StreamCommentInfo(void);
Modified: trunk/oggdsf/src/tools/OOOggCommentDump/OOOggCommentDump.cpp
===================================================================
--- trunk/oggdsf/src/tools/OOOggCommentDump/OOOggCommentDump.cpp 2004-07-24 06:50:52 UTC (rev 7302)
+++ trunk/oggdsf/src/tools/OOOggCommentDump/OOOggCommentDump.cpp 2004-07-24 07:03:10 UTC (rev 7303)
@@ -37,40 +37,42 @@
#include <libOOOgg.h>
#include <dllstuff.h>
#include <VorbisComments.h>
+#include "FileComments.h"
+#include "StreamCommentInfo.h"
#include <iostream>
#include <fstream>
-//This will be called by the callback
-unsigned long bytePos;
-VorbisComments gComments;
+////This will be called by the callback
+//unsigned long bytePos;
+//VorbisComments gComments;
+//
+//bool pageCB(OggPage* inOggPage) {
+//
+// for (unsigned long i = 0; i < inOggPage->numPackets(); i++) {
+// OggPacket* locPacket = NULL;
+// locPacket = inOggPage->getPacket(i);
+// if (strncmp((const char*)locPacket->packetData(), "\003vorbis", 7) == 0) {
+// //Comment Packet
+//
+// bool locIsOK = gComments.parseOggPacket(locPacket, 7);
+// cout<<"Vorbis Comments"<<endl;
+// cout<<gComments.toString();
+// } else if ((strncmp((char*)locPacket->packetData(), "\201theora", 7)) == 0) {
+// bool locIsOK = gComments.parseOggPacket(locPacket, 7);
+// cout<<"Theora Comments"<<endl;
+// cout<<gComments.toString();
+//
+// }
+// }
+//
+// return true;
+//}
-bool pageCB(OggPage* inOggPage) {
- for (unsigned long i = 0; i < inOggPage->numPackets(); i++) {
- OggPacket* locPacket = NULL;
- locPacket = inOggPage->getPacket(i);
- if (strncmp((const char*)locPacket->packetData(), "\003vorbis", 7) == 0) {
- //Comment Packet
-
- bool locIsOK = gComments.parseOggPacket(locPacket, 7);
- cout<<"Vorbis Comments"<<endl;
- cout<<gComments.toString();
- } else if ((strncmp((char*)locPacket->packetData(), "\201theora", 7)) == 0) {
- bool locIsOK = gComments.parseOggPacket(locPacket, 7);
- cout<<"Theora Comments"<<endl;
- cout<<gComments.toString();
-
- }
- }
-
- return true;
-}
-
-
-int _tmain(int argc, _TCHAR* argv[])
+int __cdecl _tmain(int argc, _TCHAR* argv[])
{
@@ -80,25 +82,22 @@
//
- bytePos = 0;
+
if (argc < 2) {
cout<<"Usage : OOOggCommentDump <filename>"<<endl;
} else {
- OggDataBuffer testOggBuff;
- OggCallbackRego* locCBRego = new OggCallbackRego(&pageCB);
- const BUFF_SIZE = 8092;
- testOggBuff.registerPageCallback(locCBRego);
- fstream testFile;
- testFile.open(argv[1], ios_base::in | ios_base::binary);
- char* locBuff = new char[BUFF_SIZE];
- while (!testFile.eof()) {
- testFile.read(locBuff, BUFF_SIZE);
- unsigned long locBytesRead = testFile.gcount();
- testOggBuff.feed(locBuff, locBytesRead);
- }
+ FileComments locFileComments;
+ StreamCommentInfo* locStreamInfo = NULL;
+ locFileComments.loadFile(argv[1]);
+ for (int i = 0; i < locFileComments.streamCount(); i++) {
+ locStreamInfo = locFileComments.getStreamComment(i);
- delete locBuff;
+ cout<<"Stream "<<locStreamInfo->majorStreamNo()<<":"<<locStreamInfo->minorStreamNo()<<endl;
+ cout<<"Starts "<<locStreamInfo->pageStart()<<endl;
+ cout<<locStreamInfo->comments()->toString()<<endl<<endl;
+
+ }
}
More information about the commits
mailing list