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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « media/DEPS ('k') | media/filters/webm_muxer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_FILTERS_LIBWEBM_MUXER_H_
6 #define MEDIA_FILTERS_LIBWEBM_MUXER_H_
7
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "base/threading/thread_checker.h"
11 #include "base/time/time.h"
12 #include "media/base/media_export.h"
13 #include "third_party/libwebm/source/mkvmuxer.hpp"
14 #include "ui/gfx/geometry/size.h"
15
16 namespace media {
17
18 class MEDIA_EXPORT WebmMuxer : public mkvmuxer::IMkvWriter {
19 public:
20 typedef base::Callback<void(const char*, int, bool)> WriteDataCB;
21
22 explicit WebmMuxer(const WriteDataCB& write_data_callback);
23 ~WebmMuxer() override;
24
25 void OnEncodedVideo(int track_index,
26 const std::string& encoded_data,
27 const base::TimeTicks& timestamp,
28 bool keyframe,
29 const gfx::Size& frame_size,
30 double frame_rate);
31
32 private:
33 // Add a new video track when receiving the first frame.
34 bool AddVideoTrack(const gfx::Size& frame_size,
35 double frame_rate,
36 int track_index_starting_from_one);
37
38 // IMkvWriter interface.
39 mkvmuxer::int32 Write(const void* buf, mkvmuxer::uint32 len) override;
40 mkvmuxer::int64 Position() const override;
41 mkvmuxer::int32 Position(mkvmuxer::int64 position) override;
42 bool Seekable() const override;
43 void ElementStartNotify(mkvmuxer::uint64 element_id,
44 mkvmuxer::int64 position) override;
45
46 // Used to DCHECK that we are called on the correct thread.
47 base::ThreadChecker thread_checker_;
48
49 // Callback to dump written data as being called by libwebm.
50 const WriteDataCB write_data_callback_;
51
52 // Class creation time.
53 const base::TimeTicks time_start_;
54
55 // Rolling counter of the position in bytes of the written goo.
56 int64_t position_;
57
58 std::vector<int> track_indexes_;
59
60 // Owned pointer to the MkvMuxer active element.
61 scoped_ptr<mkvmuxer::Segment> segment_;
62
63 DISALLOW_COPY_AND_ASSIGN(WebmMuxer);
64 };
65
66 } // namespace media
67
68 #endif // MEDIA_FILTERS_LIBWEBM_MUXER_H_
OLDNEW
« 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