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

Unified Diff: media/filters/webm_muxer.h

Issue 1211973012: [Experimental] MediaStreamRecorder playground (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed FFmpegMuxer, using instead libwebm::IMkvMuxer, which is partially added Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/DEPS ('k') | media/filters/webm_muxer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/webm_muxer.h
diff --git a/media/filters/webm_muxer.h b/media/filters/webm_muxer.h
new file mode 100644
index 0000000000000000000000000000000000000000..3e142a8dfac1e6c673b5e6288b72f68cf7b17ea5
--- /dev/null
+++ b/media/filters/webm_muxer.h
@@ -0,0 +1,68 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_FILTERS_LIBWEBM_MUXER_H_
+#define MEDIA_FILTERS_LIBWEBM_MUXER_H_
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "base/threading/thread_checker.h"
+#include "base/time/time.h"
+#include "media/base/media_export.h"
+#include "third_party/libwebm/source/mkvmuxer.hpp"
+#include "ui/gfx/geometry/size.h"
+
+namespace media {
+
+class MEDIA_EXPORT WebmMuxer : public mkvmuxer::IMkvWriter {
+ public:
+ typedef base::Callback<void(const char*, int, bool)> WriteDataCB;
+
+ explicit WebmMuxer(const WriteDataCB& write_data_callback);
+ ~WebmMuxer() override;
+
+ void OnEncodedVideo(int track_index,
+ const std::string& encoded_data,
+ const base::TimeTicks& timestamp,
+ bool keyframe,
+ const gfx::Size& frame_size,
+ double frame_rate);
+
+ private:
+ // Add a new video track when receiving the first frame.
+ bool AddVideoTrack(const gfx::Size& frame_size,
+ double frame_rate,
+ int track_index_starting_from_one);
+
+ // IMkvWriter interface.
+ mkvmuxer::int32 Write(const void* buf, mkvmuxer::uint32 len) override;
+ mkvmuxer::int64 Position() const override;
+ mkvmuxer::int32 Position(mkvmuxer::int64 position) override;
+ bool Seekable() const override;
+ void ElementStartNotify(mkvmuxer::uint64 element_id,
+ mkvmuxer::int64 position) override;
+
+ // Used to DCHECK that we are called on the correct thread.
+ base::ThreadChecker thread_checker_;
+
+ // Callback to dump written data as being called by libwebm.
+ const WriteDataCB write_data_callback_;
+
+ // Class creation time.
+ const base::TimeTicks time_start_;
+
+ // Rolling counter of the position in bytes of the written goo.
+ int64_t position_;
+
+ std::vector<int> track_indexes_;
+
+ // Owned pointer to the MkvMuxer active element.
+ scoped_ptr<mkvmuxer::Segment> segment_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebmMuxer);
+};
+
+} // namespace media
+
+#endif // MEDIA_FILTERS_LIBWEBM_MUXER_H_
« no previous file with comments | « media/DEPS ('k') | media/filters/webm_muxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698