liveMedia/EBMLNumber.cpp

Go to the documentation of this file.
00001 /**********
00002 This library is free software; you can redistribute it and/or modify it under
00003 the terms of the GNU Lesser General Public License as published by the
00004 Free Software Foundation; either version 2.1 of the License, or (at your
00005 option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
00006 
00007 This library is distributed in the hope that it will be useful, but WITHOUT
00008 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00009 FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
00010 more details.
00011 
00012 You should have received a copy of the GNU Lesser General Public License
00013 along with this library; if not, write to the Free Software Foundation, Inc.,
00014 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
00015 **********/
00016 // "liveMedia"
00017 // Copyright (c) 1996-2012 Live Networks, Inc.  All rights reserved.
00018 // EBML numbers (ids and sizes)
00019 // Implementation
00020 
00021 #include "EBMLNumber.hh"
00022 
00023 EBMLNumber::EBMLNumber(Boolean stripLeading1)
00024     : stripLeading1(stripLeading1), len(0) {
00025 }
00026 
00027 EBMLNumber::~EBMLNumber() {
00028 }
00029 
00030 char* EBMLNumber::hexString() const {
00031   static char printBuf[2*EBML_NUMBER_MAX_LEN + 1];
00032   
00033   char* to = printBuf;
00034   for (unsigned i = 0; i < len; ++i) {
00035     sprintf(to, "%02X", data[i]);
00036     to += 2;
00037   }
00038 
00039   return printBuf;
00040 }
00041 
00042 u_int64_t EBMLNumber::val() const {
00043   u_int64_t result = 0;
00044 
00045   for (unsigned i = 0; i < len; ++i) {
00046     result = result*256 + data[i];
00047   }
00048 
00049   return result;
00050 }
00051 
00052 EBMLId::EBMLId()
00053   : EBMLNumber(False) {
00054 }
00055 
00056 EBMLId::~EBMLId() {
00057 }
00058 
00059 char const* EBMLId::stringName() const {
00060   switch (val()) {
00061     case MATROSKA_ID_EBML: { return "EBML"; }
00062     case MATROSKA_ID_VOID: { return "Void"; }
00063     case MATROSKA_ID_CRC_32: { return "CRC-32"; }
00064     case MATROSKA_ID_SEGMENT: { return "Segment"; }
00065     case MATROSKA_ID_SEEK_HEAD: { return "Seek Head"; }
00066     case MATROSKA_ID_SEEK: { return "Seek"; }
00067     case MATROSKA_ID_SEEK_ID: { return "Seek ID"; }
00068     case MATROSKA_ID_SEEK_POSITION: { return "Seek Position"; }
00069     case MATROSKA_ID_INFO: { return "Segment Info"; }
00070     case MATROSKA_ID_SEGMENT_UID: { return "Segment UID"; }
00071     case MATROSKA_ID_DURATION: { return "Segment Duration"; }
00072     case MATROSKA_ID_TIMECODE_SCALE: { return "Timecode Scale"; }
00073     case MATROSKA_ID_DATE_UTC: { return "Date (UTC)"; }
00074     case MATROSKA_ID_MUXING_APP: { return "Muxing App"; }
00075     case MATROSKA_ID_WRITING_APP: { return "Writing App"; }
00076     case MATROSKA_ID_CLUSTER: { return "Cluster"; }
00077     case MATROSKA_ID_TIMECODE: { return "TimeCode"; }
00078     case MATROSKA_ID_POSITION: { return "Position"; }
00079     case MATROSKA_ID_PREV_SIZE: { return "Prev. Size"; }
00080     case MATROSKA_ID_SIMPLEBLOCK: { return "SimpleBlock"; }
00081     case MATROSKA_ID_BLOCK_GROUP: { return "Block Group"; }
00082     case MATROSKA_ID_BLOCK: { return "Block"; }
00083     case MATROSKA_ID_BLOCK_DURATION: { return "Block Duration"; }
00084     case MATROSKA_ID_REFERENCE_BLOCK: { return "Reference Block"; }
00085     case MATROSKA_ID_TRACKS: { return "Tracks"; }
00086     case MATROSKA_ID_TRACK_ENTRY: { return "Track Entry"; }
00087     case MATROSKA_ID_TRACK_NUMBER: { return "Track Number"; }
00088     case MATROSKA_ID_TRACK_UID: { return "Track UID"; }
00089     case MATROSKA_ID_TRACK_TYPE: { return "Track Type"; }
00090     case MATROSKA_ID_FLAG_ENABLED: { return "Flag Enabled"; }
00091     case MATROSKA_ID_FLAG_DEFAULT: { return "Flag Default"; }
00092     case MATROSKA_ID_FLAG_FORCED: { return "Flag Forced"; }
00093     case MATROSKA_ID_FLAG_LACING: { return "Flag Lacing"; }
00094     case MATROSKA_ID_MIN_CACHE: { return "Min Cache"; }
00095     case MATROSKA_ID_DEFAULT_DURATION: { return "Default Duration"; }
00096     case MATROSKA_ID_TRACK_TIMECODE_SCALE: { return "Track Timecode Scale"; }
00097     case MATROSKA_ID_MAX_BLOCK_ADDITION_ID: { return "Max Block Addition ID"; }
00098     case MATROSKA_ID_NAME: { return "Name"; }
00099     case MATROSKA_ID_LANGUAGE: { return "Language"; }
00100     case MATROSKA_ID_CODEC: { return "Codec ID"; }
00101     case MATROSKA_ID_CODEC_PRIVATE: { return "Codec Private"; }
00102     case MATROSKA_ID_CODEC_NAME: { return "Codec Name"; }
00103     case MATROSKA_ID_CODEC_DECODE_ALL: { return "Codec Decode All"; }
00104     case MATROSKA_ID_VIDEO: { return "Video Settings"; }
00105     case MATROSKA_ID_FLAG_INTERLACED: { return "Flag Interlaced"; }
00106     case MATROSKA_ID_PIXEL_WIDTH: { return "Pixel Width"; }
00107     case MATROSKA_ID_PIXEL_HEIGHT: { return "Pixel Height"; }
00108     case MATROSKA_ID_DISPLAY_WIDTH: { return "Display Width"; }
00109     case MATROSKA_ID_DISPLAY_HEIGHT: { return "Display Height"; }
00110     case MATROSKA_ID_AUDIO: { return "Audio Settings"; }
00111     case MATROSKA_ID_SAMPLING_FREQUENCY: { return "Sampling Frequency"; }
00112     case MATROSKA_ID_OUTPUT_SAMPLING_FREQUENCY: { return "Output Sampling Frequency"; }
00113     case MATROSKA_ID_CHANNELS: { return "Channels"; }
00114     case MATROSKA_ID_CONTENT_ENCODINGS: { return "Content Encodings"; }
00115     case MATROSKA_ID_CONTENT_ENCODING: { return "Content Encoding"; }
00116     case MATROSKA_ID_CONTENT_COMPRESSION: { return "Content Compression"; }
00117     case MATROSKA_ID_CONTENT_COMP_ALGO: { return "Content Compression Algorithm"; }
00118     case MATROSKA_ID_CONTENT_COMP_SETTINGS: { return "Content Compression Settings"; }
00119     case MATROSKA_ID_CONTENT_ENCRYPTION: { return "Content Encryption"; }
00120     case MATROSKA_ID_CUES: { return "Cues"; }
00121     case MATROSKA_ID_CUE_POINT: { return "Cue Point"; }
00122     case MATROSKA_ID_CUE_TIME: { return "Cue Time"; }
00123     case MATROSKA_ID_CUE_TRACK_POSITIONS: { return "Cue Track Positions"; }
00124     case MATROSKA_ID_CUE_TRACK: { return "Cue Track"; }
00125     case MATROSKA_ID_CUE_CLUSTER_POSITION: { return "Cue Cluster Position"; }
00126     case MATROSKA_ID_CUE_BLOCK_NUMBER: { return "Cue Block Number"; }
00127     case MATROSKA_ID_TAGS: { return "Tags"; }
00128     default: { return "*****unknown*****"; }
00129   }
00130 }
00131 
00132 EBMLDataSize::EBMLDataSize()
00133   : EBMLNumber(True) {
00134 }
00135 
00136 EBMLDataSize::~EBMLDataSize() {
00137 }

Generated on Thu May 17 07:11:45 2012 for live by  doxygen 1.5.2