LCOV - code coverage report
Current view: top level - avmedia/source/opengl - oglframegrabber.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 22 0.0 %
Date: 2014-11-03 Functions: 0 9 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #include "oglframegrabber.hxx"
      11             : 
      12             : #include <cppuhelper/supportsservice.hxx>
      13             : #include <vcl/bitmapex.hxx>
      14             : #include <vcl/graph.hxx>
      15             : #include <vcl/salbtype.hxx>
      16             : #include <vcl/bmpacc.hxx>
      17             : 
      18             : #include <vcl/opengl/OpenGLHelper.hxx>
      19             : 
      20             : #include <boost/scoped_array.hpp>
      21             : 
      22             : using namespace com::sun::star;
      23             : using namespace libgltf;
      24             : 
      25             : namespace avmedia { namespace ogl {
      26             : 
      27           0 : OGLFrameGrabber::OGLFrameGrabber(  glTFHandle& rHandle )
      28             :     : FrameGrabber_BASE()
      29           0 :     , m_rHandle( rHandle )
      30             : {
      31           0 : }
      32             : 
      33           0 : OGLFrameGrabber::~OGLFrameGrabber()
      34             : {
      35           0 : }
      36             : 
      37           0 : uno::Reference< css::graphic::XGraphic > SAL_CALL OGLFrameGrabber::grabFrame( double /*fMediaTime*/ )
      38             :         throw ( uno::RuntimeException, std::exception )
      39             : {
      40           0 :     boost::scoped_array<sal_uInt8> pBuffer(new sal_uInt8[m_rHandle.viewport.width * m_rHandle.viewport.height * 4]);
      41           0 :     glTFHandle* pHandle = &m_rHandle;
      42           0 :     int nRet = gltf_renderer_get_bitmap(&pHandle, 1, (char*)pBuffer.get(), GL_BGRA);
      43           0 :     if( nRet != 0 )
      44             :     {
      45             :         SAL_WARN("avmedia.opengl", "Error occured while rendering to bitmap! Error code: " << nRet);
      46           0 :         return uno::Reference< css::graphic::XGraphic >();
      47             :     }
      48           0 :     BitmapEx aBitmap = OpenGLHelper::ConvertBGRABufferToBitmapEx(pBuffer.get(), m_rHandle.viewport.width, m_rHandle.viewport.height);
      49           0 :     return Graphic( aBitmap ).GetXGraphic();
      50             : }
      51             : 
      52           0 : OUString SAL_CALL OGLFrameGrabber::getImplementationName() throw ( uno::RuntimeException, std::exception )
      53             : {
      54           0 :     return OUString("com.sun.star.comp.avmedia.FrameGrabber_OpenGL");
      55             : }
      56             : 
      57           0 : sal_Bool SAL_CALL OGLFrameGrabber::supportsService( const OUString& rServiceName )
      58             :         throw ( uno::RuntimeException, std::exception )
      59             : {
      60           0 :     return cppu::supportsService(this, rServiceName);
      61             : }
      62             : 
      63           0 : uno::Sequence< OUString > SAL_CALL OGLFrameGrabber::getSupportedServiceNames()
      64             :         throw ( uno::RuntimeException, std::exception )
      65             : {
      66           0 :     uno::Sequence< OUString > aRet(1);
      67           0 :     aRet[0] = OUString("com.sun.star.media.FrameGrabber_OpenGL");
      68           0 :     return aRet;
      69             : }
      70             : 
      71             : } // namespace ogl
      72           0 : } // namespace avmedia
      73             : 
      74             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10