Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_MUXERS_WEBM_MUXER_H_ | 5 #ifndef MEDIA_MUXERS_WEBM_MUXER_H_ |
| 6 #define MEDIA_MUXERS_WEBM_MUXER_H_ | 6 #define MEDIA_MUXERS_WEBM_MUXER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <deque> | 10 #include <deque> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 | 59 |
| 60 // |codec| can be VP8 or VP9 and should coincide with whatever is sent in | 60 // |codec| can be VP8 or VP9 and should coincide with whatever is sent in |
| 61 // OnEncodedVideo(). | 61 // OnEncodedVideo(). |
| 62 WebmMuxer(VideoCodec codec, | 62 WebmMuxer(VideoCodec codec, |
| 63 bool has_video_, | 63 bool has_video_, |
| 64 bool has_audio_, | 64 bool has_audio_, |
| 65 const WriteDataCB& write_data_callback); | 65 const WriteDataCB& write_data_callback); |
| 66 ~WebmMuxer() override; | 66 ~WebmMuxer() override; |
| 67 | 67 |
| 68 // Functions to add video and audio frames with |encoded_data.data()| | 68 // Functions to add video and audio frames with |encoded_data.data()| |
| 69 // to WebM Segment. Either one returns true on success. | 69 // to WebM Segment. Either one returns true on success. |
|
mcasas
2017/03/08 22:38:48
Say what |encoded_alpha_data| is and that it
can p
emircan
2017/03/09 01:45:41
Done.
| |
| 70 bool OnEncodedVideo(const VideoParameters& params, | 70 bool OnEncodedVideo(const VideoParameters& params, |
| 71 std::unique_ptr<std::string> encoded_data, | 71 std::unique_ptr<std::string> encoded_data, |
| 72 std::unique_ptr<std::string> encoded_alpha_data, | |
| 72 base::TimeTicks timestamp, | 73 base::TimeTicks timestamp, |
| 73 bool is_key_frame); | 74 bool is_key_frame); |
| 74 bool OnEncodedAudio(const media::AudioParameters& params, | 75 bool OnEncodedAudio(const media::AudioParameters& params, |
| 75 std::unique_ptr<std::string> encoded_data, | 76 std::unique_ptr<std::string> encoded_data, |
| 76 base::TimeTicks timestamp); | 77 base::TimeTicks timestamp); |
| 77 | 78 |
| 78 void Pause(); | 79 void Pause(); |
| 79 void Resume(); | 80 void Resume(); |
| 80 | 81 |
| 81 void ForceOneLibWebmErrorForTesting() { force_one_libwebm_error_ = true; } | 82 void ForceOneLibWebmErrorForTesting() { force_one_libwebm_error_ = true; } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 94 // IMkvWriter interface. | 95 // IMkvWriter interface. |
| 95 mkvmuxer::int32 Write(const void* buf, mkvmuxer::uint32 len) override; | 96 mkvmuxer::int32 Write(const void* buf, mkvmuxer::uint32 len) override; |
| 96 mkvmuxer::int64 Position() const override; | 97 mkvmuxer::int64 Position() const override; |
| 97 mkvmuxer::int32 Position(mkvmuxer::int64 position) override; | 98 mkvmuxer::int32 Position(mkvmuxer::int64 position) override; |
| 98 bool Seekable() const override; | 99 bool Seekable() const override; |
| 99 void ElementStartNotify(mkvmuxer::uint64 element_id, | 100 void ElementStartNotify(mkvmuxer::uint64 element_id, |
| 100 mkvmuxer::int64 position) override; | 101 mkvmuxer::int64 position) override; |
| 101 | 102 |
| 102 // Helper to simplify saving frames. Returns true on success. | 103 // Helper to simplify saving frames. Returns true on success. |
| 103 bool AddFrame(std::unique_ptr<std::string> encoded_data, | 104 bool AddFrame(std::unique_ptr<std::string> encoded_data, |
| 105 std::unique_ptr<std::string> encoded_alpha_data, | |
| 104 uint8_t track_index, | 106 uint8_t track_index, |
| 105 base::TimeDelta timestamp, | 107 base::TimeDelta timestamp, |
| 106 bool is_key_frame); | 108 bool is_key_frame); |
| 107 | 109 |
| 108 // Used to DCHECK that we are called on the correct thread. | 110 // Used to DCHECK that we are called on the correct thread. |
| 109 base::ThreadChecker thread_checker_; | 111 base::ThreadChecker thread_checker_; |
| 110 | 112 |
| 111 // Video Codec configured on construction. | 113 // Video Codec configured on construction. |
| 112 const VideoCodec video_codec_; | 114 const VideoCodec video_codec_; |
| 113 | 115 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 138 | 140 |
| 139 // The MkvMuxer active element. | 141 // The MkvMuxer active element. |
| 140 mkvmuxer::Segment segment_; | 142 mkvmuxer::Segment segment_; |
| 141 // Flag to force the next call to a |segment_| method to return false. | 143 // Flag to force the next call to a |segment_| method to return false. |
| 142 bool force_one_libwebm_error_; | 144 bool force_one_libwebm_error_; |
| 143 | 145 |
| 144 // Hold on to all encoded video frames to dump them with and when audio is | 146 // Hold on to all encoded video frames to dump them with and when audio is |
| 145 // received, if expected, since WebM headers can only be written once. | 147 // received, if expected, since WebM headers can only be written once. |
| 146 struct EncodedVideoFrame { | 148 struct EncodedVideoFrame { |
| 147 EncodedVideoFrame(std::unique_ptr<std::string> data, | 149 EncodedVideoFrame(std::unique_ptr<std::string> data, |
| 150 std::unique_ptr<std::string> alpha_data, | |
| 148 base::TimeTicks timestamp, | 151 base::TimeTicks timestamp, |
| 149 bool is_keyframe); | 152 bool is_keyframe); |
| 150 ~EncodedVideoFrame(); | 153 ~EncodedVideoFrame(); |
| 151 | 154 |
| 152 std::unique_ptr<std::string> data; | 155 std::unique_ptr<std::string> data; |
| 156 std::unique_ptr<std::string> alpha_data; | |
| 153 base::TimeTicks timestamp; | 157 base::TimeTicks timestamp; |
| 154 bool is_keyframe; | 158 bool is_keyframe; |
| 155 | 159 |
| 156 private: | 160 private: |
| 157 DISALLOW_IMPLICIT_CONSTRUCTORS(EncodedVideoFrame); | 161 DISALLOW_IMPLICIT_CONSTRUCTORS(EncodedVideoFrame); |
| 158 }; | 162 }; |
| 159 std::deque<std::unique_ptr<EncodedVideoFrame>> encoded_frames_queue_; | 163 std::deque<std::unique_ptr<EncodedVideoFrame>> encoded_frames_queue_; |
| 160 | 164 |
| 161 DISALLOW_COPY_AND_ASSIGN(WebmMuxer); | 165 DISALLOW_COPY_AND_ASSIGN(WebmMuxer); |
| 162 }; | 166 }; |
| 163 | 167 |
| 164 } // namespace media | 168 } // namespace media |
| 165 | 169 |
| 166 #endif // MEDIA_MUXERS_WEBM_MUXER_H_ | 170 #endif // MEDIA_MUXERS_WEBM_MUXER_H_ |
| OLD | NEW |