2 * Copyright (c) 2019 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 <dali/internal/vector-animation/common/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 ),
49 if( !sharedObjectName.empty() )
51 mSharedObjectName = sharedObjectName;
55 mSharedObjectName = DEFAULT_OBJECT_NAME;
61 VectorAnimationRendererPluginProxy::~VectorAnimationRendererPluginProxy()
68 if( mLibHandle && dlclose( mLibHandle ) )
70 DALI_LOG_ERROR( "Error closing vector animation renderer plugin library: %s\n", dlerror() );
75 void VectorAnimationRendererPluginProxy::Initialize()
77 mLibHandle = dlopen( mSharedObjectName.c_str(), RTLD_LAZY );
79 char* error = dlerror();
80 if( mLibHandle == NULL || error != NULL )
82 DALI_LOG_ERROR( "VectorAnimationRendererPluginProxy::Initialize: dlopen error [%s]\n", error );
87 mCreateVectorAnimationRendererPtr = reinterpret_cast< CreateVectorAnimationRendererFunction >( dlsym( mLibHandle, "CreateVectorAnimationRendererPlugin" ) );
90 if( mCreateVectorAnimationRendererPtr == NULL || error != NULL )
92 DALI_LOG_ERROR( "VectorAnimationRendererPluginProxy::Initialize: Cannot load symbol: %s\n", error );
96 mPlugin = mCreateVectorAnimationRendererPtr();
99 DALI_LOG_ERROR("VectorAnimationRendererPluginProxy::Initialize: Plugin creation failed\n");
104 bool VectorAnimationRendererPluginProxy::Initialize( const std::string& url )
108 return mPlugin->Initialize( url );
113 void VectorAnimationRendererPluginProxy::Finalize()
121 void VectorAnimationRendererPluginProxy::SetRenderer( Dali::Renderer renderer )
125 mPlugin->SetRenderer( renderer );
129 void VectorAnimationRendererPluginProxy::SetSize( uint32_t width, uint32_t height )
133 mPlugin->SetSize( width, height );
137 bool VectorAnimationRendererPluginProxy::Render( uint32_t frameNumber )
141 return mPlugin->Render( frameNumber );
146 uint32_t VectorAnimationRendererPluginProxy::GetTotalFrameNumber() const
150 return mPlugin->GetTotalFrameNumber();
155 float VectorAnimationRendererPluginProxy::GetFrameRate() const
159 return mPlugin->GetFrameRate();
164 void VectorAnimationRendererPluginProxy::GetDefaultSize( uint32_t& width, uint32_t& height ) const
168 mPlugin->GetDefaultSize( width, height );
172 void VectorAnimationRendererPluginProxy::GetLayerInfo( Property::Map& map ) const
176 mPlugin->GetLayerInfo( map );
180 bool VectorAnimationRendererPluginProxy::GetMarkerInfo( const std::string& marker, uint32_t& startFrame, uint32_t& endFrame ) const
184 return mPlugin->GetMarkerInfo( marker, startFrame, endFrame );
189 VectorAnimationRendererPlugin::UploadCompletedSignalType& VectorAnimationRendererPluginProxy::UploadCompletedSignal()
193 return mPlugin->UploadCompletedSignal();
195 return mDefaultSignal;
198 } // namespace Adaptor
200 } // namespace Internal