2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <vector-animation-renderer-plugin-proxy.h>
23 #include <dali/integration-api/debug.h>
37 // The default plugin name
38 const char* DEFAULT_OBJECT_NAME( "libdali-vector-animation-renderer-plugin.so" );
42 VectorAnimationRendererPluginProxy::VectorAnimationRendererPluginProxy( const std::string& sharedObjectName )
43 : mSharedObjectName(),
46 mCreateVectorAnimationRendererPtr( NULL )
48 if( !sharedObjectName.empty() )
50 mSharedObjectName = sharedObjectName;
54 mSharedObjectName = DEFAULT_OBJECT_NAME;
60 VectorAnimationRendererPluginProxy::~VectorAnimationRendererPluginProxy()
67 if( mLibHandle && dlclose( mLibHandle ) )
69 DALI_LOG_ERROR( "Error closing vector animation renderer plugin library: %s\n", dlerror() );
74 void VectorAnimationRendererPluginProxy::Initialize()
76 mLibHandle = dlopen( mSharedObjectName.c_str(), RTLD_LAZY );
78 char* error = dlerror();
79 if( mLibHandle == NULL || error != NULL )
81 DALI_LOG_ERROR( "VectorAnimationRendererPluginProxy::Initialize: dlopen error [%s]\n", error );
86 mCreateVectorAnimationRendererPtr = reinterpret_cast< CreateVectorAnimationRendererFunction >( dlsym( mLibHandle, "CreateVectorAnimationRendererPlugin" ) );
89 if( mCreateVectorAnimationRendererPtr == NULL || error != NULL )
91 DALI_LOG_ERROR( "VectorAnimationRendererPluginProxy::Initialize: Cannot load symbol: %s\n", error );
95 mPlugin = mCreateVectorAnimationRendererPtr();
98 DALI_LOG_ERROR("VectorAnimationRendererPluginProxy::Initialize: Plugin creation failed\n");
103 bool VectorAnimationRendererPluginProxy::CreateRenderer( const std::string& url, Dali::Renderer renderer, uint32_t width, uint32_t height )
107 return mPlugin->CreateRenderer( url, renderer, width, height );
112 bool VectorAnimationRendererPluginProxy::StartRender()
116 return mPlugin->StartRender();
121 void VectorAnimationRendererPluginProxy::StopRender()
125 mPlugin->StopRender();
129 void VectorAnimationRendererPluginProxy::Render( uint32_t frameNumber )
133 mPlugin->Render( frameNumber );
137 uint32_t VectorAnimationRendererPluginProxy::GetTotalFrameNumber()
141 return mPlugin->GetTotalFrameNumber();
146 } // namespace Adaptor
148 } // namespace Internal