Tide 0.1.0

track_entry.h

Go to the documentation of this file.
00001 /* Tide
00002  *
00003  * Header for the TrackEntry element and related elements.
00004  *
00005  * Copyright 2011 Geoffrey Biggs geoffrey.biggs@aist.go.jp
00006  *     RT-Synthesis Research Group
00007  *     Intelligent Systems Research Institute,
00008  *     National Institute of Advanced Industrial Science and Technology (AIST),
00009  *     Japan
00010  *     All rights reserved.
00011  *
00012  * This file is part of Tide.
00013  *
00014  * Tide is free software; you can redistribute it and/or modify it under
00015  * the terms of the GNU Lesser General Public License as published by
00016  * the Free Software Foundation; either version 2.1 of the License, or
00017  * (at your option) any later version.
00018  *
00019  * Tide is distributed in the hope that it will be useful, but WITHOUT
00020  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00021  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00022  * License for more details.
00023  *
00024  * You should have received a copy of the GNU Lesser General Public
00025  * License along with Tide. If not, see <http://www.gnu.org/licenses/>.
00026  */
00027 
00028 #if !defined(TIDE_TRACK_ENTRY_H_)
00029 #define TIDE_TRACK_ENTRY_H_
00030 
00031 #include <boost/operators.hpp>
00032 #include <boost/shared_ptr.hpp>
00033 #include <string>
00034 #include <tide/binary_element.h>
00035 #include <tide/float_element.h>
00036 #include <tide/master_element.h>
00037 #include <tide/string_element.h>
00038 #include <tide/track_operation.h>
00039 #include <tide/uint_element.h>
00040 #include <tide/win_dll.h>
00041 
00044 
00045 namespace tide
00046 {
00058     class TIDE_EXPORT TrackEntry : public MasterElement,
00059             public boost::equality_comparable<TrackEntry>
00060     {
00061         public:
00068             TrackEntry(uint64_t number, uint64_t uid,
00069                     std::string const& codec);
00070 
00072             virtual ~TrackEntry() {}
00073 
00079             uint64_t number() const { return number_; }
00085             void number(uint64_t number);
00086 
00093             uint64_t uid() const { return uid_; }
00099             void uid(uint64_t uid);
00100 
00107             uint8_t type() const { return type_; }
00113             void type(uint8_t type);
00114 
00121             bool enabled() const { return enabled_; }
00123             void enabled(bool enabled) { enabled_ = enabled; }
00124 
00131             bool forced() const { return forced_; }
00133             void forced(bool forced) { forced_ = forced; }
00134 
00147             bool lacing() const { return lacing_; }
00149             void lacing(bool lacing) { lacing_ = lacing; }
00150 
00161             uint64_t min_cache() const { return min_cache_; }
00163             void min_cache(uint64_t min_cache) { min_cache_ = min_cache; }
00164 
00177             uint64_t max_cache() const { return max_cache_; }
00179             void max_cache(uint64_t max_cache) { max_cache_ = max_cache; }
00180 
00187             uint64_t default_duration() const { return default_dur_; }
00192             void default_duration(uint64_t default_duration)
00193                 { default_dur_ = default_duration; }
00194 
00202             double timecode_scale() const { return timecode_scale_; }
00208             void timecode_scale(double timecode_scale);
00209 
00216             uint64_t max_block_add_id() const
00217                 { return max_block_add_id_; }
00219             void max_block_add_id(uint64_t max_id)
00220                 { max_block_add_id_ = max_id; }
00221 
00223             std::string name() const { return name_; }
00225             void name(std::string name) { name_ = name; }
00226 
00232             std::string codec_id() const { return codec_id_; }
00238             void codec_id(std::string id);
00239 
00245             std::vector<char> codec_private() const
00246                 { return codec_private_; }
00248             void codec_private(std::vector<char> const& data)
00249                 { codec_private_ = data; }
00250 
00255             std::string codec_name() const { return codec_name_; }
00257             void codec_name(std::string name) { codec_name_ = name; }
00258 
00267             uint64_t attachment_link() const
00268                 { return attachment_link_; }
00274             void attachment_link(uint64_t uid) { attachment_link_ = uid; }
00275 
00277             bool decode_all() const { return decode_all_; }
00279             void decode_all(bool decode_all) { decode_all_ = decode_all; }
00280 
00286             std::vector<uint64_t> overlays() const;
00288             void overlays(std::vector<uint64_t> const& uids);
00289 
00296             bool is_virtual() const { return operation_; }
00304             TrackOperationBase::Ptr operation() const { return operation_; }
00306             void operation(TrackOperationBase::Ptr const& operation)
00307                 { operation_ = operation; }
00308 
00310             virtual std::streamsize write_body(std::ostream& output);
00311 
00313             typedef boost::shared_ptr<TrackEntry> Ptr;
00315             typedef boost::shared_ptr<TrackEntry const> ConstPtr;
00316 
00318             friend bool operator==(TrackEntry const& lhs,
00319                     TrackEntry const& rhs);
00320 
00321         protected:
00322             UIntElement number_;
00323             UIntElement uid_;
00324             UIntElement type_;
00325             UIntElement enabled_;
00326             UIntElement forced_;
00327             UIntElement lacing_;
00328             UIntElement min_cache_;
00329             UIntElement max_cache_;
00330             UIntElement default_dur_;
00331             FloatElement timecode_scale_;
00332             UIntElement max_block_add_id_;
00333             StringElement name_;
00334             StringElement codec_id_;
00335             BinaryElement codec_private_;
00336             StringElement codec_name_;
00337             UIntElement attachment_link_;
00338             UIntElement decode_all_;
00339             std::vector<UIntElement> overlays_;
00340             TrackOperationBase::Ptr operation_;
00341 
00343             virtual std::streamsize body_size() const;
00344 
00346             virtual std::streamsize read_body(std::istream& input,
00347                     std::streamsize size);
00348 
00350             void reset();
00355             std::streamsize read_operation(std::istream& input);
00356     }; // class TrackEntry
00357 
00358     bool operator==(TrackEntry const& lhs, TrackEntry const& rhs);
00359 }; // namespace tide;
00360 
00362 // group elements
00363 
00364 #endif // TIDE_TRACK_ENTRY_H_
00365 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines