Commit c87ef2c8 authored by Matthieu Tanon's avatar Matthieu Tanon

Merge branch 'master' into dev_lime_v2

parents f902c582 efa6794e
......@@ -52,3 +52,4 @@ git-clang-format.diff
tools/mkvstream
.bc_tester_utils.tmp
**/.gradle
tester/sounds/mixed_file.wav
......@@ -23,6 +23,10 @@
cmake_minimum_required(VERSION 3.0)
project(mediastreamer2 VERSION 2.16.1 LANGUAGES C CXX)
# See: https://cmake.org/cmake/help/v3.12/policy/CMP0072.html
if(POLICY CMP0072)
cmake_policy(SET CMP0072 NEW)
endif()
set(MEDIASTREAMER_MAJOR_VERSION ${PROJECT_VERSION_MAJOR})
set(MEDIASTREAMER_MINOR_VERSION ${PROJECT_VERSION_MINOR})
......@@ -51,7 +55,7 @@ if(UNIX)
set(ENABLE_X11_DEFAULT_VALUE YES)
endif()
endif()
if(UNIX AND NOT APPLE)
if(UNIX AND NOT APPLE AND NOT ANDROID)
set(LINUX_OR_BSD 1)
endif()
......@@ -106,7 +110,6 @@ cmake_dependent_option(ENABLE_THEORA "Enable theora video codec support." YES "E
cmake_dependent_option(ENABLE_VPX "Build mediastreamer2 with VPX codec." YES "ENABLE_VIDEO" NO)
option(ENABLE_MKV "Enable support of MKV files reading and writing." YES)
cmake_dependent_option(ENABLE_QNX "Build medistreamer2 with BB10 filters." NO "ENABLE_VIDEO" NO)
cmake_dependent_option(ENABLE_VT_H264 "Build mediastreamer2 with H264 encoder/decoder based on VirtualToolbox (Apple only)" YES "ENABLE_VIDEO" NO)
option(ENABLE_JPEG "Enable JPEG support" YES)
option(ENABLE_QRCODE "Enable QRCode support" YES)
......@@ -538,10 +541,7 @@ if(APPLE)
if(IOS) # Necessary for Mediastreamer's tools and testers
list(APPEND LINK_FLAGS "-framework Foundation" "-framework QuartzCore" "-framework OpenGLES" "-framework UIKit" "-framework AVFoundation")
if(ENABLE_VIDEO)
list(APPEND LINK_FLAGS "-framework CoreGraphics" "-framework CoreMedia" "-framework CoreVideo")
if(ENABLE_VT_H264) # Necessary on iOS for Mediastreamer's tools and testers
list(APPEND LINK_FLAGS "-framework VideoToolbox")
endif()
list(APPEND LINK_FLAGS "-framework CoreGraphics" "-framework CoreMedia" "-framework CoreVideo" "-framework VideoToolbox")
endif()
else()
list(APPEND LINK_FLAGS "-framework AppKit")
......@@ -549,10 +549,7 @@ if(APPLE)
list(APPEND LINK_FLAGS "-framework Carbon" "-framework AudioUnit")
endif()
if(ENABLE_VIDEO)
list(APPEND LINK_FLAGS "-framework Cocoa" "-framework OpenGL" "-framework QuartzCore" "-framework AVFoundation")
if(ENABLE_VT_H264)
list(APPEND LINK_FLAGS "-framework VideoToolbox -framework CoreMedia")
endif()
list(APPEND LINK_FLAGS "-framework Cocoa" "-framework OpenGL" "-framework QuartzCore" "-framework AVFoundation" "-framework VideoToolbox" "-framework CoreMedia")
endif()
add_definitions("-DTARGET_OS_MAC=1")
endif()
......@@ -589,7 +586,12 @@ else()
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
list(APPEND STRICT_OPTIONS_CPP "-Qunused-arguments" "-Wno-unused-function" "-Wno-array-bounds")
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
list(APPEND STRICT_OPTIONS_CPP "-Wno-format-truncation")
if(${CMAKE_C_COMPILER_VERSION} VERSION_GREATER "7")
list(APPEND STRICT_OPTIONS_CPP "-Wno-format-truncation")
endif()
if(${CMAKE_C_COMPILER_VERSION} VERSION_GREATER "8")
list(APPEND STRICT_OPTIONS_CPP "-Wno-error=stringop-truncation")
endif()
endif()
if(APPLE)
list(APPEND STRICT_OPTIONS_CPP "-Wno-error=unknown-warning-option" "-Qunused-arguments" "-Wno-tautological-compare" "-Wno-unused-function" "-Wno-array-bounds")
......
mediastreamer2 (Unreleased):
* H265 codec based on MediaCodec API (Android only)
* H265 codec based on VideoToolbox API (iOS only)
mediastreamer2-2.16.1: July 21th, 2017
* Build fix for Windows
......
......@@ -28,7 +28,7 @@ extern MSFilterDesc ms_h263_enc_desc;
extern MSFilterDesc ms_h263_dec_desc;
extern MSFilterDesc ms_h263_old_dec_desc;
extern MSFilterDesc ms_h264_dec_desc;
extern MSFilterDesc ms_mediacodec_h264_dec_desc;
extern MSFilterDesc ms_mediacodec_h265_dec_desc;
extern MSFilterDesc ms_mediacodec_h264_enc_desc;
extern MSFilterDesc ms_pix_conv_desc;
extern MSFilterDesc ms_size_conv_desc;
......@@ -86,7 +86,7 @@ MSFilterDesc * ms_voip_filter_descs[]={
&ms_h263_dec_desc,
&ms_h263_old_dec_desc,
&ms_h264_dec_desc,
&ms_mediacodec_h264_dec_desc,
&ms_mediacodec_h265_dec_desc,
&ms_mediacodec_h264_enc_desc,
&ms_pix_conv_desc,
&ms_size_conv_desc,
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>mediastreamer_base</string>
<key>CFBundleGetInfoString</key>
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
<key>CFBundleIconFile</key>
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
<key>CFBundleIdentifier</key>
<string>${MACOSX_FRAMEWORK_IDENTIFIER}</string>
<key>LSMinimumSystemVersion</key>
<string>${MIN_OS}</string>
<key>MinimumOSVersion</key>
<string>${MIN_OS}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
<key>CFBundleName</key>
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>${MEDIASTREAMER_VERSION}</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${MEDIASTREAMER_VERSION}</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<string>True</string>
</dict>
</plist>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>mediastreamer_voip</string>
<key>CFBundleGetInfoString</key>
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
<key>CFBundleIconFile</key>
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
<key>CFBundleIdentifier</key>
<string>${MACOSX_FRAMEWORK_IDENTIFIER}</string>
<key>LSMinimumSystemVersion</key>
<string>${MIN_OS}</string>
<key>MinimumOSVersion</key>
<string>${MIN_OS}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
<key>CFBundleName</key>
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>${MEDIASTREAMER_VERSION}</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${MEDIASTREAMER_VERSION}</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<string>True</string>
</dict>
</plist>
\ No newline at end of file
......@@ -34,26 +34,16 @@ if(NOT LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
endif()
if(@ENABLE_SHARED@)
set(MEDIASTREAMER2_TARGETNAME mediastreamer_voip)
set(MEDIASTREAMER2_LIBRARIES ${MEDIASTREAMER2_TARGETNAME} mediastreamer_base)
set(MEDIASTREAMER2_TARGETNAME mediastreamer)
set(MEDIASTREAMER2_LIBRARIES ${MEDIASTREAMER2_TARGETNAME})
else()
set(MEDIASTREAMER2_TARGETNAME mediastreamer_voip-static)
set(MEDIASTREAMER2_TARGETNAME mediastreamer-static)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
set(MEDIASTREAMER2_LIBRARIES ${MEDIASTREAMER2_TARGETNAME})
else()
get_target_property(MEDIASTREAMER2_LIBRARIES ${MEDIASTREAMER2_TARGETNAME} LOCATION)
endif()
get_target_property(MEDIASTREAMER2_LINK_LIBRARIES ${MEDIASTREAMER2_TARGETNAME} INTERFACE_LINK_LIBRARIES)
if(MEDIASTREAMER2_LINK_LIBRARIES)
list(APPEND MEDIASTREAMER2_LIBRARIES ${MEDIASTREAMER2_LINK_LIBRARIES})
list(REMOVE_ITEM MEDIASTREAMER2_LIBRARIES mediastreamer_base-static)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
set(MEDIASTREAMER2_BASE_LIBRARIES mediastreamer_base-static)
else()
get_target_property(MEDIASTREAMER2_BASE_LIBRARIES mediastreamer_base-static LOCATION)
endif()
list(APPEND MEDIASTREAMER2_LIBRARIES ${MEDIASTREAMER2_BASE_LIBRARIES})
endif()
get_target_property(MEDIASTREAMER2_LIBRARIES ${MEDIASTREAMER2_TARGETNAME} INTERFACE_LINK_LIBRARIES)
endif()
get_target_property(MEDIASTREAMER2_INCLUDE_DIRS ${MEDIASTREAMER2_TARGETNAME} INTERFACE_INCLUDE_DIRECTORIES)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
......
......@@ -165,7 +165,14 @@ typedef enum MSFilterId{
MS_G729_ENC_ID,
MS_WASAPI_READ_ID,
MS_WASAPI_WRITE_ID,
MS_AUDIO_FLOW_CONTROL_ID
MS_AUDIO_FLOW_CONTROL_ID,
MS_MEDIACODEC_H265_DEC_ID,
MS_MEDIACODEC_H265_ENC_ID,
MS_VT_H265_DEC_ID,
MS_VT_H265_ENC_ID,
MS_ANDROID_DISPLAY_BAD_ID,
MS_ANDROID_OPENGL_DISPLAY_ID,
MS_ANDROID_TEXTURE_DISPLAY_ID
} MSFilterId;
#endif
......@@ -20,6 +20,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef msformats_h
#define msformats_h
#include "mediastreamer2/mscommon.h"
#ifdef __cplusplus
extern "C"{
#endif
......
......@@ -342,7 +342,7 @@ MS2_PUBLIC bool_t ms_media_resource_is_consistent(const MSMediaResource *r);
#define ms_media_resource_get_file(r) (((r)->type == MSResourceFile) ? (r)->file : NULL)
#define ms_media_resource_get_rtp_session(r) (((r)->type == MSResourceRtp) ? (r)->session : NULL)
#define ms_media_resource_get_camera(r) (((r)->type == MSResourceCamera) ? (r)->camera : NULL)
#define ms_media_resource_get_soundcard(r) (((r)->type == MSResourceSoundcard) ? (r)->souncard : NULL)
#define ms_media_resource_get_soundcard(r) (((r)->type == MSResourceSoundcard) ? (r)->soundcard : NULL)
/**
* Structure describing the input/output of a MediaStream.
* Input and output are described as MSMediaResource.
......@@ -410,7 +410,7 @@ struct _AudioStream
bool_t use_ec;
bool_t use_gc;
bool_t use_agc;
bool_t mic_eq_active;
bool_t spk_eq_active;
bool_t use_ng;/*noise gate*/
......@@ -491,7 +491,7 @@ MS2_PUBLIC void audio_stream_play_received_dtmfs(AudioStream *st, bool_t yesno);
* @param loc_rtp_port the local UDP port to listen for RTP packets.
* @param loc_rtcp_port the local UDP port to listen for RTCP packets
* @param ipv6 TRUE if ipv6 must be used.
* @param factory
* @param factory
* @return a new AudioStream.
**/
MS2_PUBLIC AudioStream *audio_stream_new(MSFactory* factory, int loc_rtp_port, int loc_rtcp_port, bool_t ipv6);
......@@ -620,7 +620,7 @@ static MS2_INLINE void audio_stream_enable_adaptive_jittcomp(AudioStream *stream
* of the sound card nor the system mixer one. If you intends
* to control the volume gain at sound card level, you should
* use audio_stream_set_sound_card_input_gain() instead.
*
*
* @param stream The stream.
* @param gain_db Gain to apply in dB.
*/
......@@ -630,9 +630,9 @@ MS2_PUBLIC void audio_stream_set_mic_gain_db(AudioStream *stream, float gain_db)
/**
* Like audio_stream_set_mic_gain_db() excepted that the gain is specified
* in percentage.
*
*
* @param stream The stream.
* @param gain Gain to apply in percetage of the max supported gain.
* @param gain Gain to apply in percentage of the max supported gain.
*/
MS2_PUBLIC void audio_stream_set_mic_gain(AudioStream *stream, float gain);
......@@ -648,12 +648,21 @@ MS2_PUBLIC void audio_stream_mute_rtp(AudioStream *stream, bool_t val);
*/
MS2_PUBLIC void audio_stream_set_spk_gain_db(AudioStream *stream, float gain_db);
/**
* Like audio_stream_set_spk_gain_db() excepted that the gain is specified
* in percentage.
*
* @param stream The stream.
* @param gain Gain to apply in percentage of the max supported gain.
*/
MS2_PUBLIC void audio_stream_set_spk_gain(AudioStream *stream, float gain);
/**
* Set microphone volume gain.
* If the sound backend supports it, the set volume gain will be synchronized
* with the host system mixer. If you intended to apply a static software gain,
* you should use audio_stream_set_mic_gain_db() or audio_stream_set_mic_gain().
*
*
* @param stream The audio stream.
* @param gain Percentage of the max supported volume gain. Valid values are in [0.0 : 1.0].
*/
......@@ -836,6 +845,7 @@ struct _VideoStream
MSWebCam *cam;
RtpSession *rtp_io_session; /**< The RTP session used for RTP input/output. */
char *preset;
MSVideoConfiguration *vconf_list;
int device_orientation; /* warning: meaning of this variable depends on the platform (Android, iOS, ...) */
uint64_t last_reported_decoding_error_time;
uint64_t last_fps_check;
......@@ -845,7 +855,7 @@ struct _VideoStream
bool_t freeze_on_error;
bool_t display_filter_auto_rotate_enabled;
bool_t source_performs_encoding;
bool_t output_performs_decoding;
bool_t player_active;
bool_t staticimage_webcam_fps_optimization; /* if TRUE, the StaticImage webcam will ignore the fps target in order to save CPU time. Default is TRUE */
......@@ -854,7 +864,7 @@ struct _VideoStream
typedef struct _VideoStream VideoStream;
MS2_PUBLIC VideoStream *video_stream_new(MSFactory* factory, int loc_rtp_port, int loc_rtcp_port, bool_t use_ipv6);
/**
* Creates a VideoStream object listening on a RTP port for a dedicated address.
......@@ -878,7 +888,7 @@ MS2_PUBLIC void video_stream_set_event_callback(VideoStream *s, VideoStreamEvent
MS2_PUBLIC void video_stream_set_display_filter_name(VideoStream *s, const char *fname);
MS2_PUBLIC int video_stream_start_with_source(VideoStream *stream, RtpProfile *profile, const char *rem_rtp_ip, int rem_rtp_port,
const char *rem_rtcp_ip, int rem_rtcp_port, int payload, int jitt_comp, MSWebCam* cam, MSFilter* source);
MS2_PUBLIC int video_stream_start(VideoStream * stream, RtpProfile *profile, const char *rem_rtp_ip, int rem_rtp_port, const char *rem_rtcp_ip,
MS2_PUBLIC int video_stream_start(VideoStream * stream, RtpProfile *profile, const char *rem_rtp_ip, int rem_rtp_port, const char *rem_rtcp_ip,
int rem_rtcp_port, int payload, int jitt_comp, MSWebCam *device);
MS2_PUBLIC int video_stream_start_with_files(VideoStream *stream, RtpProfile *profile, const char *rem_rtp_ip, int rem_rtp_port,
const char *rem_rtcp_ip, int rem_rtcp_port, int payload_type, const char *play_file, const char *record_file);
......@@ -1250,7 +1260,7 @@ typedef struct _TextStream TextStream;
* @param loc_rtp_port the local UDP port to listen for RTP packets.
* @param loc_rtcp_port the local UDP port to listen for RTCP packets
* @param ipv6 TRUE if ipv6 must be used.
* @param factory
* @param factory
* @return a new TextStream.
**/
MS2_PUBLIC TextStream *text_stream_new(MSFactory *factory, int loc_rtp_port, int loc_rtcp_port, bool_t ipv6);
......@@ -1268,7 +1278,7 @@ MS2_PUBLIC TextStream *text_stream_new_with_sessions(MSFactory *factory, const M
* @param loc_ip the local ip to listen for RTP packets. Can be ::, O.O.O.O or any ip4/6 addresses
* @param [in] loc_rtp_port the local UDP port to listen for RTP packets.
* @param [in] loc_rtcp_port the local UDP port to listen for RTCP packets
* @param factory
* @param factory
* @return a new TextStream.
**/
MS2_PUBLIC TextStream *text_stream_new2(MSFactory *factory, const char* ip, int loc_rtp_port, int loc_rtcp_port);
......@@ -1296,14 +1306,14 @@ MS2_PUBLIC void text_stream_stop (TextStream * stream);
/**
* Executes background low priority tasks related to text processing (RTP statistics analysis).
* It should be called periodically, for example with an interval of 100 ms or so.
*
*
* @param[in] stream TextStream object previously created with text_stream_new().
*/
MS2_PUBLIC void text_stream_iterate(TextStream *stream);
/**
* Writes a character to stream in UTF-32 format.
*
*
* @param[in] stream TextStream object previously created with text_stream_new().
* @param[in] i the Char in UTF-32 format.
**/
......
......@@ -314,13 +314,13 @@ MS2_PUBLIC struct _MSEventQueue * ms_factory_get_event_queue(MSFactory *obj);
MS2_PUBLIC void ms_factory_set_event_queue(MSFactory *obj,struct _MSEventQueue *q);
MS2_PUBLIC int ms_factory_get_payload_max_size(MSFactory *factory);
MS2_PUBLIC int ms_factory_get_payload_max_size(const MSFactory *factory);
MS2_PUBLIC void ms_factory_set_payload_max_size(MSFactory *obj, int size);
MS2_PUBLIC void ms_factory_set_mtu(MSFactory *obj, int mtu);
MS2_PUBLIC int ms_factory_get_mtu(MSFactory *obj);
MS2_PUBLIC int ms_factory_get_mtu(const MSFactory *obj);
/**
* Set the name of the echo canceller filter to use.
......
......@@ -85,6 +85,7 @@ enum _MSFilterInterfaceId{
MSFilterAudioCaptureInterface,/**<Interface for audio capture filters*/
MSFilterAudioPlaybackInterface,/**Interface for audio playback filters.*/
MSFilterAudioEncoderInterface,/**<Video encoder interface*/
MSFilterVADInterface,/**<Voice activity detection interface*/
MSFilterVoidInterface,/**<Void source/sink interface*/
};
......@@ -694,7 +695,6 @@ typedef struct _MSPinFormat{
**/
#define MS_FILTER_OUTPUT_FMT_CHANGED MS_FILTER_BASE_EVENT_NO_ARG(0) /**<triggered whenever a filter decides to change its output format for one or more more output pins*/
/* DEPRECATED specific methods: to be moved into implementation specific header files - DO NOT USE IN NEW CODE*/
#define MS_FILTER_SET_FILTERLENGTH MS_FILTER_BASE_METHOD(12,int)
#define MS_FILTER_SET_OUTPUT_SAMPLE_RATE MS_FILTER_BASE_METHOD(13,int)
......
......@@ -285,6 +285,8 @@ typedef enum _MSRecorderState MSRecorderState;
MS_FILTER_METHOD(MSFilterVideoEncoderInterface, 9, const MSVideoConfiguration *)
#define MS_VIDEO_ENCODER_IS_HARDWARE_ACCELERATED \
MS_FILTER_METHOD(MSFilterVideoEncoderInterface, 10, bool_t)
#define MS_VIDEO_ENCODER_GET_CONFIGURATION \
MS_FILTER_METHOD(MSFilterVideoEncoderInterface, 11, MSVideoConfiguration )
/** Interface definitions for audio capture */
/* Start numbering from the end for hacks */
......@@ -331,6 +333,25 @@ typedef enum _MSAudioRoute MSAudioRoute;
#define MS_AUDIO_ENCODER_GET_CAPABILITIES \
MS_FILTER_METHOD(MSFilterAudioEncoderInterface,4,int)
/** Interface definitions for VAD */
#define MS_VAD_ENABLE_SILENCE_DETECTION \
MS_FILTER_METHOD(MSFilterVADInterface, 0, int)
/* Set the silence duration threshold in ms */
#define MS_VAD_SET_SILENCE_DURATION_THRESHOLD \
MS_FILTER_METHOD(MSFilterVADInterface, 1, unsigned int)
/* Specific to each VAD implementation */
#define MS_VAD_SET_MODE \
MS_FILTER_METHOD(MSFilterVADInterface, 2, int)
#define MS_VAD_EVENT_SILENCE_DETECTED \
MS_FILTER_EVENT_NO_ARG(MSFilterVADInterface, 0)
/* Give the end of silence and duration in ms */
#define MS_VAD_EVENT_SILENCE_ENDED \
MS_FILTER_EVENT(MSFilterVADInterface, 1, unsigned int)
/** Interface definitions for void source/sink */
#define MS_VOID_SOURCE_SEND_SILENCE \
MS_FILTER_METHOD(MSFilterVoidInterface, 0, bool_t)
......
......@@ -56,17 +56,17 @@ static MS2_INLINE void ms_queue_insert(MSQueue *q, mblk_t *em, mblk_t *m) {
return;
}
static MS2_INLINE mblk_t * ms_queue_peek_last(MSQueue *q){
static MS2_INLINE mblk_t * ms_queue_peek_last(const MSQueue *q){
return qlast(&q->q);
}
static MS2_INLINE mblk_t *ms_queue_peek_first(MSQueue *q){
static MS2_INLINE mblk_t *ms_queue_peek_first(const MSQueue *q){
return qbegin(&q->q);
}
#define ms_queue_next(q, m) (m)->b_next
static MS2_INLINE bool_t ms_queue_end(MSQueue *q, mblk_t *m){
static MS2_INLINE bool_t ms_queue_end(const MSQueue *q, const mblk_t *m){
return qend(&q->q,m);
}
......@@ -74,7 +74,7 @@ static MS2_INLINE void ms_queue_remove(MSQueue *q, mblk_t *m){
remq(&q->q,m);
}
static MS2_INLINE bool_t ms_queue_empty(MSQueue *q){
static MS2_INLINE bool_t ms_queue_empty(const MSQueue *q){
return qempty(&q->q);
}
......
......@@ -114,6 +114,7 @@ struct _MSTickerSynchronizer
uint64_t offset; /**<the default offset of ticker*/
double av_skew; /**< mean skew */
unsigned int external_time_count; /**< number of times ms_ticker_synchronizer_set_external_time() is called */
uint64_t current_nsamples; /**< The last number of samples read notified with ms_ticker_synchronizer_update*/
};
/**
......
......@@ -155,31 +155,37 @@ struct _MSVideoConfiguration {
*/
typedef struct _MSVideoConfiguration MSVideoConfiguration;
#define MS_VIDEO_SIZE_UNKNOWN (MSVideoSize){ MS_VIDEO_SIZE_UNKNOWN_W, MS_VIDEO_SIZE_UNKNOWN_H }
#ifdef __cplusplus
#define MS_VIDEO_SIZE_TYPE MSVideoSize
#else
#define MS_VIDEO_SIZE_TYPE (MSVideoSize)
#endif // ifdef __cplusplus
#define MS_VIDEO_SIZE_CIF (MSVideoSize){MS_VIDEO_SIZE_CIF_W,MS_VIDEO_SIZE_CIF_H}
#define MS_VIDEO_SIZE_QCIF (MSVideoSize){MS_VIDEO_SIZE_QCIF_W,MS_VIDEO_SIZE_QCIF_H}
#define MS_VIDEO_SIZE_4CIF (MSVideoSize){MS_VIDEO_SIZE_4CIF_W,MS_VIDEO_SIZE_4CIF_H}
#define MS_VIDEO_SIZE_CVD (MSVideoSize){MS_VIDEO_SIZE_CVD_W, MS_VIDEO_SIZE_CVD_H}
#define MS_VIDEO_SIZE_QQVGA (MSVideoSize){MS_VIDEO_SIZE_QQVGA_W,MS_VIDEO_SIZE_QQVGA_H}
#define MS_VIDEO_SIZE_QVGA (MSVideoSize){MS_VIDEO_SIZE_QVGA_W,MS_VIDEO_SIZE_QVGA_H}
#define MS_VIDEO_SIZE_VGA (MSVideoSize){MS_VIDEO_SIZE_VGA_W,MS_VIDEO_SIZE_VGA_H}
#define MS_VIDEO_SIZE_UNKNOWN MS_VIDEO_SIZE_TYPE{ MS_VIDEO_SIZE_UNKNOWN_W, MS_VIDEO_SIZE_UNKNOWN_H }
#define MS_VIDEO_SIZE_IOS_MEDIUM (MSVideoSize){ MS_VIDEO_SIZE_IOS_MEDIUM_W, MS_VIDEO_SIZE_IOS_MEDIUM_H }
#define MS_VIDEO_SIZE_CIF MS_VIDEO_SIZE_TYPE{ MS_VIDEO_SIZE_CIF_W, MS_VIDEO_SIZE_CIF_H }
#define MS_VIDEO_SIZE_QCIF MS_VIDEO_SIZE_TYPE{ MS_VIDEO_SIZE_QCIF_W, MS_VIDEO_SIZE_QCIF_H }
#define MS_VIDEO_SIZE_4CIF MS_VIDEO_SIZE_TYPE{ MS_VIDEO_SIZE_4CIF_W, MS_VIDEO_SIZE_4CIF_H }
#define MS_VIDEO_SIZE_CVD MS_VIDEO_SIZE_TYPE{ MS_VIDEO_SIZE_CVD_W, MS_VIDEO_SIZE_CVD_H }
#define MS_VIDEO_SIZE_QQVGA MS_VIDEO_SIZE_TYPE{ MS_VIDEO_SIZE_QQVGA_W, MS_VIDEO_SIZE_QQVGA_H }
#define MS_VIDEO_SIZE_QVGA MS_VIDEO_SIZE_TYPE{ MS_VIDEO_SIZE_QVGA_W, MS_VIDEO_SIZE_QVGA_H }
#define MS_VIDEO_SIZE_VGA MS_VIDEO_SIZE_TYPE{ MS_VIDEO_SIZE_VGA_W, MS_VIDEO_SIZE_VGA_H }
#define MS_VIDEO_SIZE_720P (MSVideoSize){MS_VIDEO_SIZE_720P_W, MS_VIDEO_SIZE_720P_H}
#define MS_VIDEO_SIZE_IOS_MEDIUM MS_VIDEO_SIZE_TYPE{ MS_VIDEO_SIZE_IOS_MEDIUM_W, MS_VIDEO_SIZE_IOS_MEDIUM_H }
#define MS_VIDEO_SIZE_1080P (MSVideoSize){ MS_VIDEO_SIZE_1080P_W, MS_VIDEO_SIZE_1080P_H }
#define MS_VIDEO_SIZE_720P MS_VIDEO_SIZE_TYPE{ MS_VIDEO_SIZE_720P_W, MS_VIDEO_SIZE_720P_H }
#define MS_VIDEO_SIZE_NS1 (MSVideoSize){MS_VIDEO_SIZE_NS1_W,MS_VIDEO_SIZE_NS1_H}
#define MS_VIDEO_SIZE_1080P MS_VIDEO_SIZE_TYPE{ MS_VIDEO_SIZE_1080P_W, MS_VIDEO_SIZE_1080P_H }
#define MS_VIDEO_SIZE_XGA (MSVideoSize){MS_VIDEO_SIZE_XGA_W, MS_VIDEO_SIZE_XGA_H}
#define MS_VIDEO_SIZE_NS1 MS_VIDEO_SIZE_TYPE{ MS_VIDEO_SIZE_NS1_W,MS_VIDEO_SIZE_NS1_H }
#define MS_VIDEO_SIZE_SVGA (MSVideoSize){MS_VIDEO_SIZE_SVGA_W, MS_VIDEO_SIZE_SVGA_H}
#define MS_VIDEO_SIZE_XGA MS_VIDEO_SIZE_TYPE{ MS_VIDEO_SIZE_XGA_W, MS_VIDEO_SIZE_XGA_H }
#define MS_VIDEO_SIZE_SXGA_MINUS (MSVideoSize){ MS_VIDEO_SIZE_SXGA_MINUS_W, MS_VIDEO_SIZE_SXGA_MINUS_H }
#define MS_VIDEO_SIZE_SVGA MS_VIDEO_SIZE_TYPE{ MS_VIDEO_SIZE_SVGA_W, MS_VIDEO_SIZE_SVGA_H }
#define MS_VIDEO_SIZE_UXGA (MSVideoSize){ MS_VIDEO_SIZE_UXGA_W, MS_VIDEO_SIZE_UXGA_H }
#define MS_VIDEO_SIZE_SXGA_MINUS MS_VIDEO_SIZE_TYPE{ MS_VIDEO_SIZE_SXGA_MINUS_W, MS_VIDEO_SIZE_SXGA_MINUS_H }
#define MS_VIDEO_SIZE_UXGA MS_VIDEO_SIZE_TYPE{ MS_VIDEO_SIZE_UXGA_W, MS_VIDEO_SIZE_UXGA_H }
#ifdef _MSC_VER
#define MS_VIDEO_SIZE_ASSIGN(vsize,name) \
......@@ -241,6 +247,8 @@ typedef msgb_allocator_t MSYuvBufAllocator;
extern "C"{
#endif
MS2_PUBLIC bool_t ms_rect_equal(const MSRect *r1, const MSRect *r2);
MS2_PUBLIC const char *ms_pix_fmt_to_string(MSPixFmt fmt);
MS2_PUBLIC int ms_pix_fmt_to_ffmpeg(MSPixFmt fmt);
MS2_PUBLIC MSPixFmt ffmpeg_pix_fmt_to_ms(int fmt);
......
......@@ -40,29 +40,16 @@ typedef enum{
Rfc3984NewPPS = 1<<4,
Rfc3984HasSPS = 1<<5,
Rfc3984HasPPS = 1<<6,
Rfc3984HasIDR = 1<<7,
Rfc3984HasIDR = 1<<7
}Rfc3984Status;
typedef struct Rfc3984Context{
MSQueue q;
mblk_t *m;
int maxsz;
unsigned int status; /*bitmask of Rfc3984Status values*/
mblk_t *sps, *pps;
mblk_t *last_sps, *last_pps;
uint32_t last_ts;
uint16_t ref_cseq;
uint8_t mode;
bool_t stap_a_allowed;
bool_t initialized_ref_cseq;
} Rfc3984Context;
typedef struct _Rfc3984Context Rfc3984Context;
MS2_DEPRECATED MS2_PUBLIC Rfc3984Context *rfc3984_new(void);
MS2_PUBLIC Rfc3984Context *rfc3984_new_with_factory(MSFactory *factory);
MS2_PUBLIC void rfc3984_destroy(Rfc3984Context *ctx);
void rfc3984_init(Rfc3984Context *ctx);
MS2_PUBLIC void rfc3984_set_mode(Rfc3984Context *ctx, int mode);
......@@ -74,13 +61,6 @@ MS2_PUBLIC void rfc3984_pack(Rfc3984Context *ctx, MSQueue *naluq, MSQueue *rtpq,
MS2_PUBLIC void rfc3984_unpack_out_of_band_sps_pps(Rfc3984Context *ctx, mblk_t *sps, mblk_t *pps);
/**
* Process incoming rtp data and output NALUs, whenever possible.
* @return 0 if everything was ok, -1 on error (inconsistencies in sequence numbers for example).
* @note the naluq output argument may be filled with incomplete data even if return value was -1.
* @deprecated use rfc3984_unpack2
**/
MS2_DEPRECATED MS2_PUBLIC int rfc3984_unpack(Rfc3984Context *ctx, mblk_t *im, MSQueue *naluq);
/**
* Process incoming rtp data and output NALUs, whenever possible.
......@@ -92,8 +72,6 @@ MS2_DEPRECATED MS2_PUBLIC int rfc3984_unpack(Rfc3984Context *ctx, mblk_t *im, MS
**/
MS2_PUBLIC unsigned int rfc3984_unpack2(Rfc3984Context *ctx, mblk_t *im, MSQueue *naluq);
void rfc3984_uninit(Rfc3984Context *ctx);
#ifdef __cplusplus
}
#endif
......
......@@ -212,7 +212,7 @@ typedef struct {
MSTurnContextState state;
MSTurnContextType type;
MSStunAddress relay_addr;
struct sockaddr *turn_server_addr;
struct sockaddr_storage turn_server_addr;
socklen_t turn_server_addrlen;
bool_t force_rtp_sending_via_relay;
MSTurnContextStatistics stats;
......
......@@ -26,9 +26,11 @@ import org.linphone.mediastream.video.AndroidVideoWindowImpl;
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration.AndroidCamera;
import android.graphics.SurfaceTexture;
import android.hardware.Camera;
import android.hardware.Camera.Parameters;
import android.view.SurfaceView;
import android.view.TextureView;
/**
* Wrapper for Android Camera API. Used by Mediastreamer to record
......@@ -126,6 +128,10 @@ public class AndroidVideoApi5JniWrapper {
if (surf instanceof SurfaceView) {
SurfaceView surface = (SurfaceView) surf;
camera.setPreviewDisplay(surface.getHolder());
} else if (surf instanceof TextureView && ((TextureView) surf).isAvailable()) {
camera.setPreviewTexture(((TextureView) surf).getSurfaceTexture());
} else if (surf instanceof SurfaceTexture) {
camera.setPreviewTexture((SurfaceTexture) surf);
} else {
AndroidVideoWindowImpl avw = (AndroidVideoWindowImpl) surf;
camera.setPreviewDisplay(avw.getPreviewSurfaceView().getHolder());
......
This diff is collapsed.
......@@ -234,7 +234,7 @@ static MSFilterMethod methods[]={
};
static MSFilterDesc ms_android_display_bad_desc={
MS_ANDROID_DISPLAY_ID,
MS_ANDROID_DISPLAY_BAD_ID,
"MSAndroidDisplay",
"Video display filter for Android (unofficial)",
MS_FILTER_OTHER,
......
......@@ -73,6 +73,7 @@ static void android_display_uninit(MSFilter *f){
ms_free(ad->ogl);
}
if (ad->android_video_window) (*jenv)->DeleteGlobalRef(jenv, ad->android_video_window);
ad->android_video_window = NULL;
ms_free(ad);
}
......@@ -162,7 +163,7 @@ static MSFilterMethod methods[] = {
};
MSFilterDesc ms_android_opengl_display_desc={
.id=MS_ANDROID_DISPLAY_ID,
.id=MS_ANDROID_OPENGL_DISPLAY_ID,
.name="MSAndroidOpenGLDisplay",
.text="OpenGL-ES2 video display filter for Android.",
.category=MS_FILTER_OTHER,
......
/*
mediastreamer2 android video display filter
Copyright (C) 2010-2018 Belledonne Communications SARL (simon.morlat@linphone.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "mediastreamer2/msfilter.h"
#include "mediastreamer2/msvideo.h"
#include "mediastreamer2/msjava.h"
#include "layouts.h"
#include "opengles_display.h"