| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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 MOJO_SERVICES_MEDIA_COMMON_CPP_VIDEO_CONVERTER_H_ |
| 6 #define MOJO_SERVICES_MEDIA_COMMON_CPP_VIDEO_CONVERTER_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "mojo/services/media/common/cpp/video_packet_layout.h" |
| 11 |
| 12 namespace mojo { |
| 13 namespace media { |
| 14 |
| 15 class VideoConverter { |
| 16 public: |
| 17 VideoConverter(); |
| 18 |
| 19 ~VideoConverter(); |
| 20 |
| 21 // Sets the media type of the frames to be converted. 8-bit interleaved |
| 22 // RGBA output is assumed. |
| 23 void SetMediaType(const MediaTypePtr& media_type); |
| 24 |
| 25 // Converts the frame in the payload into the provided RGBA buffer. |
| 26 void ConvertFrame(uint8_t* rgba_buffer, |
| 27 uint32_t view_width, |
| 28 uint32_t view_height, |
| 29 void* payload, |
| 30 uint64_t payload_size); |
| 31 |
| 32 private: |
| 33 // Builds the YUV-RGBA colorspace table. |
| 34 void BuildColorspaceTable(); |
| 35 |
| 36 // Converts one line. |
| 37 void ConvertLine(uint32_t* dest_pixel, |
| 38 uint8_t* y_pixel, |
| 39 uint8_t* u_pixel, |
| 40 uint8_t* v_pixel, |
| 41 uint32_t width); |
| 42 |
| 43 bool media_type_set_ = false; |
| 44 VideoPacketLayout layout_; |
| 45 std::unique_ptr<uint32_t[]> colorspace_table_; |
| 46 }; |
| 47 |
| 48 } // namespace media |
| 49 } // namespace moj |
| 50 |
| 51 #endif // MOJO_SERVICES_MEDIA_COMMON_CPP_VIDEO_CONVERTER_H_ |
| OLD | NEW |