Skip to content

Commit ad3be16

Browse files
committed
misc: windows: remove UWP/store files and code
Change-Id: I4875e4d76f5da442eace0204052d536c65545d3f
1 parent 5692c1e commit ad3be16

20 files changed

+108
-501
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ build-macos*
111111
/extras/tools/check_sed
112112
/extras/tools/libtool-*.tar.xz
113113

114-
# UWP
114+
# Windows native build
115115
/contrib/build/
116116
/contrib/msvc/
117117

CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,6 @@ source_group("Source Files\\media\\video" FILES ${Source_Files__media__video})
158158
source_group("Source Files\\plugin" FILES ${Source_Files__plugin})
159159

160160
if(MSVC)
161-
if(WINDOWS_STORE)
162-
source_group("Source Files\\media\\video\\uwpvideo" FILES ${Source_Files__media__video__uwpvideo})
163-
endif()
164161
source_group("Source Files\\media\\audio\\portaudio" FILES ${Source_Files__media__audio__portaudio})
165162
source_group("Source Files\\media\\video\\winvideo" FILES ${Source_Files__media__video__winvideo})
166163
endif()

compat/msvc/dlfcn.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,7 @@ void *dlopen( const char *file, int mode )
136136
UINT uMode;
137137
current_error = NULL;
138138
/* Do not let Windows display the critical-error-handler message box */
139-
#ifndef RING_UWP
140139
uMode = SetErrorMode( SEM_FAILCRITICALERRORS );
141-
#endif
142140
if( file == 0 )
143141
{
144142
/* POSIX says that if the value of file is 0, a handle on a global
@@ -149,9 +147,7 @@ void *dlopen( const char *file, int mode )
149147
* symbols only from the original program file. For objects loaded with
150148
* the RTLD_GLOBAL flag, we create our own list later on.
151149
*/
152-
#ifndef RING_UWP
153150
hModule = GetModuleHandle( NULL );
154-
#endif
155151
if( !hModule )
156152
save_err_ptr_str( file );
157153
}
@@ -175,10 +171,8 @@ else
175171
* to UNIX's search paths (start with system folders instead of current
176172
* folder).
177173
*/
178-
#ifndef RING_UWP
179174
hModule = LoadLibraryEx( (LPSTR) lpFileName, NULL,
180175
LOAD_WITH_ALTERED_SEARCH_PATH );
181-
#endif
182176
/* If the object was loaded with RTLD_GLOBAL, add it to list of global
183177
* objects, so that its symbols may be retrieved even if the handle for
184178
* the original program file is passed. POSIX says that if the same
@@ -192,9 +186,7 @@ else if( (mode & RTLD_GLOBAL) )
192186
global_add( hModule );
193187
}
194188
/* Return to previous state of the error-mode bit flags. */
195-
#ifndef RING_UWP
196189
SetErrorMode( uMode );
197-
#endif
198190
return (void *) hModule;
199191
}
200192
int dlclose( void *handle )
@@ -225,9 +217,7 @@ void *dlsym( void *handle, const char *name )
225217
/* If the handle for the original program file is passed, also search
226218
* in all globally loaded objects.
227219
*/
228-
#ifndef RING_UWP
229220
hModule = GetModuleHandle( NULL );
230-
#endif
231221
if( hModule == handle )
232222
{
233223
global_object *pobject;

src/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ set (Source_Files__media__audio__audio_processing ${Source_Files__media__audio__
9494
set (Source_Files__media__audio__webrtc ${Source_Files__media__audio__webrtc} PARENT_SCOPE)
9595
set (Source_Files__media__video ${Source_Files__media__video} PARENT_SCOPE)
9696
if(MSVC)
97-
if(WINDOWS_STORE)
98-
set (Source_Files__media__video__uwpvideo ${Source_Files__media__video__uwpvideo} PARENT_SCOPE)
99-
endif()
10097
set (Source_Files__media__audio__portaudio ${Source_Files__media__audio__portaudio} PARENT_SCOPE)
10198
set (Source_Files__media__video__winvideo ${Source_Files__media__video__winvideo} PARENT_SCOPE)
10299
endif()

src/client/ring_signal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ getSignalHandlers()
8585
#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
8686
exported_callback<libjami::ConfigurationSignal::GetHardwareAudioFormat>(),
8787
#endif
88-
#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS) || defined(RING_UWP)
88+
#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
8989
exported_callback<libjami::ConfigurationSignal::GetAppDataPath>(),
9090
exported_callback<libjami::ConfigurationSignal::GetDeviceName>(),
9191
#endif

src/client/videomanager.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ AudioFrame::mix(const AudioFrame& frame)
142142
{
143143
auto& f = *pointer();
144144
auto& fIn = *frame.pointer();
145-
if (f.ch_layout.nb_channels != fIn.ch_layout.nb_channels || f.format != fIn.format || f.sample_rate != fIn.sample_rate) {
145+
if (f.ch_layout.nb_channels != fIn.ch_layout.nb_channels || f.format != fIn.format
146+
|| f.sample_rate != fIn.sample_rate) {
146147
throw std::invalid_argument("Can't mix frames with different formats");
147148
}
148149
if (f.nb_samples == 0) {
@@ -185,7 +186,8 @@ AudioFrame::calcRMS() const
185186
double rms = 0.0;
186187
auto fmt = static_cast<AVSampleFormat>(frame_->format);
187188
bool planar = av_sample_fmt_is_planar(fmt);
188-
int perChannel = planar ? frame_->nb_samples : frame_->nb_samples * frame_->ch_layout.nb_channels;
189+
int perChannel = planar ? frame_->nb_samples
190+
: frame_->nb_samples * frame_->ch_layout.nb_channels;
189191
int channels = planar ? frame_->ch_layout.nb_channels : 1;
190192
if (fmt == AV_SAMPLE_FMT_S16 || fmt == AV_SAMPLE_FMT_S16P) {
191193
for (int c = 0; c < channels; ++c) {
@@ -649,7 +651,7 @@ setEncodingAccelerated(bool state)
649651
}
650652
}
651653

652-
#if defined(__ANDROID__) || defined(RING_UWP) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
654+
#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
653655
void
654656
addVideoDevice(const std::string& node,
655657
const std::vector<std::map<std::string, std::string>>& devInfo)

src/connectivity/ip_utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#include "ip_utils.h"
2222

23-
#if defined(__ANDROID__) || defined(RING_UWP) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
23+
#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
2424
#define JAMI_DEVICE_SIGNAL 1
2525
#endif
2626

src/fileutils.cpp

Lines changed: 14 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@
2424
#include "compiler_intrinsics.h"
2525
#include <opendht/crypto.h>
2626

27-
#ifdef RING_UWP
28-
#include <io.h> // for access and close
29-
#include "ring_signal.h"
30-
#endif
31-
3227
#ifdef __APPLE__
3328
#include <TargetConditionals.h>
3429
#endif
@@ -265,7 +260,10 @@ loadTextFile(const std::filesystem::path& path, const std::filesystem::path& def
265260
}
266261

267262
void
268-
saveFile(const std::filesystem::path& path, const uint8_t* data, size_t data_size, mode_t UNUSED mode)
263+
saveFile(const std::filesystem::path& path,
264+
const uint8_t* data,
265+
size_t data_size,
266+
mode_t UNUSED mode)
269267
{
270268
std::ofstream file(path, std::ios::trunc | std::ios::binary);
271269
if (!file.is_open()) {
@@ -276,8 +274,7 @@ saveFile(const std::filesystem::path& path, const uint8_t* data, size_t data_siz
276274
#ifndef _WIN32
277275
file.close();
278276
if (chmod(path.c_str(), mode) < 0)
279-
JAMI_WARNING("fileutils::saveFile(): chmod() failed on {}, {}",
280-
path, strerror(errno));
277+
JAMI_WARNING("fileutils::saveFile(): chmod() failed on {}, {}", path, strerror(errno));
281278
#endif
282279
}
283280

@@ -382,7 +379,7 @@ writeArchive(const std::string& archive_str, const std::string& path, const std:
382379
}
383380
}
384381

385-
#if defined(__ANDROID__) || defined(RING_UWP) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
382+
#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
386383
#else
387384
static char* program_dir = NULL;
388385
void
@@ -399,21 +396,7 @@ set_program_dir(char* program_path)
399396
std::filesystem::path
400397
get_cache_dir(const char* pkg)
401398
{
402-
#ifdef RING_UWP
403-
std::string cache_path;
404-
std::vector<std::string> paths;
405-
paths.reserve(1);
406-
emitSignal<libjami::ConfigurationSignal::GetAppDataPath>("", &paths);
407-
if (not paths.empty()) {
408-
cache_path = paths[0] + DIR_SEPARATOR_STR + std::string(".cache");
409-
if (fileutils::recursive_mkdir(cache_path.data(), 0700) != true) {
410-
// If directory creation failed
411-
if (errno != EEXIST)
412-
JAMI_DBG("Cannot create directory: %s!", cache_path.c_str());
413-
}
414-
}
415-
return cache_path;
416-
#elif defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
399+
#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
417400
std::vector<std::string> paths;
418401
paths.reserve(1);
419402
emitSignal<libjami::ConfigurationSignal::GetAppDataPath>("cache", &paths);
@@ -452,13 +435,6 @@ get_home_dir()
452435
if (not paths.empty())
453436
return paths[0];
454437
return {};
455-
#elif defined RING_UWP
456-
std::vector<std::string> paths;
457-
paths.reserve(1);
458-
emitSignal<libjami::ConfigurationSignal::GetAppDataPath>("", &paths);
459-
if (not paths.empty())
460-
return paths[0];
461-
return {};
462438
#elif defined _WIN32
463439
TCHAR path[MAX_PATH];
464440
if (SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_PROFILE, nullptr, 0, path))) {
@@ -507,20 +483,6 @@ get_data_dir(const char* pkg)
507483
} else {
508484
return get_home_dir() / "AppData" / "Local" / pkg;
509485
}
510-
#elif defined(RING_UWP)
511-
std::vector<std::string> paths;
512-
paths.reserve(1);
513-
emitSignal<libjami::ConfigurationSignal::GetAppDataPath>("", &paths);
514-
if (not paths.empty()) {
515-
auto files_path = std::filesystem::path(paths[0]) / ".data";
516-
if (fileutils::recursive_mkdir(files_path.data(), 0700) != true) {
517-
// If directory creation failed
518-
if (errno != EEXIST)
519-
JAMI_DBG("Cannot create directory: %s!", files_path.c_str());
520-
}
521-
return files_path;
522-
}
523-
return {};
524486
#else
525487
std::string_view data_home(XDG_DATA_HOME);
526488
if (not data_home.empty())
@@ -546,11 +508,6 @@ get_config_dir(const char* pkg)
546508
emitSignal<libjami::ConfigurationSignal::GetAppDataPath>("config", &paths);
547509
if (not paths.empty())
548510
configdir = std::filesystem::path(paths[0]);
549-
#elif defined(RING_UWP)
550-
std::vector<std::string> paths;
551-
emitSignal<libjami::ConfigurationSignal::GetAppDataPath>("", &paths);
552-
if (not paths.empty())
553-
configdir = std::filesystem::path(paths[0]) / ".config";
554511
#elif defined(__APPLE__)
555512
configdir = fileutils::get_home_dir() / "Library" / "Application Support" / pkg;
556513
#elif defined(_WIN32)
@@ -587,8 +544,9 @@ get_config_dir()
587544
bool
588545
eraseFile_win32(const std::string& path, bool dosync)
589546
{
590-
// Note: from https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-deletefilea#remarks
591-
// To delete a read-only file, first you must remove the read-only attribute.
547+
// Note: from
548+
// https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-deletefilea#remarks To
549+
// delete a read-only file, first you must remove the read-only attribute.
592550
SetFileAttributesA(path.c_str(), GetFileAttributesA(path.c_str()) & ~FILE_ATTRIBUTE_READONLY);
593551
HANDLE h
594552
= CreateFileA(path.c_str(), GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
@@ -656,7 +614,7 @@ eraseFile_posix(const std::string& path, bool dosync)
656614
return false;
657615
}
658616
// Remove read-only flag if possible
659-
chmod(path.c_str(), st.st_mode | (S_IWGRP+S_IWUSR) );
617+
chmod(path.c_str(), st.st_mode | (S_IWGRP + S_IWUSR));
660618

661619
int fd = open(path.c_str(), O_WRONLY);
662620
if (fd == -1) {
@@ -693,7 +651,7 @@ eraseFile_posix(const std::string& path, bool dosync)
693651

694652
bool
695653
eraseFile(const std::string& path, bool dosync)
696-
{
654+
{
697655
#ifdef _WIN32
698656
return eraseFile_win32(path, dosync);
699657
#else
@@ -788,8 +746,8 @@ uint64_t
788746
lastWriteTimeInSeconds(const std::filesystem::path& filePath)
789747
{
790748
return std::chrono::duration_cast<std::chrono::seconds>(
791-
std::filesystem::last_write_time(filePath)
792-
.time_since_epoch()).count();
749+
std::filesystem::last_write_time(filePath).time_since_epoch())
750+
.count();
793751
}
794752

795753
} // namespace fileutils

src/jami/configurationmanager_interface.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ LIBJAMI_PUBLIC std::map<std::string, std::string> getAccountTemplate(const std::
6565
LIBJAMI_PUBLIC std::string addAccount(const std::map<std::string, std::string>& details,
6666
const std::string& accountID = {});
6767
LIBJAMI_PUBLIC void monitor(bool continuous);
68-
LIBJAMI_PUBLIC std::vector<std::map<std::string, std::string>> getConnectionList(const std::string& accountId, const std::string& conversationId);
69-
LIBJAMI_PUBLIC std::vector<std::map<std::string, std::string>> getChannelList(const std::string& accountId, const std::string& connectionId);
68+
LIBJAMI_PUBLIC std::vector<std::map<std::string, std::string>> getConnectionList(
69+
const std::string& accountId, const std::string& conversationId);
70+
LIBJAMI_PUBLIC std::vector<std::map<std::string, std::string>> getChannelList(
71+
const std::string& accountId, const std::string& connectionId);
7072

7173
LIBJAMI_PUBLIC bool exportOnRing(const std::string& accountID, const std::string& password);
7274
LIBJAMI_PUBLIC bool exportToFile(const std::string& accountID,
@@ -537,7 +539,7 @@ struct LIBJAMI_PUBLIC ConfigurationSignal
537539
using cb_type = void(std::vector<int32_t>* /* params_ret */);
538540
};
539541
#endif
540-
#if defined(__ANDROID__) || defined(RING_UWP) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
542+
#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
541543
struct LIBJAMI_PUBLIC GetAppDataPath
542544
{
543545
constexpr static const char* name = "GetAppDataPath";

src/jami/videomanager_interface.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,15 @@ namespace libjami {
5757
[[deprecated("Replaced by registerSignalHandlers")]] LIBJAMI_PUBLIC void registerVideoHandlers(
5858
const std::map<std::string, std::shared_ptr<CallbackWrapperBase>>&);
5959

60-
struct LIBJAMI_PUBLIC AVFrame_deleter {
60+
struct LIBJAMI_PUBLIC AVFrame_deleter
61+
{
6162
void operator()(AVFrame* frame) const { av_frame_free(&frame); }
6263
};
6364

6465
typedef std::unique_ptr<AVFrame, AVFrame_deleter> FrameBuffer;
6566

66-
struct LIBJAMI_PUBLIC AVPacket_deleter {
67+
struct LIBJAMI_PUBLIC AVPacket_deleter
68+
{
6769
void operator()(AVPacket* pkt) const { av_packet_free(&pkt); }
6870
};
6971

@@ -184,7 +186,7 @@ LIBJAMI_PUBLIC std::vector<std::string> getDeviceList();
184186
LIBJAMI_PUBLIC VideoCapabilities getCapabilities(const std::string& deviceId);
185187
LIBJAMI_PUBLIC std::map<std::string, std::string> getSettings(const std::string& deviceId);
186188
LIBJAMI_PUBLIC void applySettings(const std::string& deviceId,
187-
const std::map<std::string, std::string>& settings);
189+
const std::map<std::string, std::string>& settings);
188190
LIBJAMI_PUBLIC void setDefaultDevice(const std::string& deviceId);
189191
LIBJAMI_PUBLIC void setDeviceOrientation(const std::string& deviceId, int angle);
190192
LIBJAMI_PUBLIC std::map<std::string, std::string> getDeviceParams(const std::string& deviceId);
@@ -209,10 +211,10 @@ LIBJAMI_PUBLIC void startShmSink(const std::string& sinkId, bool value);
209211
LIBJAMI_PUBLIC std::map<std::string, std::string> getRenderer(const std::string& callId);
210212

211213
LIBJAMI_PUBLIC std::string startLocalMediaRecorder(const std::string& videoInputId,
212-
const std::string& filepath);
214+
const std::string& filepath);
213215
LIBJAMI_PUBLIC void stopLocalRecorder(const std::string& filepath);
214216

215-
#if defined(__ANDROID__) || defined(RING_UWP) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
217+
#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
216218
LIBJAMI_PUBLIC void addVideoDevice(
217219
const std::string& node, const std::vector<std::map<std::string, std::string>>& devInfo = {});
218220
LIBJAMI_PUBLIC void removeVideoDevice(const std::string& node);

0 commit comments

Comments
 (0)