Commit 4f39d6a4 authored by Sandrine Avakian's avatar Sandrine Avakian

Merge branch 'master' of git.linphone.org:mediastreamer2 into dev_msfactory

parents 22778d62 f3651d2c
......@@ -888,69 +888,80 @@ AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${package_prefix}/share" ,[path of data])
AC_SUBST(PACKAGE_DATA_DIR)
dnl check for video4linux headers
AC_CHECK_HEADERS(linux/videodev.h linux/videodev2.h)
if test "${ac_cv_header_linux_videodev_h}" = "yes" ; then
found_v4l1=yes
else
found_v4l1=no
fi
if test "${ac_cv_header_linux_videodev2_h}" = "yes" ; then
found_v4l2=yes
else
found_v4l2=no
fi
AM_CONDITIONAL(BUILD_V4L1, test x$found_v4l1 = xyes )
AM_CONDITIONAL(BUILD_V4L2, test x$found_v4l2 = xyes )
AC_ARG_ENABLE(libv4l1,
[AS_HELP_STRING([--disable-libv4l1], [Disable usage of libv4l1, really discouraged])],
AC_ARG_ENABLE(v4l,
[AS_HELP_STRING([--disable-v4l], [Disable usage of video4linux, really discouraged (linux-only)])],
[case "${enableval}" in
yes) libv4l1=yes ;;
no) libv4l1=no ;;
yes) v4l=yes ;;
no) v4l=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --disable-libv4l1) ;;
esac],
[libv4l1=yes]
[v4l=yes]
)
AC_ARG_ENABLE(libv4l2,
[AS_HELP_STRING([--disable-libv4l2], [Disable usage of libv4l2, really discouraged])],
[case "${enableval}" in
yes) libv4l2=yes ;;
no) libv4l2=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --disable-libv4l2) ;;
esac],
[libv4l2=yes]
)
if test "$v4l" = "yes" ; then
AC_CHECK_HEADERS(linux/videodev.h linux/videodev2.h)
if test "${ac_cv_header_linux_videodev_h}" = "yes" ; then
found_v4l1=yes
else
found_v4l1=no
fi
if test "${ac_cv_header_linux_videodev2_h}" = "yes" ; then
found_v4l2=yes
else
found_v4l2=no
fi
PKG_CHECK_MODULES(LIBV4L2, libv4l2,
[AC_DEFINE(HAVE_LIBV4L2,1,[Defined if we have libv4l2])
have_libv4l2=yes],
[echo "No libv4l2 found."]
)
PKG_CHECK_MODULES(LIBV4L1, libv4l1,
[AC_DEFINE(HAVE_LIBV4L1,1,[Defined if we have libv4l1])
have_libv4l1=yes],
[echo "No libv4l1 found."]
)
PKG_CHECK_MODULES(LIBV4LCONVERT, libv4lconvert,
[AC_DEFINE(HAVE_LIBV4LCONVERT,1,[Defined if we have libv4lconvert])
have_libv4lconvert=yes],
[echo "No libv4lconvert found."]
)
AC_ARG_ENABLE(libv4l1,
[AS_HELP_STRING([--disable-libv4l1], [Disable usage of libv4l1, really discouraged])],
[case "${enableval}" in
yes) libv4l1=yes ;;
no) libv4l1=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --disable-libv4l1) ;;
esac],
[libv4l1=yes]
)
if test "$found_v4l2" = "yes" && test "$have_libv4l2" != "yes" ; then
if test "$video" = "true" && test "$libv4l2" = "yes" ; then
AC_MSG_ERROR([
Missing libv4l2. It is highly recommended to build with
libv4l2 headers and library. Many camera will won't work or will crash
your application if libv4l2 is not installed.
If you know what you are doing, you can use --disable-libv4l2 to disable
this check.
])
AC_ARG_ENABLE(libv4l2,
[AS_HELP_STRING([--disable-libv4l2], [Disable usage of libv4l2, really discouraged])],
[case "${enableval}" in
yes) libv4l2=yes ;;
no) libv4l2=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --disable-libv4l2) ;;
esac],
[libv4l2=yes]
)
PKG_CHECK_MODULES(LIBV4L2, libv4l2,
[AC_DEFINE(HAVE_LIBV4L2,1,[Defined if we have libv4l2])
have_libv4l2=yes],
[echo "No libv4l2 found."]
)
PKG_CHECK_MODULES(LIBV4L1, libv4l1,
[AC_DEFINE(HAVE_LIBV4L1,1,[Defined if we have libv4l1])
have_libv4l1=yes],
[echo "No libv4l1 found."]
)
PKG_CHECK_MODULES(LIBV4LCONVERT, libv4lconvert,
[AC_DEFINE(HAVE_LIBV4LCONVERT,1,[Defined if we have libv4lconvert])
have_libv4lconvert=yes],
[echo "No libv4lconvert found."]
)
if test "$found_v4l2" = "yes" && test "$have_libv4l2" != "yes" ; then
if test "$video" = "true" && test "$libv4l2" = "yes" ; then
AC_MSG_ERROR([
Missing libv4l2. It is highly recommended to build with
libv4l2 headers and library. Many camera will won't work or will crash
your application if libv4l2 is not installed.
If you know what you are doing, you can use --disable-libv4l2 to disable
this check.
])
fi
fi
fi
AM_CONDITIONAL(BUILD_V4L1, test x$found_v4l1 = xyes )
AM_CONDITIONAL(BUILD_V4L2, test x$found_v4l2 = xyes )
AC_PATH_PROG(PCAP,pcap-config,false)
AM_CONDITIONAL(HAVE_PCAP, test $PCAP != false)
......
......@@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "ortp/rtp.h"
#include <stdint.h>
#if defined(ANDROID) || defined(MS2_WINDOWS_PHONE) || defined(MS2_WINDOWS_UNIVERSAL)
#if defined(ANDROID) || defined(MS2_WINDOWS_PHONE)
#include <opus.h>
#else
#include <opus/opus.h>
......
......@@ -34,7 +34,7 @@
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#if defined(ANDROID) || defined(MS2_WINDOWS_PHONE) || defined(MS2_WINDOWS_UNIVERSAL)
#if defined(ANDROID) || defined(MS2_WINDOWS_PHONE)
// Android and Windows phone don't use make install
#include <srtp.h>
//#include <srtp_priv.h>
......
......@@ -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