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

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

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years 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
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 <stdint.h>
9
8 #include <list> 10 #include <list>
9 #include <string> 11 #include <string>
10 #include <vector> 12 #include <vector>
11 13
12 #include "base/basictypes.h" 14 #include "base/macros.h"
13 15
14 namespace media { 16 namespace media {
15 17
16 class TracksBuilder { 18 class TracksBuilder {
17 public: 19 public:
18 // If |allow_invalid_values| is false, some AddTrack() parameters will be 20 // If |allow_invalid_values| is false, some AddTrack() parameters will be
19 // basically checked and will assert if out of valid range. |codec_id|, 21 // basically checked and will assert if out of valid range. |codec_id|,
20 // |name|, |language| and any device-specific constraints are not checked. 22 // |name|, |language| and any device-specific constraints are not checked.
21 explicit TracksBuilder(bool allow_invalid_values); 23 explicit TracksBuilder(bool allow_invalid_values);
22 TracksBuilder(); // Sets |allow_invalid_values| to false. 24 TracksBuilder(); // Sets |allow_invalid_values| to false.
23 ~TracksBuilder(); 25 ~TracksBuilder();
24 26
25 // Only a non-negative |default_duration| will result in a serialized 27 // Only a non-negative |default_duration| will result in a serialized
26 // kWebMIdDefaultDuration element. Note, 0 is allowed here for testing only 28 // kWebMIdDefaultDuration element. Note, 0 is allowed here for testing only
27 // if |allow_invalid_values_| is true, since it is an illegal value for 29 // if |allow_invalid_values_| is true, since it is an illegal value for
28 // DefaultDuration. Similar applies to |audio_channels|, 30 // DefaultDuration. Similar applies to |audio_channels|,
29 // |audio_sampling_frequency|, |video_pixel_width| and |video_pixel_height|. 31 // |audio_sampling_frequency|, |video_pixel_width| and |video_pixel_height|.
30 void AddVideoTrack(int track_num, 32 void AddVideoTrack(int track_num,
31 uint64 track_uid, 33 uint64_t track_uid,
32 const std::string& codec_id, 34 const std::string& codec_id,
33 const std::string& name, 35 const std::string& name,
34 const std::string& language, 36 const std::string& language,
35 int default_duration, 37 int default_duration,
36 int video_pixel_width, 38 int video_pixel_width,
37 int video_pixel_height); 39 int video_pixel_height);
38 void AddAudioTrack(int track_num, 40 void AddAudioTrack(int track_num,
39 uint64 track_uid, 41 uint64_t track_uid,
40 const std::string& codec_id, 42 const std::string& codec_id,
41 const std::string& name, 43 const std::string& name,
42 const std::string& language, 44 const std::string& language,
43 int default_duration, 45 int default_duration,
44 int audio_channels, 46 int audio_channels,
45 double audio_sampling_frequency); 47 double audio_sampling_frequency);
46 void AddTextTrack(int track_num, 48 void AddTextTrack(int track_num,
47 uint64 track_uid, 49 uint64_t track_uid,
48 const std::string& codec_id, 50 const std::string& codec_id,
49 const std::string& name, 51 const std::string& name,
50 const std::string& language); 52 const std::string& language);
51 53
52 std::vector<uint8> Finish(); 54 std::vector<uint8_t> Finish();
53 55
54 private: 56 private:
55 void AddTrackInternal(int track_num, 57 void AddTrackInternal(int track_num,
56 int track_type, 58 int track_type,
57 uint64 track_uid, 59 uint64_t track_uid,
58 const std::string& codec_id, 60 const std::string& codec_id,
59 const std::string& name, 61 const std::string& name,
60 const std::string& language, 62 const std::string& language,
61 int default_duration, 63 int default_duration,
62 int video_pixel_width, 64 int video_pixel_width,
63 int video_pixel_height, 65 int video_pixel_height,
64 int audio_channels, 66 int audio_channels,
65 double audio_sampling_frequency); 67 double audio_sampling_frequency);
66 int GetTracksSize() const; 68 int GetTracksSize() const;
67 int GetTracksPayloadSize() const; 69 int GetTracksPayloadSize() const;
68 void WriteTracks(uint8* buffer, int buffer_size) const; 70 void WriteTracks(uint8_t* buffer, int buffer_size) const;
69 71
70 class Track { 72 class Track {
71 public: 73 public:
72 Track(int track_num, 74 Track(int track_num,
73 int track_type, 75 int track_type,
74 uint64 track_uid, 76 uint64_t track_uid,
75 const std::string& codec_id, 77 const std::string& codec_id,
76 const std::string& name, 78 const std::string& name,
77 const std::string& language, 79 const std::string& language,
78 int default_duration, 80 int default_duration,
79 int video_pixel_width, 81 int video_pixel_width,
80 int video_pixel_height, 82 int video_pixel_height,
81 int audio_channels, 83 int audio_channels,
82 double audio_sampling_frequency, 84 double audio_sampling_frequency,
83 bool allow_invalid_values); 85 bool allow_invalid_values);
84 86
85 int GetSize() const; 87 int GetSize() const;
86 void Write(uint8** buf, int* buf_size) const; 88 void Write(uint8_t** buf, int* buf_size) const;
89
87 private: 90 private:
88 int GetPayloadSize() const; 91 int GetPayloadSize() const;
89 int GetVideoPayloadSize() const; 92 int GetVideoPayloadSize() const;
90 int GetAudioPayloadSize() const; 93 int GetAudioPayloadSize() const;
91 94
92 int track_num_; 95 int track_num_;
93 int track_type_; 96 int track_type_;
94 int track_uid_; 97 int track_uid_;
95 std::string codec_id_; 98 std::string codec_id_;
96 std::string name_; 99 std::string name_;
97 std::string language_; 100 std::string language_;
98 int default_duration_; 101 int default_duration_;
99 int video_pixel_width_; 102 int video_pixel_width_;
100 int video_pixel_height_; 103 int video_pixel_height_;
101 int audio_channels_; 104 int audio_channels_;
102 double audio_sampling_frequency_; 105 double audio_sampling_frequency_;
103 }; 106 };
104 107
105 typedef std::list<Track> TrackList; 108 typedef std::list<Track> TrackList;
106 TrackList tracks_; 109 TrackList tracks_;
107 bool allow_invalid_values_; 110 bool allow_invalid_values_;
108 111
109 DISALLOW_COPY_AND_ASSIGN(TracksBuilder); 112 DISALLOW_COPY_AND_ASSIGN(TracksBuilder);
110 }; 113 };
111 114
112 } // namespace media 115 } // namespace media
113 116
114 #endif // MEDIA_FORMATS_WEBM_TRACKS_BUILDER_H_ 117 #endif // MEDIA_FORMATS_WEBM_TRACKS_BUILDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698