| 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_
|
|
|