Index: content/common/gpu/media/omx_video_decode_accelerator.cc |
=================================================================== |
--- content/common/gpu/media/omx_video_decode_accelerator.cc (revision 120554) |
+++ content/common/gpu/media/omx_video_decode_accelerator.cc (working copy) |
@@ -21,6 +21,8 @@ |
enum { kNumPictureBuffers = 4 }; |
+int width_ = 0; |
+int height_ = 0; |
Ami GONE FROM CHROMIUM
2012/02/07 17:05:40
No. These are mutable static globals, and are a b
|
// Open the libnvomx here for now. |
void* omx_handle = dlopen("libnvomx.so", RTLD_NOW); |
@@ -111,7 +113,8 @@ |
output_buffers_at_component_(0), |
client_(client), |
profile_(OMX_VIDEO_AVCProfileMax), |
- component_name_is_nvidia_h264ext_(false) { |
+ component_name_is_nvidia_h264ext_(false), |
+ component_name_is_sec_h264ext_(false) { |
RETURN_ON_FAILURE(AreOMXFunctionPointersInitialized(), |
"Failed to load openmax library", PLATFORM_FAILURE,); |
RETURN_ON_OMX_FAILURE(omx_init(), "Failed to init OpenMAX core", |
@@ -127,10 +130,13 @@ |
} |
void OmxVideoDecodeAccelerator::SetEglState( |
- EGLDisplay egl_display, EGLContext egl_context) { |
+ Display* x_display, EGLDisplay egl_display, |
+ EGLContext egl_context, EGLSurface egl_surface) { |
DCHECK_EQ(message_loop_, MessageLoop::current()); |
+ x_display_ = x_display; |
egl_display_ = egl_display; |
egl_context_ = egl_context; |
+ egl_surface_ = egl_surface; |
} |
// This is to initialize the OMX data structures to default values. |
@@ -199,6 +205,10 @@ |
reinterpret_cast<char *>(component.get()), |
"OMX.Nvidia.h264ext.decode"); |
+ component_name_is_sec_h264ext_ = !strcmp( |
+ reinterpret_cast<char *>(component.get()), |
+ "OMX.SEC.AVC.Decoder"); |
Ami GONE FROM CHROMIUM
2012/02/07 17:05:40
What is "SEC"? can you add a comment identifying
|
+ |
// Get the port information. This will obtain information about the number of |
// ports and index of the first port. |
OMX_PORT_PARAM_TYPE port_param; |
@@ -346,8 +356,16 @@ |
static Gles2TextureToEglImageTranslator texture2eglImage_translator; |
for (size_t i = 0; i < buffers.size(); ++i) { |
- EGLImageKHR egl_image = texture2eglImage_translator.TranslateToEglImage( |
- egl_display_, egl_context_, buffers[i].texture_id()); |
+ EGLImageKHR egl_image; |
+ if(component_name_is_sec_h264ext_) { |
+ egl_image = texture2eglImage_translator.CreateEglImage( |
+ x_display_, egl_display_, egl_context_, egl_surface_, |
+ buffers[i].texture_id(), width_, height_); |
+ } |
+ else { |
+ egl_image = texture2eglImage_translator.TranslateToEglImage( |
+ egl_display_, egl_context_, buffers[i].texture_id()); |
+ } |
CHECK(pictures_.insert(std::make_pair( |
buffers[i].id(), OutputPicture(buffers[i], NULL, egl_image))).second); |
} |
@@ -704,7 +722,7 @@ |
delete reinterpret_cast<media::Picture*>(omx_buffer->pAppPrivate); |
result = OMX_FreeBuffer(component_handle_, output_port_, omx_buffer); |
RETURN_ON_OMX_FAILURE(result, "OMX_FreeBuffer", PLATFORM_FAILURE,); |
- texture2eglImage_translator.DestroyEglImage(egl_display_, |
+ texture2eglImage_translator.DestroyEglImage(x_display_, egl_display_, |
it->second.egl_image); |
if (client_) |
client_->DismissPictureBuffer(it->first); |
@@ -730,6 +748,9 @@ |
// ProvidePictureBuffers() will trigger AssignPictureBuffers, which ultimately |
// assigns the textures to the component and re-enables the port. |
const OMX_VIDEO_PORTDEFINITIONTYPE& vformat = port_format.format.video; |
+ width_ = vformat.nFrameWidth; |
+ height_ = vformat.nFrameHeight; |
+ |
if (client_) { |
client_->ProvidePictureBuffers( |
kNumPictureBuffers, |