Commit a6df9747 authored by Pierre-Eric Pelloux-Prayer's avatar Pierre-Eric Pelloux-Prayer
Browse files

Merge remote-tracking branch 'origin/master' into linuxgl

Conflicts:
	include/mediastreamer2/msinterfaces.h
	src/shaders.c
	src/yuv2rgb.vs.h
parents 4993792f 0796641e
mediastreamer2-2.8.2: February 22, 2012
* Enable relative prefix for plugin loading
mediastreamer2-2.8.1: February 17, 2012
* OpenGL fixes for mac OS X
mediastreamer2-2.8.0: December 22, 2011
* audio conferencing
* mac os X video support
......
dnl Process this file with autoconf to produce a configure script.
AC_INIT([mediastreamer],[2.8.0])
AC_INIT([mediastreamer],[2.8.2])
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)])
......@@ -47,13 +47,7 @@ AC_MSG_CHECKING([warning make an error on compilation])
AC_ARG_ENABLE(strict,
[ --enable-strict Enable error on compilation warning [default=no]],
[wall_werror=$enableval],
[
if test "$USER" = "smorlat" ; then
wall_werror=yes
else
wall_werror=no
fi
]
[wall_werror=yes]
)
CFLAGS="-DORTP_INET6 $CFLAGS "
......@@ -90,14 +84,14 @@ if test "$GCC" != "yes" ; then
;;
esac
else
CFLAGS="$CFLAGS -Wall"
CFLAGS="$CFLAGS -Wall -fdiagnostics-show-option"
fi
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug=@<:@yes/no@:>@],[enables the display of traces showing the execution of the library. @<:@default=yes@:>@]),
[], dnl [action-if-given]
[enable_debug=no]) dnl [action-if-not-given]
AS_CASE([$enable_debug],
[yes],[
......@@ -239,7 +233,7 @@ if test "$fixed_point" = "guess" ; then
esac
AC_MSG_RESULT([$fixed_point])
fi
if test x$fixed_point = xtrue ; then
MS_PUBLIC_CFLAGS="$MS_PUBLIC_CFLAGS -DMS_FIXED_POINT"
......@@ -309,7 +303,7 @@ if test "$alsa" = "true"; then
[ ALSA_LIBS="-lasound"
found_sound=yes
AC_DEFINE(__ALSA_ENABLED__,1,[defined if alsa support is available])
alsa_enabled=true
alsa_enabled=true
])
]
)
......@@ -339,7 +333,7 @@ if test "$artsc" = "true" ; then
dnl Old detection
if test x$artsc = xtrue ; then
AC_CHECK_HEADERS(kde/artsc/artsc.h,
[ AC_CHECK_LIB(artsc,arts_init,
[ AC_CHECK_LIB(artsc,arts_init,
[ ARTS_LIBS="-lartsc"
arts_enabled=true
])
......@@ -371,7 +365,7 @@ if test "$portaudio" = "true"; then
[ PORTAUDIO_LIBS="-lportaudio"
found_sound=yes
AC_DEFINE(__PORTAUDIO_ENABLED__,1,[defined if portaudio support is available])
portaudio_enabled=true
portaudio_enabled=true
])
]
)
......@@ -491,7 +485,7 @@ AC_ARG_ENABLE(gsm,
no) gsm=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --disable-gsm) ;;
esac],[gsm=auto])
if test x$gsm != xfalse; then
dnl check for gsm
......@@ -507,7 +501,7 @@ if test x"$gsmdir" != xno ; then
if test "$GSM_found" = "yes" ; then
build_gsm=yes
elif test "$gsm" = "true"; then
AC_MSG_ERROR([Could not locate gsm headers or library.])
AC_MSG_ERROR([Could not locate gsm headers or library.])
fi
else
build_gsm=no
......@@ -564,7 +558,7 @@ AC_ARG_ENABLE(external-ortp,
esac],[external_ortp=false])
if test "$external_ortp" = 'false'; then
if test -e $srcdir/../oRTP/include/ortp/ortp.h ; then
if test -e $srcdir/../oRTP/include/ortp/ortp.h ; then
echo "building from linphone source tree, using ../oRTP/include/ortp/ortp.h"
ORTP_CFLAGS="-I\$(top_srcdir)/../oRTP/include"
ORTP_LIBS="\$(top_builddir)/../oRTP/src/libortp.la"
......@@ -594,6 +588,13 @@ fi
dnl check various things
AC_FUNC_ALLOCA
AC_ARG_ENABLE(relativeprefix,
[ --enable-relativeprefix Build a linphone that finds its resources relatively to the directory where it is installed],
[case "${enableval}" in
yes) relativeprefix=yes ;;
no) relativeprefix=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-relativeprefix) ;;
esac],[relativeprefix=guess])
if test "x${prefix}" = "xNONE"; then
package_prefix=${ac_default_prefix}
......@@ -602,11 +603,12 @@ else
fi
PACKAGE_PLUGINS_DIR="\$(libdir)/mediastreamer/plugins"
if test x$mingw_found = xyes ; then
if test x$mingw_found = xyes || test x$relativeprefix = xyes ; then
package_prefix="."
PACKAGE_PLUGINS_DIR="./lib/mediastreamer/plugins"
else
PACKAGE_PLUGINS_DIR="\$(libdir)/mediastreamer/plugins"
fi
dnl define path of plugins:
......@@ -777,5 +779,3 @@ help/Doxyfile
)
AC_OUTPUT
......@@ -288,6 +288,7 @@ struct _VideoStream
bool_t use_preview_window;
bool_t use_rc;
bool_t pad[2];
bool_t display_filter_auto_rotate_enabled;
int device_orientation; /* warning: meaning of this variable depends on the platform (Android, iOS, ...) */
OrtpZrtpContext *ortpZrtpContext;
srtp_t srtp_session;
......@@ -341,6 +342,8 @@ MS2_PUBLIC void video_stream_enable_zrtp(VideoStream *vstream, AudioStream *astr
/* enable SRTP on the video stream */
MS2_PUBLIC bool_t video_stream_enable_strp(VideoStream* stream, enum ortp_srtp_crypto_suite_t suite, const char* snd_key, const char* rcv_key);
/* if enabled, the display filter will internaly rotate the video, according to the device orientation */
MS2_PUBLIC void video_stream_enable_display_filter_auto_rotate(VideoStream* stream, bool_t enable);
/**
* Small API to display a local preview window.
......
......@@ -55,6 +55,7 @@ MS2_PUBLIC unsigned int ms_concealer_context_is_concealement_required(MSConceale
**/
MS2_PUBLIC int ms_concealer_inc_sample_time(MSConcealerContext* obj, uint64_t current_time, int time_increment, int got_packet);
MS2_PUBLIC unsigned long ms_concealer_context_get_total_number_of_plc(MSConcealerContext* obj);
/*FEC API*/
......
......@@ -236,6 +236,14 @@ MS2_PUBLIC unsigned int ms_get_cpu_count();
# ifdef HAVE_CONFIG_H
# include "mediastreamer-config.h" /*necessary to know if ENABLE_NLS is there*/
# endif
#ifdef WIN32
#include <malloc.h> //for alloca
#ifdef _MSC_VER
#define alloca _alloca
#endif
#endif
# if defined(ENABLE_NLS)
# include <libintl.h>
# define _(String) dgettext (GETTEXT_PACKAGE, String)
......
......@@ -59,7 +59,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
MS_FILTER_METHOD(MSFilterVideoDisplayInterface,9,int)
#define MS_VIDEO_DISPLAY_ZOOM \
MS_FILTER_METHOD(MSFilterVideoDisplayInterface,9,int[4])
MS_FILTER_METHOD(MSFilterVideoDisplayInterface,10,int[4])
/**Specifiy device orientation from portrait */
#define MS_VIDEO_DISPLAY_SET_DEVICE_ORIENTATION \
MS_FILTER_METHOD(MSFilterVideoDisplayInterface,11,int)
/**
* Interface definitions for players
......@@ -126,6 +130,10 @@ typedef enum _MSPlayerState MSPlayerState;
/** Interface definitions for video decoders */
#define MS_VIDEO_DECODER_DECODING_ERRORS \
MS_FILTER_EVENT_NO_ARG(MSFilterVideoDecoderInterface,0)
#define MS_VIDEO_DECODER_FIRST_IMAGE_DECODED \
MS_FILTER_EVENT_NO_ARG(MSFilterVideoDecoderInterface,1)
#define MS_VIDEO_DECODER_RESET_FIRST_IMAGE_NOTIFICATION \
MS_FILTER_METHOD_NO_ARG(MSFilterVideoDecoderInterface, 0)
/** Interface definitions for video capture */
#define MS_VIDEO_CAPTURE_SET_DEVICE_ORIENTATION \
......
......@@ -117,6 +117,18 @@ MS2_PUBLIC void ms_ticker_set_priority(MSTicker *ticker, MSTickerPrio prio);
*/
MS2_PUBLIC int ms_ticker_attach(MSTicker *ticker,MSFilter *f);
/**
* Attach a chain of filters to a ticker.
* The processing chain will be executed until ms_ticker_detach
* will be called.
* This variadic can be used to attach multiple chains in a single call. The argument list MUST be NULL terminated.
*
* @param ticker A #MSTicker object.
* @param f A #MSFilter object.
*
* Returns: 0 if successfull, -1 otherwise.
*/
MS2_PUBLIC int ms_ticker_attach_multiple(MSTicker *ticker,MSFilter *f,...);
/**
* Dettach a chain of filters to a ticker.
* The processing chain will no more be executed.
......
......@@ -10,7 +10,7 @@
Summary: Audio/Video real-time streaming
Name: mediastreamer
Version: @MEDIASTREAMER_VERSION@
Release: 4
Release: %(git describe --tags --abbrev=40 | sed -rn 's/^.*-([0-9]+)-g[a-z0-9]{40}$/\1/p' || echo '1')%{?dist}
License: GPL
Group: Applications/Communications
URL: http://www.mediastreamer2.com
......@@ -46,20 +46,14 @@ develop programs using the mediastreamer2 library.
%endif
%define mediastreamer2_cflags %mediastreamer2_arch_cflags -Wall -g -pipe -pthread -O3 -fomit-frame-pointer -fno-schedule-insns -fschedule-insns2 -fstrict-aliasing
%define opt_with() %{expand:%%global with_%{1} %%{?_with_%{1}:1}%%{?!_with_%{1}:0}}
%define opt_without() %{expand:%%global with_%{1} %%{!?_without_%{1}:1}%%{?_without_%{1}:0}}
%opt_with video - build with video features
%define have_video %{?_with_video:1}%{!?_with_video:0}
%define video %{?_without_video:0}%{!?_without_video:1}
%prep
%setup -q
%build
options="--enable-shared --enable-static --docdir=%{_docdir} "
%if !%{have_video}
%if !%{video}
options="$options --disable-video"
%endif
......@@ -69,7 +63,7 @@ make -j$RPM_BUILD_NCPUS CFLAGS="%mediastreamer2_cflags" CXXFLAGS="%mediastreamer
%install
rm -rf $RPM_BUILD_ROOT
%makeinstall
make install DESTDIR=$RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
......
......@@ -635,6 +635,7 @@ static void alsa_card_detect(MSSndCardManager *m){
if (card!=NULL)
ms_snd_card_manager_add_card(m,card);
}
atexit((void(*)(void))snd_config_update_free_global);
}
MSSndCardDesc alsa_card_desc={
......
......@@ -140,7 +140,9 @@ static int android_display_set_window(MSFilter *f, void *arg){
}
}
ad->android_video_window=window;
if (ad->android_video_window)
(*jenv)->DeleteGlobalRef(jenv, ad->android_video_window);
ad->android_video_window=(*jenv)->NewGlobalRef(jenv, window);
ms_filter_unlock(f);
......
......@@ -389,7 +389,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
ms_filter_call_method(stream->soundwrite,MS_FILTER_SET_NCHANNELS, &tmp);
/*configure the echo canceller if required */
if (!use_ec) {
if (!use_ec && stream->ec != NULL) {
ms_filter_destroy(stream->ec);
stream->ec=NULL;
}
......
......@@ -66,7 +66,7 @@ static void apply_ptime(MSAudioBitrateDriver *obj){
static int inc_ptime(MSAudioBitrateDriver *obj){
if (obj->cur_ptime>=max_ptime){
ms_message("AudioBitrateController: maximum ptime reached");
ms_message("MSAudioBitrateDriver: maximum ptime reached");
return -1;
}
obj->cur_ptime+=obj->min_ptime;
......@@ -77,46 +77,53 @@ static int inc_ptime(MSAudioBitrateDriver *obj){
static int audio_bitrate_driver_execute_action(MSBitrateDriver *objbase, const MSRateControlAction *action){
MSAudioBitrateDriver *obj=(MSAudioBitrateDriver*)objbase;
ms_message("MSAudioBitrateDriver: executing action of type %s, value=%i",ms_rate_control_action_type_name(action->type),action->value);
if (obj->nom_bitrate==0){
ms_filter_call_method(obj->encoder,MS_FILTER_GET_BITRATE,&obj->nom_bitrate);
if (obj->nom_bitrate==0){
ms_warning("MSAVBitrateDriver: Not doing adaptive rate control on audio encoder, it does not seem to support that.");
obj->nom_bitrate=-1;
}
}
if (action->type==MSRateControlActionDecreaseBitrate){
/*reducing bitrate of the codec actually doesn't work very well (not enough). Increasing ptime is much more efficient*/
if (inc_ptime(obj)==-1){
if (obj->nom_bitrate>0){
int cur_br=0;
int new_br;
if (obj->nom_bitrate==0){
if (ms_filter_call_method(obj->encoder,MS_FILTER_GET_BITRATE,&obj->nom_bitrate)!=0){
ms_message("MSAudioBitrateDriver: Encoder has nominal bitrate %i",obj->nom_bitrate);
}
obj->cur_bitrate=obj->nom_bitrate;
}
/*if max ptime is reached, then try to reduce the codec bitrate if possible */
if (ms_filter_call_method(obj->encoder,MS_FILTER_GET_BITRATE,&cur_br)!=0){
ms_message("AudioBitrateController: GET_BITRATE failed");
return 0;
}
new_br=cur_br-((cur_br*action->value)/100);
ms_message("MSAudioBitrateDriver: Attempting to reduce audio bitrate to %i",new_br);
if (ms_filter_call_method(obj->encoder,MS_FILTER_SET_BITRATE,&new_br)!=0){
ms_message("MSAudioBitrateDriver: SET_BITRATE failed, incrementing ptime");
inc_ptime(obj);
return 0;
}
new_br=0;
ms_filter_call_method(obj->encoder,MS_FILTER_GET_BITRATE,&new_br);
ms_message("MSAudioBitrateDriver: bitrate actually set to %i",new_br);
obj->cur_bitrate=new_br;
/*reducing bitrate of the codec isn't sufficient. Increasing ptime is much more efficient*/
inc_ptime(obj);
if (obj->nom_bitrate>0){
int cur_br=0;
int new_br;
if (ms_filter_call_method(obj->encoder,MS_FILTER_GET_BITRATE,&obj->cur_bitrate)!=0){
ms_message("MSAudioBitrateDriver: Encoder has current bitrate %i",obj->cur_bitrate);
}
/*if max ptime is reached, then try to reduce the codec bitrate if possible */
if (ms_filter_call_method(obj->encoder,MS_FILTER_GET_BITRATE,&cur_br)!=0){
ms_message("MSAudioBitrateDriver: GET_BITRATE failed");
return 0;
}
new_br=cur_br-((cur_br*action->value)/100);
ms_message("MSAudioBitrateDriver: Attempting to reduce audio bitrate to %i",new_br);
if (ms_filter_call_method(obj->encoder,MS_FILTER_SET_BITRATE,&new_br)!=0){
ms_message("MSAudioBitrateDriver: SET_BITRATE failed, incrementing ptime");
inc_ptime(obj);
return 0;
}
new_br=0;
ms_filter_call_method(obj->encoder,MS_FILTER_GET_BITRATE,&new_br);
ms_message("MSAudioBitrateDriver: bitrate actually set to %i",new_br);
obj->cur_bitrate=new_br;
}
}else if (action->type==MSRateControlActionDecreasePacketRate){
inc_ptime(obj);
}else if (action->type==MSRateControlActionIncreaseQuality){
if (obj->cur_bitrate<obj->nom_bitrate){
ms_message("MSAudioBitrateDriver: increasing bitrate of codec");
if (ms_filter_call_method(obj->encoder,MS_FILTER_SET_BITRATE,&obj->nom_bitrate)!=0){
ms_message("MSAudioBitrateDriver: could not restore nominal codec bitrate (%i)",obj->nom_bitrate);
if (obj->nom_bitrate>0 && obj->cur_bitrate<obj->nom_bitrate){
obj->cur_bitrate=(obj->cur_bitrate*120)/100;
if (obj->cur_bitrate> obj->nom_bitrate) obj->cur_bitrate=obj->nom_bitrate;
ms_message("MSAudioBitrateDriver: increasing bitrate of codec to %i",obj->cur_bitrate);
if (ms_filter_call_method(obj->encoder,MS_FILTER_SET_BITRATE,&obj->cur_bitrate)!=0){
ms_message("MSAudioBitrateDriver: could not set codec bitrate to %i",obj->cur_bitrate);
}else obj->cur_bitrate=obj->nom_bitrate;
}else if (obj->cur_ptime>obj->min_ptime){
obj->cur_ptime-=obj->min_ptime;
......
......@@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SELVIEW_POS_INACTIVE -100.0
#define LOCAL_BORDER_SIZE 2
#include <Vfw.h>
#include <vfw.h>
typedef struct Yuv2RgbCtx{
uint8_t *rgb;
......
......@@ -22,11 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <math.h>
#ifdef _MSC_VER
#include <malloc.h>
#define alloca _alloca
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
......
......@@ -72,7 +72,7 @@ static bool_t read_event(MSEventQueue *q){
f=(MSFilter *)*(long*)(q->rptr);
id=(unsigned int)*(long*)(q->rptr+8);
argsize=id & 0xffff;
argsize=id & 0xff;
evsize=argsize+16;
data=q->rptr+16;
if (f->notify!=NULL)
......
......@@ -8,7 +8,7 @@
static inline int val_seg(int val)
{
int r = 0;
val >>= 7;
val >>= 7; /*7 = 4 + 3*/
if (val & 0xf0) {
val >>= 4;
r += 4;
......@@ -40,6 +40,7 @@ static inline int val_seg(int val)
*
* For further information see John C. Bellamy's Digital Telephony, 1982,
* John Wiley & Sons, pps 98-111 and 472-476.
* G711 is designed for 13 bits input signal, this function add extra shifting to take this into account.
*/
static inline unsigned char s16_to_alaw(int pcm_val)
......@@ -57,8 +58,8 @@ static inline unsigned char s16_to_alaw(int pcm_val)
pcm_val = 0x7fff;
}
if (pcm_val < 256)
aval = pcm_val >> 4;
if (pcm_val < 256) /*256 = 32 << 3*/
aval = pcm_val >> 4; /*4 = 1 + 3*/
else {
/* Convert the scaled magnitude to segment number. */
seg = val_seg(pcm_val);
......
......@@ -39,6 +39,7 @@ typedef struct _DecData{
uint8_t *bitstream;
int bitstream_size;
uint64_t last_error_reported_time;
bool_t first_image_decoded;
}DecData;
static void ffmpeg_init(){
......@@ -80,6 +81,11 @@ static void dec_init(MSFilter *f){
f->data=d;
}
static void dec_preprocess(MSFilter* f) {
DecData *s=(DecData*)f->data;
s->first_image_decoded = FALSE;
}
static void dec_reinit(DecData *d){
avcodec_close(&d->av_context);
dec_open(d);
......@@ -274,6 +280,10 @@ static void dec_process(MSFilter *f){
}
if (got_picture) {
ms_queue_put(f->outputs[0],get_as_yuvmsg(f,d,&orig));
if (!d->first_image_decoded) {
ms_filter_notify_no_arg(f,MS_VIDEO_DECODER_FIRST_IMAGE_DECODED);
d->first_image_decoded = TRUE;
}
}
p+=len;
}
......@@ -302,8 +312,15 @@ static int dec_add_fmtp(MSFilter *f, void *arg){
return 0;
}
static int reset_first_image(MSFilter* f, void *data) {
DecData *d=(DecData*)f->data;
d->first_image_decoded = FALSE;
return 0;
}
static MSFilterMethod h264_dec_methods[]={
{ MS_FILTER_ADD_FMTP , dec_add_fmtp },
{ MS_VIDEO_DECODER_RESET_FIRST_IMAGE_NOTIFICATION, reset_first_image },
{ 0 , NULL }
};
......@@ -318,6 +335,7 @@ MSFilterDesc ms_h264_dec_desc={
.ninputs=1,
.noutputs=1,
.init=dec_init,
.preprocess=dec_preprocess,
.process=dec_process,
.uninit=dec_uninit,
.methods=h264_dec_methods
......@@ -335,7 +353,7 @@ MSFilterDesc ms_h264_dec_desc={
1,
1,
dec_init,
NULL,
dec_preprocess,
dec_process,
NULL,
dec_uninit,
......
......@@ -126,14 +126,18 @@ didOutputSampleBuffer:(CMSampleBufferRef) sampleBuffer
case 0:
case 180:
if (mOutputVideoSize.width*factor>plane_width || mOutputVideoSize.height*factor>plane_height) {
ms_warning("IOS capture discarding frame because wrong dimensions");
ms_warning("[1]IOS capture discarding frame because wrong dimensions (%d > %d || %d > %d)",
mOutputVideoSize.width*factor, plane_width,
mOutputVideoSize.height*factor, plane_height);
return;
}
break;
case 90:
case 270:
if (mOutputVideoSize.width*factor>plane_height || mOutputVideoSize.height*factor>plane_width) {
ms_warning("IOS capture discarding frame because wrong dimensions");
ms_warning("[2] IOS capture discarding frame because wrong dimensions (%d > %d || %d > %d)",
mOutputVideoSize.width*factor, plane_height,
mOutputVideoSize.height*factor, plane_width);
return;
}
break;
......@@ -210,7 +214,7 @@ didOutputSampleBuffer:(CMSampleBufferRef) sampleBuffer
dispatch_release(queue);
captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session];
captureVideoPreviewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
//captureVideoPreviewLayer.orientation = AVCaptureVideoOrientationLandscapeRight;
captureVideoPreviewLayer.orientation = AVCaptureVideoOrientationPortrait;
start_time=0;
frame_count=-1;
fps=0;
......@@ -251,23 +255,21 @@ didOutputSampleBuffer:(CMSampleBufferRef) sampleBuffer
return 0;
}
static AVCaptureVideoOrientation devideOrientation2AVCaptureVideoOrientation(int deviceOrientation) {
switch (deviceOrientation) {
case 0: return AVCaptureVideoOrientationPortrait;
case 90: return AVCaptureVideoOrientationLandscapeLeft;
case -180:
case 180: return AVCaptureVideoOrientationPortraitUpsideDown;
case -90:
case 270: return AVCaptureVideoOrientationLandscapeRight;
default:
ms_error("Unexpected device orientation [%i] expected value are 0, 90, 180, 270",deviceOrientation);
break;
}
return AVCaptureVideoOrientationPortrait;
switch (deviceOrientation) {
case 0: return AVCaptureVideoOrientationPortrait;
case 90: return AVCaptureVideoOrientationLandscapeLeft;
case -180:
case 180: return AVCaptureVideoOrientationPortraitUpsideDown;
case -90:
case 270: return AVCaptureVideoOrientationLandscapeRight;
default:
ms_error("Unexpected device orientation [%i] expected value are 0, 90, 180, 270",deviceOrientation);
break;
}
return AVCaptureVideoOrientationPortrait;
}
-(void) setSize:(MSVideoSize) size {
@synchronized(self) {
[session beginConfiguration];
......@@ -292,31 +294,31 @@ static AVCaptureVideoOrientation devideOrientation2AVCaptureVideoOrientation(int
mOutputVideoSize=mCameraVideoSize;
mDownScalingRequired=false;
}
NSArray *connections = output.connections;
if ([connections count] > 0 && [[connections objectAtIndex:0] isVideoOrientationSupported]) {
switch (mDeviceOrientation) {
case 0:
[[connections objectAtIndex:0] setVideoOrientation:AVCaptureVideoOrientationPortrait];
ms_message("Configuring camera in AVCaptureVideoOrientationPortrait mode ");
break;
case 180:
[[connections objectAtIndex:0] setVideoOrientation:AVCaptureVideoOrientationPortraitUpsideDown];
ms_message("Configuring camera in AVCaptureVideoOrientationPortraitUpsideDown mode ");
break;
case 90:
[[connections objectAtIndex:0] setVideoOrientation:AVCaptureVideoOrientationLandscapeLeft];
ms_message("Configuring camera in AVCaptureVideoOrientationLandscapeLeft mode ");
break;
case 270:
[[connections objectAtIndex:0] setVideoOrientation:AVCaptureVideoOrientationLandscapeRight];
ms_message("Configuring camera in AVCaptureVideoOrientationLandscapeRight mode ");
default:
break;
}
}
NSArray *connections = output.connections;
if ([connections count] > 0 && [[connections objectAtIndex:0] isVideoOrientationSupported]) {
switch (mDeviceOrientation) {
case 0:
[[connections objectAtIndex:0] setVideoOrientation:AVCaptureVideoOrientationPortrait];
ms_message("Configuring camera in AVCaptureVideoOrientationPortrait mode ");
break;
case 180:
[[connections objectAtIndex:0] setVideoOrientation:AVCaptureVideoOrientationPortraitUpsideDown];