SET( adaptor_video_dir ${ADAPTOR_ROOT}/dali/internal/video )
include( ${ADAPTOR_ROOT}/dali/internal/video/file.list )
+SET( adaptor_camera_dir ${ADAPTOR_ROOT}/dali/internal/camera )
+include( ${ADAPTOR_ROOT}/dali/internal/camera/file.list )
+
SET( adaptor_web_engine_dir ${ADAPTOR_ROOT}/dali/internal/web-engine )
include( ${ADAPTOR_ROOT}/dali/internal/web-engine/file.list )
SET( adaptor_video_dir ${ADAPTOR_ROOT}/dali/internal/video )
include( ${ADAPTOR_ROOT}/dali/internal/video/file.list )
+SET( adaptor_camera_dir ${ADAPTOR_ROOT}/dali/internal/camera )
+include( ${ADAPTOR_ROOT}/dali/internal/camera/file.list )
+
SET( adaptor_web_engine_dir ${ADAPTOR_ROOT}/dali/internal/web-engine )
include( ${ADAPTOR_ROOT}/dali/internal/web-engine/file.list )
${adaptor_vector_animation_common_src_files}
${adaptor_vector_image_common_src_files}
${adaptor_video_common_src_files}
+ ${adaptor_camera_common_src_files}
${adaptor_web_engine_common_src_files}
${adaptor_window_system_common_src_files}
${adaptor_window_system_android_src_files}
${adaptor_vector_animation_common_src_files}
${adaptor_vector_image_common_src_files}
${adaptor_video_common_src_files}
+ ${adaptor_camera_common_src_files}
${adaptor_web_engine_common_src_files}
${adaptor_window_system_common_src_files}
${adaptor_window_system_tizen_src_files}
${adaptor_vector_animation_common_src_files}
${adaptor_vector_image_common_src_files}
${adaptor_video_common_src_files}
+ ${adaptor_camera_common_src_files}
${adaptor_web_engine_common_src_files}
${adaptor_window_system_common_src_files}
${adaptor_window_system_tizen_src_files}
${adaptor_vector_animation_common_src_files}
${adaptor_vector_image_common_src_files}
${adaptor_video_common_src_files}
+ ${adaptor_camera_common_src_files}
${adaptor_web_engine_common_src_files}
${adaptor_window_system_common_src_files}
${adaptor_macos_platform_src_files}
${adaptor_vector_animation_common_src_files}
${adaptor_vector_image_common_src_files}
${adaptor_video_common_src_files}
+ ${adaptor_camera_common_src_files}
${adaptor_web_engine_common_src_files}
${adaptor_window_system_common_src_files}
${adaptor_window_system_tizen_src_files}
${adaptor_vector_animation_common_src_files}
${adaptor_vector_image_common_src_files}
${adaptor_video_common_src_files}
+ ${adaptor_camera_common_src_files}
${adaptor_web_engine_common_src_files}
${adaptor_window_system_common_src_files}
${adaptor_window_system_tizen_src_files}
${adaptor_vector_animation_common_src_files}
${adaptor_vector_image_common_src_files}
${adaptor_video_common_src_files}
+ ${adaptor_camera_common_src_files}
${adaptor_web_engine_common_src_files}
${adaptor_window_system_common_src_files}
${adaptor_trace_common_src_files}
${adaptor_vector_animation_common_src_files}
${adaptor_vector_image_common_src_files}
${adaptor_video_common_src_files}
+ ${adaptor_camera_common_src_files}
${adaptor_web_engine_common_src_files}
${adaptor_window_system_common_src_files}
${adaptor_window_system_tizen_src_files}
${adaptor_vector_animation_common_src_files}
${adaptor_vector_image_common_src_files}
${adaptor_video_common_src_files}
+ ${adaptor_camera_common_src_files}
${adaptor_web_engine_common_src_files}
${adaptor_window_system_common_src_files}
${adaptor_trace_common_src_files}
--- /dev/null
+#ifndef DALI_CAMERA_PLAYER_PLUGIN_H
+#define DALI_CAMERA_PLAYER_PLUGIN_H
+
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/adaptor-framework/native-image-source.h>
+#include <dali/public-api/adaptor-framework/window.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/math/rect.h>
+
+namespace Dali
+{
+class Any;
+using DisplayArea = Dali::Rect<int>;
+
+/**
+ * @brief CameraPlayerPlugin is an abstract interface, used by dali-adaptor to access camera player plugin.
+ * A concrete implementation must be created for each platform and provided as dynamic library.
+ */
+class CameraPlayerPlugin
+{
+public:
+ /**
+ * @brief Constructor.
+ */
+ CameraPlayerPlugin()
+ {
+ }
+
+ /**
+ * @brief Destructor.
+ */
+ virtual ~CameraPlayerPlugin()
+ {
+ }
+
+ /**
+ * @brief Sets camera rendering target for window
+ * @param[in] target The target for camera rendering, window surface
+ */
+ virtual void SetWindowRenderingTarget(Dali::Window target) = 0;
+
+ /**
+ * @brief Sets camera rendering target for native image
+ * @param[in] target The target for camera rendering, native image source
+ */
+ virtual void SetNativeImageRenderingTarget(Dali::NativeImageSourcePtr target) = 0;
+
+ /**
+ * @brief Sets the area of camera display.
+ * @param[in] area The left-top position and size of the camera display area
+ */
+ virtual void SetDisplayArea(DisplayArea area) = 0;
+
+ /**
+ * @brief Set the camera player handle.
+ * @param[in] handle The handle for camera player
+ */
+ virtual void SetCameraPlayer(Any handle) = 0;
+};
+
+} // namespace Dali
+
+#endif // DALI_CAMERA_PLAYER_PLUGIN_H
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/adaptor-framework/camera-player.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/any.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/camera/common/camera-player-impl.h>
+
+namespace Dali
+{
+CameraPlayer::CameraPlayer()
+{
+}
+
+CameraPlayer::CameraPlayer(Internal::Adaptor::CameraPlayer* internal)
+: BaseHandle(internal)
+{
+}
+
+CameraPlayer::~CameraPlayer()
+{
+}
+
+CameraPlayer CameraPlayer::New()
+{
+ Internal::Adaptor::CameraPlayerPtr player = Internal::Adaptor::CameraPlayer::New();
+ return CameraPlayer(player.Get());
+}
+
+CameraPlayer::CameraPlayer(const CameraPlayer& player)
+: BaseHandle(player)
+{
+}
+
+CameraPlayer& CameraPlayer::operator=(const CameraPlayer& player)
+{
+ if(*this != player)
+ {
+ BaseHandle::operator=(player);
+ }
+ return *this;
+}
+
+CameraPlayer CameraPlayer::DownCast(BaseHandle handle)
+{
+ return CameraPlayer(dynamic_cast<Internal::Adaptor::CameraPlayer*>(handle.GetObjectPtr()));
+}
+
+void CameraPlayer::SetWindowRenderingTarget(Dali::Window target)
+{
+ GetImplementation(*this).SetWindowRenderingTarget(target);
+}
+
+void CameraPlayer::SetNativeImageRenderingTarget(Dali::NativeImageSourcePtr target)
+{
+ GetImplementation(*this).SetNativeImageRenderingTarget(target);
+}
+
+void CameraPlayer::SetDisplayArea(DisplayArea area)
+{
+ GetImplementation(*this).SetDisplayArea(area);
+}
+
+void CameraPlayer::SetCameraPlayer(Any handle)
+{
+ GetImplementation(*this).SetCameraPlayer(handle);
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_CAMERA_PLAYER_H
+#define DALI_CAMERA_PLAYER_H
+
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-handle.h>
+
+//INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/camera-player-plugin.h>
+#include <dali/public-api/dali-adaptor-common.h>
+
+namespace Dali
+{
+class Any;
+
+namespace Internal
+{
+namespace Adaptor
+{
+class CameraPlayer;
+} // namespace Adaptor
+
+} // namespace Internal
+
+/**
+ * @brief CameraPlayer class is used for camera playback.
+ */
+class DALI_ADAPTOR_API CameraPlayer : public BaseHandle
+{
+public:
+ /**
+ * @brief Constructor.
+ */
+ CameraPlayer();
+
+ /**
+ * @brief Destructor.
+ */
+ ~CameraPlayer();
+
+ /**
+ * @brief Creates a new instance of a CameraPlayer.
+ */
+ static CameraPlayer New();
+
+ /**
+ * @brief Copy constructor.
+ *
+ * @param[in] player CameraPlayer to copy. The copied player will point at the same implementation
+ */
+ CameraPlayer(const CameraPlayer& player);
+
+ /**
+ * @brief Assignment operator.
+ *
+ * @param[in] player The CameraPlayer to assign from.
+ * @return The updated CameraPlayer.
+ */
+ CameraPlayer& operator=(const CameraPlayer& player);
+
+ /**
+ * @brief Downcast a handle to CameraPlayer handle.
+ *
+ * If handle points to a CameraPlayer the downcast produces valid
+ * handle. If not the returned handle is left uninitialized.
+ *
+ * @param[in] handle Handle to an object
+ * @return Handle to a CameraPlayer or an uninitialized handle
+ */
+ static CameraPlayer DownCast(BaseHandle handle);
+
+ /**
+ * @brief Sets camera rendering target.
+ * @param[in] target The target for camera rendering, window surface
+ */
+ void SetWindowRenderingTarget(Dali::Window target);
+
+ /**
+ * @brief Sets camera rendering target.
+ * @param[in] target The target for camera rendering, native image source
+ */
+ void SetNativeImageRenderingTarget(Dali::NativeImageSourcePtr target);
+
+ /**
+ * @brief Sets the area of camera display.
+ * @param[in] area The left-top position and size of the camera display area
+ */
+ void SetDisplayArea(DisplayArea area);
+
+ /**
+ * @brief Sets the camera player handle
+ * @param[in] handle The handle for camera player
+ */
+ void SetCameraPlayer(Any handle);
+
+private: // Not intended for application developers
+ /**
+ * @brief Internal constructor
+ */
+ explicit DALI_INTERNAL CameraPlayer(Internal::Adaptor::CameraPlayer* internal);
+};
+
+} // namespace Dali
+
+#endif // DALI_CAMERA_PLAYER_H
${adaptor_devel_api_dir}/adaptor-framework/gl-window.cpp
${adaptor_devel_api_dir}/adaptor-framework/offscreen-application.cpp
${adaptor_devel_api_dir}/adaptor-framework/offscreen-window.cpp
+ ${adaptor_devel_api_dir}/adaptor-framework/camera-player.cpp
)
${adaptor_devel_api_dir}/adaptor-framework/gl-window.h
${adaptor_devel_api_dir}/adaptor-framework/offscreen-application.h
${adaptor_devel_api_dir}/adaptor-framework/offscreen-window.h
+ ${adaptor_devel_api_dir}/adaptor-framework/camera-player.h
+ ${adaptor_devel_api_dir}/adaptor-framework/camera-player-plugin.h
)
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/camera/common/camera-player-impl.h>
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+#include <dali/public-api/object/any.h>
+#include <dali/public-api/object/type-registry.h>
+#include <dlfcn.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/adaptor-framework/native-image-source.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+namespace // unnamed namespace
+{
+const char* CAMERA_PLUGIN_SO("libdali2-camera-player-plugin.so");
+
+Dali::BaseHandle Create()
+{
+ return Dali::CameraPlayer::New();
+}
+
+Dali::TypeRegistration type(typeid(Dali::CameraPlayer), typeid(Dali::BaseHandle), Create);
+
+} // unnamed namespace
+
+CameraPlayerPtr CameraPlayer::New()
+{
+ CameraPlayerPtr player = new CameraPlayer();
+ player->Initialize();
+ return player;
+}
+
+CameraPlayer::CameraPlayer()
+: mPlugin(NULL),
+ mHandle(NULL),
+ mCreateCameraPlayerPtr(NULL),
+ mDestroyCameraPlayerPtr(NULL)
+{
+}
+
+CameraPlayer::~CameraPlayer()
+{
+ if(mHandle != NULL)
+ {
+ if(mDestroyCameraPlayerPtr != NULL)
+ {
+ mDestroyCameraPlayerPtr(mPlugin);
+ }
+
+ dlclose(mHandle);
+ }
+}
+
+void CameraPlayer::Initialize()
+{
+ char* error = NULL;
+
+ mHandle = dlopen(CAMERA_PLUGIN_SO, RTLD_LAZY);
+
+ error = dlerror();
+ if(mHandle == NULL || error != NULL)
+ {
+ DALI_LOG_ERROR("CameraPlayer::Initialize(), dlopen error: %s\n", error);
+ return;
+ }
+
+ mCreateCameraPlayerPtr = reinterpret_cast<CreateCameraPlayerFunction>(dlsym(mHandle, "CreateCameraPlayerPlugin"));
+
+ error = dlerror();
+ if(mCreateCameraPlayerPtr == NULL || error != NULL)
+ {
+ DALI_LOG_ERROR("Can't load symbol CreateCameraPlayerPlugin(), error: %s\n", error);
+ return;
+ }
+
+ mPlugin = mCreateCameraPlayerPtr();
+
+ if(mPlugin == NULL)
+ {
+ DALI_LOG_ERROR("Can't create the CameraPlayerPlugin object\n");
+ return;
+ }
+
+ mDestroyCameraPlayerPtr = reinterpret_cast<DestroyCameraPlayerFunction>(dlsym(mHandle, "DestroyCameraPlayerPlugin"));
+
+ error = dlerror();
+ if(mDestroyCameraPlayerPtr == NULL || error != NULL)
+ {
+ DALI_LOG_ERROR("Can't load symbol DestroyCameraPlayerPlugin(), error: %s\n", error);
+ return;
+ }
+}
+
+void CameraPlayer::SetWindowRenderingTarget(Dali::Window target)
+{
+ if(mPlugin != NULL)
+ {
+ mPlugin->SetWindowRenderingTarget(target);
+ }
+}
+
+void CameraPlayer::SetNativeImageRenderingTarget(Dali::NativeImageSourcePtr target)
+{
+ if(mPlugin != NULL)
+ {
+ mPlugin->SetNativeImageRenderingTarget(target);
+ }
+}
+
+void CameraPlayer::SetDisplayArea(DisplayArea area)
+{
+ if(mPlugin != NULL)
+ {
+ mPlugin->SetDisplayArea(area);
+ }
+}
+
+void CameraPlayer::SetCameraPlayer(Any handle)
+{
+ if(mPlugin != NULL)
+ {
+ mPlugin->SetCameraPlayer(handle);
+ }
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
--- /dev/null
+#ifndef DALI_CAMERA_PLAYER_IMPL_H
+#define DALI_CAMERA_PLAYER_IMPL_H
+
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-object.h>
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/camera-player-plugin.h>
+#include <dali/devel-api/adaptor-framework/camera-player.h>
+
+namespace Dali
+{
+class Any;
+
+namespace Internal
+{
+namespace Adaptor
+{
+class CameraPlayer;
+
+typedef IntrusivePtr<CameraPlayer> CameraPlayerPtr;
+
+/**
+ * @brief CameraPlayer class is used for camera preview.
+ */
+class CameraPlayer : public Dali::BaseObject
+{
+public:
+ /**
+ * @brief Creates a new CameraPlayer handle
+ * @return CameraPlayer pointer
+ */
+ static CameraPlayerPtr New();
+
+ /**
+ * @copydoc Dali::CameraPlayer::SetWindowRenderingTarget()
+ */
+ void SetWindowRenderingTarget(Dali::Window target);
+
+ /**
+ * @copydoc Dali::CameraPlayer::SetNativeImageRenderingTarget()
+ */
+ void SetNativeImageRenderingTarget(Dali::NativeImageSourcePtr target);
+
+ /**
+ * @copydoc Dali::CameraPlayer::SetDisplayArea()
+ */
+ void SetDisplayArea(DisplayArea area);
+
+ /**
+ * @brief Dali::CameraPlayer::SetCameraPlayer()
+ */
+ void SetCameraPlayer(Any handle);
+
+private:
+ /**
+ * @brief Constructor.
+ */
+ CameraPlayer();
+
+ /**
+ * @brief Destructor.
+ */
+ virtual ~CameraPlayer();
+
+ // Undefined copy constructor
+ CameraPlayer(const CameraPlayer& player);
+
+ // Undefined assignment operator
+ CameraPlayer& operator=(const CameraPlayer& player);
+
+ /**
+ * @brief Initializes member data.
+ */
+ void Initialize();
+
+private:
+ Dali::CameraPlayerPlugin* mPlugin; ///< camera player plugin handle
+ void* mHandle; ///< Handle for the loaded library
+
+ using CreateCameraPlayerFunction = Dali::CameraPlayerPlugin* (*)();
+ using DestroyCameraPlayerFunction = void (*)(Dali::CameraPlayerPlugin* plugin);
+
+ CreateCameraPlayerFunction mCreateCameraPlayerPtr;
+ DestroyCameraPlayerFunction mDestroyCameraPlayerPtr;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+
+inline static Internal::Adaptor::CameraPlayer& GetImplementation(Dali::CameraPlayer& player)
+{
+ DALI_ASSERT_ALWAYS(player && "CameraPlayer handle is empty.");
+
+ BaseObject& handle = player.GetBaseObject();
+
+ return static_cast<Internal::Adaptor::CameraPlayer&>(handle);
+}
+
+inline static const Internal::Adaptor::CameraPlayer& GetImplementation(const Dali::CameraPlayer& player)
+{
+ DALI_ASSERT_ALWAYS(player && "CameraPlayer handle is empty.");
+
+ const BaseObject& handle = player.GetBaseObject();
+
+ return static_cast<const Internal::Adaptor::CameraPlayer&>(handle);
+}
+
+} // namespace Dali
+
+#endif // DALI_CAMERA_PLAYER_IMPL_H
--- /dev/null
+
+# module: camera, backend: common
+SET( adaptor_camera_common_src_files
+ ${adaptor_camera_dir}/common/camera-player-impl.cpp
+)
+