| 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, | |
| 64 int64_t time_stamp_ns, | 62 int64_t time_stamp_ns, |
| 65 webrtc::VideoRotation rotation); | 63 webrtc::VideoRotation rotation); |
| 66 | 64 |
| 67 bool Init(const CapturedFrame* frame, int dw, int dh, bool apply_rotation); | 65 bool Init(const CapturedFrame* frame, int dw, int dh, bool apply_rotation); |
| 68 | 66 |
| 67 void InitToEmptyBuffer(int w, int h, int64_t time_stamp_ns); |
| 68 |
| 69 // TODO(nisse): Old signature. Delete after chrome is updated. |
| 69 void InitToEmptyBuffer(int w, int h, size_t pixel_width, size_t pixel_height, | 70 void InitToEmptyBuffer(int w, int h, size_t pixel_width, size_t pixel_height, |
| 70 int64_t time_stamp_ns); | 71 int64_t time_stamp_ns) { |
| 72 InitToEmptyBuffer(w, h, time_stamp_ns); |
| 73 } |
| 71 | 74 |
| 72 bool InitToBlack(int w, int h, size_t pixel_width, size_t pixel_height, | 75 bool InitToBlack(int w, int h, int64_t time_stamp_ns) override; |
| 73 int64_t time_stamp_ns) override; | |
| 74 | 76 |
| 75 // From base class VideoFrame. | 77 // From base class VideoFrame. |
| 76 bool Reset(uint32_t format, | 78 bool Reset(uint32_t format, |
| 77 int w, | 79 int w, |
| 78 int h, | 80 int h, |
| 79 int dw, | 81 int dw, |
| 80 int dh, | 82 int dh, |
| 81 uint8_t* sample, | 83 uint8_t* sample, |
| 82 size_t sample_size, | 84 size_t sample_size, |
| 83 size_t pixel_width, | |
| 84 size_t pixel_height, | |
| 85 int64_t time_stamp_ns, | 85 int64_t time_stamp_ns, |
| 86 webrtc::VideoRotation rotation, | 86 webrtc::VideoRotation rotation, |
| 87 bool apply_rotation) override; | 87 bool apply_rotation) override; |
| 88 | 88 |
| 89 size_t GetWidth() const override; | 89 size_t GetWidth() const override; |
| 90 size_t GetHeight() const override; | 90 size_t GetHeight() const override; |
| 91 const uint8_t* GetYPlane() const override; | 91 const uint8_t* GetYPlane() const override; |
| 92 const uint8_t* GetUPlane() const override; | 92 const uint8_t* GetUPlane() const override; |
| 93 const uint8_t* GetVPlane() const override; | 93 const uint8_t* GetVPlane() const override; |
| 94 uint8_t* GetYPlane() override; | 94 uint8_t* GetYPlane() override; |
| 95 uint8_t* GetUPlane() override; | 95 uint8_t* GetUPlane() override; |
| 96 uint8_t* GetVPlane() override; | 96 uint8_t* GetVPlane() override; |
| 97 int32_t GetYPitch() const override; | 97 int32_t GetYPitch() const override; |
| 98 int32_t GetUPitch() const override; | 98 int32_t GetUPitch() const override; |
| 99 int32_t GetVPitch() const override; | 99 int32_t GetVPitch() const override; |
| 100 void* GetNativeHandle() const override; | 100 void* GetNativeHandle() const override; |
| 101 rtc::scoped_refptr<webrtc::VideoFrameBuffer> GetVideoFrameBuffer() | 101 rtc::scoped_refptr<webrtc::VideoFrameBuffer> GetVideoFrameBuffer() |
| 102 const override; | 102 const override; |
| 103 | 103 |
| 104 size_t GetPixelWidth() const override { return pixel_width_; } | |
| 105 size_t GetPixelHeight() const override { return pixel_height_; } | |
| 106 int64_t GetTimeStamp() const override { return time_stamp_ns_; } | 104 int64_t GetTimeStamp() const override { return time_stamp_ns_; } |
| 107 void SetTimeStamp(int64_t time_stamp_ns) override { | 105 void SetTimeStamp(int64_t time_stamp_ns) override { |
| 108 time_stamp_ns_ = time_stamp_ns; | 106 time_stamp_ns_ = time_stamp_ns; |
| 109 } | 107 } |
| 110 | 108 |
| 111 webrtc::VideoRotation GetVideoRotation() const override { | 109 webrtc::VideoRotation GetVideoRotation() const override { |
| 112 return rotation_; | 110 return rotation_; |
| 113 } | 111 } |
| 114 | 112 |
| 115 VideoFrame* Copy() const override; | 113 VideoFrame* Copy() const override; |
| 116 bool IsExclusive() const override; | 114 bool IsExclusive() const override; |
| 117 bool MakeExclusive() override; | 115 bool MakeExclusive() override; |
| 118 size_t ConvertToRgbBuffer(uint32_t to_fourcc, | 116 size_t ConvertToRgbBuffer(uint32_t to_fourcc, |
| 119 uint8_t* buffer, | 117 uint8_t* buffer, |
| 120 size_t size, | 118 size_t size, |
| 121 int stride_rgb) const override; | 119 int stride_rgb) const override; |
| 122 | 120 |
| 123 const VideoFrame* GetCopyWithRotationApplied() const override; | 121 const VideoFrame* GetCopyWithRotationApplied() const override; |
| 124 | 122 |
| 125 protected: | 123 protected: |
| 126 void SetRotation(webrtc::VideoRotation rotation) override { | 124 void SetRotation(webrtc::VideoRotation rotation) override { |
| 127 rotation_ = rotation; | 125 rotation_ = rotation; |
| 128 } | 126 } |
| 129 | 127 |
| 130 private: | 128 private: |
| 131 VideoFrame* CreateEmptyFrame(int w, int h, size_t pixel_width, | 129 VideoFrame* CreateEmptyFrame(int w, int h, |
| 132 size_t pixel_height, | |
| 133 int64_t time_stamp_ns) const override; | 130 int64_t time_stamp_ns) const override; |
| 134 | 131 |
| 135 // An opaque reference counted handle that stores the pixel data. | 132 // An opaque reference counted handle that stores the pixel data. |
| 136 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_; | 133 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_; |
| 137 size_t pixel_width_; | |
| 138 size_t pixel_height_; | |
| 139 int64_t time_stamp_ns_; | 134 int64_t time_stamp_ns_; |
| 140 webrtc::VideoRotation rotation_; | 135 webrtc::VideoRotation rotation_; |
| 141 | 136 |
| 142 // This is mutable as the calculation is expensive but once calculated, it | 137 // This is mutable as the calculation is expensive but once calculated, it |
| 143 // remains const. | 138 // remains const. |
| 144 mutable rtc::scoped_ptr<VideoFrame> rotated_frame_; | 139 mutable rtc::scoped_ptr<VideoFrame> rotated_frame_; |
| 145 }; | 140 }; |
| 146 | 141 |
| 147 } // namespace cricket | 142 } // namespace cricket |
| 148 | 143 |
| 149 #endif // TALK_MEDIA_WEBRTCVIDEOFRAME_H_ | 144 #endif // TALK_MEDIA_WEBRTCVIDEOFRAME_H_ |
| OLD | NEW |