Home | History | Annotate | Download | only in webm
      1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef MEDIA_WEBM_TRACKS_BUILDER_H_
      6 #define MEDIA_WEBM_TRACKS_BUILDER_H_
      7 
      8 #include <list>
      9 #include <string>
     10 #include <vector>
     11 
     12 #include "base/basictypes.h"
     13 
     14 namespace media {
     15 
     16 class TracksBuilder {
     17  public:
     18   TracksBuilder();
     19   ~TracksBuilder();
     20 
     21   void AddTrack(int track_num, int track_type, const std::string& codec_id,
     22                 const std::string& name, const std::string& language);
     23 
     24   std::vector<uint8> Finish();
     25 
     26  private:
     27   int GetTracksSize() const;
     28   int GetTracksPayloadSize() const;
     29   void WriteTracks(uint8* buffer, int buffer_size) const;
     30 
     31   class Track {
     32    public:
     33     Track(int track_num, int track_type, const std::string& codec_id,
     34           const std::string& name, const std::string& language);
     35 
     36     int GetSize() const;
     37     void Write(uint8** buf, int* buf_size) const;
     38    private:
     39     int GetPayloadSize() const;
     40 
     41     int track_num_;
     42     int track_type_;
     43     std::string codec_id_;
     44     std::string name_;
     45     std::string language_;
     46   };
     47 
     48   typedef std::list<Track> TrackList;
     49   TrackList tracks_;
     50 
     51   DISALLOW_COPY_AND_ASSIGN(TracksBuilder);
     52 };
     53 
     54 }  // namespace media
     55 
     56 #endif  // MEDIA_WEBM_TRACKS_BUILDER_H_
     57