Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: media/formats/webm/tracks_builder.h

Issue 213153008: MSE: Parse WebM TrackEntry DefaultDuration field (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_FORMATS_WEBM_TRACKS_BUILDER_H_ 5 #ifndef MEDIA_FORMATS_WEBM_TRACKS_BUILDER_H_
6 #define MEDIA_FORMATS_WEBM_TRACKS_BUILDER_H_ 6 #define MEDIA_FORMATS_WEBM_TRACKS_BUILDER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 13
14 namespace media { 14 namespace media {
15 15
16 class TracksBuilder { 16 class TracksBuilder {
17 public: 17 public:
18 TracksBuilder(); 18 TracksBuilder();
19 ~TracksBuilder(); 19 ~TracksBuilder();
20 20
21 // Only a non-negative |default_duration| will result in a serialized
22 // kWebMIdDefaultDuration element. Note, 0 is allowed here for testing, but it
23 // is an illegal value for DefaultDuration. Similar applies to
24 // |audio_channels|, |audio_sampling_frequency|, |video_pixel_width| and
25 // |video_pixel_height|.
21 void AddTrack(int track_num, int track_type, int track_uid, 26 void AddTrack(int track_num, int track_type, int track_uid,
22 const std::string& codec_id, const std::string& name, 27 const std::string& codec_id, const std::string& name,
23 const std::string& language); 28 const std::string& language, int default_duration,
29 int video_pixel_width, int video_pixel_height,
30 int audio_channels, double audio_sampling_frequency);
24 31
25 std::vector<uint8> Finish(); 32 std::vector<uint8> Finish();
26 33
27 private: 34 private:
28 int GetTracksSize() const; 35 int GetTracksSize() const;
29 int GetTracksPayloadSize() const; 36 int GetTracksPayloadSize() const;
30 void WriteTracks(uint8* buffer, int buffer_size) const; 37 void WriteTracks(uint8* buffer, int buffer_size) const;
31 38
32 class Track { 39 class Track {
33 public: 40 public:
34 Track(int track_num, int track_type, int track_uid, 41 Track(int track_num, int track_type, int track_uid,
35 const std::string& codec_id, const std::string& name, 42 const std::string& codec_id, const std::string& name,
36 const std::string& language); 43 const std::string& language, int default_duration,
44 int video_pixel_width, int video_pixel_height,
45 int audio_channels, double audio_sampling_frequency);
37 46
38 int GetSize() const; 47 int GetSize() const;
39 void Write(uint8** buf, int* buf_size) const; 48 void Write(uint8** buf, int* buf_size) const;
40 private: 49 private:
41 int GetPayloadSize() const; 50 int GetPayloadSize() const;
51 int GetVideoPayloadSize() const;
52 int GetAudioPayloadSize() const;
42 53
43 int track_num_; 54 int track_num_;
44 int track_type_; 55 int track_type_;
45 int track_uid_; 56 int track_uid_;
46 std::string codec_id_; 57 std::string codec_id_;
47 std::string name_; 58 std::string name_;
48 std::string language_; 59 std::string language_;
60 int default_duration_;
61 int video_pixel_width_;
62 int video_pixel_height_;
63 int audio_channels_;
64 double audio_sampling_frequency_;
49 }; 65 };
50 66
51 typedef std::list<Track> TrackList; 67 typedef std::list<Track> TrackList;
52 TrackList tracks_; 68 TrackList tracks_;
53 69
54 DISALLOW_COPY_AND_ASSIGN(TracksBuilder); 70 DISALLOW_COPY_AND_ASSIGN(TracksBuilder);
55 }; 71 };
56 72
57 } // namespace media 73 } // namespace media
58 74
59 #endif // MEDIA_FORMATS_WEBM_TRACKS_BUILDER_H_ 75 #endif // MEDIA_FORMATS_WEBM_TRACKS_BUILDER_H_
OLDNEW
« no previous file with comments | « no previous file | media/formats/webm/tracks_builder.cc » ('j') | media/formats/webm/tracks_builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698