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

Side by Side Diff: media/filters/webm_muxer.h

Issue 1225123006: media/capture: Adding WebmMuxer class and unittests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@m_crbug262211__MSRecorder__2__libwebm_reland_in_third_party
Patch Set: 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
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 <vector>
9
10 #include "base/callback.h"
11 #include "base/gtest_prod_util.h"
12 #include "base/threading/thread_checker.h"
13 #include "base/time/time.h"
14 #include "media/base/media_export.h"
15 #include "third_party/libwebm/source/mkvmuxer.hpp"
16 #include "ui/gfx/geometry/size.h"
17
18 namespace media {
19
20 class MEDIA_EXPORT WebmMuxer : public mkvmuxer::IMkvWriter {
21 public:
22 typedef base::Callback<void(const char*, int, bool)> WriteDataCB;
23
24 explicit WebmMuxer(const WriteDataCB& write_data_callback);
25 ~WebmMuxer() override;
26
27 void OnEncodedVideo(int track_index,
28 const std::string& encoded_data,
29 const base::TimeTicks& timestamp,
30 bool keyframe,
31 const gfx::Size& frame_size,
32 double frame_rate);
33
34 private:
35 friend class WebmMuxerTest;
36 FRIEND_TEST_ALL_PREFIXES(WebmMuxerTest, Write);
37 FRIEND_TEST_ALL_PREFIXES(WebmMuxerTest, OnEncodedVideo);
38
39 // Add a new video track when receiving the first frame.
40 bool AddVideoTrack(const gfx::Size& frame_size,
41 double frame_rate,
42 int track_index_starting_from_one);
43
44 // IMkvWriter interface.
45 mkvmuxer::int32 Write(const void* buf, mkvmuxer::uint32 len) override;
46 mkvmuxer::int64 Position() const override;
47 mkvmuxer::int32 Position(mkvmuxer::int64 position) override;
48 bool Seekable() const override;
49 void ElementStartNotify(mkvmuxer::uint64 element_id,
50 mkvmuxer::int64 position) override;
51
52 // Used to DCHECK that we are called on the correct thread.
53 base::ThreadChecker thread_checker_;
54
55 // Callback to dump written data as being called by libwebm.
56 const WriteDataCB write_data_callback_;
57
58 // Class creation time.
59 const base::TimeTicks time_start_;
60
61 // Rolling counter of the position in bytes of the written goo.
62 int64_t position_;
63
64 // Local cache of track indexes to speed up adding a new track when seen for
65 // the first time.
66 std::vector<int> track_indexes_;
67
68 // Owned pointer to the MkvMuxer active element.
69 scoped_ptr<mkvmuxer::Segment> segment_;
70
71 DISALLOW_COPY_AND_ASSIGN(WebmMuxer);
72 };
73
74 } // namespace media
75
76 #endif // MEDIA_FILTERS_LIBWEBM_MUXER_H_
OLDNEW
« no previous file with comments | « media/DEPS ('k') | media/filters/webm_muxer.cc » ('j') | media/filters/webm_muxer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698