VirtualBox

Changeset 63160 in vbox for trunk/src


Ignore:
Timestamp:
Aug 8, 2016 12:47:24 PM (8 years ago)
Author:
vboxsync
Message:

EblmWriter: cleanup, disable some warnings when including vpx_encoder.h.

Location:
trunk/src/VBox/Main/src-client
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/EbmlWriter.cpp

    r62485 r63160  
    1616 */
    1717
    18 /*
    19  * This code is based on:
    20  *
    21  * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
    22  *
    23  * Use of this source code is governed by a BSD-style license
    24  * that can be found in the LICENSE file in the root of the source
    25  * tree. An additional intellectual property rights grant can be found
    26  * in the file PATENTS.  All contributing project authors may
    27  * be found in the AUTHORS file in the root of the source tree.
    28  */
    2918
    3019#include <list>
     
    3726#include <VBox/log.h>
    3827#include "EbmlWriter.h"
    39 
    40 /* Matroska EBML Class IDs supported by WebM */
    41  enum Mkv
    42  {
    43      EBML = 0x1A45DFA3,
    44      EBMLVersion = 0x4286,
    45      EBMLReadVersion = 0x42F7,
    46      EBMLMaxIDLength = 0x42F2,
    47      EBMLMaxSizeLength = 0x42F3,
    48      DocType = 0x4282,
    49      DocTypeVersion = 0x4287,
    50      DocTypeReadVersion = 0x4285,
    51  //  CRC_32 = 0xBF,
    52      Void = 0xEC,
    53      SignatureSlot = 0x1B538667,
    54      SignatureAlgo = 0x7E8A,
    55      SignatureHash = 0x7E9A,
    56      SignaturePublicKey = 0x7EA5,
    57      Signature = 0x7EB5,
    58      SignatureElements = 0x7E5B,
    59      SignatureElementList = 0x7E7B,
    60      SignedElement = 0x6532,
    61      //segment
    62      Segment = 0x18538067,
    63      //Meta Seek Information
    64      SeekHead = 0x114D9B74,
    65      Seek = 0x4DBB,
    66      SeekID = 0x53AB,
    67      SeekPosition = 0x53AC,
    68      //Segment Information
    69      Info = 0x1549A966,
    70  //  SegmentUID = 0x73A4,
    71  //  SegmentFilename = 0x7384,
    72  //  PrevUID = 0x3CB923,
    73  //  PrevFilename = 0x3C83AB,
    74  //  NextUID = 0x3EB923,
    75  //  NextFilename = 0x3E83BB,
    76  //  SegmentFamily = 0x4444,
    77  //  ChapterTranslate = 0x6924,
    78  //  ChapterTranslateEditionUID = 0x69FC,
    79  //  ChapterTranslateCodec = 0x69BF,
    80  //  ChapterTranslateID = 0x69A5,
    81      TimecodeScale = 0x2AD7B1,
    82      Segment_Duration = 0x4489,
    83      DateUTC = 0x4461,
    84  //  Title = 0x7BA9,
    85      MuxingApp = 0x4D80,
    86      WritingApp = 0x5741,
    87      //Cluster
    88      Cluster = 0x1F43B675,
    89      Timecode = 0xE7,
    90  //  SilentTracks = 0x5854,
    91  //  SilentTrackNumber = 0x58D7,
    92  //  Position = 0xA7,
    93      PrevSize = 0xAB,
    94      BlockGroup = 0xA0,
    95      Block = 0xA1,
    96  //  BlockVirtual = 0xA2,
    97  //  BlockAdditions = 0x75A1,
    98  //  BlockMore = 0xA6,
    99  //  BlockAddID = 0xEE,
    100  //  BlockAdditional = 0xA5,
    101      BlockDuration = 0x9B,
    102  //  ReferencePriority = 0xFA,
    103      ReferenceBlock = 0xFB,
    104  //  ReferenceVirtual = 0xFD,
    105  //  CodecState = 0xA4,
    106  //  Slices = 0x8E,
    107  //  TimeSlice = 0xE8,
    108      LaceNumber = 0xCC,
    109  //  FrameNumber = 0xCD,
    110  //  BlockAdditionID = 0xCB,
    111  //  MkvDelay = 0xCE,
    112  //  Cluster_Duration = 0xCF,
    113      SimpleBlock = 0xA3,
    114  //  EncryptedBlock = 0xAF,
    115      //Track
    116      Tracks = 0x1654AE6B,
    117      TrackEntry = 0xAE,
    118      TrackNumber = 0xD7,
    119      TrackUID = 0x73C5,
    120      TrackType = 0x83,
    121      FlagEnabled = 0xB9,
    122      FlagDefault = 0x88,
    123      FlagForced = 0x55AA,
    124      FlagLacing = 0x9C,
    125  //  MinCache = 0x6DE7,
    126  //  MaxCache = 0x6DF8,
    127      DefaultDuration = 0x23E383,
    128  //  TrackTimecodeScale = 0x23314F,
    129  //  TrackOffset = 0x537F,
    130  //  MaxBlockAdditionID = 0x55EE,
    131      Name = 0x536E,
    132      Language = 0x22B59C,
    133      CodecID = 0x86,
    134      CodecPrivate = 0x63A2,
    135      CodecName = 0x258688,
    136  //  AttachmentLink = 0x7446,
    137  //  CodecSettings = 0x3A9697,
    138  //  CodecInfoURL = 0x3B4040,
    139  //  CodecDownloadURL = 0x26B240,
    140  //  CodecDecodeAll = 0xAA,
    141  //  TrackOverlay = 0x6FAB,
    142  //  TrackTranslate = 0x6624,
    143  //  TrackTranslateEditionUID = 0x66FC,
    144  //  TrackTranslateCodec = 0x66BF,
    145  //  TrackTranslateTrackID = 0x66A5,
    146      //video
    147      Video = 0xE0,
    148      FlagInterlaced = 0x9A,
    149  //  StereoMode = 0x53B8,
    150      PixelWidth = 0xB0,
    151      PixelHeight = 0xBA,
    152      PixelCropBottom = 0x54AA,
    153      PixelCropTop = 0x54BB,
    154      PixelCropLeft = 0x54CC,
    155      PixelCropRight = 0x54DD,
    156      DisplayWidth = 0x54B0,
    157      DisplayHeight = 0x54BA,
    158      DisplayUnit = 0x54B2,
    159      AspectRatioType = 0x54B3,
    160  //  ColourSpace = 0x2EB524,
    161  //  GammaValue = 0x2FB523,
    162      FrameRate = 0x2383E3,
    163      //end video
    164      //audio
    165      Audio = 0xE1,
    166      SamplingFrequency = 0xB5,
    167      OutputSamplingFrequency = 0x78B5,
    168      Channels = 0x9F,
    169  //  ChannelPositions = 0x7D7B,
    170      BitDepth = 0x6264,
    171      //end audio
    172      //content encoding
    173  //  ContentEncodings = 0x6d80,
    174  //  ContentEncoding = 0x6240,
    175  //  ContentEncodingOrder = 0x5031,
    176  //  ContentEncodingScope = 0x5032,
    177  //  ContentEncodingType = 0x5033,
    178  //  ContentCompression = 0x5034,
    179  //  ContentCompAlgo = 0x4254,
    180  //  ContentCompSettings = 0x4255,
    181  //  ContentEncryption = 0x5035,
    182  //  ContentEncAlgo = 0x47e1,
    183  //  ContentEncKeyID = 0x47e2,
    184  //  ContentSignature = 0x47e3,
    185  //  ContentSigKeyID = 0x47e4,
    186  //  ContentSigAlgo = 0x47e5,
    187  //  ContentSigHashAlgo = 0x47e6,
    188      //end content encoding
    189      //Cueing Data
    190      Cues = 0x1C53BB6B,
    191      CuePoint = 0xBB,
    192      CueTime = 0xB3,
    193      CueTrackPositions = 0xB7,
    194      CueTrack = 0xF7,
    195      CueClusterPosition = 0xF1,
    196      CueBlockNumber = 0x5378
    197  //  CueCodecState = 0xEA,
    198  //  CueReference = 0xDB,
    199  //  CueRefTime = 0x96,
    200  //  CueRefCluster = 0x97,
    201  //  CueRefNumber = 0x535F,
    202  //  CueRefCodecState = 0xEB,
    203      //Attachment
    204  //  Attachments = 0x1941A469,
    205  //  AttachedFile = 0x61A7,
    206  //  FileDescription = 0x467E,
    207  //  FileName = 0x466E,
    208  //  FileMimeType = 0x4660,
    209  //  FileData = 0x465C,
    210  //  FileUID = 0x46AE,
    211  //  FileReferral = 0x4675,
    212      //Chapters
    213  //  Chapters = 0x1043A770,
    214  //  EditionEntry = 0x45B9,
    215  //  EditionUID = 0x45BC,
    216  //  EditionFlagHidden = 0x45BD,
    217  //  EditionFlagDefault = 0x45DB,
    218  //  EditionFlagOrdered = 0x45DD,
    219  //  ChapterAtom = 0xB6,
    220  //  ChapterUID = 0x73C4,
    221  //  ChapterTimeStart = 0x91,
    222  //  ChapterTimeEnd = 0x92,
    223  //  ChapterFlagHidden = 0x98,
    224  //  ChapterFlagEnabled = 0x4598,
    225  //  ChapterSegmentUID = 0x6E67,
    226  //  ChapterSegmentEditionUID = 0x6EBC,
    227  //  ChapterPhysicalEquiv = 0x63C3,
    228  //  ChapterTrack = 0x8F,
    229  //  ChapterTrackNumber = 0x89,
    230  //  ChapterDisplay = 0x80,
    231  //  ChapString = 0x85,
    232  //  ChapLanguage = 0x437C,
    233  //  ChapCountry = 0x437E,
    234  //  ChapProcess = 0x6944,
    235  //  ChapProcessCodecID = 0x6955,
    236  //  ChapProcessPrivate = 0x450D,
    237  //  ChapProcessCommand = 0x6911,
    238  //  ChapProcessTime = 0x6922,
    239  //  ChapProcessData = 0x6933,
    240      //Tagging
    241  //  Tags = 0x1254C367,
    242  //  Tag = 0x7373,
    243  //  Targets = 0x63C0,
    244  //  TargetTypeValue = 0x68CA,
    245  //  TargetType = 0x63CA,
    246  //  Tagging_TrackUID = 0x63C5,
    247  //  Tagging_EditionUID = 0x63C9,
    248  //  Tagging_ChapterUID = 0x63C4,
    249  //  AttachmentUID = 0x63C6,
    250  //  SimpleTag = 0x67C8,
    251  //  TagName = 0x45A3,
    252  //  TagLanguage = 0x447A,
    253  //  TagDefault = 0x4484,
    254  //  TagString = 0x4487,
    255  //  TagBinary = 0x4485,
    256  };
     28#include "EbmlIDs.h"
     29
    25730
    25831class Ebml
     
    27548public:
    27649
    277     /* Creates EBML output file. */
     50    /** Creates EBML output file. */
    27851    inline int create(const char *a_pszFilename)
    27952    {
     
    28154    }
    28255
    283     /* Returns file size. */
     56    /** Returns file size. */
    28457    inline uint64_t getFileSize()
    28558    {
     
    28760    }
    28861
    289     /* Get reference to file descriptor */
     62    /** Get reference to file descriptor */
    29063    inline const RTFILE &getFile()
    29164    {
     
    29366    }
    29467
    295     /* Returns available space on storage. */
     68    /** Returns available space on storage. */
    29669    inline uint64_t getAvailableSpace()
    29770    {
     
    30174    }
    30275
    303     /* Closes the file. */
     76    /** Closes the file. */
    30477    inline void close()
    30578    {
     
    30780    }
    30881
    309     /* Starts an EBML sub-element. */
     82    /** Starts an EBML sub-element. */
    31083    inline Ebml &subStart(EbmlClassId classId)
    31184    {
     
    32093    }
    32194
    322     /* Ends an EBML sub-element. */
     95    /** Ends an EBML sub-element. */
    32396    inline Ebml &subEnd(EbmlClassId classId)
    32497    {
     
    339112    }
    340113
    341     /* Serializes a null-terminated string. */
     114    /** Serializes a null-terminated string. */
    342115    inline Ebml &serializeString(EbmlClassId classId, const char *str)
    343116    {
     
    360133    }
    361134
    362     /* Serializes a floating point value.
     135    /** Serializes a floating point value.
     136     *
    363137     * Only 8-bytes double precision values are supported
    364138     * by this function.
     
    372146    }
    373147
    374     /* Writes raw data to file. */
     148    /** Writes raw data to file. */
    375149    inline void write(const void *data, size_t size)
    376150    {
     
    379153    }
    380154
    381     /* Writes an unsigned integer of variable of fixed size. */
     155    /** Writes an unsigned integer of variable of fixed size. */
    382156    inline void writeUnsignedInteger(uint64_t value, size_t size = sizeof(uint64_t))
    383157    {
     
    387161    }
    388162
    389     /* Writes EBML class ID to file.
     163    /** Writes EBML class ID to file.
     164     *
    390165     * EBML ID already has a UTF8-like represenation
    391166     * so getSizeOfUInt is used to determine
     
    397172    }
    398173
    399     /* Writes data size value. */
     174    /** Writes data size value. */
    400175    inline void writeSize(uint64_t parm)
    401176    {
     
    419194        writeUnsignedInteger((parm & (((mask << 1) - 1) >> size)) | (mask >> (size - 1)), size);
    420195    }
    421     /* Size calculation for variable size UNSIGNED integer.
     196
     197    /** Size calculation for variable size UNSIGNED integer.
     198     *
    422199     * The function defines the size of the number by trimming
    423200     * consequent trailing zero bytes starting from the most significant.
     
    730507    return m_Impl->m_Ebml.getAvailableSpace();
    731508}
     509
  • trunk/src/VBox/Main/src-client/EbmlWriter.h

    r62485 r63160  
    1616 */
    1717
    18 /*
    19  * This code is based on:
    20  *
    21  * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
    22  *
    23  * Use of this source code is governed by a BSD-style license
    24  * that can be found in the LICENSE file in the root of the source
    25  * tree. An additional intellectual property rights grant can be found
    26  * in the file PATENTS.  All contributing project authors may
    27  * be found in the AUTHORS file in the root of the source tree.
    28  */
    29 
    3018#ifndef ____EBMLWRITER
    3119#define ____EBMLWRITER
    3220
     21#ifdef _MSC_VER
     22# pragma warning(push)
     23# pragma warning(disable: 4668) /* vpx_codec.h(64) : warning C4668: '__GNUC__' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */
    3324#include <vpx/vpx_encoder.h>
     25# pragma warning(pop)
     26#else
     27# include <vpx/vpx_encoder.h>
     28#endif
    3429
    3530class WebMWriter_Impl;
     
    4136    virtual ~WebMWriter();
    4237
    43     /* Creates output file
     38    /** Creates output file
    4439     *
    4540     * @param   a_pszFilename   Name of the file to create.
     
    5146    void close();
    5247
    53     /* Writes WebM header to file.
     48    /** Writes WebM header to file.
     49     *
    5450     * Should be called before any writeBlock call.
    5551     *
     
    6157    int writeHeader(const vpx_codec_enc_cfg_t *a_pCfg, const vpx_rational *a_pFps);
    6258
    63     /* Writes a block of compressed data
     59    /** Writes a block of compressed data
    6460     *
    6561     * @param a_pCfg Pointer to VPX Codec configuration structure.
     
    7066    int writeBlock(const vpx_codec_enc_cfg_t *a_pCfg, const vpx_codec_cx_pkt_t *a_pPkt);
    7167
    72     /* Writes WebM footer.
     68    /** Writes WebM footer.
     69     *
    7370     * No other write functions should be called after this one.
     71     *
    7472     * @param a_u64Hash Hash value for the data written.
    7573     *
     
    7876    int writeFooter(uint32_t a_u64Hash);
    7977
    80     /* Gets current output file size.
     78    /** Gets current output file size.
     79     *
    8180     * @returns File size in bytes.
    8281     */
    8382    uint64_t getFileSize();
    8483
    85     /* Gets current free storage space
     84    /** Gets current free storage space
    8685     * available for the file.
    8786     *
     
    9190
    9291private:
    93     /* WebMWriter implementation.
     92    /** WebMWriter implementation.
    9493     * To isolate some include files */
    9594    WebMWriter_Impl *m_Impl;
    9695
    97     /* Not defined */
    98     void operator=(const WebMWriter &);
    99     WebMWriter(const WebMWriter &);
     96    DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(WebMWriter);
    10097};
    10198
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette