Skip to content

Commit

Permalink
RDK-30238: System Audio Player (rdkcentral#1756)
Browse files Browse the repository at this point in the history
Reason for change: System Audio Player supports Audio Casting & Beep sound
Test Procedure: Test app included
Risks: Low

Signed-off-by: vdinak240 <[email protected]>
  • Loading branch information
vdinak240 authored Aug 31, 2021
1 parent 0762478 commit 14feff9
Show file tree
Hide file tree
Showing 27 changed files with 4,898 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ if(PLUGIN_TEXTTOSPEECH)
add_subdirectory(TextToSpeech)
endif()

if(PLUGIN_SYSTEMAUDIOPLAYER)
add_subdirectory(SystemAudioPlayer)
endif()

if(PLUGIN_PERSISTENTSTORE)
add_subdirectory(PersistentStore)
endif()
Expand Down
1 change: 1 addition & 0 deletions Monitor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ set(PLUGIN_MONITOR_WEBKITBROWSER_RESIDENT_APP "${PLUGIN_WEBKITBROWSER_RESIDENT_A
set(PLUGIN_MONITOR_WEBKITBROWSER_UX "${PLUGIN_WEBKITBROWSER_UX}" CACHE BOOL "Enable monitor for the WebKitBrowser UX plugin")
set(PLUGIN_MONITOR_WEBKITBROWSER_YOUTUBE "${PLUGIN_WEBKITBROWSER_YOUTUBE}" CACHE BOOL "Enable monitor for the WebKitBrowser Youtube plugin")
set(PLUGIN_MONITOR_OPENCDMI "${PLUGIN_OPENCDMI}" CACHE BOOL "Enable monitor for the OpenCDMI plugin")
set(PLUGIN_MONITOR_SYSTEMAUDIOPLAYER "${PLUGIN_SYSTEMAUDIOPLAYER}" CACHE BOOL "Enable monitor for the SystemAudioPlayer plugin")

# Plugins built from outside of this repository have to be enabled manually
set(PLUGIN_MONITOR_COBALT OFF CACHE BOOL "Enable monitor for the Cobalt plugin")
Expand Down
15 changes: 15 additions & 0 deletions Monitor/Monitor.config
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,21 @@ if(PLUGIN_MONITOR_OPENCDMI)
map_append(${configuration} observables ${OPENCDMI_MONITOR_CONFIG})
endif()

if(PLUGIN_MONITOR_SYSTEMAUDIOPLAYER)
map()
kv(callsign org.rdk.SystemAudioPlayer)
kv(operational 1)
key(restart)
map()
kv(window 60)
kv(limit 3)
end()
end()
ans(SYSTEMAUDIOPLAYER_MONITOR_CONFIG)
map_append(${configuration} observables ___array___)
map_append(${configuration} observables ${SYSTEMAUDIOPLAYER_MONITOR_CONFIG})
endif()

if(PLUGIN_MONITOR_WEBKITBROWSER_RESIDENT_APP)
map()
kv(callsign ResidentApp)
Expand Down
45 changes: 45 additions & 0 deletions SystemAudioPlayer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
set(PLUGIN_NAME SystemAudioPlayer)
set(MODULE_NAME ${NAMESPACE}${PLUGIN_NAME})

find_package(${NAMESPACE}Plugins REQUIRED)

add_subdirectory(test)

add_library(${MODULE_NAME} SHARED
Module.cpp
SystemAudioPlayer.cpp
SystemAudioPlayerJsonRpc.cpp
ProxyStubs_SystemAudioPlayer.cpp
SystemAudioPlayerImplementation.cpp
impl/AudioPlayer.cpp
impl/BufferQueue.cpp
impl/WebSocketClient.cpp
impl/logger.cpp
)
set_target_properties(${MODULE_NAME} PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED YES)

list(APPEND CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/")

find_package(PkgConfig REQUIRED)
pkg_check_modules(GSTREAMERBASE REQUIRED gstreamer-app-1.0)
pkg_check_modules(LIBWEBSOCKETS REQUIRED libwebsockets)

find_package(GSTREAMER REQUIRED)

find_package(Curl)

set(AUDIO_CLIENT_LIB "")
if (BUILD_AMLOGIC)
set(AUDIO_CLIENT_LIB "audio_client")
endif()

target_include_directories(${MODULE_NAME} PRIVATE ../helpers ${GSTREAMER_INCLUDES} ${GSTREAMERBASE_INCLUDE_DIRS} ${LIBWEBSOCKETS_INCLUDE_DIRS})
target_link_libraries(${MODULE_NAME} PRIVATE ${NAMESPACE}Plugins::${NAMESPACE}Plugins ${CURL_LIBRARY} ${GSTREAMER_LIBRARIES} ${GSTREAMERBASE_LIBRARIES} ${AUDIO_CLIENT_LIB} ${LIBWEBSOCKETS_LIBRARIES} trower-base64)

install(TARGETS ${MODULE_NAME}
DESTINATION lib/${STORAGE_DIRECTORY}/plugins)

write_config( SystemAudioPlayer )
43 changes: 43 additions & 0 deletions SystemAudioPlayer/ISystemAudioPlayer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

#ifndef __ISYSTEMAUDIOPLAYER_H
#define __ISYSTEMAUDIOPLAYER_H

#include "Module.h"
#include <interfaces/Ids.h>

namespace WPEFramework {
namespace Exchange {

struct EXTERNAL ISystemAudioPlayer : virtual public Core::IUnknown {
enum { ID = ID_BROWSER + 0x7000 };

struct INotification : virtual public Core::IUnknown {
enum { ID = ISystemAudioPlayer::ID + 1};

virtual ~INotification() {}
virtual void OnSAPEvents(const string &data) = 0;
};

virtual ~ISystemAudioPlayer() {}

virtual uint32_t Configure(PluginHost::IShell* service) = 0;
virtual void Register(INotification* sink) = 0;
virtual void Unregister(INotification* sink) = 0;

virtual uint32_t Open(const string &input, string &output /* @out */) = 0;
virtual uint32_t Play(const string &input, string &output /* @out */) = 0;
virtual uint32_t PlayBuffer(const string &input, string &output /* @out */) = 0;
virtual uint32_t Pause(const string &input, string &output /* @out */) = 0;
virtual uint32_t Resume(const string &input, string &output /* @out */) = 0;
virtual uint32_t Stop(const string &input, string &output /* @out */) = 0;
virtual uint32_t Close(const string &input, string &output /* @out */) = 0;
virtual uint32_t SetMixerLevels(const string &input, string &output /* @out */) = 0;
virtual uint32_t IsPlaying(const string &input, string &output /* @out */) = 0;
virtual uint32_t Config(const string &input, string &output /* @out */) = 0;

};

} // Exchange
} // WPEFramework

#endif //__ISYSTEMAUDIOPLAYER_H
22 changes: 22 additions & 0 deletions SystemAudioPlayer/Module.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* If not stated otherwise in this file or this component's LICENSE
* file the following copyright and licenses apply:
*
* Copyright 2019 RDK Management
*
* 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.
**/

#include "Module.h"

MODULE_NAME_DECLARATION(BUILD_REFERENCE)
29 changes: 29 additions & 0 deletions SystemAudioPlayer/Module.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* If not stated otherwise in this file or this component's LICENSE
* file the following copyright and licenses apply:
*
* Copyright 2019 RDK Management
*
* 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.
**/

#pragma once
#ifndef MODULE_NAME
#define MODULE_NAME SystemAudioPlayer
#endif

#include <plugins/plugins.h>
#include <tracing/tracing.h>

#undef EXTERNAL
#define EXTERNAL
Loading

0 comments on commit 14feff9

Please sign in to comment.