FishSkeleton.cpp

Go to the documentation of this file.
00001 //===========================================================================
00002 //Copyright (C) 2003, 2004 Zentaro Kavanagh
00003 //
00004 //Copyright (C) 2004 Commonwealth Scientific and Industrial Research
00005 //   Organisation (CSIRO) Australia
00006 //
00007 //Redistribution and use in source and binary forms, with or without
00008 //modification, are permitted provided that the following conditions
00009 //are met:
00010 //
00011 //- Redistributions of source code must retain the above copyright
00012 //  notice, this list of conditions and the following disclaimer.
00013 //
00014 //- Redistributions in binary form must reproduce the above copyright
00015 //  notice, this list of conditions and the following disclaimer in the
00016 //  documentation and/or other materials provided with the distribution.
00017 //
00018 //- Neither the name of Zentaro Kavanagh nor the names of contributors 
00019 //  may be used to endorse or promote products derived from this software 
00020 //  without specific prior written permission.
00021 //
00022 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023 //``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024 //LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00025 //PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE ORGANISATION OR
00026 //CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00027 //EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00028 //PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00029 //PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00030 //LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00031 //NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00032 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033 //===========================================================================
00034 
00035 #include "stdafx.h"
00036 #include ".\fishskeleton.h"
00037 
00038 FishSkeleton::FishSkeleton(void)
00039 {
00040 }
00041 
00042 FishSkeleton::~FishSkeleton(void)
00043 {
00044 }
00045 OggPage* FishSkeleton::makeFishHeadBOS_3_0      (               unsigned long inSerialNo
00046                                                                                                 ,       unsigned short inVersionMajor
00047                                                                                                 ,       unsigned short inVersionMinor
00048                                                                                                 ,       unsigned __int64 inTimebaseNum
00049                                                                                                 ,       unsigned __int64 inTimebaseDenom
00050                                                                                                 ,       const unsigned char* inUTC
00051                                                                                                                 
00052                                                                                         )
00053 {
00054         unsigned char* locBuff = NULL;
00055         StampedOggPacket* locPack = NULL;
00056         OggPage* retPage = NULL;
00057         unsigned char* locSegTable = NULL;
00058         switch (inVersionMajor) {
00059                 case 2:
00060                         locBuff = new unsigned char[FishSkeleton::FISHEAD_3_0_PACKET_SIZE];
00061 
00062                         //      0       -       7               fishead\0
00063                         //  8   -   9           Version Major
00064                         // 10   -  11           Version Minor
00065                         // 12   -  19           Timebase Num
00066                         // 20   -  27           Timebase Denom
00067                         // 28   =  48           UTC
00068                         locBuff[0] = 'f';
00069                         locBuff[1] = 'i';
00070                         locBuff[2] = 's';
00071                         locBuff[3] = 'h';
00072                         locBuff[4] = 'e';
00073                         locBuff[5] = 'a';
00074                         locBuff[6] = 'd';
00075                         locBuff[7] = 0;
00076                         iLE_Math::UShortToCharArr(inVersionMajor, locBuff + 8);
00077                         iLE_Math::UShortToCharArr(inVersionMinor, locBuff + 10);
00078                         iLE_Math::Int64ToCharArr(inTimebaseNum, locBuff + 12);
00079                         iLE_Math::Int64ToCharArr(inTimebaseDenom, locBuff + 20);
00080                         for (int i = 0; i < 20; i++) {
00081                                 locBuff[28 + i] = inUTC[i];
00082                         }
00083                         
00084                         locPack = new StampedOggPacket(locBuff, FishSkeleton::FISHEAD_3_0_PACKET_SIZE, false, false, 0, 0, StampedOggPacket::OGG_END_ONLY);
00085 
00086                         retPage = new OggPage;
00087                         retPage->header()->setHeaderFlags(2);
00088                         retPage->header()->setGranulePos((__int64)0);
00089                         retPage->header()->setNumPageSegments( 1);
00090                         locSegTable = new unsigned char[1];
00091                         locSegTable[0] = FishSkeleton::FISHEAD_3_0_PACKET_SIZE;
00092                         retPage->header()->setSegmentTable(locSegTable, 1);
00093                         retPage->header()->setHeaderSize(28);
00094                         retPage->header()->setDataSize(FishSkeleton::FISHEAD_3_0_PACKET_SIZE);
00095 
00096                         retPage->header()->setStreamSerialNo(inSerialNo);
00097                         retPage->addPacket(locPack);
00098                         
00099                         return retPage;
00100 
00101                 default:
00102                         return NULL;
00103 
00104 
00105         }
00106 }
00107 
00108 StampedOggPacket* FishSkeleton::makeFishBone_3_0        (               unsigned __int64 inGranuleRateNum
00109                                                                                                                 ,       unsigned __int64 inGranuleDenom
00110                                                                                                                 ,       unsigned long inNumSecHeaders
00111                                                                                                                 ,       unsigned short inGranuleShift
00112                                                                                                                 ,       vector<string> inMessageHeaders
00113                                                                                                         ) 
00114 {
00115         return NULL;
00116 }

Generated on Tue Feb 15 14:54:20 2005 for oggdsf by  doxygen 1.3.9