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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 WebRtcVideoFrame(const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, | 51 WebRtcVideoFrame(const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, |
52 int64_t elapsed_time_ns, | 52 int64_t elapsed_time_ns, |
53 int64_t time_stamp_ns); | 53 int64_t time_stamp_ns); |
54 | 54 |
55 ~WebRtcVideoFrame(); | 55 ~WebRtcVideoFrame(); |
56 | 56 |
57 // Creates a frame from a raw sample with FourCC "format" and size "w" x "h". | 57 // Creates a frame from a raw sample with FourCC "format" and size "w" x "h". |
58 // "h" can be negative indicating a vertically flipped image. | 58 // "h" can be negative indicating a vertically flipped image. |
59 // "dh" is destination height if cropping is desired and is always positive. | 59 // "dh" is destination height if cropping is desired and is always positive. |
60 // Returns "true" if successful. | 60 // Returns "true" if successful. |
61 bool Init(uint32 format, | 61 bool Init(uint32_t format, |
62 int w, | 62 int w, |
63 int h, | 63 int h, |
64 int dw, | 64 int dw, |
65 int dh, | 65 int dh, |
66 uint8* sample, | 66 uint8_t* sample, |
67 size_t sample_size, | 67 size_t sample_size, |
68 size_t pixel_width, | 68 size_t pixel_width, |
69 size_t pixel_height, | 69 size_t pixel_height, |
70 int64_t elapsed_time_ns, | 70 int64_t elapsed_time_ns, |
71 int64_t time_stamp_ns, | 71 int64_t time_stamp_ns, |
72 webrtc::VideoRotation rotation); | 72 webrtc::VideoRotation rotation); |
73 | 73 |
74 bool Init(const CapturedFrame* frame, int dw, int dh, bool apply_rotation); | 74 bool Init(const CapturedFrame* frame, int dw, int dh, bool apply_rotation); |
75 | 75 |
76 void InitToEmptyBuffer(int w, int h, size_t pixel_width, size_t pixel_height, | 76 void InitToEmptyBuffer(int w, int h, size_t pixel_width, size_t pixel_height, |
77 int64_t elapsed_time_ns, int64_t time_stamp_ns); | 77 int64_t elapsed_time_ns, int64_t time_stamp_ns); |
78 | 78 |
79 bool InitToBlack(int w, int h, size_t pixel_width, size_t pixel_height, | 79 bool InitToBlack(int w, int h, size_t pixel_width, size_t pixel_height, |
80 int64_t elapsed_time_ns, int64_t time_stamp_ns); | 80 int64_t elapsed_time_ns, int64_t time_stamp_ns); |
81 | 81 |
82 // From base class VideoFrame. | 82 // From base class VideoFrame. |
83 virtual bool Reset(uint32 format, | 83 virtual bool Reset(uint32_t format, |
84 int w, | 84 int w, |
85 int h, | 85 int h, |
86 int dw, | 86 int dw, |
87 int dh, | 87 int dh, |
88 uint8* sample, | 88 uint8_t* sample, |
89 size_t sample_size, | 89 size_t sample_size, |
90 size_t pixel_width, | 90 size_t pixel_width, |
91 size_t pixel_height, | 91 size_t pixel_height, |
92 int64_t elapsed_time_ns, | 92 int64_t elapsed_time_ns, |
93 int64_t time_stamp_ns, | 93 int64_t time_stamp_ns, |
94 webrtc::VideoRotation rotation, | 94 webrtc::VideoRotation rotation, |
95 bool apply_rotation); | 95 bool apply_rotation); |
96 | 96 |
97 virtual size_t GetWidth() const; | 97 virtual size_t GetWidth() const; |
98 virtual size_t GetHeight() const; | 98 virtual size_t GetHeight() const; |
99 virtual const uint8* GetYPlane() const; | 99 virtual const uint8_t* GetYPlane() const; |
100 virtual const uint8* GetUPlane() const; | 100 virtual const uint8_t* GetUPlane() const; |
101 virtual const uint8* GetVPlane() const; | 101 virtual const uint8_t* GetVPlane() const; |
102 virtual uint8* GetYPlane(); | 102 virtual uint8_t* GetYPlane(); |
103 virtual uint8* GetUPlane(); | 103 virtual uint8_t* GetUPlane(); |
104 virtual uint8* GetVPlane(); | 104 virtual uint8_t* GetVPlane(); |
105 virtual int32 GetYPitch() const; | 105 virtual int32_t GetYPitch() const; |
106 virtual int32 GetUPitch() const; | 106 virtual int32_t GetUPitch() const; |
107 virtual int32 GetVPitch() const; | 107 virtual int32_t GetVPitch() const; |
108 virtual void* GetNativeHandle() const; | 108 virtual void* GetNativeHandle() const; |
109 virtual rtc::scoped_refptr<webrtc::VideoFrameBuffer> GetVideoFrameBuffer() | 109 virtual rtc::scoped_refptr<webrtc::VideoFrameBuffer> GetVideoFrameBuffer() |
110 const; | 110 const; |
111 | 111 |
112 virtual size_t GetPixelWidth() const { return pixel_width_; } | 112 virtual size_t GetPixelWidth() const { return pixel_width_; } |
113 virtual size_t GetPixelHeight() const { return pixel_height_; } | 113 virtual size_t GetPixelHeight() const { return pixel_height_; } |
114 virtual int64_t GetElapsedTime() const { return elapsed_time_ns_; } | 114 virtual int64_t GetElapsedTime() const { return elapsed_time_ns_; } |
115 virtual int64_t GetTimeStamp() const { return time_stamp_ns_; } | 115 virtual int64_t GetTimeStamp() const { return time_stamp_ns_; } |
116 virtual void SetElapsedTime(int64_t elapsed_time_ns) { | 116 virtual void SetElapsedTime(int64_t elapsed_time_ns) { |
117 elapsed_time_ns_ = elapsed_time_ns; | 117 elapsed_time_ns_ = elapsed_time_ns; |
118 } | 118 } |
119 virtual void SetTimeStamp(int64_t time_stamp_ns) { | 119 virtual void SetTimeStamp(int64_t time_stamp_ns) { |
120 time_stamp_ns_ = time_stamp_ns; | 120 time_stamp_ns_ = time_stamp_ns; |
121 } | 121 } |
122 | 122 |
123 virtual webrtc::VideoRotation GetVideoRotation() const { return rotation_; } | 123 virtual webrtc::VideoRotation GetVideoRotation() const { return rotation_; } |
124 | 124 |
125 virtual VideoFrame* Copy() const; | 125 virtual VideoFrame* Copy() const; |
126 virtual bool IsExclusive() const; | 126 virtual bool IsExclusive() const; |
127 virtual bool MakeExclusive(); | 127 virtual bool MakeExclusive(); |
128 virtual size_t ConvertToRgbBuffer(uint32 to_fourcc, uint8* buffer, | 128 virtual size_t ConvertToRgbBuffer(uint32_t to_fourcc, |
129 size_t size, int stride_rgb) const; | 129 uint8_t* buffer, |
| 130 size_t size, |
| 131 int stride_rgb) const; |
130 | 132 |
131 const VideoFrame* GetCopyWithRotationApplied() const override; | 133 const VideoFrame* GetCopyWithRotationApplied() const override; |
132 | 134 |
133 protected: | 135 protected: |
134 void SetRotation(webrtc::VideoRotation rotation) override { | 136 void SetRotation(webrtc::VideoRotation rotation) override { |
135 rotation_ = rotation; | 137 rotation_ = rotation; |
136 } | 138 } |
137 | 139 |
138 private: | 140 private: |
139 virtual VideoFrame* CreateEmptyFrame(int w, int h, size_t pixel_width, | 141 virtual VideoFrame* CreateEmptyFrame(int w, int h, size_t pixel_width, |
(...skipping 10 matching lines...) Expand all Loading... |
150 webrtc::VideoRotation rotation_; | 152 webrtc::VideoRotation rotation_; |
151 | 153 |
152 // This is mutable as the calculation is expensive but once calculated, it | 154 // This is mutable as the calculation is expensive but once calculated, it |
153 // remains const. | 155 // remains const. |
154 mutable rtc::scoped_ptr<VideoFrame> rotated_frame_; | 156 mutable rtc::scoped_ptr<VideoFrame> rotated_frame_; |
155 }; | 157 }; |
156 | 158 |
157 } // namespace cricket | 159 } // namespace cricket |
158 | 160 |
159 #endif // TALK_MEDIA_WEBRTCVIDEOFRAME_H_ | 161 #endif // TALK_MEDIA_WEBRTCVIDEOFRAME_H_ |
OLD | NEW |