08f63a549c9afd9ce6bb43557901ffaa79024606
[platform/framework/web/crosswalk.git] / src / third_party / libjingle / source / talk / media / webrtc / webrtctexturevideoframe.cc
1 /*
2  * libjingle
3  * Copyright 2013 Google Inc.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  *  1. Redistributions of source code must retain the above copyright notice,
9  *     this list of conditions and the following disclaimer.
10  *  2. Redistributions in binary form must reproduce the above copyright notice,
11  *     this list of conditions and the following disclaimer in the documentation
12  *     and/or other materials provided with the distribution.
13  *  3. The name of the author may not be used to endorse or promote products
14  *     derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19  * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27
28 #include "talk/media/webrtc/webrtctexturevideoframe.h"
29
30 #include "talk/base/common.h"
31 #include "talk/base/logging.h"
32 #include "talk/base/stream.h"
33
34 #define UNIMPLEMENTED \
35   LOG(LS_ERROR) << "Call to unimplemented function "<< __FUNCTION__; \
36   ASSERT(false)
37
38 namespace cricket {
39
40 WebRtcTextureVideoFrame::WebRtcTextureVideoFrame(
41     webrtc::NativeHandle* handle, int width, int height, int64 elapsed_time,
42     int64 time_stamp)
43     : handle_(handle), width_(width), height_(height),
44       elapsed_time_(elapsed_time), time_stamp_(time_stamp) {}
45
46 WebRtcTextureVideoFrame::~WebRtcTextureVideoFrame() {}
47
48 bool WebRtcTextureVideoFrame::InitToBlack(
49     int w, int h, size_t pixel_width, size_t pixel_height, int64 elapsed_time,
50     int64 time_stamp) {
51   UNIMPLEMENTED;
52   return false;
53 }
54
55 bool WebRtcTextureVideoFrame::Reset(
56     uint32 fourcc, int w, int h, int dw, int dh, uint8* sample,
57     size_t sample_size, size_t pixel_width, size_t pixel_height,
58     int64 elapsed_time, int64 time_stamp, int rotation) {
59   UNIMPLEMENTED;
60   return false;
61 }
62
63 const uint8* WebRtcTextureVideoFrame::GetYPlane() const {
64   UNIMPLEMENTED;
65   return NULL;
66 }
67
68 const uint8* WebRtcTextureVideoFrame::GetUPlane() const {
69   UNIMPLEMENTED;
70   return NULL;
71 }
72
73 const uint8* WebRtcTextureVideoFrame::GetVPlane() const {
74   UNIMPLEMENTED;
75   return NULL;
76 }
77
78 uint8* WebRtcTextureVideoFrame::GetYPlane() {
79   UNIMPLEMENTED;
80   return NULL;
81 }
82
83 uint8* WebRtcTextureVideoFrame::GetUPlane() {
84   UNIMPLEMENTED;
85   return NULL;
86 }
87
88 uint8* WebRtcTextureVideoFrame::GetVPlane() {
89   UNIMPLEMENTED;
90   return NULL;
91 }
92
93 int32 WebRtcTextureVideoFrame::GetYPitch() const {
94   UNIMPLEMENTED;
95   return width_;
96 }
97
98 int32 WebRtcTextureVideoFrame::GetUPitch() const {
99   UNIMPLEMENTED;
100   return (width_ + 1) / 2;
101 }
102
103 int32 WebRtcTextureVideoFrame::GetVPitch() const {
104   UNIMPLEMENTED;
105   return (width_ + 1) / 2;
106 }
107
108 VideoFrame* WebRtcTextureVideoFrame::Copy() const {
109   return new WebRtcTextureVideoFrame(
110       handle_, width_, height_, elapsed_time_, time_stamp_);
111 }
112
113 bool WebRtcTextureVideoFrame::MakeExclusive() {
114   UNIMPLEMENTED;
115   return false;
116 }
117
118 size_t WebRtcTextureVideoFrame::CopyToBuffer(uint8* buffer, size_t size) const {
119   UNIMPLEMENTED;
120   return 0;
121 }
122
123 size_t WebRtcTextureVideoFrame::ConvertToRgbBuffer(
124     uint32 to_fourcc, uint8* buffer, size_t size, int stride_rgb) const {
125   UNIMPLEMENTED;
126   return 0;
127 }
128
129 bool WebRtcTextureVideoFrame::CopyToPlanes(
130     uint8* dst_y, uint8* dst_u, uint8* dst_v, int32 dst_pitch_y,
131     int32 dst_pitch_u, int32 dst_pitch_v) const {
132   UNIMPLEMENTED;
133   return false;
134 }
135
136 void WebRtcTextureVideoFrame::CopyToFrame(VideoFrame* dst) const {
137   UNIMPLEMENTED;
138 }
139
140 talk_base::StreamResult WebRtcTextureVideoFrame::Write(
141     talk_base::StreamInterface* stream, int* error) {
142   UNIMPLEMENTED;
143   return talk_base::SR_ERROR;
144 }
145 void WebRtcTextureVideoFrame::StretchToPlanes(
146     uint8* dst_y, uint8* dst_u, uint8* dst_v, int32 dst_pitch_y,
147     int32 dst_pitch_u, int32 dst_pitch_v, size_t width, size_t height,
148     bool interpolate, bool vert_crop) const {
149   UNIMPLEMENTED;
150 }
151
152 size_t WebRtcTextureVideoFrame::StretchToBuffer(
153     size_t dst_width, size_t dst_height, uint8* dst_buffer, size_t size,
154     bool interpolate, bool vert_crop) const {
155   UNIMPLEMENTED;
156   return 0;
157 }
158
159 void WebRtcTextureVideoFrame::StretchToFrame(
160     VideoFrame* dst, bool interpolate, bool vert_crop) const {
161   UNIMPLEMENTED;
162 }
163
164 VideoFrame* WebRtcTextureVideoFrame::Stretch(
165     size_t dst_width, size_t dst_height, bool interpolate,
166     bool vert_crop) const {
167   UNIMPLEMENTED;
168   return NULL;
169 }
170
171 bool WebRtcTextureVideoFrame::SetToBlack() {
172   UNIMPLEMENTED;
173   return false;
174 }
175
176 VideoFrame* WebRtcTextureVideoFrame::CreateEmptyFrame(
177     int w, int h, size_t pixel_width, size_t pixel_height, int64 elapsed_time,
178     int64 time_stamp) const {
179   UNIMPLEMENTED;
180   return NULL;
181 }
182
183 }  // namespace cricket