Commit 04513bf8 authored by Ghislain MARY's avatar Ghislain MARY

Use correct namespaces and winmd name when building for Windows 10.

parent 1b124839
......@@ -66,6 +66,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
target_include_directories(mediastreamer2_tester_runtime PRIVATE "../../../mswinrtvid") # HACK!!
target_link_libraries(mediastreamer2_tester_runtime mediastreamer2_tester_static)
set_target_properties(mediastreamer2_tester_runtime PROPERTIES VS_WINRT_COMPONENT TRUE)
set_target_properties(mediastreamer2_tester_runtime PROPERTIES LIBRARY_OUTPUT_NAME "BelledonneCommunications.Mediastreamer2.Tester")
set_target_properties(mediastreamer2_tester_runtime PROPERTIES LINK_FLAGS "/WINMDFILE:BelledonneCommunications.Mediastreamer2.Tester.winmd")
install(TARGETS mediastreamer2_tester_runtime
RUNTIME DESTINATION bin
......@@ -73,7 +75,13 @@ if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
ARCHIVE DESTINATION lib
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/mediastreamer2_tester_runtime.winmd" DESTINATION bin)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/BelledonneCommunications.Mediastreamer2.Tester.winmd" DESTINATION lib)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/BelledonneCommunications.Mediastreamer2.Tester.pdb
DESTINATION lib
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()
else()
......
......@@ -4,7 +4,7 @@
#include "mediastreamer2_tester_windows.h"
#include "mswinrtvid.h"
using namespace mediastreamer2_tester_runtime;
using namespace BelledonneCommunications::Mediastreamer2::Tester;
using namespace Platform;
using namespace Platform::Collections;
using namespace Windows::Foundation;
......@@ -20,7 +20,7 @@ using namespace Windows::UI::ViewManagement;
static OutputTraceListener^ sTraceListener;
MS2Tester^ MS2Tester::_instance = ref new MS2Tester();
NativeTester^ NativeTester::_instance = ref new NativeTester();
static void nativeOutputTraceHandler(int lev, const char *fmt, va_list args)
{
......@@ -53,35 +53,35 @@ static void nativeOutputTraceHandler(int lev, const char *fmt, va_list args)
OutputDebugStringW(L"\n");
}
static void ms2NativeOutputTraceHandler(OrtpLogLevel lev, const char *fmt, va_list args)
static void ms2NativeOutputTraceHandler(const char *domain, OrtpLogLevel lev, const char *fmt, va_list args)
{
nativeOutputTraceHandler((int)lev, fmt, args);
}
MS2Tester::MS2Tester()
NativeTester::NativeTester()
: _deviceRotation(0)
{
}
MS2Tester::~MS2Tester()
NativeTester::~NativeTester()
{
mediastreamer2_tester_uninit();
}
void MS2Tester::setOutputTraceListener(OutputTraceListener^ traceListener)
void NativeTester::setOutputTraceListener(OutputTraceListener^ traceListener)
{
sTraceListener = traceListener;
}
void MS2Tester::initialize(StorageFolder^ writableDirectory, Platform::Boolean ui)
void NativeTester::initialize(StorageFolder^ writableDirectory, Platform::Boolean ui)
{
if (ui) {
mediastreamer2_tester_init(nativeOutputTraceHandler);
}
else {
mediastreamer2_tester_init(NULL);
ortp_set_log_level_mask((OrtpLogLevel)(ORTP_MESSAGE | ORTP_WARNING | ORTP_ERROR | ORTP_FATAL));
ortp_set_log_level_mask(NULL, (OrtpLogLevel)(ORTP_MESSAGE | ORTP_WARNING | ORTP_ERROR | ORTP_FATAL));
}
char writable_dir[MAX_WRITABLE_DIR_SIZE] = { 0 };
......@@ -101,7 +101,7 @@ void MS2Tester::initialize(StorageFolder^ writableDirectory, Platform::Boolean u
}
}
bool MS2Tester::run(Platform::String^ suiteName, Platform::String^ caseName, Platform::Boolean verbose)
bool NativeTester::run(Platform::String^ suiteName, Platform::String^ caseName, Platform::Boolean verbose)
{
std::wstring all(L"ALL");
std::wstring wssuitename = suiteName->Data();
......@@ -112,16 +112,16 @@ bool MS2Tester::run(Platform::String^ suiteName, Platform::String^ caseName, Pla
wcstombs(ccasename, wscasename.c_str(), sizeof(ccasename));
if (verbose) {
ortp_set_log_level_mask(ORTP_MESSAGE | ORTP_WARNING | ORTP_ERROR | ORTP_FATAL);
ortp_set_log_level_mask(NULL, ORTP_MESSAGE | ORTP_WARNING | ORTP_ERROR | ORTP_FATAL);
}
else {
ortp_set_log_level_mask(ORTP_ERROR | ORTP_FATAL);
ortp_set_log_level_mask(NULL, ORTP_ERROR | ORTP_FATAL);
}
ortp_set_log_handler(ms2NativeOutputTraceHandler);
return bc_tester_run_tests(wssuitename == all ? 0 : csuitename, wscasename == all ? 0 : ccasename) != 0;
}
void MS2Tester::runAllToXml()
void NativeTester::runAllToXml()
{
auto workItem = ref new WorkItemHandler([this](IAsyncAction ^workItem) {
bc_tester_start(NULL);
......@@ -130,12 +130,12 @@ void MS2Tester::runAllToXml()
_asyncAction = ThreadPool::RunAsync(workItem);
}
unsigned int MS2Tester::nbTestSuites()
unsigned int NativeTester::nbTestSuites()
{
return bc_tester_nb_suites();
}
unsigned int MS2Tester::nbTests(Platform::String^ suiteName)
unsigned int NativeTester::nbTests(Platform::String^ suiteName)
{
std::wstring suitename = suiteName->Data();
char cname[MAX_SUITE_NAME_SIZE] = { 0 };
......@@ -143,7 +143,7 @@ unsigned int MS2Tester::nbTests(Platform::String^ suiteName)
return bc_tester_nb_tests(cname);
}
Platform::String^ MS2Tester::testSuiteName(int index)
Platform::String^ NativeTester::testSuiteName(int index)
{
const char *cname = bc_tester_suite_name(index);
wchar_t wcname[MAX_SUITE_NAME_SIZE];
......@@ -151,7 +151,7 @@ Platform::String^ MS2Tester::testSuiteName(int index)
return ref new String(wcname);
}
Platform::String^ MS2Tester::testName(Platform::String^ suiteName, int testIndex)
Platform::String^ NativeTester::testName(Platform::String^ suiteName, int testIndex)
{
std::wstring suitename = suiteName->Data();
char csuitename[MAX_SUITE_NAME_SIZE] = { 0 };
......@@ -162,7 +162,7 @@ Platform::String^ MS2Tester::testName(Platform::String^ suiteName, int testIndex
return ref new String(wcname);
}
Windows::Foundation::Collections::IVector<Platform::String^>^ MS2Tester::VideoDevices::get()
Windows::Foundation::Collections::IVector<Platform::String^>^ NativeTester::VideoDevices::get()
{
wchar_t wcname[MAX_DEVICE_NAME_SIZE];
Vector<Platform::String^>^ devices = ref new Vector<Platform::String^>();
......@@ -176,14 +176,16 @@ Windows::Foundation::Collections::IVector<Platform::String^>^ MS2Tester::VideoDe
return devices;
}
void MS2Tester::initVideo()
void NativeTester::initVideo()
{
ortp_init();
ms_base_init();
ortp_set_log_level_mask(ORTP_MESSAGE | ORTP_WARNING | ORTP_ERROR | ORTP_FATAL);
ortp_set_log_level_mask(NULL, ORTP_MESSAGE | ORTP_WARNING | ORTP_ERROR | ORTP_FATAL);
ortp_set_log_handler(ms2NativeOutputTraceHandler);
ms_voip_init();
ms_plugins_init();
rtp_profile_set_payload(&av_profile, 100, &payload_type_h263);
rtp_profile_set_payload(&av_profile, 101, &payload_type_mp4v);
rtp_profile_set_payload(&av_profile, 102, &payload_type_h264);
rtp_profile_set_payload(&av_profile, 103, &payload_type_vp8);
Platform::String^ appFolder = Windows::ApplicationModel::Package::Current->InstalledLocation->Path;
......@@ -194,7 +196,7 @@ void MS2Tester::initVideo()
ms_static_image_set_default_image(cPath);
}
void MS2Tester::uninitVideo()
void NativeTester::uninitVideo()
{
ms_exit();
}
......@@ -205,20 +207,23 @@ void MS2Tester::uninitVideo()
wcstombs(cst, wst.c_str(), sizeof(cst))
void MS2Tester::startVideoStream(Platform::Object^ CaptureElement, Platform::Object^ MediaElement, Platform::String^ camera, Platform::String^ codec, Platform::String^ videoSize, unsigned int frameRate, unsigned int bitRate)
void NativeTester::startVideoStream(Platform::Object^ CaptureElement, Platform::Object^ MediaElement, Platform::String^ camera, Platform::String^ codec, Platform::String^ videoSize, unsigned int frameRate, unsigned int bitRate)
{
ms_filter_enable_statistics(TRUE);
ms_filter_reset_statistics();
MSVideoSize vsize = { MS_VIDEO_SIZE_CIF_W, MS_VIDEO_SIZE_CIF_H };
int payload = 102;
int payload = 103;
char cst[1024];
std::wstring wst;
MSWebCamManager *manager = ms_web_cam_manager_get();
PLATFORM_STRING_TO_C_STRING(camera);
MSWebCam *cam = ms_web_cam_manager_get_cam(manager, cst);
PLATFORM_STRING_TO_C_STRING(codec);
if (strcmp(cst, "VP8") == 0) payload = 103;
if (strcmp(cst, "H263") == 0) payload = 100;
else if (strcmp(cst, "H264") == 0) payload = 102;
else if (strcmp(cst, "MPEG4") == 0) payload = 101;
else if (strcmp(cst, "VP8") == 0) payload = 103;
PLATFORM_STRING_TO_C_STRING(videoSize);
if (strcmp(cst, "720P") == 0) {
vsize.width = MS_VIDEO_SIZE_720P_W;
......@@ -251,14 +256,14 @@ void MS2Tester::startVideoStream(Platform::Object^ CaptureElement, Platform::Obj
video_stream_start(_videoStream, &av_profile, "127.0.0.1", 20000, NULL, 0, payload, 0, cam);
}
void MS2Tester::stopVideoStream()
void NativeTester::stopVideoStream()
{
ms_filter_log_statistics();
video_stream_stop(_videoStream);
_videoStream = NULL;
}
void MS2Tester::changeCamera(Platform::String^ camera)
void NativeTester::changeCamera(Platform::String^ camera)
{
char cst[1024];
std::wstring wst;
......@@ -268,7 +273,7 @@ void MS2Tester::changeCamera(Platform::String^ camera)
video_stream_change_camera(_videoStream, cam);
}
void MS2Tester::setOrientation(int degrees)
void NativeTester::setOrientation(int degrees)
{
_deviceRotation = degrees;
if (_videoStream != NULL) {
......
......@@ -3,52 +3,58 @@
#include "mediastreamer2/mscommon.h"
#include "mediastreamer2_tester.h"
namespace mediastreamer2_tester_runtime
namespace BelledonneCommunications
{
public interface class OutputTraceListener
namespace Mediastreamer2
{
public:
void outputTrace(Platform::String^ lev, Platform::String^ msg);
};
namespace Tester
{
public interface class OutputTraceListener
{
public:
void outputTrace(Platform::String^ lev, Platform::String^ msg);
};
public ref class MS2Tester sealed
{
public:
void setOutputTraceListener(OutputTraceListener^ traceListener);
unsigned int nbTestSuites();
unsigned int nbTests(Platform::String^ suiteName);
Platform::String^ testSuiteName(int index);
Platform::String^ testName(Platform::String^ suiteName, int testIndex);
void initialize(Windows::Storage::StorageFolder^ writableDirectory, Platform::Boolean ui);
bool run(Platform::String^ suiteName, Platform::String^ caseName, Platform::Boolean verbose);
void runAllToXml();
void initVideo();
void uninitVideo();
void startVideoStream(Platform::Object^ CaptureElement, Platform::Object^ MediaElement, Platform::String^ camera, Platform::String^ codec, Platform::String^ videoSize, unsigned int frameRate, unsigned int bitRate);
void stopVideoStream();
int getOrientation() { return _deviceRotation; }
void setOrientation(int degrees);
void changeCamera(Platform::String^ camera);
public ref class NativeTester sealed
{
public:
void setOutputTraceListener(OutputTraceListener^ traceListener);
unsigned int nbTestSuites();
unsigned int nbTests(Platform::String^ suiteName);
Platform::String^ testSuiteName(int index);
Platform::String^ testName(Platform::String^ suiteName, int testIndex);
void initialize(Windows::Storage::StorageFolder^ writableDirectory, Platform::Boolean ui);
bool run(Platform::String^ suiteName, Platform::String^ caseName, Platform::Boolean verbose);
void runAllToXml();
void initVideo();
void uninitVideo();
void startVideoStream(Platform::Object^ CaptureElement, Platform::Object^ MediaElement, Platform::String^ camera, Platform::String^ codec, Platform::String^ videoSize, unsigned int frameRate, unsigned int bitRate);
void stopVideoStream();
int getOrientation() { return _deviceRotation; }
void setOrientation(int degrees);
void changeCamera(Platform::String^ camera);
static property MS2Tester^ Instance
{
MS2Tester^ get() { return _instance; }
}
property Windows::Foundation::IAsyncAction^ AsyncAction
{
Windows::Foundation::IAsyncAction^ get() { return _asyncAction; }
}
property Windows::Foundation::Collections::IVector<Platform::String^>^ VideoDevices
{
Windows::Foundation::Collections::IVector<Platform::String^>^ get();
}
private:
MS2Tester();
~MS2Tester();
static property NativeTester^ Instance
{
NativeTester^ get() { return _instance; }
}
property Windows::Foundation::IAsyncAction^ AsyncAction
{
Windows::Foundation::IAsyncAction^ get() { return _asyncAction; }
}
property Windows::Foundation::Collections::IVector<Platform::String^>^ VideoDevices
{
Windows::Foundation::Collections::IVector<Platform::String^>^ get();
}
private:
NativeTester();
~NativeTester();
static MS2Tester^ _instance;
Windows::Foundation::IAsyncAction^ _asyncAction;
VideoStream *_videoStream;
int _deviceRotation;
};
static NativeTester^ _instance;
Windows::Foundation::IAsyncAction^ _asyncAction;
VideoStream *_videoStream;
int _deviceRotation;
};
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment