| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // "h" can be negative indicating a vertically flipped image. | 52 // "h" can be negative indicating a vertically flipped image. |
| 53 // "dh" is destination height if cropping is desired and is always positive. | 53 // "dh" is destination height if cropping is desired and is always positive. |
| 54 // Returns "true" if successful. | 54 // Returns "true" if successful. |
| 55 bool Init(uint32_t format, | 55 bool Init(uint32_t format, |
| 56 int w, | 56 int w, |
| 57 int h, | 57 int h, |
| 58 int dw, | 58 int dw, |
| 59 int dh, | 59 int dh, |
| 60 uint8_t* sample, | 60 uint8_t* sample, |
| 61 size_t sample_size, | 61 size_t sample_size, |
| 62 size_t pixel_width, |
| 63 size_t pixel_height, |
| 62 int64_t time_stamp_ns, | 64 int64_t time_stamp_ns, |
| 63 webrtc::VideoRotation rotation); | 65 webrtc::VideoRotation rotation); |
| 64 | 66 |
| 65 bool Init(const CapturedFrame* frame, int dw, int dh, bool apply_rotation); | 67 bool Init(const CapturedFrame* frame, int dw, int dh, bool apply_rotation); |
| 66 | 68 |
| 67 void InitToEmptyBuffer(int w, int h, int64_t time_stamp_ns); | 69 void InitToEmptyBuffer(int w, int h, size_t pixel_width, size_t pixel_height, |
| 70 int64_t time_stamp_ns); |
| 68 | 71 |
| 69 bool InitToBlack(int w, int h, int64_t time_stamp_ns) override; | 72 bool InitToBlack(int w, int h, size_t pixel_width, size_t pixel_height, |
| 73 int64_t time_stamp_ns) override; |
| 70 | 74 |
| 71 // From base class VideoFrame. | 75 // From base class VideoFrame. |
| 72 bool Reset(uint32_t format, | 76 bool Reset(uint32_t format, |
| 73 int w, | 77 int w, |
| 74 int h, | 78 int h, |
| 75 int dw, | 79 int dw, |
| 76 int dh, | 80 int dh, |
| 77 uint8_t* sample, | 81 uint8_t* sample, |
| 78 size_t sample_size, | 82 size_t sample_size, |
| 83 size_t pixel_width, |
| 84 size_t pixel_height, |
| 79 int64_t time_stamp_ns, | 85 int64_t time_stamp_ns, |
| 80 webrtc::VideoRotation rotation, | 86 webrtc::VideoRotation rotation, |
| 81 bool apply_rotation) override; | 87 bool apply_rotation) override; |
| 82 | 88 |
| 83 size_t GetWidth() const override; | 89 size_t GetWidth() const override; |
| 84 size_t GetHeight() const override; | 90 size_t GetHeight() const override; |
| 85 const uint8_t* GetYPlane() const override; | 91 const uint8_t* GetYPlane() const override; |
| 86 const uint8_t* GetUPlane() const override; | 92 const uint8_t* GetUPlane() const override; |
| 87 const uint8_t* GetVPlane() const override; | 93 const uint8_t* GetVPlane() const override; |
| 88 uint8_t* GetYPlane() override; | 94 uint8_t* GetYPlane() override; |
| 89 uint8_t* GetUPlane() override; | 95 uint8_t* GetUPlane() override; |
| 90 uint8_t* GetVPlane() override; | 96 uint8_t* GetVPlane() override; |
| 91 int32_t GetYPitch() const override; | 97 int32_t GetYPitch() const override; |
| 92 int32_t GetUPitch() const override; | 98 int32_t GetUPitch() const override; |
| 93 int32_t GetVPitch() const override; | 99 int32_t GetVPitch() const override; |
| 94 void* GetNativeHandle() const override; | 100 void* GetNativeHandle() const override; |
| 95 rtc::scoped_refptr<webrtc::VideoFrameBuffer> GetVideoFrameBuffer() | 101 rtc::scoped_refptr<webrtc::VideoFrameBuffer> GetVideoFrameBuffer() |
| 96 const override; | 102 const override; |
| 97 | 103 |
| 104 size_t GetPixelWidth() const override { return pixel_width_; } |
| 105 size_t GetPixelHeight() const override { return pixel_height_; } |
| 98 int64_t GetTimeStamp() const override { return time_stamp_ns_; } | 106 int64_t GetTimeStamp() const override { return time_stamp_ns_; } |
| 99 void SetTimeStamp(int64_t time_stamp_ns) override { | 107 void SetTimeStamp(int64_t time_stamp_ns) override { |
| 100 time_stamp_ns_ = time_stamp_ns; | 108 time_stamp_ns_ = time_stamp_ns; |
| 101 } | 109 } |
| 102 | 110 |
| 103 webrtc::VideoRotation GetVideoRotation() const override { | 111 webrtc::VideoRotation GetVideoRotation() const override { |
| 104 return rotation_; | 112 return rotation_; |
| 105 } | 113 } |
| 106 | 114 |
| 107 VideoFrame* Copy() const override; | 115 VideoFrame* Copy() const override; |
| 108 bool IsExclusive() const override; | 116 bool IsExclusive() const override; |
| 109 bool MakeExclusive() override; | 117 bool MakeExclusive() override; |
| 110 size_t ConvertToRgbBuffer(uint32_t to_fourcc, | 118 size_t ConvertToRgbBuffer(uint32_t to_fourcc, |
| 111 uint8_t* buffer, | 119 uint8_t* buffer, |
| 112 size_t size, | 120 size_t size, |
| 113 int stride_rgb) const override; | 121 int stride_rgb) const override; |
| 114 | 122 |
| 115 const VideoFrame* GetCopyWithRotationApplied() const override; | 123 const VideoFrame* GetCopyWithRotationApplied() const override; |
| 116 | 124 |
| 117 protected: | 125 protected: |
| 118 void SetRotation(webrtc::VideoRotation rotation) override { | 126 void SetRotation(webrtc::VideoRotation rotation) override { |
| 119 rotation_ = rotation; | 127 rotation_ = rotation; |
| 120 } | 128 } |
| 121 | 129 |
| 122 private: | 130 private: |
| 123 VideoFrame* CreateEmptyFrame(int w, int h, | 131 VideoFrame* CreateEmptyFrame(int w, int h, size_t pixel_width, |
| 132 size_t pixel_height, |
| 124 int64_t time_stamp_ns) const override; | 133 int64_t time_stamp_ns) const override; |
| 125 | 134 |
| 126 // An opaque reference counted handle that stores the pixel data. | 135 // An opaque reference counted handle that stores the pixel data. |
| 127 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_; | 136 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_; |
| 137 size_t pixel_width_; |
| 138 size_t pixel_height_; |
| 128 int64_t time_stamp_ns_; | 139 int64_t time_stamp_ns_; |
| 129 webrtc::VideoRotation rotation_; | 140 webrtc::VideoRotation rotation_; |
| 130 | 141 |
| 131 // This is mutable as the calculation is expensive but once calculated, it | 142 // This is mutable as the calculation is expensive but once calculated, it |
| 132 // remains const. | 143 // remains const. |
| 133 mutable rtc::scoped_ptr<VideoFrame> rotated_frame_; | 144 mutable rtc::scoped_ptr<VideoFrame> rotated_frame_; |
| 134 }; | 145 }; |
| 135 | 146 |
| 136 } // namespace cricket | 147 } // namespace cricket |
| 137 | 148 |
| 138 #endif // TALK_MEDIA_WEBRTCVIDEOFRAME_H_ | 149 #endif // TALK_MEDIA_WEBRTCVIDEOFRAME_H_ |
| OLD | NEW |