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

Unified Diff: mojo/services/media/common/cpp/video_converter.h

Issue 2068043005: Motown: Video renderer library code (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fixes per feedback. Created 4 years, 6 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 | « mojo/services/media/common/cpp/BUILD.gn ('k') | mojo/services/media/common/cpp/video_converter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/media/common/cpp/video_converter.h
diff --git a/mojo/services/media/common/cpp/video_converter.h b/mojo/services/media/common/cpp/video_converter.h
new file mode 100644
index 0000000000000000000000000000000000000000..c8b55ce521dd5e01efc23b4ca1f8479aabd74c6f
--- /dev/null
+++ b/mojo/services/media/common/cpp/video_converter.h
@@ -0,0 +1,51 @@
+// Copyright 2016 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 MOJO_SERVICES_MEDIA_COMMON_CPP_VIDEO_CONVERTER_H_
+#define MOJO_SERVICES_MEDIA_COMMON_CPP_VIDEO_CONVERTER_H_
+
+#include <memory>
+
+#include "mojo/services/media/common/cpp/video_packet_layout.h"
+
+namespace mojo {
+namespace media {
+
+class VideoConverter {
+ public:
+ VideoConverter();
+
+ ~VideoConverter();
+
+ // Sets the media type of the frames to be converted. 8-bit interleaved
+ // RGBA output is assumed.
+ void SetMediaType(const MediaTypePtr& media_type);
+
+ // Converts the frame in the payload into the provided RGBA buffer.
+ void ConvertFrame(uint8_t* rgba_buffer,
+ uint32_t view_width,
+ uint32_t view_height,
+ void* payload,
+ uint64_t payload_size);
+
+ private:
+ // Builds the YUV-RGBA colorspace table.
+ void BuildColorspaceTable();
+
+ // Converts one line.
+ void ConvertLine(uint32_t* dest_pixel,
+ uint8_t* y_pixel,
+ uint8_t* u_pixel,
+ uint8_t* v_pixel,
+ uint32_t width);
+
+ bool media_type_set_ = false;
+ VideoPacketLayout layout_;
+ std::unique_ptr<uint32_t[]> colorspace_table_;
+};
+
+} // namespace media
+} // namespace moj
+
+#endif // MOJO_SERVICES_MEDIA_COMMON_CPP_VIDEO_CONVERTER_H_
« no previous file with comments | « mojo/services/media/common/cpp/BUILD.gn ('k') | mojo/services/media/common/cpp/video_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698