Add HAVE_YUV
git-svn-id: http://libjingle.googlecode.com/svn/trunk@92 dd674b97-3498-5ee5-1854-bdd07cd0ff33
diff --git a/talk/main.scons b/talk/main.scons
index 689288f..a4c228f 100644
--- a/talk/main.scons
+++ b/talk/main.scons
@@ -64,6 +64,7 @@
'FEATURE_ENABLE_VOICEMAIL',
'FEATURE_ENABLE_PSTN',
'HAVE_SRTP',
+ 'HAVE_YUV',
],
# Ensure the os environment is captured for any scripts we call out to
ENV = os.environ,
diff --git a/talk/session/phone/videoframe.cc b/talk/session/phone/videoframe.cc
index 2a8e1ae..0db3352 100644
--- a/talk/session/phone/videoframe.cc
+++ b/talk/session/phone/videoframe.cc
@@ -29,8 +29,10 @@
#include <cstring>
+#ifdef HAVE_YUV
#include "libyuv/planar_functions.h"
#include "libyuv/scale.h"
+#endif
namespace cricket {
@@ -42,6 +44,7 @@
uint8* y, uint8* u, uint8* v,
int32 dst_pitch_y, int32 dst_pitch_u, int32 dst_pitch_v,
size_t width, size_t height, bool interpolate, bool vert_crop) const {
+#ifdef HAVE_YUV
if (!GetYPlane() || !GetUPlane() || !GetVPlane())
return;
@@ -79,6 +82,7 @@
iwidth, iheight,
y, u, v, dst_pitch_y, dst_pitch_u, dst_pitch_v,
width, height, interpolate);
+#endif
}
size_t VideoFrame::StretchToBuffer(size_t w, size_t h,
@@ -117,11 +121,19 @@
}
bool VideoFrame::SetToBlack() {
+#ifdef HAVE_YUV
return libyuv::I420Rect(GetYPlane(), GetYPitch(),
GetUPlane(), GetUPitch(),
GetVPlane(), GetVPitch(),
0, 0, GetWidth(), GetHeight(),
16, 128, 128) == 0;
+#else
+ int uv_size = GetUPitch() * GetChromaHeight();
+ memset(GetYPlane(), 16, GetWidth() * GetHeight());
+ memset(GetUPlane(), 128, uv_size);
+ memset(GetVPlane(), 128, uv_size);
+ return true;
+#endif
}
} // namespace cricket