1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
///////////////////////////////////////////////////////////////////////////////
//
// The contents of this file are subject to the Mozilla Public License
// Version 1.1 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is MP4v2.
//
// The Initial Developer of the Original Code is Kona Blend.
// Portions created by Kona Blend are Copyright (C) 2008.
// All Rights Reserved.
//
// Contributors:
// Kona Blend, kona8lend@@gmail.com
//
///////////////////////////////////////////////////////////////////////////////
#ifndef MP4V2_UTIL_TRACKMODIFIER_H
#define MP4V2_UTIL_TRACKMODIFIER_H
namespace mp4v2 { namespace util {
///////////////////////////////////////////////////////////////////////////////
class MP4V2_EXPORT TrackModifier
{
private:
class Properties
{
private:
TrackModifier& _trackModifier;
public:
Properties( TrackModifier& );
void update();
MP4Integer24Property& flags;
MP4Integer16Property& layer;
MP4Integer16Property& alternateGroup;
MP4Float32Property& volume;
MP4Float32Property& width;
MP4Float32Property& height;
MP4LanguageCodeProperty& language;
MP4StringProperty& handlerType;
MP4StringProperty& handlerName;
MP4BytesProperty* userDataName;
private:
MP4Property& refProperty( const char* );
MP4Property* findProperty( const char* );
void updateProperty( const char*, MP4Property** );
};
friend class Properties;
private:
static MP4Atom& refTrackAtom( MP4File&, uint16_t );
private:
MP4Atom& _track;
Properties _props;
// Track Header
bool _enabled;
bool _inMovie;
bool _inPreview;
uint16_t _layer;
uint16_t _alternateGroup;
float _volume;
float _width;
float _height;
// Media Header
bmff::LanguageCode _language;
// Handler Reference
string _handlerType;
string _handlerName;
// User Data name
string _userDataName;
public:
MP4File& file;
const uint16_t trackIndex;
const MP4TrackId trackId;
const bool& enabled;
const bool& inMovie;
const bool& inPreview;
const uint16_t& layer;
const uint16_t& alternateGroup;
const float& volume;
const float& width;
const float& height;
const bmff::LanguageCode& language;
const string& handlerType;
const string& handlerName;
const string& userDataName;
public:
TrackModifier( MP4FileHandle, uint16_t );
~TrackModifier();
void setEnabled ( bool );
void setInMovie ( bool );
void setInPreview ( bool );
void setLayer ( uint16_t );
void setAlternateGroup ( uint16_t );
void setVolume ( float );
void setWidth ( float );
void setHeight ( float );
void setLanguage ( bmff::LanguageCode );
void setHandlerName ( const string& );
void setUserDataName ( const string& );
// set by string
void setEnabled ( const string& );
void setInMovie ( const string& );
void setInPreview ( const string& );
void setLayer ( const string& );
void setAlternateGroup ( const string& );
void setVolume ( const string& );
void setWidth ( const string& );
void setHeight ( const string& );
void setLanguage ( const string& );
bool hasUserDataName() const;
void removeUserDataName();
void dump( ostream&, const string& );
private:
void fetch();
static string toString( bool );
static string toString( float, uint8_t, uint8_t );
static bool& fromString( const string&, bool& );
static float& fromString( const string&, float& );
static uint16_t& fromString( const string&, uint16_t& );
static string toStringTrackType( const string& );
};
///////////////////////////////////////////////////////////////////////////////
}} // namespace mp4v2::util
#endif // MP4V2_UTIL_TRACKMODIFIER_H
|