| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #import "RTCOpenGLVideoRenderer.h" | 11 #import "RTCOpenGLVideoRenderer.h" |
| 12 | 12 |
| 13 #if TARGET_OS_IPHONE | 13 #if TARGET_OS_IPHONE |
| 14 #import <OpenGLES/ES3/gl.h> | 14 #import <OpenGLES/ES3/gl.h> |
| 15 #else | 15 #else |
| 16 #import <OpenGL/gl3.h> | 16 #import <OpenGL/gl3.h> |
| 17 #endif | 17 #endif |
| 18 #include <string.h> | 18 #include <string.h> |
| 19 #include <memory> |
| 19 | 20 |
| 20 #import "WebRTC/RTCVideoFrame.h" | 21 #import "WebRTC/RTCVideoFrame.h" |
| 21 | 22 |
| 22 #include "webrtc/base/scoped_ptr.h" | |
| 23 | 23 |
| 24 // TODO(tkchin): check and log openGL errors. Methods here return BOOLs in | 24 // TODO(tkchin): check and log openGL errors. Methods here return BOOLs in |
| 25 // anticipation of that happening in the future. | 25 // anticipation of that happening in the future. |
| 26 | 26 |
| 27 #if TARGET_OS_IPHONE | 27 #if TARGET_OS_IPHONE |
| 28 #define RTC_PIXEL_FORMAT GL_LUMINANCE | 28 #define RTC_PIXEL_FORMAT GL_LUMINANCE |
| 29 #define SHADER_VERSION | 29 #define SHADER_VERSION |
| 30 #define VERTEX_SHADER_IN "attribute" | 30 #define VERTEX_SHADER_IN "attribute" |
| 31 #define VERTEX_SHADER_OUT "varying" | 31 #define VERTEX_SHADER_OUT "varying" |
| 32 #define FRAGMENT_SHADER_IN "varying" | 32 #define FRAGMENT_SHADER_IN "varying" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 GLuint _vertexArray; | 155 GLuint _vertexArray; |
| 156 #endif | 156 #endif |
| 157 GLuint _vertexBuffer; | 157 GLuint _vertexBuffer; |
| 158 GLint _position; | 158 GLint _position; |
| 159 GLint _texcoord; | 159 GLint _texcoord; |
| 160 GLint _ySampler; | 160 GLint _ySampler; |
| 161 GLint _uSampler; | 161 GLint _uSampler; |
| 162 GLint _vSampler; | 162 GLint _vSampler; |
| 163 // Used to create a non-padded plane for GPU upload when we receive padded | 163 // Used to create a non-padded plane for GPU upload when we receive padded |
| 164 // frames. | 164 // frames. |
| 165 rtc::scoped_ptr<uint8_t[]> _planeBuffer; | 165 std::unique_ptr<uint8_t[]> _planeBuffer; |
| 166 } | 166 } |
| 167 | 167 |
| 168 @synthesize lastDrawnFrame = _lastDrawnFrame; | 168 @synthesize lastDrawnFrame = _lastDrawnFrame; |
| 169 | 169 |
| 170 + (void)initialize { | 170 + (void)initialize { |
| 171 // Disable dithering for performance. | 171 // Disable dithering for performance. |
| 172 glDisable(GL_DITHER); | 172 glDisable(GL_DITHER); |
| 173 } | 173 } |
| 174 | 174 |
| 175 #if TARGET_OS_IPHONE | 175 #if TARGET_OS_IPHONE |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 GL_FLOAT, | 475 GL_FLOAT, |
| 476 GL_FALSE, | 476 GL_FALSE, |
| 477 4 * sizeof(GLfloat), | 477 4 * sizeof(GLfloat), |
| 478 (void *)(2 * sizeof(GLfloat))); | 478 (void *)(2 * sizeof(GLfloat))); |
| 479 glEnableVertexAttribArray(_texcoord); | 479 glEnableVertexAttribArray(_texcoord); |
| 480 | 480 |
| 481 return YES; | 481 return YES; |
| 482 } | 482 } |
| 483 | 483 |
| 484 @end | 484 @end |
| OLD | NEW |