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

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: Fixes lint err (c-style cast). 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
« no previous file with comments | « no previous file | media/formats/webm/tracks_builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // If |allow_invalid_values| is false, some AddTrack() parameters will be
19 // basically checked and will assert if out of valid range. |codec_id|,
20 // |name|, |language| and any device-specific constraints are not checked.
21 explicit TracksBuilder(bool allow_invalid_values);
22 TracksBuilder(); // Sets |allow_invalid_values| to false.
19 ~TracksBuilder(); 23 ~TracksBuilder();
20 24
21 void AddTrack(int track_num, int track_type, int track_uid, 25 // Only a non-negative |default_duration| will result in a serialized
22 const std::string& codec_id, const std::string& name, 26 // kWebMIdDefaultDuration element. Note, 0 is allowed here for testing only
23 const std::string& language); 27 // if |allow_invalid_values_| is true, since it is an illegal value for
28 // DefaultDuration. Similar applies to |audio_channels|,
29 // |audio_sampling_frequency|, |video_pixel_width| and |video_pixel_height|.
30 void AddVideoTrack(int track_num, int track_uid, const std::string& codec_id,
31 const std::string& name, const std::string& language,
32 int default_duration, int video_pixel_width,
33 int video_pixel_height);
34 void AddAudioTrack(int track_num, int track_uid, const std::string& codec_id,
35 const std::string& name, const std::string& language,
36 int default_duration, int audio_channels,
37 double audio_sampling_frequency);
38 void AddTextTrack(int track_num, int track_uid, const std::string& codec_id,
39 const std::string& name, const std::string& language);
24 40
25 std::vector<uint8> Finish(); 41 std::vector<uint8> Finish();
26 42
27 private: 43 private:
44 void AddTrackInternal(int track_num, int track_type, int track_uid,
45 const std::string& codec_id, const std::string& name,
46 const std::string& language, int default_duration,
47 int video_pixel_width, int video_pixel_height,
48 int audio_channels, double audio_sampling_frequency);
28 int GetTracksSize() const; 49 int GetTracksSize() const;
29 int GetTracksPayloadSize() const; 50 int GetTracksPayloadSize() const;
30 void WriteTracks(uint8* buffer, int buffer_size) const; 51 void WriteTracks(uint8* buffer, int buffer_size) const;
31 52
32 class Track { 53 class Track {
33 public: 54 public:
34 Track(int track_num, int track_type, int track_uid, 55 Track(int track_num, int track_type, int track_uid,
35 const std::string& codec_id, const std::string& name, 56 const std::string& codec_id, const std::string& name,
36 const std::string& language); 57 const std::string& language, int default_duration,
58 int video_pixel_width, int video_pixel_height,
59 int audio_channels, double audio_sampling_frequency,
60 bool allow_invalid_values);
37 61
38 int GetSize() const; 62 int GetSize() const;
39 void Write(uint8** buf, int* buf_size) const; 63 void Write(uint8** buf, int* buf_size) const;
40 private: 64 private:
41 int GetPayloadSize() const; 65 int GetPayloadSize() const;
66 int GetVideoPayloadSize() const;
67 int GetAudioPayloadSize() const;
42 68
43 int track_num_; 69 int track_num_;
44 int track_type_; 70 int track_type_;
45 int track_uid_; 71 int track_uid_;
46 std::string codec_id_; 72 std::string codec_id_;
47 std::string name_; 73 std::string name_;
48 std::string language_; 74 std::string language_;
75 int default_duration_;
76 int video_pixel_width_;
77 int video_pixel_height_;
78 int audio_channels_;
79 double audio_sampling_frequency_;
49 }; 80 };
50 81
51 typedef std::list<Track> TrackList; 82 typedef std::list<Track> TrackList;
52 TrackList tracks_; 83 TrackList tracks_;
84 bool allow_invalid_values_;
53 85
54 DISALLOW_COPY_AND_ASSIGN(TracksBuilder); 86 DISALLOW_COPY_AND_ASSIGN(TracksBuilder);
55 }; 87 };
56 88
57 } // namespace media 89 } // namespace media
58 90
59 #endif // MEDIA_FORMATS_WEBM_TRACKS_BUILDER_H_ 91 #endif // MEDIA_FORMATS_WEBM_TRACKS_BUILDER_H_
OLDNEW
« no previous file with comments | « no previous file | media/formats/webm/tracks_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698