Commit c0db0e30 authored by François Grisez's avatar François Grisez

Merge branch 'master' into dev_video_toolbox

parents 459f0ee8 1d7705a9
......@@ -279,7 +279,9 @@ endif()
# TODO: Handle Theora option
if(ENABLE_VPX)
find_package(VPX)
if(NOT VPX_FOUND)
if(VPX_FOUND)
set(HAVE_VPX 1)
else()
set(ENABLE_VPX OFF CACHE BOOL "Build mediastreamer2 with VPX codec." FORCE)
endif()
endif()
......@@ -452,21 +454,25 @@ if(APPLE)
list(APPEND LINK_FLAGS "-framework CoreFoundation" "-framework AudioToolbox" "-framework CoreAudio")
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(IOS AND ENABLE_VT_H264) # Necessary for Mediastreamer's tools and testers
list(APPEND LINK_FLAGS "-framework VideoToolbox")
endif()
endif()
else()
list(APPEND LINK_FLAGS "-framework AppKit")
if(ENABLE_MACSND)
list(APPEND LINK_FLAGS "-framework Carbon" "-framework AudioUnit")
endif()
endif()
if(ENABLE_VIDEO)
list(APPEND LINK_FLAGS "-framework Cocoa" "-framework OpenGL" "-framework QuartzCore" "-framework QTKit")
if(IOS AND ENABLE_VT_H264) # Necessary for Mediastreamer's tools and testers
list(APPEND LINK_FLAGS "-framework VideoToolbox")
if(ENABLE_VIDEO)
list(APPEND LINK_FLAGS "-framework Cocoa" "-framework OpenGL" "-framework QuartzCore" "-framework QTKit")
endif()
set(PLUGINS_EXT ".dylib")
add_definitions("-DTARGET_OS_MAC=1")
endif()
set(PLUGINS_EXT ".dylib")
add_definitions("-DTARGET_OS_MAC=1")
endif()
string(REPLACE ";" " " LINK_FLAGS_STR "${LINK_FLAGS}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/mediastreamer-config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/mediastreamer-config.h)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/mediastreamer-config.h PROPERTIES GENERATED ON)
add_definitions("-DHAVE_CONFIG_H")
......
......@@ -31,6 +31,7 @@ MEDIASTREAMER2_INCLUDES := \
$(LOCAL_PATH)/utils \
$(LOCAL_PATH)/voip \
$(LOCAL_PATH)/audiofilters \
$(LOCAL_PATH)/android \
$(LOCAL_PATH)/otherfilters \
$(LOCAL_PATH)/videofilters \
$(LOCAL_PATH)/../include \
......@@ -65,6 +66,7 @@ LOCAL_SRC_FILES = \
audiofilters/flowcontrol.c \
audiofilters/g711.c \
audiofilters/genericplc.c \
audiofilters/msgenericplc.c \
audiofilters/l16.c \
audiofilters/msfileplayer.c \
audiofilters/msfilerec.c \
......@@ -159,6 +161,9 @@ LOCAL_SRC_FILES += \
videofilters/vp8.c \
videofilters/jpegwriter.c \
videofilters/msv4l2.c \
android/mediacodech264dec.c \
android/mediacodech264enc.c \
android/android_mediacodec.cpp \
android/android-display.c \
android/android-display-bad.cpp \
android/androidvideo.cpp \
......
......@@ -28,6 +28,8 @@ 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_h264_enc_desc;
extern MSFilterDesc ms_pix_conv_desc;
extern MSFilterDesc ms_size_conv_desc;
extern MSFilterDesc ms_tone_detector_desc;
......@@ -84,6 +86,8 @@ 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_h264_enc_desc,
&ms_pix_conv_desc,
&ms_size_conv_desc,
&ms_vp8_enc_desc,
......
......@@ -99,6 +99,7 @@
<ClCompile Include="..\..\..\src\audiofilters\msfileplayer.c" />
<ClCompile Include="..\..\..\src\audiofilters\msfilerec.c" />
<ClCompile Include="..\..\..\src\audiofilters\msg722.c" />
<ClCompile Include="..\..\..\src\audiofilters\msgenericplc.c" />
<ClCompile Include="..\..\..\src\audiofilters\msopus.c" />
<ClCompile Include="..\..\..\src\audiofilters\msresample.c" />
<ClCompile Include="..\..\..\src\audiofilters\msspeex.c" />
......
......@@ -60,7 +60,10 @@
</ComboBox>
<TextBlock x:Name="BitrateLabel" Grid.Row="4" Grid.Column="0" Text="Bitrate:" VerticalAlignment="Center" Margin="8"/>
<TextBox x:Name="BitrateTextBox" Grid.Row="4" Grid.Column="1" Margin="8" IsSpellCheckEnabled="False" IsTextPredictionEnabled="False" InputScope="Number" Text="1500"/>
<ToggleButton x:Name="VideoToggleButton" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" Content="Toggle video" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="8" Checked="VideoToggleButton_Checked" Unchecked="VideoToggleButton_Checked"/>
<StackPanel Grid.Row="5" Grid.ColumnSpan="2" Orientation="Horizontal">
<ToggleButton x:Name="VideoToggleButton" Content="Toggle video" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="8" Checked="VideoToggleButton_Checked" Unchecked="VideoToggleButton_Checked"/>
<Button x:Name="ChangeCameraButton" Content="Change camera" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="8" Click="ChangeCameraButton_Click" IsEnabled="{Binding ElementName=VideoToggleButton, Path=IsChecked}"/>
</StackPanel>
</Grid>
<Grid Grid.Row="1" MaxHeight="320">
<Grid.ColumnDefinitions>
......
......@@ -144,6 +144,12 @@ namespace ms2_tester
}
}
private void ChangeCameraButton_Click(object sender, RoutedEventArgs e)
{
String camera = (CameraComboBox.SelectedItem as ComboBoxItem).Content as String;
MS2Tester.Instance.changeCamera(camera);
}
private void SetVideoOrientation()
{
SimpleOrientation orientation = deviceOrientation;
......
......@@ -60,5 +60,5 @@ if(BZRTP_FOUND)
list(APPEND MEDIASTREAMER2_LIBRARIES ${BZRTP_LIBRARIES})
endif()
set(MEDIASTREAMER2_CPPFLAGS ${ORTP_CPPFLAGS})
set(MEDIASTREAMER2_LDFLAGS @LINK_FLAGS@)
set(MEDIASTREAMER2_LDFLAGS "@LINK_FLAGS_STR@")
set(MEDIASTREAMER2_FOUND 1)
dnl Process this file with autoconf to produce a configure script.
AC_INIT([mediastreamer],[2.12.1])
AC_INIT([mediastreamer],[2.13.0])
AC_MSG_NOTICE([$PACKAGE_NAME-$PACKAGE_VERSION A mediastreaming library for telephony application.])
AC_MSG_NOTICE([licensed under the terms of the General Public License (GPL)])
......@@ -764,6 +764,10 @@ AM_CONDITIONAL(BUILD_X11_XV, test "$enable_xv" = "true" )
AM_CONDITIONAL(BUILD_X11_GL, test "$enable_glx" = "true" )
AM_CONDITIONAL(BUILD_UPNP, test "$build_upnp" = "true" )
if test "$build_vp8" != "false" ; then
AC_DEFINE(HAVE_VPX, 1, [Tells whether vpx can be used])
fi
dnl *********************************************
dnl Enable/disable oRTP dependency
dnl *********************************************
......@@ -1024,12 +1028,6 @@ fi
AM_CONDITIONAL(BUILD_TESTS,test x$found_cunit = xyes)
case "$target_os" in
*linux*)
# Eliminate -lstdc++ addition to postdeps for cross compiles.
postdeps_CXX=`echo " $postdeps_CXX " | sed 's, -lstdc++ ,,g'`
;;
esac
dnl check for libsrtp support (secure rtp)
AC_ARG_WITH(srtp,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -152,7 +152,9 @@ typedef enum MSFilterId{
MS_VT_H264_ENC_ID,
MS_VT_H264_DEC_ID,
MS_RTT_4103_SOURCE_ID,
MS_RTT_4103_SINK_ID
MS_RTT_4103_SINK_ID,
MS_MEDIACODEC_H264_DEC_ID,
MS_MEDIACODEC_H264_ENC_ID
} MSFilterId;
#endif
......@@ -753,8 +753,15 @@ static MS2_INLINE RtpSession * audio_stream_get_rtp_session(const AudioStream *s
typedef void (*VideoStreamRenderCallback)(void *user_pointer, const MSPicture *local_view, const MSPicture *remote_view);
typedef void (*VideoStreamEventCallback)(void *user_pointer, const MSFilter *f, const unsigned int event_id, const void *args);
struct _MediastreamVideoStat
{
int counter_rcvd_pli; /*Picture Loss Indication counter */
int counter_rcvd_sli;/* Slice Loss Indication counter */
int counter_rcvd_rpsi; /*Reference Picture Selection Indication */
int counter_rcvd_fir; /* Full INTRA-frame Request */
};
typedef struct _MediastreamVideoStat MediaStreamVideoStat;
struct _VideoStream
{
......@@ -797,11 +804,14 @@ struct _VideoStream
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 */
MediaStreamVideoStat ms_video_stat;
};
typedef struct _VideoStream VideoStream;
MS2_PUBLIC VideoStream *video_stream_new(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.
......
......@@ -108,6 +108,66 @@ struct _MSRtpPayloadPickerContext {
RtpPayloadPicker picker;
};
struct _MSOfferAnswerContext;
#ifndef MS_OFFER_ANSWER_CONTEXT_DEFINED
#define MS_OFFER_ANSWER_CONTEXT_DEFINED
typedef struct _MSOfferAnswerContext MSOfferAnswerContext;
#endif
/* SDP offer answer payload matching API*/
/**
* The MSPayloadMatcherFunc prototype takes:
* - a list of local payload types
* - a remote payload type (offered or answered) by remote to be matched agains payload types of the local payload type list.
* - the full list of remote (offered or answered) payload types, which is sometimes necessary to do the matching in ambiguous situations.
* - is_reading, a boolean indicating whether we are doing the match processing while reading a SDP response, or (if FALSE) to prepare a response to be sent.
* The expected return value is a newly allocated PayloadType similar to the local payload type that was matched.
* Due to specific per codec offer/answer logic, the fmtp of the payload type might be changed compared to the original local payload type.
* If there is no match, NULL must be returned.
**/
typedef PayloadType * (*MSPayloadMatcherFunc)(MSOfferAnswerContext *context, const MSList *local_payloads, const PayloadType *remote_payload, const MSList *remote_payloads, bool_t is_reading);
/**
* The MSOfferAnswerContext is only there to provide a context during the SDP offer/answer handshake.
* It could be used in the future to provide extra information, for the moment the context is almost useless*/
struct _MSOfferAnswerContext{
MSPayloadMatcherFunc match_payload;
void (*destroy)(MSOfferAnswerContext *ctx);
void *context_data;
};
/**
* Executes an offer/answer processing for a given codec.
* @param context the context
* @param local_payloads the local payload type supported
* @param remote_payload a remote payload type (offered or answered) by remote to be matched agains payload types of the local payload type list.
* @param remote_payloads the full list of remote (offered or answered) payload types, which is sometimes necessary to do the matching in ambiguous situations.
* @param is_reading, a boolean indicating whether we are doing the match processing while reading a SDP response, or (if FALSE) to prepare a response to be sent.
* The expected return value is a newly allocated PayloadType similar to the local payload type that was matched.
* Due to specific per codec offer/answer logic, the fmtp of the payload type might be changed compared to the original local payload type.
* If there is no match, NULL must be returned.
**/
MS2_PUBLIC PayloadType * ms_offer_answer_context_match_payload(MSOfferAnswerContext *context, const MSList *local_payloads, const PayloadType *remote_payload, const MSList *remote_payloads, bool_t is_reading);
MS2_PUBLIC void ms_offer_answer_context_destroy(MSOfferAnswerContext *ctx);
/**
* A convenience function to instanciate an offer answer context giving only the payload matching function pointer.
**/
MS2_PUBLIC MSOfferAnswerContext *ms_offer_answer_create_simple_context(MSPayloadMatcherFunc func);
/**
* The struct to declare offer-answer provider, that act as factories per mime type to instanciate MSOfferAnswerContext object able to take in charge
* the offer answer model for a particular codec
**/
struct _MSOfferAnswerProvider{
const char *mime_type;
MSOfferAnswerContext *(*create_context)(void);
};
#ifdef __cplusplus
}
#endif
......
......@@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
struct _MSFactory{
MSList *desc_list;
MSList *stats_list;
MSList *offer_answer_provider_list;
#ifdef _WIN32
MSList *ms_plugins_loaded_list;
#endif
......@@ -295,6 +296,41 @@ MS2_PUBLIC int ms_factory_enable_filter_from_name(MSFactory *factory, const char
*/
MS2_PUBLIC bool_t ms_factory_filter_from_name_enabled(const MSFactory *factory, const char *name);
#ifndef MS_OFFER_ANSWER_CONTEXT_DEFINED
#define MS_OFFER_ANSWER_CONTEXT_DEFINED
typedef struct _MSOfferAnswerContext MSOfferAnswerContext;
#endif
typedef struct _MSOfferAnswerProvider MSOfferAnswerProvider;
/**
* Registers an offer-answer provider. An offer answer provider is a kind of factory that creates
* context objects able to execute the particular offer/answer logic for a given codec.
* Indeed, several codecs have complex parameter handling specified in their RFC, and hence cannot be
* treated in a generic way by the global SDP offer answer logic.
* Mediastreamer2 plugins can then register with this method their offer/answer logic together with the encoder
* and decoder filters, so that it can be used by the signaling layer of the application.
* @param factory
* @param offer_answer_prov the offer answer provider descriptor.
**/
MS2_PUBLIC void ms_factory_register_offer_answer_provider(MSFactory *f, MSOfferAnswerProvider *offer_answer_prov);
/**
* Retrieve an offer answer provider previously registered, giving the codec name.
* @param f the factory
* @param mime_type the codec mime type.
* @return an MSOfferAnswerProvider or NULL if none was registered for this codec.
**/
MS2_PUBLIC MSOfferAnswerProvider * ms_factory_get_offer_answer_provider(MSFactory *f, const char *mime_type);
/**
* Directly creates an offer-answer context giving the codec mime-type.
* @param f the factory
* @param the mime-type of the codec.
* @return an MSOfferAnswerContext or NULL if none was registered for this codec.
**/
MS2_PUBLIC MSOfferAnswerContext * ms_factory_create_offer_answer_context(MSFactory *f, const char *mime_type);
#ifdef __cplusplus
}
#endif
......
......@@ -68,3 +68,4 @@
#cmakedefine HAVE_POLARSSL_SSL_H 1
#cmakedefine HAVE_PCAP 1
#cmakedefine HAVE_MATROSKA 1
#cmakedefine HAVE_VPX 1
......@@ -44,3 +44,5 @@ src/videofilters/winvideods.c
src/videofilters/winvideo2.c
src/videofilters/x11video.c
src/voip/ice.c
src/audiofilters/msgenericplc.c
......@@ -47,19 +47,17 @@ set(BASE_SOURCE_FILES_C
otherfilters/void.c
)
set(BASE_GENERATED_SOURCE_FILES_C
${CMAKE_CURRENT_BINARY_DIR}/basedescs.h
${CMAKE_CURRENT_BINARY_DIR}/gitversion.h
)
set_source_files_properties(${BASE_GENERATED_SOURCE_FILES_C} PROPERTIES GENERATED TRUE)
find_package(Git)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gitversion.h
COMMAND ${CMAKE_COMMAND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -DOUTPUT_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/gitversion.cmake)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/basedescs.h
COMMAND ${CMAKE_COMMAND} -DAWK_PROGRAM=${AWK_PROGRAM} -DAWK_SCRIPTS_DIR=${CMAKE_CURRENT_SOURCE_DIR}/../
add_custom_target(ms2-git-version
COMMAND ${CMAKE_COMMAND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -DMEDIASTREAMER_VERSION=${MEDIASTREAMER_VERSION} -DWORK_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DOUTPUT_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/gitversion.cmake
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/gitversion.h"
)
add_custom_target(ms2-basedescs-header
COMMAND ${CMAKE_COMMAND} -DAWK_PROGRAM=${AWK_PROGRAM} -DAWK_SCRIPTS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/../"
-DINPUT_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DOUTPUT_DIR=${CMAKE_CURRENT_BINARY_DIR}
-DTYPE=base -DSOURCE_FILES="${BASE_SOURCE_FILES_C}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/generate_descs_header.cmake)
-P "${CMAKE_CURRENT_SOURCE_DIR}/generate_descs_header.cmake"
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/basedescs.h")
add_definitions(
-DMEDIASTREAMER2_EXPORTS
......@@ -80,12 +78,11 @@ if(HAVE_DLOPEN)
endif()
apply_compile_flags(BASE_SOURCE_FILES_C "CPP" "C")
apply_compile_flags(BASE_GENERATED_SOURCE_FILES_C "CPP" "C")
if(ENABLE_STATIC)
add_library(mediastreamer_base STATIC ${MEDIASTREAMER2_HEADER_FILES} ${BASE_SOURCE_FILES_C} ${BASE_GENERATED_SOURCE_FILES_C})
add_library(mediastreamer_base STATIC ${MEDIASTREAMER2_HEADER_FILES} ${BASE_SOURCE_FILES_C})
else()
add_library(mediastreamer_base SHARED ${MEDIASTREAMER2_HEADER_FILES} ${BASE_SOURCE_FILES_C} ${BASE_GENERATED_SOURCE_FILES_C})
add_library(mediastreamer_base SHARED ${MEDIASTREAMER2_HEADER_FILES} ${BASE_SOURCE_FILES_C})
set_target_properties(mediastreamer_base PROPERTIES VERSION ${MEDIASTREAMER_SO_VERSION} LINKER_LANGUAGE C)
if(MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
......@@ -96,6 +93,7 @@ else()
endif()
endif()
endif()
add_dependencies(mediastreamer_base ms2-git-version ms2-basedescs-header)
target_link_libraries(mediastreamer_base ${BASE_LIBS})
install(TARGETS mediastreamer_base EXPORT ${EXPORT_TARGETS_NAME}Targets
......@@ -118,7 +116,9 @@ set(VOIP_SOURCE_FILES_C
audiofilters/flowcontrol.c
audiofilters/g711.c
audiofilters/g711.h
audiofilters/genericplc.h
audiofilters/genericplc.c
audiofilters/msgenericplc.c
audiofilters/l16.c
audiofilters/msfileplayer.c
audiofilters/msfilerec.c
......@@ -333,43 +333,42 @@ if(ENABLE_VIDEO)
endif()
endif()
set(VOIP_GENERATED_SOURCE_FILES_C
${CMAKE_CURRENT_BINARY_DIR}/voipdescs.h
)
set(VOIP_SOURCE_FILES_ALL ${VOIP_SOURCE_FILES_C} ${VOIP_SOURCE_FILES_CXX} ${VOIP_SOURCE_FILES_OBJC})
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/voipdescs.h
COMMAND ${CMAKE_COMMAND} -DAWK_PROGRAM=${AWK_PROGRAM} -DAWK_SCRIPTS_DIR=${CMAKE_CURRENT_SOURCE_DIR}/../
add_custom_target(ms2-voipdescs-header
COMMAND ${CMAKE_COMMAND} -DAWK_PROGRAM=${AWK_PROGRAM} -DAWK_SCRIPTS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/../"
-DINPUT_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DOUTPUT_DIR=${CMAKE_CURRENT_BINARY_DIR}
-DTYPE=voip -DSOURCE_FILES="${VOIP_SOURCE_FILES_ALL}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/generate_descs_header.cmake)
if(APPLE OR GLX_FOUND)
find_program(XXD_PROGRAM xxd)
if(NOT XXD_PROGRAM)
message(FATAL_ERROR "You need the xxd program to build mediastreamer2.")
endif()
find_program(SED_PROGRAM sed)
if(NOT SED_PROGRAM)
message(FATAL_ERROR "You need the sed program to build mediastreamer2.")
endif()
list(APPEND VOIP_GENERATED_SOURCE_FILES_C
${CMAKE_CURRENT_BINARY_DIR}/yuv2rgb.fs.h
${CMAKE_CURRENT_BINARY_DIR}/yuv2rgb.vs.h
-P "${CMAKE_CURRENT_SOURCE_DIR}/generate_descs_header.cmake"
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/voipdescs.h"
)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/yuv2rgb.fs.h
COMMAND ${CMAKE_COMMAND} -DXXD_PROGRAM=${XXD_PROGRAM} -DSED_PROGRAM=${SED_PROGRAM}
-DINPUT_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DOUTPUT_DIR=${CMAKE_CURRENT_BINARY_DIR}
-DSOURCE_FILE="yuv2rgb.fs"
-P ${CMAKE_CURRENT_SOURCE_DIR}/generate_yuv2rgb_header.cmake)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/yuv2rgb.vs.h
COMMAND ${CMAKE_COMMAND} -DXXD_PROGRAM=${XXD_PROGRAM} -DSED_PROGRAM=${SED_PROGRAM}
-DINPUT_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DOUTPUT_DIR=${CMAKE_CURRENT_BINARY_DIR}
-DSOURCE_FILE="yuv2rgb.vs"
-P ${CMAKE_CURRENT_SOURCE_DIR}/generate_yuv2rgb_header.cmake)
if(APPLE OR GLX_FOUND)
find_program(XXD_PROGRAM xxd)
if(NOT XXD_PROGRAM)
message(FATAL_ERROR "You need the xxd program to build mediastreamer2.")
endif()
find_program(SED_PROGRAM sed)
if(NOT SED_PROGRAM)
message(FATAL_ERROR "You need the sed program to build mediastreamer2.")
endif()
add_custom_target(ms2-yuv2rgb-fs-header
COMMAND ${CMAKE_COMMAND} -DXXD_PROGRAM=${XXD_PROGRAM} -DSED_PROGRAM=${SED_PROGRAM}
-DINPUT_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DOUTPUT_DIR=${CMAKE_CURRENT_BINARY_DIR}
-DSOURCE_FILE="yuv2rgb.fs"
-P "${CMAKE_CURRENT_SOURCE_DIR}/generate_yuv2rgb_header.cmake"
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/yuv2rgb.fs.h"
)
add_custom_target(ms2-yuv2rgb-vs-header
COMMAND ${CMAKE_COMMAND} -DXXD_PROGRAM=${XXD_PROGRAM} -DSED_PROGRAM=${SED_PROGRAM}
-DINPUT_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DOUTPUT_DIR=${CMAKE_CURRENT_BINARY_DIR}
-DSOURCE_FILE="yuv2rgb.vs"
-P "${CMAKE_CURRENT_SOURCE_DIR}/generate_yuv2rgb_header.cmake"
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/yuv2rgb.vs.h"
)
endif()
set_source_files_properties(${VOIP_GENERATED_SOURCE_FILES_C} PROPERTIES GENERATED TRUE)
apply_compile_flags(VOIP_SOURCE_FILES_C "CPP" "C")
apply_compile_flags(VOIP_GENERATED_SOURCE_FILES_C "CPP" "C")
apply_compile_flags(VOIP_SOURCE_FILES_OBJC "CPP" "OBJC")
if(VOIP_SOURCE_FILES_CXX)
set_source_files_properties(${VOIP_SOURCE_FILES_CXX} PROPERTIES LANGUAGE CXX)
......@@ -461,9 +460,9 @@ if (CAMAPI_FOUND)
endif()
if(ENABLE_STATIC)
add_library(mediastreamer_voip STATIC ${MEDIASTREAMER2_HEADER_FILES} ${VOIP_SOURCE_FILES_C} ${VOIP_GENERATED_SOURCE_FILES_C} ${VOIP_SOURCE_FILES_CXX} ${VOIP_SOURCE_FILES_OBJC})
add_library(mediastreamer_voip STATIC ${MEDIASTREAMER2_HEADER_FILES} ${VOIP_SOURCE_FILES_C} ${VOIP_SOURCE_FILES_CXX} ${VOIP_SOURCE_FILES_OBJC})
else()
add_library(mediastreamer_voip SHARED ${MEDIASTREAMER2_HEADER_FILES} ${VOIP_SOURCE_FILES_C} ${VOIP_GENERATED_SOURCE_FILES_C} ${VOIP_SOURCE_FILES_CXX} ${VOIP_SOURCE_FILES_OBJC})
add_library(mediastreamer_voip SHARED ${MEDIASTREAMER2_HEADER_FILES} ${VOIP_SOURCE_FILES_C} ${VOIP_SOURCE_FILES_CXX} ${VOIP_SOURCE_FILES_OBJC})
set_target_properties(mediastreamer_voip PROPERTIES VERSION ${MEDIASTREAMER_SO_VERSION} LINKER_LANGUAGE CXX)
if(MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
......@@ -474,6 +473,10 @@ else()
endif()
endif()
endif()
add_dependencies(mediastreamer_voip ms2-git-version ms2-voipdescs-header)
if(APPLE OR GLX_FOUND)
add_dependencies(mediastreamer_voip ms2-yuv2rgb-fs-header ms2-yuv2rgb-vs-header)
endif()
target_link_libraries(mediastreamer_voip ${VOIP_LIBS})
string(REPLACE ";" " " LINK_FLAGS_STR "${LINK_FLAGS}")
if(LINK_FLAGS_STR)
......
......@@ -23,6 +23,10 @@ ANDROID_SRC_FILES= \
android/android-opengl-display.c \
android/audio.h \
android/loader.cpp android/loader.h \
android/mediacodech264dec.c \
android/mediacodech264enc.c \
android/android_mediacodec.cpp \
android/android_mediacodec.h \
audiofilters/aac-eld-android.cpp
EXTRA_DIST= audiofilters/winsnd2.c audiofilters/winsnd.c videofilters/winvideo.c \
......@@ -142,7 +146,9 @@ libmediastreamer_voip_la_SOURCES+= audiofilters/alaw.c \
utils/g722_encode.c \
audiofilters/msg722.c \
audiofilters/l16.c \
audiofilters/genericplc.h \
audiofilters/genericplc.c \
audiofilters/msgenericplc.c \
audiofilters/msfileplayer.c \
audiofilters/msfilerec.c \
audiofilters/waveheader.h \
......
......@@ -285,5 +285,5 @@ extern "C" void libmsandroiddisplaybad_init(MSFactory *factory){
ms_factory_register_filter(factory,&ms_android_display_bad_desc);
ms_message("Android display filter (the bad one) loaded.");
}
}else ms_message("Could not load either "LIBSURFACE22_SO " or "LIBSURFACE21_SO);
} else ms_message("Could not load either " LIBSURFACE22_SO " or " LIBSURFACE21_SO);
}
This diff is collapsed.
/*
mediastreamer2 android_mediacodec.h
Copyright (C) 2015 Belledonne Communications SARL
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "mediastreamer2/mscommon.h"
#include <media/NdkMediaCodec.h>
#ifdef __cplusplus
extern "C" {
#endif
void AMediaCodec_setParams(AMediaCodec *codec, const char *params);
#ifdef __cplusplus
} // extern "C"
#endif
......@@ -291,7 +291,7 @@ void video_capture_preprocess(MSFilter *f){
jmethodID method = env->GetStaticMethodID(d->helperClass,"startRecording", "(IIIIIJ)Ljava/lang/Object;");
ms_message("Starting Android camera '%d' (rotation:%d)\n", ((AndroidWebcamConfig*)d->webcam->data)->id, d->rotation);
ms_message("Starting Android camera '%d' (rotation:%d)", ((AndroidWebcamConfig*)d->webcam->data)->id, d->rotation);
jobject cam = env->CallStaticObjectMethod(d->helperClass, method,
((AndroidWebcamConfig*)d->webcam->data)->id,
d->hwCapableSize.width,
......
/*
* Copyright (C) 2014 The Android Open Source Project
*
* 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.
*/
/*
* This file defines an NDK API.
* Do not remove methods.
* Do not change method signatures.
* Do not change the value of constants.
* Do not change the size of any of the classes defined in here.
* Do not reference types that are not part of the NDK.
* Do not #include files that aren't part of the NDK.
*/
#ifndef _NDK_MEDIA_CODEC_H
#define _NDK_MEDIA_CODEC_H
#include <android/native_window.h>
#include "NdkMediaCrypto.h"
#include "NdkMediaError.h"
#include "NdkMediaFormat.h"
#ifdef __cplusplus
extern "C" {
#endif
struct AMediaCodec;
typedef struct AMediaCodec AMediaCodec;
struct AMediaCodecBufferInfo {
int32_t offset;
int32_t size;
int64_t presentationTimeUs;
uint32_t flags;
};
typedef struct AMediaCodecBufferInfo AMediaCodecBufferInfo;
typedef struct AMediaCodecCryptoInfo AMediaCodecCryptoInfo;
enum {
AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM = 4,
AMEDIACODEC_CONFIGURE_FLAG_ENCODE = 1,
AMEDIACODEC_INFO_OUTPUT_BUFFERS_CHANGED = -3,
AMEDIACODEC_INFO_OUTPUT_FORMAT_CHANGED = -2,
AMEDIACODEC_INFO_TRY_AGAIN_LATER = -1
};
/**
* Create codec by name. Use this if you know the exact codec you want to use.
* When configuring, you will need to specify whether to use the codec as an
* encoder or decoder.
*/
AMediaCodec* AMediaCodec_createCodecByName(const char *name);
/**
* Create codec by mime type. Most applications will use this, specifying a
* mime type obtained from media extractor.
*/
AMediaCodec* AMediaCodec_createDecoderByType(const char *mime_type);
/**
* Create encoder by name.
*/
AMediaCodec* AMediaCodec_createEncoderByType(const char *mime_type);
/**
* delete the codec and free its resources
*/
media_status_t AMediaCodec_delete(AMediaCodec*);
/**
* Configure the codec. For decoding you would typically get the format from an extractor.
*/
media_status_t AMediaCodec_configure(
AMediaCodec*,
const AMediaFormat* format,
ANativeWindow* surface,
AMediaCrypto *crypto,
uint32_t flags);
/**
* Start the codec. A codec must be configured before it can be started, and must be started
* before buffers can be sent to it.
*/
media_status_t AMediaCodec_start(AMediaCodec*);
/**
* Stop the codec.
*/
media_status_t AMediaCodec_stop(AMediaCodec*);
/*
* Flush the codec's input and output. All indices previously returned from calls to
* AMediaCodec_dequeueInputBuffer and AMediaCodec_dequeueOutputBuffer become invalid.
*/
media_status_t AMediaCodec_flush(AMediaCodec*);
/**
* Get an input buffer. The specified buffer index must have been previously obtained from
* dequeueInputBuffer, and not yet queued.
*/
uint8_t* AMediaCodec_getInputBuffer(AMediaCodec*, size_t idx, size_t *out_size);
/**
* Get an output buffer. The specified buffer index must have been previously obtained from
* dequeueOutputBuffer, and not yet queued.
*/
uint8_t* AMediaCodec_getOutputBuffer(AMediaCodec*, size_t idx, size_t *out_size);
/**
* Get the index of the next available input buffer. An app will typically use this with
* getInputBuffer() to get a pointer to the buffer, then copy the data to be encoded or decoded
* into the buffer before passing it to the codec.
*/
ssize_t AMediaCodec_dequeueInputBuffer(AMediaCodec*, int64_t timeoutUs);
/**
* Send the specified buffer to the codec for processing.
*/
media_status_t AMediaCodec_queueInputBuffer(AMediaCodec*,
size_t idx, off_t offset, size_t size, uint64_t time, uint32_t flags);
/**
* Send the specified buffer to the codec for processing.
*/
media_status_t AMediaCodec_queueSecureInputBuffer(AMediaCodec*,
size_t idx, off_t offset, AMediaCodecCryptoInfo*, uint64_t time, uint32_t flags);
/**
* Get the index of the next available buffer of processed data.
*/
ssize_t AMediaCodec_dequeueOutputBuffer(AMediaCodec*, AMediaCodecBufferInfo *info, int64_t timeoutUs);
AMediaFormat* AMediaCodec_getOutputFormat(AMediaCodec*);
/**
* If you are done with a buffer, use this call to return the buffer to
* the codec. If you previously specified a surface when configuring this
* video decoder you can optionally render the buffer.
*/
media_status_t AMediaCodec_releaseOutputBuffer(AMediaCodec*, size_t idx, bool render);